aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-29 06:17:26 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-29 06:17:26 +0800
commit208ee935c843cfff9f0559a4c4058af3908f6261 (patch)
treee3ae1675f9688a2b51baea5100ab6f5dccbcb27d /packages/instant/src/util
parentec01893e9c987fcbd3fd7bcb4ec34498a6f516cc (diff)
downloaddexon-sol-tools-208ee935c843cfff9f0559a4c4058af3908f6261.tar
dexon-sol-tools-208ee935c843cfff9f0559a4c4058af3908f6261.tar.gz
dexon-sol-tools-208ee935c843cfff9f0559a4c4058af3908f6261.tar.bz2
dexon-sol-tools-208ee935c843cfff9f0559a4c4058af3908f6261.tar.lz
dexon-sol-tools-208ee935c843cfff9f0559a4c4058af3908f6261.tar.xz
dexon-sol-tools-208ee935c843cfff9f0559a4c4058af3908f6261.tar.zst
dexon-sol-tools-208ee935c843cfff9f0559a4c4058af3908f6261.zip
Move fetch origin out of options
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r--packages/instant/src/util/buy_quote_updater.ts10
-rw-r--r--packages/instant/src/util/heartbeater_factory.ts12
2 files changed, 11 insertions, 11 deletions
diff --git a/packages/instant/src/util/buy_quote_updater.ts b/packages/instant/src/util/buy_quote_updater.ts
index 06474b69f..5685a7d00 100644
--- a/packages/instant/src/util/buy_quote_updater.ts
+++ b/packages/instant/src/util/buy_quote_updater.ts
@@ -17,10 +17,10 @@ export const buyQuoteUpdater = {
dispatch: Dispatch<Action>,
asset: ERC20Asset,
assetUnitAmount: BigNumber,
+ fetchOrigin: QuoteFetchOrigin,
options: {
setPending: boolean;
dispatchErrors: boolean;
- fetchOrigin: QuoteFetchOrigin;
affiliateInfo?: AffiliateInfo;
},
): Promise<void> => {
@@ -37,11 +37,7 @@ export const buyQuoteUpdater = {
} catch (error) {
if (options.dispatchErrors) {
dispatch(actions.setQuoteRequestStateFailure());
- analytics.trackQuoteError(
- error.message ? error.message : 'other',
- assetUnitAmount,
- options.fetchOrigin,
- );
+ analytics.trackQuoteError(error.message ? error.message : 'other', assetUnitAmount, fetchOrigin);
let errorMessage;
if (error.message === AssetBuyerError.InsufficientAssetLiquidity) {
const assetName = assetUtils.bestNameForAsset(asset, 'of this asset');
@@ -69,6 +65,6 @@ export const buyQuoteUpdater = {
errorFlasher.clearError(dispatch);
// invalidate the last buy quote.
dispatch(actions.updateLatestBuyQuote(newBuyQuote));
- analytics.trackQuoteFetched(newBuyQuote, options.fetchOrigin);
+ analytics.trackQuoteFetched(newBuyQuote, fetchOrigin);
},
};
diff --git a/packages/instant/src/util/heartbeater_factory.ts b/packages/instant/src/util/heartbeater_factory.ts
index 5f7ef55e5..cf29bf3ea 100644
--- a/packages/instant/src/util/heartbeater_factory.ts
+++ b/packages/instant/src/util/heartbeater_factory.ts
@@ -18,9 +18,13 @@ export const generateAccountHeartbeater = (options: HeartbeatFactoryOptions): He
export const generateBuyQuoteHeartbeater = (options: HeartbeatFactoryOptions): Heartbeater => {
const { store, shouldPerformImmediatelyOnStart } = options;
return new Heartbeater(async () => {
- await asyncData.fetchCurrentBuyQuoteAndDispatchToStore(store.getState(), store.dispatch, {
- updateSilently: true,
- fetchOrigin: QuoteFetchOrigin.Heartbeat,
- });
+ await asyncData.fetchCurrentBuyQuoteAndDispatchToStore(
+ store.getState(),
+ store.dispatch,
+ QuoteFetchOrigin.Heartbeat,
+ {
+ updateSilently: true,
+ },
+ );
}, shouldPerformImmediatelyOnStart);
};