diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-06-30 02:52:15 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-06-30 08:25:56 +0800 |
commit | 654b0486027ed42662bbc907a72806046ec7697e (patch) | |
tree | 60a565728c458eca6e424df1c220898c76ef58ec /packages/migrations/src/migrate.ts | |
parent | 3ece72af49fe1042058dadabbc0c4c584b709a17 (diff) | |
download | dexon-sol-tools-654b0486027ed42662bbc907a72806046ec7697e.tar dexon-sol-tools-654b0486027ed42662bbc907a72806046ec7697e.tar.gz dexon-sol-tools-654b0486027ed42662bbc907a72806046ec7697e.tar.bz2 dexon-sol-tools-654b0486027ed42662bbc907a72806046ec7697e.tar.lz dexon-sol-tools-654b0486027ed42662bbc907a72806046ec7697e.tar.xz dexon-sol-tools-654b0486027ed42662bbc907a72806046ec7697e.tar.zst dexon-sol-tools-654b0486027ed42662bbc907a72806046ec7697e.zip |
Export LedgerEthereumClient type in subproviders
Diffstat (limited to 'packages/migrations/src/migrate.ts')
-rw-r--r-- | packages/migrations/src/migrate.ts | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/packages/migrations/src/migrate.ts b/packages/migrations/src/migrate.ts index 4661e1ead..c46d3580a 100644 --- a/packages/migrations/src/migrate.ts +++ b/packages/migrations/src/migrate.ts @@ -9,7 +9,6 @@ import { runV1MigrationsAsync } from './1.0.0/migration'; import { runV2TestnetMigrationsAsync } from './2.0.0-beta-testnet/migration'; import { runV2MigrationsAsync } from './2.0.0/migration'; -import { constants } from './utils/constants'; import { providerFactory } from './utils/provider_factory'; enum ContractVersions { @@ -20,29 +19,37 @@ enum ContractVersions { const args = yargs.argv; (async () => { - const providerConfigs = { shouldUseInProcessGanache: false }; - const provider: Provider = web3Factory.getRpcProvider(providerConfigs); - const txDefaults = { - from: devConstants.TESTRPC_FIRST_ADDRESS, - }; const contractsVersion = args.contractsVersion; const artifactsDir = `artifacts/${contractsVersion}`; + let providerConfigs; + let provider: Provider; + let txDefaults; switch (contractsVersion) { case ContractVersions.V1: + providerConfigs = { shouldUseInProcessGanache: false }; + provider = web3Factory.getRpcProvider(providerConfigs); + txDefaults = { + from: devConstants.TESTRPC_FIRST_ADDRESS, + }; await runV1MigrationsAsync(provider, artifactsDir, txDefaults); break; case ContractVersions.V2: + providerConfigs = { shouldUseInProcessGanache: false }; + provider = web3Factory.getRpcProvider(providerConfigs); + txDefaults = { + from: devConstants.TESTRPC_FIRST_ADDRESS, + }; await runV2MigrationsAsync(provider, artifactsDir, txDefaults); break; case ContractVersions.V2Testnet: - const ledgerProvider = await providerFactory.getLedgerProviderAsync(); - const web3Wrapper = new Web3Wrapper(ledgerProvider); + provider = await providerFactory.getLedgerProviderAsync(); + const web3Wrapper = new Web3Wrapper(provider); const accounts = await web3Wrapper.getAvailableAddressesAsync(); - const testnetTxDefaults = { + txDefaults = { from: accounts[0], gas: devConstants.GAS_LIMIT, }; - await runV2TestnetMigrationsAsync(ledgerProvider, artifactsDir, testnetTxDefaults); + await runV2TestnetMigrationsAsync(provider, artifactsDir, txDefaults); break; default: throw new Error(`Unsupported contract version: ${contractsVersion}`); |