From 4bd4ff46cf894a29bc6d4a9b58c4d6a4bd5e2ddd Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Fri, 26 Oct 2018 11:36:01 -0700 Subject: Make doesBuyQuoteMatchState in reducer less strict --- packages/instant/src/redux/reducer.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'packages') diff --git a/packages/instant/src/redux/reducer.ts b/packages/instant/src/redux/reducer.ts index 4f572532a..614ed21ac 100644 --- a/packages/instant/src/redux/reducer.ts +++ b/packages/instant/src/redux/reducer.ts @@ -143,12 +143,17 @@ const doesBuyQuoteMatchState = (buyQuote: BuyQuote, state: State): boolean => { if (selectedAssetIfExists.assetData !== buyQuote.assetData) { return false; } - // if buyQuote's assetBuyAmount does not match selectedAssetAmount, return false + // if ERC20 and buyQuote's assetBuyAmount does not match selectedAssetAmount, return false + // if ERC721, return true const selectedAssetMetaData = selectedAssetIfExists.metaData; - const selectedAssetAmountBaseUnits = - selectedAssetMetaData.assetProxyId === AssetProxyId.ERC20 - ? Web3Wrapper.toBaseUnitAmount(selectedAssetAmountIfExists, selectedAssetMetaData.decimals) - : new BigNumber(1); - const doesAssetAmountMatch = selectedAssetAmountBaseUnits.eq(buyQuote.assetBuyAmount); - return doesAssetAmountMatch; + if (selectedAssetMetaData.assetProxyId === AssetProxyId.ERC20) { + const selectedAssetAmountBaseUnits = Web3Wrapper.toBaseUnitAmount( + selectedAssetAmountIfExists, + selectedAssetMetaData.decimals, + ); + const doesAssetAmountMatch = selectedAssetAmountBaseUnits.eq(buyQuote.assetBuyAmount); + return doesAssetAmountMatch; + } else { + return true; + } }; -- cgit v1.2.3