diff options
Diffstat (limited to 'packages/deployer/src/deployer.ts')
-rw-r--r-- | packages/deployer/src/deployer.ts | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/packages/deployer/src/deployer.ts b/packages/deployer/src/deployer.ts index e87d2ab0e..4d0f4cfe4 100644 --- a/packages/deployer/src/deployer.ts +++ b/packages/deployer/src/deployer.ts @@ -6,7 +6,13 @@ import * as Web3 from 'web3'; import { Contract } from './utils/contract'; import { encoder } from './utils/encoder'; import { fsWrapper } from './utils/fs_wrapper'; -import { ContractArtifact, ContractNetworkData, DeployerOptions } from './utils/types'; +import { + ContractArtifact, + ContractNetworkData, + DeployerOptions, + PortDeployerOptions, + ProviderDeployerOptions, +} from './utils/types'; import { utils } from './utils/utils'; // Gas added to gas estimate to make sure there is sufficient gas for deployment. @@ -15,17 +21,16 @@ const EXTRA_GAS = 200000; export class Deployer { public web3Wrapper: Web3Wrapper; private _artifactsDir: string; - private _jsonrpcPort: number; private _networkId: number; private _defaults: Partial<TxData>; constructor(opts: DeployerOptions) { this._artifactsDir = opts.artifactsDir; - this._jsonrpcPort = opts.jsonrpcPort; this._networkId = opts.networkId; - const jsonrpcUrl = `http://localhost:${this._jsonrpcPort}`; - const web3Provider = new Web3.providers.HttpProvider(jsonrpcUrl); this._defaults = opts.defaults; + const web3Provider = _.isUndefined((opts as ProviderDeployerOptions).web3Provider) + ? new Web3.providers.HttpProvider(`http://localhost:${(opts as PortDeployerOptions).jsonrpcPort}`) + : (opts as ProviderDeployerOptions).web3Provider; this.web3Wrapper = new Web3Wrapper(web3Provider, this._defaults); } /** @@ -39,7 +44,7 @@ export class Deployer { const contractNetworkDataIfExists: ContractNetworkData = this._getContractNetworkDataFromArtifactIfExists( contractArtifactIfExists, ); - const data = contractNetworkDataIfExists.unlinked_binary; + const data = contractNetworkDataIfExists.bytecode; const from = await this._getFromAddressAsync(); const gas = await this._getAllowableGasEstimateAsync(data); const txData = { |