Skip to content

Instantly share code, notes, and snippets.

@rahuldamodar94
Created May 27, 2020 17:17
Show Gist options
  • Save rahuldamodar94/d5cde3db1a8765d75b14e0fb423056e9 to your computer and use it in GitHub Desktop.
Save rahuldamodar94/d5cde3db1a8765d75b14e0fb423056e9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
import { devConstants, web3Factory } from '@0x/dev-utils';
import { logUtils } from '@0x/utils';
import { MnemonicWalletSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { runMigrationsAsync } from './migration';
import { providerUtils } from '@0x/utils';
(async () => {
const mnemonicWallet = new MnemonicWalletSubprovider({
mnemonic: 'seedwords',
baseDerivationPath: `44'/60'/0'/0`,
});
const providerEngine = new Web3ProviderEngine();
providerEngine.addProvider(mnemonicWallet);
providerEngine.addProvider(new RPCSubprovider('https://testnetv3.matic.network'));
providerUtils.startProviderEngine(providerEngine);
const web3Wrapper = new Web3Wrapper(providerEngine);
const [owner] = await web3Wrapper.getAvailableAddressesAsync();
console.log('########################', owner)
let txDefaults = {
from: owner,
gas: 8000000,
gasPrice: 1
};
let response = await runMigrationsAsync(providerEngine, txDefaults);
console.log(response)
process.exit(0);
})().catch(err => {
logUtils.log(err);
process.exit(1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment