diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-10-26 05:48:37 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-10-26 05:48:37 +0800 |
commit | 0515a914e0215bb40f0da4147258544c38cf282d (patch) | |
tree | 9814fa764fdecd95f17614a045568c3b9a5991c9 /packages/instant/src/util | |
parent | 23b165669202c1bdf4bd7d7e509b9bfe06e3ef8a (diff) | |
download | dexon-sol-tools-0515a914e0215bb40f0da4147258544c38cf282d.tar.gz dexon-sol-tools-0515a914e0215bb40f0da4147258544c38cf282d.tar.zst dexon-sol-tools-0515a914e0215bb40f0da4147258544c38cf282d.zip |
fix: dont fail for mainnet assetData and non-mainnet network
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r-- | packages/instant/src/util/asset.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/instant/src/util/asset.ts b/packages/instant/src/util/asset.ts index 4e3b2b946..d7e87eebb 100644 --- a/packages/instant/src/util/asset.ts +++ b/packages/instant/src/util/asset.ts @@ -18,7 +18,10 @@ export const assetUtils = { getMetaDataOrThrow: (assetData: string, metaDataMap: ObjectMap<AssetMetaData>, network: Network): AssetMetaData => { let mainnetAssetData: string | undefined = assetData; if (network !== Network.Mainnet) { - mainnetAssetData = assetUtils.getAssociatedAssetDataIfExists(assetData, network); + const mainnetAssetDataIfExists = assetUtils.getAssociatedAssetDataIfExists(assetData, network); + // Just so we don't fail in the case where we are on a non-mainnet network, + // but pass in a valid mainnet assetData. + mainnetAssetData = mainnetAssetDataIfExists || assetData; } if (_.isUndefined(mainnetAssetData)) { throw new Error(ZeroExInstantError.AssetMetaDataNotAvailable); |