aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-10-27 02:36:01 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-10-27 04:10:15 +0800
commit4bd4ff46cf894a29bc6d4a9b58c4d6a4bd5e2ddd (patch)
treef54b461bf01406feef9e82203645a79848a8cd33
parentedfb56de6cd1f9605698f9a499016a28f6ba8754 (diff)
downloaddexon-sol-tools-4bd4ff46cf894a29bc6d4a9b58c4d6a4bd5e2ddd.tar
dexon-sol-tools-4bd4ff46cf894a29bc6d4a9b58c4d6a4bd5e2ddd.tar.gz
dexon-sol-tools-4bd4ff46cf894a29bc6d4a9b58c4d6a4bd5e2ddd.tar.bz2
dexon-sol-tools-4bd4ff46cf894a29bc6d4a9b58c4d6a4bd5e2ddd.tar.lz
dexon-sol-tools-4bd4ff46cf894a29bc6d4a9b58c4d6a4bd5e2ddd.tar.xz
dexon-sol-tools-4bd4ff46cf894a29bc6d4a9b58c4d6a4bd5e2ddd.tar.zst
dexon-sol-tools-4bd4ff46cf894a29bc6d4a9b58c4d6a4bd5e2ddd.zip
Make doesBuyQuoteMatchState in reducer less strict
-rw-r--r--packages/instant/src/redux/reducer.ts19
1 files changed, 12 insertions, 7 deletions
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;
+ }
};