blob: 724ed4e1f42c4b1441f91dd21176fd97a8c24ded (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import { env, EnvVars } from '@0xproject/dev-utils';
import { GanacheSubprovider, prependSubprovider } from '@0xproject/subproviders';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as fs from 'fs';
import * as _ from 'lodash';
import ProviderEngine = require('web3-provider-engine');
import { config } from './config';
import { coverage } from './coverage';
export const provider = new ProviderEngine();
provider.addProvider(
new GanacheSubprovider({
logger: {
log: (arg: any) => {
fs.appendFileSync(config.ganacheLogFile, `${arg}\n`);
},
},
verbose: env.parseBoolean(EnvVars.SolidityCoverage),
networkId: config.networkId,
mnemonic: config.mnemonic,
}),
);
provider.start();
const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage);
if (isCoverageEnabled) {
const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
prependSubprovider(provider, coverageSubprovider);
}
export const web3Wrapper = new Web3Wrapper(provider);
|