@orbs-network/twap 1.5.6 → 1.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/lib.d.ts +2 -2
- package/dist/src/lib.js +5 -5
- package/package.json +1 -1
package/dist/src/lib.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ export declare class TWAPLib {
|
|
|
16
16
|
isValidChain: (chainId: number) => boolean;
|
|
17
17
|
maxPossibleChunks: (srcToken: TokenData, srcAmount: BN.Value, srcUsd: BN.Value) => number;
|
|
18
18
|
srcChunkAmount: (srcAmount: BN.Value, totalChunks: BN.Value) => BN;
|
|
19
|
-
totalChunks: (srcAmount: BN.Value, srcChunkAmount: BN.Value) =>
|
|
20
|
-
fillDelayMillis: (totalChunks: BN.Value, maxDurationMillis: BN.Value) =>
|
|
19
|
+
totalChunks: (srcAmount: BN.Value, srcChunkAmount: BN.Value) => number;
|
|
20
|
+
fillDelayMillis: (totalChunks: BN.Value, maxDurationMillis: BN.Value) => number;
|
|
21
21
|
dstMinAmountOut: (srcToken: TokenData, dstToken: TokenData, srcChunkAmount: BN.Value, limitDstPriceFor1Src: BN.Value, isMarketOrder: boolean) => BN;
|
|
22
22
|
isMarketOrder: (order: Order) => boolean;
|
|
23
23
|
orderProgress: (order: Order) => BN;
|
package/dist/src/lib.js
CHANGED
|
@@ -34,15 +34,15 @@ class TWAPLib {
|
|
|
34
34
|
.integerValue(bignumber_js_1.default.ROUND_FLOOR)
|
|
35
35
|
.toNumber();
|
|
36
36
|
this.srcChunkAmount = (srcAmount, totalChunks) => (0, bignumber_js_1.default)(srcAmount).div(totalChunks).integerValue(bignumber_js_1.default.ROUND_FLOOR);
|
|
37
|
-
this.totalChunks = (srcAmount, srcChunkAmount) => (0, bignumber_js_1.default)(srcAmount).div(srcChunkAmount).integerValue(bignumber_js_1.default.ROUND_CEIL);
|
|
38
|
-
this.fillDelayMillis = (totalChunks, maxDurationMillis) => (0, bignumber_js_1.default)(totalChunks).lte(
|
|
39
|
-
?
|
|
37
|
+
this.totalChunks = (srcAmount, srcChunkAmount) => (0, bignumber_js_1.default)(srcAmount).div(srcChunkAmount).integerValue(bignumber_js_1.default.ROUND_CEIL).toNumber();
|
|
38
|
+
this.fillDelayMillis = (totalChunks, maxDurationMillis) => (0, bignumber_js_1.default)(totalChunks).lte(1) || (0, bignumber_js_1.default)(maxDurationMillis).lte(this.config.bidDelaySeconds)
|
|
39
|
+
? 0
|
|
40
40
|
: bignumber_js_1.default.max((0, bignumber_js_1.default)(maxDurationMillis)
|
|
41
41
|
.div(totalChunks)
|
|
42
|
-
.minus((0, bignumber_js_1.default)(this.config.bidDelaySeconds * 1000)), 0);
|
|
42
|
+
.minus((0, bignumber_js_1.default)(this.config.bidDelaySeconds * 1000)), 0).toNumber();
|
|
43
43
|
this.dstMinAmountOut = (srcToken, dstToken, srcChunkAmount, limitDstPriceFor1Src, isMarketOrder) => isMarketOrder
|
|
44
44
|
? (0, bignumber_js_1.default)(1)
|
|
45
|
-
: (0, web3_candies_1.convertDecimals)((0, bignumber_js_1.default)(srcChunkAmount).times(limitDstPriceFor1Src), srcToken.decimals, dstToken.decimals).integerValue(bignumber_js_1.default.ROUND_FLOOR);
|
|
45
|
+
: bignumber_js_1.default.max(1, (0, web3_candies_1.convertDecimals)((0, bignumber_js_1.default)(srcChunkAmount).times(limitDstPriceFor1Src), srcToken.decimals, dstToken.decimals).integerValue(bignumber_js_1.default.ROUND_FLOOR));
|
|
46
46
|
this.isMarketOrder = (order) => order.ask.dstMinAmount.lte(1);
|
|
47
47
|
this.orderProgress = (order) => order.srcFilledAmount.div(order.ask.srcAmount);
|
|
48
48
|
this.status = (order) => order.status > Date.now() / 1000
|