aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-utils/src/web3_factory.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-06-07 18:18:53 +0800
committerFabio Berger <me@fabioberger.com>2018-06-07 18:18:53 +0800
commit0fc981400442e4c567ca363bdf0f4c03ba87473d (patch)
treeee19dfb9dcd9c631fa4138326b9d639a7fc7374e /packages/dev-utils/src/web3_factory.ts
parente617da3bbf650b25c29df33cd12e23c994efe674 (diff)
parente0bc01eea1c20e0afda296f331c6a475e062b59c (diff)
downloaddexon-0x-contracts-0fc981400442e4c567ca363bdf0f4c03ba87473d.tar
dexon-0x-contracts-0fc981400442e4c567ca363bdf0f4c03ba87473d.tar.gz
dexon-0x-contracts-0fc981400442e4c567ca363bdf0f4c03ba87473d.tar.bz2
dexon-0x-contracts-0fc981400442e4c567ca363bdf0f4c03ba87473d.tar.lz
dexon-0x-contracts-0fc981400442e4c567ca363bdf0f4c03ba87473d.tar.xz
dexon-0x-contracts-0fc981400442e4c567ca363bdf0f4c03ba87473d.tar.zst
dexon-0x-contracts-0fc981400442e4c567ca363bdf0f4c03ba87473d.zip
merge v2-prototype
Diffstat (limited to 'packages/dev-utils/src/web3_factory.ts')
-rw-r--r--packages/dev-utils/src/web3_factory.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts
index 12872c122..47eef4cbd 100644
--- a/packages/dev-utils/src/web3_factory.ts
+++ b/packages/dev-utils/src/web3_factory.ts
@@ -7,10 +7,8 @@ import ProviderEngine = require('web3-provider-engine');
import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
import { EmptyWalletSubprovider, FakeGasEstimateSubprovider, GanacheSubprovider } from '@0xproject/subproviders';
-import { Provider } from 'ethereum-types';
import * as fs from 'fs';
import * as _ from 'lodash';
-import * as process from 'process';
import { constants } from './constants';
import { env, EnvVars } from './env';
@@ -19,16 +17,22 @@ export interface Web3Config {
hasAddresses?: boolean; // default: true
shouldUseInProcessGanache?: boolean; // default: false
rpcUrl?: string; // default: localhost:8545
+ shouldUseFakeGasEstimate?: boolean; // default: true
}
export const web3Factory = {
getRpcProvider(config: Web3Config = {}): ProviderEngine {
const provider = new ProviderEngine();
const hasAddresses = _.isUndefined(config.hasAddresses) || config.hasAddresses;
+ config.shouldUseFakeGasEstimate =
+ _.isUndefined(config.shouldUseFakeGasEstimate) || config.shouldUseFakeGasEstimate;
if (!hasAddresses) {
provider.addProvider(new EmptyWalletSubprovider());
}
- provider.addProvider(new FakeGasEstimateSubprovider(constants.GAS_LIMIT));
+
+ if (config.shouldUseFakeGasEstimate) {
+ provider.addProvider(new FakeGasEstimateSubprovider(constants.GAS_LIMIT));
+ }
const logger = {
log: (arg: any) => {
fs.appendFileSync('ganache.log', `${arg}\n`);