aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util/buy_quote_updater.ts
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-28 07:10:40 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-28 07:13:32 +0800
commitc5d6b925e4e04d5b6cfd0623d0a1449ba69d3a30 (patch)
tree55fbd82f4bb9c5f8e689684238d539bcd4e2fee1 /packages/instant/src/util/buy_quote_updater.ts
parent47a87e57f1cfa82375c87829320f30049217d657 (diff)
downloaddexon-0x-contracts-c5d6b925e4e04d5b6cfd0623d0a1449ba69d3a30.tar.gz
dexon-0x-contracts-c5d6b925e4e04d5b6cfd0623d0a1449ba69d3a30.tar.zst
dexon-0x-contracts-c5d6b925e4e04d5b6cfd0623d0a1449ba69d3a30.zip
feat(instant): Quote fetch tracking
Diffstat (limited to 'packages/instant/src/util/buy_quote_updater.ts')
-rw-r--r--packages/instant/src/util/buy_quote_updater.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/packages/instant/src/util/buy_quote_updater.ts b/packages/instant/src/util/buy_quote_updater.ts
index 2fd16d781..59d3a85af 100644
--- a/packages/instant/src/util/buy_quote_updater.ts
+++ b/packages/instant/src/util/buy_quote_updater.ts
@@ -6,7 +6,8 @@ import { Dispatch } from 'redux';
import { oc } from 'ts-optchain';
import { Action, actions } from '../redux/actions';
-import { AffiliateInfo, ERC20Asset } from '../types';
+import { AffiliateInfo, ERC20Asset, QuoteFetchedVia } from '../types';
+import { analytics } from '../util/analytics';
import { assetUtils } from '../util/asset';
import { errorFlasher } from '../util/error_flasher';
@@ -16,7 +17,12 @@ export const buyQuoteUpdater = {
dispatch: Dispatch<Action>,
asset: ERC20Asset,
assetUnitAmount: BigNumber,
- options: { setPending: boolean; dispatchErrors: boolean; affiliateInfo?: AffiliateInfo },
+ options: {
+ setPending: boolean;
+ dispatchErrors: boolean;
+ fetchedVia: QuoteFetchedVia;
+ affiliateInfo?: AffiliateInfo;
+ },
): Promise<void> => {
// get a new buy quote.
const baseUnitValue = Web3Wrapper.toBaseUnitAmount(assetUnitAmount, asset.metaData.decimals);
@@ -58,5 +64,6 @@ export const buyQuoteUpdater = {
errorFlasher.clearError(dispatch);
// invalidate the last buy quote.
dispatch(actions.updateLatestBuyQuote(newBuyQuote));
+ analytics.trackQuoteFetched(newBuyQuote, options.fetchedVia);
},
};