aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util/buy_quote_updater.ts
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-12-15 02:23:01 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-12-15 07:34:45 +0800
commita3d93d17cdefc2258a9f08e6fc680df1fb2b8456 (patch)
tree0f074b7205b4026b0e3b9bd84c9d8a1257411757 /packages/instant/src/util/buy_quote_updater.ts
parentc6c45095a8511814db6aa33e39794ae60debad8b (diff)
downloaddexon-sol-tools-a3d93d17cdefc2258a9f08e6fc680df1fb2b8456.tar.gz
dexon-sol-tools-a3d93d17cdefc2258a9f08e6fc680df1fb2b8456.tar.zst
dexon-sol-tools-a3d93d17cdefc2258a9f08e6fc680df1fb2b8456.zip
Factor in slippage amount in InsufficientAssetLiquidityError error, and show in instant
Diffstat (limited to 'packages/instant/src/util/buy_quote_updater.ts')
-rw-r--r--packages/instant/src/util/buy_quote_updater.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/instant/src/util/buy_quote_updater.ts b/packages/instant/src/util/buy_quote_updater.ts
index 6191c92e3..37974e71c 100644
--- a/packages/instant/src/util/buy_quote_updater.ts
+++ b/packages/instant/src/util/buy_quote_updater.ts
@@ -5,6 +5,7 @@ import * as _ from 'lodash';
import { Dispatch } from 'redux';
import { oc } from 'ts-optchain';
+import { SLIPPAGE_PERCENTAGE } from '../constants';
import { Action, actions } from '../redux/actions';
import { AffiliateInfo, ERC20Asset, QuoteFetchOrigin } from '../types';
import { analytics } from '../util/analytics';
@@ -33,8 +34,12 @@ export const buyQuoteUpdater = {
}
const feePercentage = oc(options.affiliateInfo).feePercentage();
let newBuyQuote: BuyQuote | undefined;
+ const slippagePercentage = SLIPPAGE_PERCENTAGE;
try {
- newBuyQuote = await assetBuyer.getBuyQuoteAsync(asset.assetData, baseUnitValue, { feePercentage });
+ newBuyQuote = await assetBuyer.getBuyQuoteAsync(asset.assetData, baseUnitValue, {
+ feePercentage,
+ slippagePercentage,
+ });
} catch (error) {
const errorMessage = assetUtils.assetBuyerErrorMessage(asset, error);