From 14345ab24e0cd8db7bd2804b169acfaf18040ea4 Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 19 Sep 2018 16:02:52 +0200 Subject: Rename forceOrderRefresh to shouldForceOrderRefresh --- packages/asset-buyer/src/asset_buyer.ts | 6 +++--- packages/asset-buyer/src/constants.ts | 2 +- packages/asset-buyer/src/types.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/asset-buyer/src/asset_buyer.ts b/packages/asset-buyer/src/asset_buyer.ts index 7becb8285..81b46d89a 100644 --- a/packages/asset-buyer/src/asset_buyer.ts +++ b/packages/asset-buyer/src/asset_buyer.ts @@ -160,20 +160,20 @@ export class AssetBuyer { * @return An object that conforms to BuyQuote that satisfies the request. See type definition for more information. */ public async getBuyQuoteAsync(assetBuyAmount: BigNumber, options: Partial): Promise { - const { feePercentage, forceOrderRefresh, slippagePercentage } = { + const { feePercentage, shouldForceOrderRefresh, slippagePercentage } = { ...options, ...constants.DEFAULT_BUY_QUOTE_REQUEST_OPTS, }; assert.isBigNumber('assetBuyAmount', assetBuyAmount); assert.isValidPercentage('feePercentage', feePercentage); - assert.isBoolean('forceOrderRefresh', forceOrderRefresh); + assert.isBoolean('shouldForceOrderRefresh', shouldForceOrderRefresh); // we should refresh if: // we do not have any orders OR // we are forced to OR // we have some last refresh time AND that time was sufficiently long ago const shouldRefresh = _.isUndefined(this._currentOrdersAndFillableAmountsIfExists) || - forceOrderRefresh || + shouldForceOrderRefresh || (!_.isUndefined(this._lastRefreshTimeIfExists) && this._lastRefreshTimeIfExists + this.orderRefreshIntervalMs < Date.now()); let ordersAndFillableAmounts: AssetBuyerOrdersAndFillableAmounts; diff --git a/packages/asset-buyer/src/constants.ts b/packages/asset-buyer/src/constants.ts index 53fe89160..701832fd4 100644 --- a/packages/asset-buyer/src/constants.ts +++ b/packages/asset-buyer/src/constants.ts @@ -4,7 +4,7 @@ import { BuyQuoteRequestOpts } from './types'; const DEFAULT_BUY_QUOTE_REQUEST_OPTS: BuyQuoteRequestOpts = { feePercentage: 0, - forceOrderRefresh: false, + shouldForceOrderRefresh: false, slippagePercentage: 0.2, // 20% slippage protection }; diff --git a/packages/asset-buyer/src/types.ts b/packages/asset-buyer/src/types.ts index fb4aecd77..339bce52c 100644 --- a/packages/asset-buyer/src/types.ts +++ b/packages/asset-buyer/src/types.ts @@ -54,7 +54,7 @@ export interface BuyQuote { export interface BuyQuoteRequestOpts { feePercentage: number; - forceOrderRefresh: boolean; + shouldForceOrderRefresh: boolean; slippagePercentage: number; } -- cgit