diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-03-12 10:19:39 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-03-12 10:37:30 +0800 |
commit | c4a18ee64b58217dd9733c9b9edbfe592fc1cb8d (patch) | |
tree | e51b2242419174ae7e77a8eaea74918607be070e /packages | |
parent | 7143996d265cde74c473467439158ae557d9f8a8 (diff) | |
download | dexon-sol-tools-c4a18ee64b58217dd9733c9b9edbfe592fc1cb8d.tar.gz dexon-sol-tools-c4a18ee64b58217dd9733c9b9edbfe592fc1cb8d.tar.zst dexon-sol-tools-c4a18ee64b58217dd9733c9b9edbfe592fc1cb8d.zip |
Make Deployer configurable by jsonrpcUrl instead of jsonrpcPort
Diffstat (limited to 'packages')
-rw-r--r-- | packages/contracts/migrations/index.ts | 2 | ||||
-rw-r--r-- | packages/contracts/test/utils/deployer.ts | 2 | ||||
-rw-r--r-- | packages/deployer/CHANGELOG.md | 2 | ||||
-rw-r--r-- | packages/deployer/src/cli.ts | 14 | ||||
-rw-r--r-- | packages/deployer/src/deployer.ts | 10 | ||||
-rw-r--r-- | packages/deployer/src/utils/types.ts | 8 | ||||
-rw-r--r-- | packages/deployer/test/deploy_test.ts | 2 | ||||
-rw-r--r-- | packages/deployer/test/util/constants.ts | 2 |
8 files changed, 22 insertions, 20 deletions
diff --git a/packages/contracts/migrations/index.ts b/packages/contracts/migrations/index.ts index a44d011da..47ae7044d 100644 --- a/packages/contracts/migrations/index.ts +++ b/packages/contracts/migrations/index.ts @@ -8,7 +8,7 @@ import { runMigrationsAsync } from './migrate'; const deployerOpts = { artifactsDir: path.resolve('src', 'artifacts'), - jsonrpcPort: devConstants.RPC_PORT, + jsonrpcUrl: devConstants.RPC_URL, networkId: constants.TESTRPC_NETWORK_ID, defaults: { gas: devConstants.GAS_ESTIMATE, diff --git a/packages/contracts/test/utils/deployer.ts b/packages/contracts/test/utils/deployer.ts index c1370f38c..1baa47f09 100644 --- a/packages/contracts/test/utils/deployer.ts +++ b/packages/contracts/test/utils/deployer.ts @@ -9,7 +9,7 @@ import { web3 } from './web3_wrapper'; const deployerOpts = { web3Provider: web3.currentProvider, artifactsDir: path.resolve('src', 'artifacts'), - jsonrpcPort: devConstants.RPC_PORT, + jsonrpcUrl: devConstants.RPC_URL, networkId: constants.TESTRPC_NETWORK_ID, defaults: { gas: devConstants.GAS_ESTIMATE, diff --git a/packages/deployer/CHANGELOG.md b/packages/deployer/CHANGELOG.md index 17fe26838..e33638011 100644 --- a/packages/deployer/CHANGELOG.md +++ b/packages/deployer/CHANGELOG.md @@ -3,6 +3,8 @@ ## v0.3.0 - _TBD, 2018_ * Add support for Solidity 0.4.20 and 0.4.21 + * Replace `jsonrpcPort` config by `jsonrpcUrl` (#426) + * Replace `jsonrpc-port` CLI option by `jsonrpc-url` (#426) ## v0.2.0 - _March 4, 2018_ diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts index 3b410e9f2..063366d47 100644 --- a/packages/deployer/src/cli.ts +++ b/packages/deployer/src/cli.ts @@ -13,7 +13,7 @@ const DEFAULT_OPTIMIZER_ENABLED = false; const DEFAULT_CONTRACTS_DIR = path.resolve('src/contracts'); const DEFAULT_ARTIFACTS_DIR = path.resolve('src/artifacts'); const DEFAULT_NETWORK_ID = 50; -const DEFAULT_JSONRPC_PORT = 8545; +const DEFAULT_JSONRPC_URL = 'http://localhost:8545'; const DEFAULT_GAS_PRICE = (10 ** 9 * 2).toString(); const DEFAULT_CONTRACTS_LIST = '*'; @@ -36,7 +36,7 @@ async function onCompileCommand(argv: CliOptions): Promise<void> { * @param argv Instance of process.argv provided by yargs. */ async function onDeployCommand(argv: CliOptions): Promise<void> { - const url = `http://localhost:${argv.jsonrpcPort}`; + const url = argv.jsonrpcUrl; const web3Provider = new Web3.providers.HttpProvider(url); const web3Wrapper = new Web3Wrapper(web3Provider); const networkId = await web3Wrapper.getNetworkIdAsync(); @@ -55,7 +55,7 @@ async function onDeployCommand(argv: CliOptions): Promise<void> { }; const deployerOpts: DeployerOptions = { artifactsDir: argv.artifactsDir, - jsonrpcPort: argv.jsonrpcPort, + jsonrpcUrl: argv.jsonrpcUrl, networkId, defaults, }; @@ -120,10 +120,10 @@ function deployCommandBuilder(yargsInstance: any) { 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('jsonrpc-url', { + type: 'string', + default: DEFAULT_JSONRPC_URL, + description: 'url of JSON RPC', }) .option('gas-price', { type: 'string', diff --git a/packages/deployer/src/deployer.ts b/packages/deployer/src/deployer.ts index b72219d6e..94f6938fc 100644 --- a/packages/deployer/src/deployer.ts +++ b/packages/deployer/src/deployer.ts @@ -10,7 +10,7 @@ import { ContractArtifact, ContractNetworkData, DeployerOptions, - PortDeployerOptions, + UrlDeployerOptions, ProviderDeployerOptions, } from './utils/types'; import { utils } from './utils/utils'; @@ -30,13 +30,13 @@ export class Deployer { this._defaults = opts.defaults; let web3Provider: Web3.Provider; if (_.isUndefined((opts as ProviderDeployerOptions).web3Provider)) { - const jsonrpcPort = (opts as PortDeployerOptions).jsonrpcPort; - if (_.isUndefined(jsonrpcPort)) { + const jsonrpcUrl = (opts as UrlDeployerOptions).jsonrpcUrl; + if (_.isUndefined(jsonrpcUrl)) { throw new Error( - `Deployer options don't have neither web3Provider nor jsonrpcPort. Please pass one of them`, + `Deployer options don't have neither web3Provider nor jsonrpcUrl. Please pass one of them`, ); } - web3Provider = new Web3.providers.HttpProvider(`http://localhost:${jsonrpcPort}`); + web3Provider = new Web3.providers.HttpProvider(jsonrpcUrl); } else { web3Provider = (opts as ProviderDeployerOptions).web3Provider; } diff --git a/packages/deployer/src/utils/types.ts b/packages/deployer/src/utils/types.ts index ca2f8af0c..0068faf6a 100644 --- a/packages/deployer/src/utils/types.ts +++ b/packages/deployer/src/utils/types.ts @@ -41,7 +41,7 @@ export interface SolcErrors { export interface CliOptions extends yargs.Arguments { artifactsDir: string; contractsDir: string; - jsonrpcPort: number; + jsonrpcUrl: string; networkId: number; shouldOptimize: boolean; gasPrice: string; @@ -68,11 +68,11 @@ export interface ProviderDeployerOptions extends BaseDeployerOptions { web3Provider: Web3.Provider; } -export interface PortDeployerOptions extends BaseDeployerOptions { - jsonrpcPort: number; +export interface UrlDeployerOptions extends BaseDeployerOptions { + jsonrpcUrl: string; } -export type DeployerOptions = PortDeployerOptions | ProviderDeployerOptions; +export type DeployerOptions = UrlDeployerOptions | ProviderDeployerOptions; export interface ContractSources { [key: string]: string; diff --git a/packages/deployer/test/deploy_test.ts b/packages/deployer/test/deploy_test.ts index 905e5673b..26ce337ef 100644 --- a/packages/deployer/test/deploy_test.ts +++ b/packages/deployer/test/deploy_test.ts @@ -24,7 +24,7 @@ const compiler = new Compiler(compilerOpts); const deployerOpts = { artifactsDir, networkId: constants.networkId, - jsonrpcPort: constants.jsonrpcPort, + jsonrpcUrl: constants.jsonrpcUrl, defaults: { gasPrice: constants.gasPrice, }, diff --git a/packages/deployer/test/util/constants.ts b/packages/deployer/test/util/constants.ts index adb13f330..7b6960359 100644 --- a/packages/deployer/test/util/constants.ts +++ b/packages/deployer/test/util/constants.ts @@ -2,7 +2,7 @@ import { BigNumber } from '@0xproject/utils'; export const constants = { networkId: 0, - jsonrpcPort: 8545, + jsonrpcUrl: 'http://localhost:8545', optimizerEnabled: 0, gasPrice: new BigNumber(20000000000), timeoutMs: 20000, |