aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer/src/cli.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-01-30 20:21:01 +0800
committerFabio Berger <me@fabioberger.com>2018-01-30 20:21:01 +0800
commit93a5b3f457c1211676296840c285759007a55500 (patch)
treed1682b657c207f447748e08550095bafc79b6997 /packages/deployer/src/cli.ts
parent4242176d291f54212797de9f5df80b1346724ebb (diff)
downloaddexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar
dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.gz
dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.bz2
dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.lz
dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.xz
dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.zst
dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.zip
Fix prettier
Diffstat (limited to 'packages/deployer/src/cli.ts')
-rw-r--r--packages/deployer/src/cli.ts218
1 files changed, 109 insertions, 109 deletions
diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts
index decb37fdc..f4241b1cc 100644
--- a/packages/deployer/src/cli.ts
+++ b/packages/deployer/src/cli.ts
@@ -20,13 +20,13 @@ const DEFAULT_GAS_PRICE = (10 ** 9 * 2).toString();
* @param argv Instance of process.argv provided by yargs.
*/
async function onCompileCommand(argv: CliOptions): Promise<void> {
- const opts: CompilerOptions = {
- contractsDir: argv.contractsDir,
- networkId: argv.networkId,
- optimizerEnabled: argv.shouldOptimize ? 1 : 0,
- artifactsDir: argv.artifactsDir,
- };
- await commands.compileAsync(opts);
+ const opts: CompilerOptions = {
+ contractsDir: argv.contractsDir,
+ networkId: argv.networkId,
+ optimizerEnabled: argv.shouldOptimize ? 1 : 0,
+ artifactsDir: argv.artifactsDir,
+ };
+ await commands.compileAsync(opts);
}
/**
* Compiles all contracts and runs migration script with options passed in through CLI.
@@ -34,123 +34,123 @@ async function onCompileCommand(argv: CliOptions): Promise<void> {
* @param argv Instance of process.argv provided by yargs.
*/
async function onMigrateCommand(argv: CliOptions): Promise<void> {
- const url = `http://localhost:${argv.jsonrpcPort}`;
- const web3Provider = new Web3.providers.HttpProvider(url);
- const web3Wrapper = new Web3Wrapper(web3Provider);
- const networkId = await web3Wrapper.getNetworkIdAsync();
- const compilerOpts: CompilerOptions = {
- contractsDir: argv.contractsDir,
- networkId,
- optimizerEnabled: argv.shouldOptimize ? 1 : 0,
- artifactsDir: argv.artifactsDir,
- };
- await commands.compileAsync(compilerOpts);
+ const url = `http://localhost:${argv.jsonrpcPort}`;
+ const web3Provider = new Web3.providers.HttpProvider(url);
+ const web3Wrapper = new Web3Wrapper(web3Provider);
+ const networkId = await web3Wrapper.getNetworkIdAsync();
+ const compilerOpts: CompilerOptions = {
+ contractsDir: argv.contractsDir,
+ networkId,
+ optimizerEnabled: argv.shouldOptimize ? 1 : 0,
+ artifactsDir: argv.artifactsDir,
+ };
+ await commands.compileAsync(compilerOpts);
- const defaults = {
- gasPrice: new BigNumber(argv.gasPrice),
- from: argv.account,
- };
- const deployerOpts = {
- artifactsDir: argv.artifactsDir,
- jsonrpcPort: argv.jsonrpcPort,
- networkId,
- defaults,
- };
- await commands.migrateAsync(deployerOpts);
+ const defaults = {
+ gasPrice: new BigNumber(argv.gasPrice),
+ from: argv.account,
+ };
+ const deployerOpts = {
+ artifactsDir: argv.artifactsDir,
+ jsonrpcPort: argv.jsonrpcPort,
+ networkId,
+ defaults,
+ };
+ await commands.migrateAsync(deployerOpts);
}
/**
* Deploys a single contract with provided name and args.
* @param argv Instance of process.argv provided by yargs.
*/
async function onDeployCommand(argv: CliOptions): Promise<void> {
- const url = `http://localhost:${argv.jsonrpcPort}`;
- const web3Provider = new Web3.providers.HttpProvider(url);
- const web3Wrapper = new Web3Wrapper(web3Provider);
- const networkId = await web3Wrapper.getNetworkIdAsync();
- const compilerOpts: CompilerOptions = {
- contractsDir: argv.contractsDir,
- networkId,
- optimizerEnabled: argv.shouldOptimize ? 1 : 0,
- artifactsDir: argv.artifactsDir,
- };
- await commands.compileAsync(compilerOpts);
+ const url = `http://localhost:${argv.jsonrpcPort}`;
+ const web3Provider = new Web3.providers.HttpProvider(url);
+ const web3Wrapper = new Web3Wrapper(web3Provider);
+ const networkId = await web3Wrapper.getNetworkIdAsync();
+ const compilerOpts: CompilerOptions = {
+ contractsDir: argv.contractsDir,
+ networkId,
+ optimizerEnabled: argv.shouldOptimize ? 1 : 0,
+ artifactsDir: argv.artifactsDir,
+ };
+ await commands.compileAsync(compilerOpts);
- const defaults = {
- gasPrice: new BigNumber(argv.gasPrice),
- from: argv.account,
- };
- const deployerOpts: DeployerOptions = {
- artifactsDir: argv.artifactsDir,
- jsonrpcPort: argv.jsonrpcPort,
- networkId,
- defaults,
- };
- const deployerArgsString = argv.args;
- const deployerArgs = deployerArgsString.split(',');
- await commands.deployAsync(argv.contract, deployerArgs, deployerOpts);
+ const defaults = {
+ gasPrice: new BigNumber(argv.gasPrice),
+ from: argv.account,
+ };
+ const deployerOpts: DeployerOptions = {
+ artifactsDir: argv.artifactsDir,
+ jsonrpcPort: argv.jsonrpcPort,
+ networkId,
+ defaults,
+ };
+ const deployerArgsString = argv.args;
+ const deployerArgs = deployerArgsString.split(',');
+ await commands.deployAsync(argv.contract, deployerArgs, deployerOpts);
}
/**
* Provides extra required options for deploy command.
* @param yargsInstance yargs instance provided in builder function callback.
*/
function deployCommandBuilder(yargsInstance: any) {
- return yargsInstance
- .option('contract', {
- type: 'string',
- description: 'name of contract to deploy, exluding .sol extension',
- })
- .option('args', {
- type: 'string',
- description: 'comma separated list of constructor args to deploy contract with',
- })
- .demandOption(['contract', 'args'])
- .help().argv;
+ return yargsInstance
+ .option('contract', {
+ type: 'string',
+ description: 'name of contract to deploy, exluding .sol extension',
+ })
+ .option('args', {
+ type: 'string',
+ description: 'comma separated list of constructor args to deploy contract with',
+ })
+ .demandOption(['contract', 'args'])
+ .help().argv;
}
(() => {
- const identityCommandBuilder = _.identity;
- return yargs
- .option('contracts-dir', {
- type: 'string',
- default: DEFAULT_CONTRACTS_DIR,
- description: 'path of contracts directory to compile',
- })
- .option('network-id', {
- type: 'number',
- default: DEFAULT_NETWORK_ID,
- description: 'mainnet=1, kovan=42, testrpc=50',
- })
- .option('should-optimize', {
- type: 'boolean',
- default: DEFAULT_OPTIMIZER_ENABLED,
- description: 'enable optimizer',
- })
- .option('artifacts-dir', {
- type: 'string',
- default: DEFAULT_ARTIFACTS_DIR,
- description: 'path to write contracts artifacts to',
- })
- .option('jsonrpc-port', {
- type: 'number',
- default: DEFAULT_JSONRPC_PORT,
- description: 'port connected to JSON RPC',
- })
- .option('gas-price', {
- type: 'string',
- default: DEFAULT_GAS_PRICE,
- description: 'gasPrice to be used for transactions',
- })
- .option('account', {
- type: 'string',
- description: 'account to use for deploying contracts',
- })
- .command('compile', 'compile contracts', identityCommandBuilder, onCompileCommand)
- .command(
- 'migrate',
- 'compile and deploy contracts using migration scripts',
- identityCommandBuilder,
- onMigrateCommand,
- )
- .command('deploy', 'deploy a single contract with provided arguments', deployCommandBuilder, onDeployCommand)
- .help().argv;
+ const identityCommandBuilder = _.identity;
+ return yargs
+ .option('contracts-dir', {
+ type: 'string',
+ default: DEFAULT_CONTRACTS_DIR,
+ description: 'path of contracts directory to compile',
+ })
+ .option('network-id', {
+ type: 'number',
+ default: DEFAULT_NETWORK_ID,
+ description: 'mainnet=1, kovan=42, testrpc=50',
+ })
+ .option('should-optimize', {
+ type: 'boolean',
+ default: DEFAULT_OPTIMIZER_ENABLED,
+ description: 'enable optimizer',
+ })
+ .option('artifacts-dir', {
+ type: 'string',
+ default: DEFAULT_ARTIFACTS_DIR,
+ description: 'path to write contracts artifacts to',
+ })
+ .option('jsonrpc-port', {
+ type: 'number',
+ default: DEFAULT_JSONRPC_PORT,
+ description: 'port connected to JSON RPC',
+ })
+ .option('gas-price', {
+ type: 'string',
+ default: DEFAULT_GAS_PRICE,
+ description: 'gasPrice to be used for transactions',
+ })
+ .option('account', {
+ type: 'string',
+ description: 'account to use for deploying contracts',
+ })
+ .command('compile', 'compile contracts', identityCommandBuilder, onCompileCommand)
+ .command(
+ 'migrate',
+ 'compile and deploy contracts using migration scripts',
+ identityCommandBuilder,
+ onMigrateCommand,
+ )
+ .command('deploy', 'deploy a single contract with provided arguments', deployCommandBuilder, onDeployCommand)
+ .help().argv;
})();