@orbs-network/twap 1.7.8 → 1.7.10
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 +1 -5
- package/dist/src/lib.js +3 -2
- package/package.json +1 -1
package/dist/src/lib.d.ts
CHANGED
|
@@ -40,11 +40,7 @@ export declare class TWAPLib {
|
|
|
40
40
|
getAllOrders(): Promise<Order[]>;
|
|
41
41
|
private sendTx;
|
|
42
42
|
parseOrder(r: any): Order;
|
|
43
|
-
getToken(address: string): Promise<
|
|
44
|
-
address: string;
|
|
45
|
-
decimals: number;
|
|
46
|
-
symbol: string;
|
|
47
|
-
}>;
|
|
43
|
+
getToken(address: string): Promise<TokenData>;
|
|
48
44
|
}
|
|
49
45
|
export interface Order {
|
|
50
46
|
id: number;
|
package/dist/src/lib.js
CHANGED
|
@@ -123,8 +123,7 @@ class TWAPLib {
|
|
|
123
123
|
}
|
|
124
124
|
validateOrderInputs(srcToken, dstToken, srcAmount, srcChunkAmount, dstMinChunkAmountOut, deadline, fillDelaySeconds, srcUsd) {
|
|
125
125
|
const tokensValidation = this.validateTokens(srcToken, dstToken);
|
|
126
|
-
if (
|
|
127
|
-
(tokensValidation !== TokensValidation.valid && tokensValidation !== TokensValidation.dstTokenZero))
|
|
126
|
+
if (tokensValidation === TokensValidation.invalid)
|
|
128
127
|
return OrderInputValidation.invalidTokens;
|
|
129
128
|
if ((0, bignumber_js_1.default)(srcAmount).lte(0))
|
|
130
129
|
return OrderInputValidation.invalidSrcAmount;
|
|
@@ -217,6 +216,8 @@ class TWAPLib {
|
|
|
217
216
|
}
|
|
218
217
|
getToken(address) {
|
|
219
218
|
return __awaiter(this, void 0, void 0, function* () {
|
|
219
|
+
if ((0, configs_1.isNativeAddress)(address))
|
|
220
|
+
return this.config.wToken;
|
|
220
221
|
const t = (0, web3_candies_1.erc20)("", address);
|
|
221
222
|
return { address, decimals: yield t.decimals(), symbol: yield t.methods.symbol().call() };
|
|
222
223
|
});
|