aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils/web3_wrapper.ts
blob: 2dd0dd1a3cde8d6316fbd7503169b9c859fdd939 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { devConstants, env, EnvVars, web3Factory } from '@0xproject/dev-utils';
import { prependSubprovider } from '@0xproject/subproviders';
import { Provider } from 'ethereum-types';
import { Web3Wrapper } from '@0xproject/web3-wrapper';

import { coverage } from './coverage';

export const txDefaults = {
    from: devConstants.TESTRPC_FIRST_ADDRESS,
    gas: devConstants.GAS_LIMIT,
};
const providerConfigs = { shouldUseInProcessGanache: true };
export const provider = web3Factory.getRpcProvider(providerConfigs);
const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage);
if (isCoverageEnabled) {
    const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
    prependSubprovider(provider, coverageSubprovider);
}
export const web3Wrapper = new Web3Wrapper(provider);