diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-15 02:23:01 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-15 07:34:45 +0800 |
commit | a3d93d17cdefc2258a9f08e6fc680df1fb2b8456 (patch) | |
tree | 0f074b7205b4026b0e3b9bd84c9d8a1257411757 /packages/instant/src/util/buy_quote_updater.ts | |
parent | c6c45095a8511814db6aa33e39794ae60debad8b (diff) | |
download | dexon-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.ts | 7 |
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); |