blob: 273cdf961ca66c1ad0b10cafd19619fbf1e80320 (
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
|
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 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);
|