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/deployer | |
parent | 24454938e51e40ae74809f15bd1f612c69c218ec (diff) | |
download | dexon-sol-tools-75a51af00603236e0b80fe04336494944a32739c.tar dexon-sol-tools-75a51af00603236e0b80fe04336494944a32739c.tar.gz dexon-sol-tools-75a51af00603236e0b80fe04336494944a32739c.tar.bz2 dexon-sol-tools-75a51af00603236e0b80fe04336494944a32739c.tar.lz dexon-sol-tools-75a51af00603236e0b80fe04336494944a32739c.tar.xz 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/deployer')
-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 |
4 files changed, 14 insertions, 11 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 }; |