From 2004c0d7398a5e77d08e3b4d8030c0f22cb09cc8 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Fri, 1 Jun 2018 13:19:36 -0700 Subject: Add ability to quickly switch between Geth and Ganache by changing a const --- packages/contracts/src/utils/web3_wrapper.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'packages/contracts/src/utils') diff --git a/packages/contracts/src/utils/web3_wrapper.ts b/packages/contracts/src/utils/web3_wrapper.ts index a89d7e8d0..bd582e841 100644 --- a/packages/contracts/src/utils/web3_wrapper.ts +++ b/packages/contracts/src/utils/web3_wrapper.ts @@ -5,14 +5,27 @@ import { Provider } from 'ethereum-types'; import { coverage } from './coverage'; -export const txDefaults = { +const useGeth = false; + +const ganacheTxDefaults = { + from: devConstants.TESTRPC_FIRST_ADDRESS, + gas: devConstants.GAS_LIMIT, +}; +const gethTxDefaults = { from: devConstants.TESTRPC_FIRST_ADDRESS, - // gas: devConstants.GAS_LIMIT, }; -const providerConfigs = { +export const txDefaults = useGeth ? gethTxDefaults : ganacheTxDefaults; + +const gethConfigs = { shouldUseInProcessGanache: false, rpcUrl: 'http://localhost:8501', + shouldUseFakeGasEstimate: false, +}; +const ganacheConfigs = { + shouldUseInProcessGanache: true, }; +const providerConfigs = useGeth ? gethConfigs : ganacheConfigs; + export const provider = web3Factory.getRpcProvider(providerConfigs); const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage); if (isCoverageEnabled) { -- cgit v1.2.3