diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-10 02:40:47 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-10 02:40:47 +0800 |
commit | 2e8f74abce7be3a5799bb93a0360d299de55b621 (patch) | |
tree | e052e2d4aeaf85546cde770748ebc5d2058ea109 /packages/instant/src/util/buy_quote_updater.ts | |
parent | df91d343154bced69be86f7af4c4c702286cfd16 (diff) | |
download | dexon-sol-tools-2e8f74abce7be3a5799bb93a0360d299de55b621.tar dexon-sol-tools-2e8f74abce7be3a5799bb93a0360d299de55b621.tar.gz dexon-sol-tools-2e8f74abce7be3a5799bb93a0360d299de55b621.tar.bz2 dexon-sol-tools-2e8f74abce7be3a5799bb93a0360d299de55b621.tar.lz dexon-sol-tools-2e8f74abce7be3a5799bb93a0360d299de55b621.tar.xz dexon-sol-tools-2e8f74abce7be3a5799bb93a0360d299de55b621.tar.zst dexon-sol-tools-2e8f74abce7be3a5799bb93a0360d299de55b621.zip |
Use existing functions instead of writing our own
Diffstat (limited to 'packages/instant/src/util/buy_quote_updater.ts')
-rw-r--r-- | packages/instant/src/util/buy_quote_updater.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/instant/src/util/buy_quote_updater.ts b/packages/instant/src/util/buy_quote_updater.ts index e697d3ef7..fb5da311d 100644 --- a/packages/instant/src/util/buy_quote_updater.ts +++ b/packages/instant/src/util/buy_quote_updater.ts @@ -1,4 +1,5 @@ import { AssetBuyer, AssetBuyerError, BuyQuote } from '@0x/asset-buyer'; +import { AssetProxyId } from '@0x/types'; import { BigNumber } from '@0x/utils'; import { Web3Wrapper } from '@0x/web3-wrapper'; import * as _ from 'lodash'; @@ -6,6 +7,7 @@ import { Dispatch } from 'redux'; import { oc } from 'ts-optchain'; import { Action, actions } from '../redux/actions'; +import { State } from '../redux/reducer'; import { AffiliateInfo, ERC20Asset } from '../types'; import { assetUtils } from '../util/asset'; import { errorFlasher } from '../util/error_flasher'; @@ -16,12 +18,15 @@ export const buyQuoteUpdater = { dispatch: Dispatch<Action>, asset: ERC20Asset, assetAmount: BigNumber, + setPending = true, affiliateInfo?: AffiliateInfo, ): Promise<void> => { // get a new buy quote. const baseUnitValue = Web3Wrapper.toBaseUnitAmount(assetAmount, asset.metaData.decimals); - // mark quote as pending - dispatch(actions.setQuoteRequestStatePending()); + if (setPending) { + // mark quote as pending + dispatch(actions.setQuoteRequestStatePending()); + } const feePercentage = oc(affiliateInfo).feePercentage(); let newBuyQuote: BuyQuote | undefined; try { |