diff --git a/src/arguments.js b/src/arguments.js index ef41e354..b7dcbdf1 100644 --- a/src/arguments.js +++ b/src/arguments.js @@ -1,6 +1,6 @@ import { Argument, Option } from 'commander'; import BigNumber from 'bignumber.js'; -import { NODE_URL } from './utils/constant'; +import { NODE_URL, COMPILER_URL } from './utils/constant'; export const coinAmountParser = (amount) => ( new BigNumber(amount.replace(/ae$/, '')).shiftedBy(amount.endsWith('ae') ? 18 : 0) @@ -12,8 +12,13 @@ export const feeOption = new Option('-F, --fee [fee]', 'Override the transaction export const nonceArgument = new Argument('', 'Unique number that is required to sign transaction securely') .argParser((nonce) => +nonce); -export const nodeOption = new Option('-u, --url [hostname]', 'Node to connect to') - .default(NODE_URL, 'Aeternity testnet'); +export const nodeOption = new Option('-u, --url [nodeUrl]', 'Node to connect to') + .default(NODE_URL, 'Aeternity testnet') + .env('AECLI_NODE_URL'); + +export const compilerOption = new Option('--compilerUrl [compilerUrl]', 'Compiler to connect to') + .default(COMPILER_URL, 'Stable compiler') + .env('AECLI_COMPILER_URL'); export const jsonOption = new Option('--json', 'Print result in json format'); diff --git a/src/commands/contract.js b/src/commands/contract.js index 95536a3d..71ee65bf 100644 --- a/src/commands/contract.js +++ b/src/commands/contract.js @@ -20,12 +20,11 @@ // We'll use `commander` for parsing options import { Argument, Option, Command } from 'commander'; import { TX_TTL, MIN_GAS_PRICE } from '@aeternity/aepp-sdk'; -import { COMPILER_URL } from '../utils/constant'; import { withGlobalOpts } from '../utils/cli'; import CliError from '../utils/CliError'; import * as Contract from '../actions/contract'; import { - nodeOption, jsonOption, gasOption, feeOption, + nodeOption, compilerOption, jsonOption, gasOption, feeOption, } from '../arguments'; const callArgs = new Argument('[args]', 'JSON-encoded arguments array of contract call') @@ -50,7 +49,7 @@ const program = new Command().name('aecli contract'); // ## Initialize `options` program .addOption(nodeOption) - .option('--compilerUrl [compilerUrl]', 'Compiler URL', COMPILER_URL) + .addOption(compilerOption) .option('-f --force', 'Ignore node version compatibility check') .addOption(jsonOption);