diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-09-19 22:02:52 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-09-19 22:02:52 +0800 |
commit | 14345ab24e0cd8db7bd2804b169acfaf18040ea4 (patch) | |
tree | 2ab0a7f1836c5cbfb91ea1174eb16ea5282007c4 | |
parent | 60e2dfdbda1e089ee4d4419243167eaeb769ff6a (diff) | |
download | dexon-sol-tools-14345ab24e0cd8db7bd2804b169acfaf18040ea4.tar.gz dexon-sol-tools-14345ab24e0cd8db7bd2804b169acfaf18040ea4.tar.zst dexon-sol-tools-14345ab24e0cd8db7bd2804b169acfaf18040ea4.zip |
Rename forceOrderRefresh to shouldForceOrderRefresh
-rw-r--r-- | packages/asset-buyer/src/asset_buyer.ts | 6 | ||||
-rw-r--r-- | packages/asset-buyer/src/constants.ts | 2 | ||||
-rw-r--r-- | 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<BuyQuoteRequestOpts>): Promise<BuyQuote> { - 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; } |