diff options
author | Fabio Berger <me@fabioberger.com> | 2018-04-06 14:04:17 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-04-06 14:04:17 +0800 |
commit | 75a51af00603236e0b80fe04336494944a32739c (patch) | |
tree | b5e605911321cfc148f5eedec842fbe2c6bd0672 /packages | |
parent | 24454938e51e40ae74809f15bd1f612c69c218ec (diff) | |
download | dexon-sol-tools-75a51af00603236e0b80fe04336494944a32739c.tar.gz dexon-sol-tools-75a51af00603236e0b80fe04336494944a32739c.tar.zst dexon-sol-tools-75a51af00603236e0b80fe04336494944a32739c.zip |
Use provider over web3 in deployer, dev-utils and subprovider tests, rename subprovider to ganacheSubprovider in test util
Diffstat (limited to 'packages')
-rw-r--r-- | packages/deployer/src/cli.ts | 4 | ||||
-rw-r--r-- | packages/deployer/src/deployer.ts | 10 | ||||
-rw-r--r-- | packages/deployer/test/deployer_test.ts | 2 | ||||
-rw-r--r-- | packages/deployer/test/util/provider.ts | 9 | ||||
-rw-r--r-- | packages/dev-utils/test/blockchain_lifecycle_test.ts | 4 | ||||
-rw-r--r-- | packages/dev-utils/test/rpc_test.ts | 4 | ||||
-rw-r--r-- | packages/subproviders/test/unit/ledger_subprovider_test.ts | 2 | ||||
-rw-r--r-- | packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts | 2 | ||||
-rw-r--r-- | packages/subproviders/test/utils/ganache_subprovider.ts (renamed from packages/subproviders/test/utils/subprovider.ts) | 2 |
9 files changed, 21 insertions, 18 deletions
diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts index d1bd645b3..f1cf56416 100644 --- a/packages/deployer/src/cli.ts +++ b/packages/deployer/src/cli.ts @@ -41,8 +41,8 @@ async function onCompileCommandAsync(argv: CliOptions): Promise<void> { */ async function onDeployCommandAsync(argv: CliOptions): Promise<void> { const url = argv.jsonrpcUrl; - const web3Provider = new Web3.providers.HttpProvider(url); - const web3Wrapper = new Web3Wrapper(web3Provider); + const provider = new Web3.providers.HttpProvider(url); + const web3Wrapper = new Web3Wrapper(provider); const networkId = await web3Wrapper.getNetworkIdAsync(); const compilerOpts: CompilerOptions = { contractsDir: argv.contractsDir, diff --git a/packages/deployer/src/deployer.ts b/packages/deployer/src/deployer.ts index 84392997c..e4208e7a1 100644 --- a/packages/deployer/src/deployer.ts +++ b/packages/deployer/src/deployer.ts @@ -38,17 +38,17 @@ export class Deployer { this._artifactsDir = opts.artifactsDir; this._networkId = opts.networkId; this._defaults = opts.defaults; - let web3Provider: Provider; + let provider: Provider; if (_.isUndefined((opts as ProviderDeployerOptions).provider)) { const jsonrpcUrl = (opts as UrlDeployerOptions).jsonrpcUrl; if (_.isUndefined(jsonrpcUrl)) { - throw new Error(`Deployer options don't contain web3Provider nor jsonrpcUrl. Please pass one of them`); + throw new Error(`Deployer options don't contain provider nor jsonrpcUrl. Please pass one of them`); } - web3Provider = new Web3.providers.HttpProvider(jsonrpcUrl); + provider = new Web3.providers.HttpProvider(jsonrpcUrl); } else { - web3Provider = (opts as ProviderDeployerOptions).provider; + provider = (opts as ProviderDeployerOptions).provider; } - this.web3Wrapper = new Web3Wrapper(web3Provider, this._defaults); + this.web3Wrapper = new Web3Wrapper(provider, this._defaults); } /** * Loads a contract's corresponding artifacts and deploys it with the supplied constructor arguments. diff --git a/packages/deployer/test/deployer_test.ts b/packages/deployer/test/deployer_test.ts index eadb535ab..238624220 100644 --- a/packages/deployer/test/deployer_test.ts +++ b/packages/deployer/test/deployer_test.ts @@ -27,7 +27,7 @@ describe('#Deployer', () => { const deployerOpts = { artifactsDir, networkId: constants.networkId, - web3Provider: provider, + provider, defaults: { gasPrice: constants.gasPrice, }, diff --git a/packages/deployer/test/util/provider.ts b/packages/deployer/test/util/provider.ts index bc0f55028..e0fcb362a 100644 --- a/packages/deployer/test/util/provider.ts +++ b/packages/deployer/test/util/provider.ts @@ -1,6 +1,9 @@ import { web3Factory } from '@0xproject/dev-utils'; +import { Provider } from '@0xproject/types'; import * as Web3 from 'web3'; -const web3ProviderConfig = { shouldUseInProcessGanache: true }; -const web3Instance = web3Factory.create(web3ProviderConfig); -export const provider = web3Instance.currentProvider; +const providerConfigs = { shouldUseInProcessGanache: true }; +const web3Instance = web3Factory.create(providerConfigs); +const provider: Provider = web3Instance.currentProvider; + +export { provider }; diff --git a/packages/dev-utils/test/blockchain_lifecycle_test.ts b/packages/dev-utils/test/blockchain_lifecycle_test.ts index 077f6f2f1..2cfad9644 100644 --- a/packages/dev-utils/test/blockchain_lifecycle_test.ts +++ b/packages/dev-utils/test/blockchain_lifecycle_test.ts @@ -8,8 +8,8 @@ import { BlockchainLifecycle, web3Factory } from '../src'; const expect = chai.expect; describe('BlockchainLifecycle tests', () => { - const web3Provider = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true }); - const web3Wrapper = new Web3Wrapper(web3Provider); + const provider = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true }); + const web3Wrapper = new Web3Wrapper(provider); const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('#startAsync/revertAsync', () => { it('reverts changes in between', async () => { diff --git a/packages/dev-utils/test/rpc_test.ts b/packages/dev-utils/test/rpc_test.ts index 233d8035e..b6998f604 100644 --- a/packages/dev-utils/test/rpc_test.ts +++ b/packages/dev-utils/test/rpc_test.ts @@ -8,8 +8,8 @@ import { web3Factory } from '../src'; const expect = chai.expect; describe('RPC tests', () => { - const web3Provider = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true }); - const web3Wrapper = new Web3Wrapper(web3Provider); + const provider = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true }); + const web3Wrapper = new Web3Wrapper(provider); describe('#mineBlockAsync', () => { it('increases block number when called', async () => { const blockNumberBefore = await web3Wrapper.getBlockNumberAsync(); diff --git a/packages/subproviders/test/unit/ledger_subprovider_test.ts b/packages/subproviders/test/unit/ledger_subprovider_test.ts index a3800434a..d30c68f65 100644 --- a/packages/subproviders/test/unit/ledger_subprovider_test.ts +++ b/packages/subproviders/test/unit/ledger_subprovider_test.ts @@ -8,8 +8,8 @@ import Web3ProviderEngine = require('web3-provider-engine'); import { LedgerSubprovider } from '../../src'; import { DoneCallback, LedgerCommunicationClient, LedgerSubproviderErrors } from '../../src/types'; import { chaiSetup } from '../chai_setup'; +import { ganacheSubprovider } from '../utils/ganache_subprovider'; import { reportCallbackErrors } from '../utils/report_callback_errors'; -import { subprovider as ganacheSubprovider } from '../utils/subprovider'; chaiSetup.configure(); const expect = chai.expect; diff --git a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts index ab540e202..e7ca6d496 100644 --- a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts +++ b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts @@ -8,8 +8,8 @@ import RpcSubprovider = require('web3-provider-engine/subproviders/rpc'); import { RedundantRPCSubprovider } from '../../src'; import { DoneCallback } from '../../src/types'; import { chaiSetup } from '../chai_setup'; +import { ganacheSubprovider } from '../utils/ganache_subprovider'; import { reportCallbackErrors } from '../utils/report_callback_errors'; -import { subprovider as ganacheSubprovider } from '../utils/subprovider'; const expect = chai.expect; chaiSetup.configure(); diff --git a/packages/subproviders/test/utils/subprovider.ts b/packages/subproviders/test/utils/ganache_subprovider.ts index b1c459746..ac4a9325c 100644 --- a/packages/subproviders/test/utils/subprovider.ts +++ b/packages/subproviders/test/utils/ganache_subprovider.ts @@ -9,7 +9,7 @@ const logger = { }, }; -export const subprovider = new GanacheSubprovider({ +export const ganacheSubprovider = new GanacheSubprovider({ logger, verbose: false, port: configs.port, |