diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-08-30 12:36:20 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-08-31 04:24:24 +0800 |
commit | 01685b7622f7c29137aba65f1836a344b1321555 (patch) | |
tree | ff6888d43ea7f6dad9e1d4221d332240e81740c2 /packages/contract-wrappers/src | |
parent | 397fefa8d7bc2761ee8b7be786e710f86cc30fec (diff) | |
download | dexon-sol-tools-01685b7622f7c29137aba65f1836a344b1321555.tar dexon-sol-tools-01685b7622f7c29137aba65f1836a344b1321555.tar.gz dexon-sol-tools-01685b7622f7c29137aba65f1836a344b1321555.tar.bz2 dexon-sol-tools-01685b7622f7c29137aba65f1836a344b1321555.tar.lz dexon-sol-tools-01685b7622f7c29137aba65f1836a344b1321555.tar.xz dexon-sol-tools-01685b7622f7c29137aba65f1836a344b1321555.tar.zst dexon-sol-tools-01685b7622f7c29137aba65f1836a344b1321555.zip |
Fix contract not deployed on network bug in ContractWrapper class
Diffstat (limited to 'packages/contract-wrappers/src')
-rw-r--r-- | packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts index ba36afea1..19de17c0a 100644 --- a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts @@ -145,9 +145,12 @@ export abstract class ContractWrapper { } protected _getContractAddress(artifact: ContractArtifact, addressIfExists?: string): string { if (_.isUndefined(addressIfExists)) { + if (_.isUndefined(artifact.networks[this._networkId])) { + throw new Error(ContractWrappersError.ContractNotDeployedOnNetwork); + } const contractAddress = artifact.networks[this._networkId].address; if (_.isUndefined(contractAddress)) { - throw new Error(ContractWrappersError.ExchangeContractDoesNotExist); + throw new Error(CONTRACT_NAME_TO_NOT_FOUND_ERROR[artifact.contractName]); } return contractAddress; } else { |