@orbs-network/twap 1.5.2 → 1.5.4
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/README.md +1 -1
- package/dist/src/lib.d.ts +1 -1
- package/dist/src/lib.js +3 -3
- package/dist/src/paraswap.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -95,7 +95,7 @@ As a result of this process, an `Order` is generated and held in the `TWAP` cont
|
|
|
95
95
|
* `time`: order creation timestamp
|
|
96
96
|
* `deadline`: order duration timestamp, required
|
|
97
97
|
* `bidDelay`: minimum delay in seconds before a bid can be filled, must be `>=MIN_BID_DELAY_SECONDS`
|
|
98
|
-
* `fillDelay`: minimum delay in seconds between chunks
|
|
98
|
+
* `fillDelay`: minimum delay in seconds between chunks
|
|
99
99
|
* `maker`: order creator (`msg.sender`)
|
|
100
100
|
* `exchange`: swap only on this exchange, or zero for any exchange
|
|
101
101
|
* `srcToken`: input token, required
|
package/dist/src/lib.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare class TWAPLib {
|
|
|
13
13
|
constructor(config: Config, provider: any, maker: string);
|
|
14
14
|
dstAmount: (srcAmount: BN.Value, srcUsd: BN.Value, dstUsd: BN.Value) => BN;
|
|
15
15
|
isNativeToken: (token: TokenData) => boolean;
|
|
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
19
|
totalChunks: (srcAmount: BN.Value, srcChunkAmount: BN.Value) => BN;
|
package/dist/src/lib.js
CHANGED
|
@@ -29,7 +29,7 @@ class TWAPLib {
|
|
|
29
29
|
this.maker = maker;
|
|
30
30
|
this.dstAmount = (srcAmount, srcUsd, dstUsd) => (0, bignumber_js_1.default)(srcAmount).times(srcUsd).idiv(dstUsd);
|
|
31
31
|
this.isNativeToken = (token) => !!lodash_1.default.find(configs_1.nativeTokenAddresses, (a) => (0, web3_candies_1.eqIgnoreCase)(a, token.address));
|
|
32
|
-
this.
|
|
32
|
+
this.isValidChain = (chainId) => chainId === this.config.chainId;
|
|
33
33
|
this.maxPossibleChunks = (srcToken, srcAmount, srcUsd) => bignumber_js_1.default.max(1, (0, bignumber_js_1.default)(srcAmount).div((0, bignumber_js_1.default)(10).pow(srcToken.decimals).div(srcUsd).times(this.config.minChunkSizeUsd)))
|
|
34
34
|
.integerValue(bignumber_js_1.default.ROUND_FLOOR)
|
|
35
35
|
.toNumber();
|
|
@@ -53,8 +53,8 @@ class TWAPLib {
|
|
|
53
53
|
? Status.Completed
|
|
54
54
|
: Status.Expired;
|
|
55
55
|
(0, web3_candies_1.setWeb3Instance)(new web3_1.default(provider));
|
|
56
|
-
this.twap = (0, web3_candies_1.contract)(exports.twapAbi,
|
|
57
|
-
this.lens = (0, web3_candies_1.contract)(exports.lensAbi,
|
|
56
|
+
this.twap = (0, web3_candies_1.contract)(exports.twapAbi, config.twapAddress);
|
|
57
|
+
this.lens = (0, web3_candies_1.contract)(exports.lensAbi, config.lensAddress);
|
|
58
58
|
}
|
|
59
59
|
makerBalance(token) {
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/src/paraswap.js
CHANGED
|
@@ -28,7 +28,7 @@ var Paraswap;
|
|
|
28
28
|
})(OnlyDex = Paraswap.OnlyDex || (Paraswap.OnlyDex = {}));
|
|
29
29
|
function priceUsd(chainId, token) {
|
|
30
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const r = yield findRoute(chainId, token,
|
|
31
|
+
const r = yield findRoute(chainId, token, { address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", symbol: "Native", decimals: 18 }, (0, bignumber_js_1.default)(10).pow(token.decimals));
|
|
32
32
|
return (0, bignumber_js_1.default)(r.srcUSD);
|
|
33
33
|
});
|
|
34
34
|
}
|