aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer/src/deployer.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-03-05 11:05:26 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-03-12 10:37:27 +0800
commit13299158d1e22d1af1cd36434fc403a74743ecb1 (patch)
tree9b35435c6f8641d2dc3d7bfd530c7c4f040a1f51 /packages/deployer/src/deployer.ts
parenta6571b09d2087ffb9a4860c0db3d7344321fe2c3 (diff)
downloaddexon-sol-tools-13299158d1e22d1af1cd36434fc403a74743ecb1.tar
dexon-sol-tools-13299158d1e22d1af1cd36434fc403a74743ecb1.tar.gz
dexon-sol-tools-13299158d1e22d1af1cd36434fc403a74743ecb1.tar.bz2
dexon-sol-tools-13299158d1e22d1af1cd36434fc403a74743ecb1.tar.lz
dexon-sol-tools-13299158d1e22d1af1cd36434fc403a74743ecb1.tar.xz
dexon-sol-tools-13299158d1e22d1af1cd36434fc403a74743ecb1.tar.zst
dexon-sol-tools-13299158d1e22d1af1cd36434fc403a74743ecb1.zip
Add sol-cover implementation
Diffstat (limited to 'packages/deployer/src/deployer.ts')
-rw-r--r--packages/deployer/src/deployer.ts17
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 = {