aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-10-26 05:48:37 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-10-26 05:48:37 +0800
commit0515a914e0215bb40f0da4147258544c38cf282d (patch)
tree9814fa764fdecd95f17614a045568c3b9a5991c9 /packages/instant/src
parent23b165669202c1bdf4bd7d7e509b9bfe06e3ef8a (diff)
downloaddexon-0x-contracts-0515a914e0215bb40f0da4147258544c38cf282d.tar.gz
dexon-0x-contracts-0515a914e0215bb40f0da4147258544c38cf282d.tar.zst
dexon-0x-contracts-0515a914e0215bb40f0da4147258544c38cf282d.zip
fix: dont fail for mainnet assetData and non-mainnet network
Diffstat (limited to 'packages/instant/src')
-rw-r--r--packages/instant/src/util/asset.ts5
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);