diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-30 02:02:52 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-30 02:02:52 +0800 |
commit | 260def1aefc65fd1b5ae19c86f9c361c795630ed (patch) | |
tree | fcb494a007b361bcd9ca34e5405070e5943b6010 /src | |
parent | 330a1cff1103932ec535aed5ee39a5e57da3b836 (diff) | |
download | dexon-sol-tools-260def1aefc65fd1b5ae19c86f9c361c795630ed.tar dexon-sol-tools-260def1aefc65fd1b5ae19c86f9c361c795630ed.tar.gz dexon-sol-tools-260def1aefc65fd1b5ae19c86f9c361c795630ed.tar.bz2 dexon-sol-tools-260def1aefc65fd1b5ae19c86f9c361c795630ed.tar.lz dexon-sol-tools-260def1aefc65fd1b5ae19c86f9c361c795630ed.tar.xz dexon-sol-tools-260def1aefc65fd1b5ae19c86f9c361c795630ed.tar.zst dexon-sol-tools-260def1aefc65fd1b5ae19c86f9c361c795630ed.zip |
Check that artefacts by networkId are not undefined before getting the address
Diffstat (limited to 'src')
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 7f67346ce..a121d524c 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -609,9 +609,12 @@ export class ExchangeWrapper extends ContractWrapper { if (_.isUndefined(networkId)) { return []; } else { + const exchangeArtifacts = _.values(ExchangeArtifactsByName); + const networkSpecificExchangeArtifacts = _.compact(_.map( + exchangeArtifacts, exchangeArtifact => exchangeArtifact.networks[networkId])); const exchangeAddresses = _.map( - _.values(ExchangeArtifactsByName), - exchangeArtifact => exchangeArtifact.networks[networkId].address, + networkSpecificExchangeArtifacts, + networkSpecificExchangeArtifact => networkSpecificExchangeArtifact.address, ); return exchangeAddresses; } |