diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-06-05 08:47:18 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-06-07 03:40:30 +0800 |
commit | 5900899c0195a851c8d20ca0d4ad85dbbf4c100f (patch) | |
tree | dededc2c133e764399c5e9c41127d25ed956a5ca | |
parent | 2dfc4680941293ca9f4a55f3ca58b9ee68872754 (diff) | |
download | dexon-sol-tools-5900899c0195a851c8d20ca0d4ad85dbbf4c100f.tar dexon-sol-tools-5900899c0195a851c8d20ca0d4ad85dbbf4c100f.tar.gz dexon-sol-tools-5900899c0195a851c8d20ca0d4ad85dbbf4c100f.tar.bz2 dexon-sol-tools-5900899c0195a851c8d20ca0d4ad85dbbf4c100f.tar.lz dexon-sol-tools-5900899c0195a851c8d20ca0d4ad85dbbf4c100f.tar.xz dexon-sol-tools-5900899c0195a851c8d20ca0d4ad85dbbf4c100f.tar.zst dexon-sol-tools-5900899c0195a851c8d20ca0d4ad85dbbf4c100f.zip |
Add support for TEST_PROVIDER env var
-rw-r--r-- | packages/contracts/src/utils/web3_wrapper.ts | 7 | ||||
-rw-r--r-- | packages/web3-wrapper/src/web3_wrapper.ts | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/packages/contracts/src/utils/web3_wrapper.ts b/packages/contracts/src/utils/web3_wrapper.ts index 49744dea1..6df8ac073 100644 --- a/packages/contracts/src/utils/web3_wrapper.ts +++ b/packages/contracts/src/utils/web3_wrapper.ts @@ -5,7 +5,7 @@ import { Provider } from 'ethereum-types'; import { coverage } from './coverage'; -const useGeth = true; +const testProvider = process.env.TEST_PROVIDER || 'ganache'; const ganacheTxDefaults = { from: devConstants.TESTRPC_FIRST_ADDRESS, @@ -14,7 +14,7 @@ const ganacheTxDefaults = { const gethTxDefaults = { from: devConstants.TESTRPC_FIRST_ADDRESS, }; -export const txDefaults = useGeth ? gethTxDefaults : ganacheTxDefaults; +export const txDefaults = testProvider === 'ganache' ? ganacheTxDefaults : gethTxDefaults; const gethConfigs = { shouldUseInProcessGanache: false, @@ -24,7 +24,8 @@ const gethConfigs = { const ganacheConfigs = { shouldUseInProcessGanache: true, }; -const providerConfigs = useGeth ? gethConfigs : ganacheConfigs; + +const providerConfigs = testProvider === 'ganache' ? ganacheConfigs : gethConfigs; export const provider = web3Factory.getRpcProvider(providerConfigs); const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage); diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index b9b0bdbb2..ace6a2d61 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -257,9 +257,9 @@ export class Web3Wrapper { * Increase the next blocks timestamp on TestRPC/Ganache local node * @param timeDelta Amount of time to add in seconds */ - public async increaseTimeAsync(timeDelta: number): Promise<void> { + public async increaseTimeAsync(timeDelta: number): Promise<number> { // TODO(albrow): Detect Geth vs. Ganache and use appropriate endpoint. - await this._sendRawPayloadAsync<string>({ method: 'debug_increaseTime', params: [timeDelta] }); + return this._sendRawPayloadAsync<number>({ method: 'debug_increaseTime', params: [timeDelta] }); } /** * Retrieve smart contract logs for a given filter |