@orbs-network/twap 1.7.13 → 1.7.14
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/configs.d.ts +1 -0
- package/dist/src/configs.js +3 -7
- package/dist/src/lib.d.ts +5 -8
- package/dist/src/lib.js +23 -39
- package/dist/typechain-hardhat/contracts/IExchange.d.ts +2 -3
- package/dist/typechain-hardhat/contracts/IWETH.d.ts +1 -2
- package/dist/typechain-hardhat/contracts/TWAP.d.ts +9 -10
- package/dist/typechain-hardhat/contracts/exchange/IUniswapV2.d.ts +3 -4
- package/dist/typechain-hardhat/contracts/exchange/ParaswapExchange.d.ts +2 -3
- package/dist/typechain-hardhat/contracts/exchange/UniswapV2Exchange.d.ts +2 -3
- package/dist/typechain-hardhat/contracts/periphery/Lens.d.ts +2 -3
- package/dist/typechain-hardhat/contracts/periphery/Taker.d.ts +2 -3
- package/dist/typechain-hardhat/contracts/test/MockDeflationaryToken.d.ts +5 -6
- package/dist/typechain-hardhat/contracts/test/MockExchange.d.ts +4 -5
- package/dist/typechain-hardhat/types.d.ts +9 -10
- package/package.json +1 -1
package/dist/src/configs.d.ts
CHANGED
package/dist/src/configs.js
CHANGED
|
@@ -36,8 +36,8 @@ exports.ChainConfigs = {
|
|
|
36
36
|
},
|
|
37
37
|
poly: {
|
|
38
38
|
chainId: 137,
|
|
39
|
-
twapAddress: "",
|
|
40
|
-
lensAddress: "",
|
|
39
|
+
twapAddress: "0xBAFdE1cc254BB94Be5866d5a86ddafde4BB44EEF",
|
|
40
|
+
lensAddress: "0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55",
|
|
41
41
|
bidDelaySeconds: 60,
|
|
42
42
|
minChunkSizeUsd: 10,
|
|
43
43
|
wToken: {
|
|
@@ -65,6 +65,7 @@ exports.Configs = {
|
|
|
65
65
|
SpiritSwap: Object.assign(Object.assign({}, exports.ChainConfigs.ftm), { partner: "SpiritSwap", exchangeAddress: "0xAd19179201be5A51D1cBd3bB2fC651BB05822404", exchangeType: "ParaswapExchange", pathfinderKey: paraswap_1.Paraswap.OnlyDex.SpiritSwap }),
|
|
66
66
|
SpookySwap: Object.assign(Object.assign({}, exports.ChainConfigs.ftm), { partner: "SpookySwap", exchangeAddress: "0x37F427DA0D12Fe2C80aCa09EE08e7e92A1B2B114", exchangeType: "UniswapV2Exchange", pathfinderKey: paraswap_1.Paraswap.OnlyDex.SpookySwap }),
|
|
67
67
|
Pangolin: Object.assign(Object.assign({}, exports.ChainConfigs.avax), { partner: "Pangolin", exchangeAddress: "0x25a0A78f5ad07b2474D3D42F1c1432178465936d", exchangeType: "UniswapV2Exchange", pathfinderKey: paraswap_1.Paraswap.OnlyDex.Pangolin }),
|
|
68
|
+
QuickSwap: Object.assign(Object.assign({}, exports.ChainConfigs.poly), { partner: "QuickSwap", exchangeAddress: "0xeFE1B6096838949156e5130604434A2a13c68C68", exchangeType: "UniswapV2Exchange", pathfinderKey: paraswap_1.Paraswap.OnlyDex.QuickSwap }),
|
|
68
69
|
};
|
|
69
70
|
// export const UniswapV2Config: Config = {
|
|
70
71
|
// ...ChainConfigs.eth,
|
|
@@ -76,11 +77,6 @@ exports.Configs = {
|
|
|
76
77
|
// partner: "SushiSwap",
|
|
77
78
|
// exchangeAddress: "0x72a18A408e329E7052d08aA0746243Dc30Ad2530",
|
|
78
79
|
// };
|
|
79
|
-
// export const QuickSwapConfig: Config = {
|
|
80
|
-
// ...ChainConfigs.poly,
|
|
81
|
-
// partner: "QuickSwap",
|
|
82
|
-
// exchangeAddress: "0xeFE1B6096838949156e5130604434A2a13c68C68",
|
|
83
|
-
// };
|
|
84
80
|
exports.nativeTokenAddresses = [
|
|
85
81
|
web3_candies_1.zeroAddress,
|
|
86
82
|
"0x0000000000000000000000000000000000001010",
|
package/dist/src/lib.d.ts
CHANGED
|
@@ -27,21 +27,18 @@ export declare class TWAPLib {
|
|
|
27
27
|
percentAboveMarket: (srcUsdMarket: BN.Value, dstUsdMarket: BN.Value, limitDstPriceFor1Src: BN.Value) => number;
|
|
28
28
|
status: (order: Order) => Status;
|
|
29
29
|
makerBalance(token: TokenData): Promise<BN>;
|
|
30
|
-
wrapNativeToken(amount: BN.Value,
|
|
31
|
-
unwrapNativeToken(amount: BN.Value,
|
|
32
|
-
waitForConfirmation<T>(fn: () => Promise<T>): Promise<T>;
|
|
30
|
+
wrapNativeToken(amount: BN.Value, maxPriorityFeePerGas?: BN.Value, maxFeePerGas?: BN.Value): Promise<void>;
|
|
31
|
+
unwrapNativeToken(amount: BN.Value, maxPriorityFeePerGas?: BN.Value, maxFeePerGas?: BN.Value): Promise<void>;
|
|
33
32
|
hasAllowance(srcToken: TokenData, amount: BN.Value): Promise<boolean>;
|
|
34
|
-
approve(srcToken: TokenData, amount: BN.Value,
|
|
33
|
+
approve(srcToken: TokenData, amount: BN.Value, maxPriorityFeePerGas?: BN.Value, maxFeePerGas?: BN.Value): Promise<void>;
|
|
35
34
|
validateTokens(srcToken: TokenData, dstToken: TokenData): TokensValidation;
|
|
36
35
|
validateOrderInputs(srcToken: TokenData, dstToken: TokenData, srcAmount: BN.Value, srcChunkAmount: BN.Value, dstMinChunkAmountOut: BN.Value, deadline: BN.Value, fillDelaySeconds: BN.Value, srcUsd: BN.Value): OrderInputValidation;
|
|
37
|
-
submitOrder(srcToken: TokenData, dstToken: TokenData, srcAmount: BN.Value, srcChunkAmount: BN.Value, dstMinChunkAmountOut: BN.Value, deadline: number, fillDelaySeconds: number, srcUsd: BN.Value,
|
|
36
|
+
submitOrder(srcToken: TokenData, dstToken: TokenData, srcAmount: BN.Value, srcChunkAmount: BN.Value, dstMinChunkAmountOut: BN.Value, deadline: number, fillDelaySeconds: number, srcUsd: BN.Value, maxPriorityFeePerGas?: BN.Value, maxFeePerGas?: BN.Value): Promise<number>;
|
|
38
37
|
getOrder(id: number): Promise<Order>;
|
|
39
|
-
cancelOrder(id: number,
|
|
38
|
+
cancelOrder(id: number, maxPriorityFeePerGas?: BN.Value, maxFeePerGas?: BN.Value): Promise<void>;
|
|
40
39
|
getAllOrders(): Promise<Order[]>;
|
|
41
|
-
private sendTx;
|
|
42
40
|
parseOrder(r: any): Order;
|
|
43
41
|
getToken(address: string): Promise<TokenData>;
|
|
44
|
-
deployTaker(priorityFeePerGas?: BN.Value, maxFeePerGas?: BN.Value): Promise<void>;
|
|
45
42
|
getSwapData(orderId: number): Promise<{
|
|
46
43
|
srcToken: TokenData;
|
|
47
44
|
dstToken: TokenData;
|
package/dist/src/lib.js
CHANGED
|
@@ -20,8 +20,8 @@ const web3_candies_1 = require("@defi.org/web3-candies");
|
|
|
20
20
|
const TWAP_json_1 = __importDefault(require("../artifacts/contracts/TWAP.sol/TWAP.json"));
|
|
21
21
|
const Lens_json_1 = __importDefault(require("../artifacts/contracts/periphery/Lens.sol/Lens.json"));
|
|
22
22
|
const Taker_json_1 = __importDefault(require("../artifacts/contracts/periphery/Taker.sol/Taker.json"));
|
|
23
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
24
23
|
const paraswap_1 = require("./paraswap");
|
|
24
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
25
25
|
exports.twapAbi = TWAP_json_1.default.abi;
|
|
26
26
|
exports.lensAbi = Lens_json_1.default.abi;
|
|
27
27
|
exports.takerAbi = Taker_json_1.default.abi;
|
|
@@ -73,24 +73,14 @@ class TWAPLib {
|
|
|
73
73
|
return (0, web3_candies_1.erc20)(token.symbol, token.address, token.decimals).methods.balanceOf(this.maker).call().then(bignumber_js_1.default);
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
wrapNativeToken(amount,
|
|
77
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
return yield this.sendTx((0, web3_candies_1.erc20)(this.config.wToken.symbol, this.config.wToken.address, this.config.wToken.decimals, web3_candies_1.iwethabi).methods.deposit(), priorityFeePerGas, maxFeePerGas, amount);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
unwrapNativeToken(amount, priorityFeePerGas, maxFeePerGas) {
|
|
76
|
+
wrapNativeToken(amount, maxPriorityFeePerGas, maxFeePerGas) {
|
|
82
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
|
|
78
|
+
yield (0, web3_candies_1.sendAndWaitForConfirmations)((0, web3_candies_1.erc20)(this.config.wToken.symbol, this.config.wToken.address, this.config.wToken.decimals, web3_candies_1.iwethabi).methods.deposit(), { from: this.maker, maxPriorityFeePerGas, maxFeePerGas, value: amount });
|
|
84
79
|
});
|
|
85
80
|
}
|
|
86
|
-
|
|
81
|
+
unwrapNativeToken(amount, maxPriorityFeePerGas, maxFeePerGas) {
|
|
87
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
|
|
89
|
-
const result = yield fn();
|
|
90
|
-
while ((yield (0, web3_candies_1.web3)().eth.getTransactionCount(this.maker)) === nonceBefore) {
|
|
91
|
-
yield new Promise((r) => setTimeout(r, 1000));
|
|
92
|
-
}
|
|
93
|
-
return result;
|
|
83
|
+
yield (0, web3_candies_1.sendAndWaitForConfirmations)((0, web3_candies_1.erc20)(this.config.wToken.symbol, this.config.wToken.address, this.config.wToken.decimals, web3_candies_1.iwethabi).methods.withdraw((0, bignumber_js_1.default)(amount).toFixed(0)), { from: this.maker, maxPriorityFeePerGas, maxFeePerGas });
|
|
94
84
|
});
|
|
95
85
|
}
|
|
96
86
|
hasAllowance(srcToken, amount) {
|
|
@@ -102,10 +92,14 @@ class TWAPLib {
|
|
|
102
92
|
return allowance.gte(amount);
|
|
103
93
|
});
|
|
104
94
|
}
|
|
105
|
-
approve(srcToken, amount,
|
|
95
|
+
approve(srcToken, amount, maxPriorityFeePerGas, maxFeePerGas) {
|
|
106
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
97
|
const token = (0, web3_candies_1.erc20)(srcToken.symbol, srcToken.address, srcToken.decimals);
|
|
108
|
-
yield
|
|
98
|
+
yield (0, web3_candies_1.sendAndWaitForConfirmations)(token.methods.approve(this.config.twapAddress, (0, bignumber_js_1.default)(amount).toFixed(0)), {
|
|
99
|
+
from: this.maker,
|
|
100
|
+
maxPriorityFeePerGas,
|
|
101
|
+
maxFeePerGas,
|
|
102
|
+
});
|
|
109
103
|
});
|
|
110
104
|
}
|
|
111
105
|
validateTokens(srcToken, dstToken) {
|
|
@@ -144,12 +138,16 @@ class TWAPLib {
|
|
|
144
138
|
return OrderInputValidation.invalidSmallestSrcChunkUsd;
|
|
145
139
|
return OrderInputValidation.valid;
|
|
146
140
|
}
|
|
147
|
-
submitOrder(srcToken, dstToken, srcAmount, srcChunkAmount, dstMinChunkAmountOut, deadline, fillDelaySeconds, srcUsd,
|
|
141
|
+
submitOrder(srcToken, dstToken, srcAmount, srcChunkAmount, dstMinChunkAmountOut, deadline, fillDelaySeconds, srcUsd, maxPriorityFeePerGas, maxFeePerGas) {
|
|
148
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
149
143
|
let validation = this.validateOrderInputs(srcToken, dstToken, srcAmount, srcChunkAmount, dstMinChunkAmountOut, deadline, fillDelaySeconds, srcUsd);
|
|
150
144
|
if (validation !== OrderInputValidation.valid)
|
|
151
145
|
throw new Error(`invalid inputs: ${validation}`);
|
|
152
|
-
const tx = yield
|
|
146
|
+
const tx = yield (0, web3_candies_1.sendAndWaitForConfirmations)(this.twap.methods.ask(this.config.exchangeAddress, srcToken.address, dstToken.address, (0, bignumber_js_1.default)(srcAmount).toFixed(0), (0, bignumber_js_1.default)(srcChunkAmount).toFixed(0), (0, bignumber_js_1.default)(dstMinChunkAmountOut).toFixed(0), (0, bignumber_js_1.default)(deadline).div(1000).toFixed(0), (0, bignumber_js_1.default)(this.config.bidDelaySeconds).toFixed(0), (0, bignumber_js_1.default)(fillDelaySeconds).toFixed(0)), {
|
|
147
|
+
from: this.maker,
|
|
148
|
+
maxPriorityFeePerGas,
|
|
149
|
+
maxFeePerGas,
|
|
150
|
+
});
|
|
153
151
|
const events = (0, web3_candies_1.parseEvents)(tx, this.twap.options.jsonInterface);
|
|
154
152
|
return Number(events[0].returnValues.id);
|
|
155
153
|
});
|
|
@@ -159,9 +157,13 @@ class TWAPLib {
|
|
|
159
157
|
return this.parseOrder(yield this.twap.methods.order(id).call());
|
|
160
158
|
});
|
|
161
159
|
}
|
|
162
|
-
cancelOrder(id,
|
|
160
|
+
cancelOrder(id, maxPriorityFeePerGas, maxFeePerGas) {
|
|
163
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
-
yield
|
|
162
|
+
yield (0, web3_candies_1.sendAndWaitForConfirmations)(this.twap.methods.cancel(id), {
|
|
163
|
+
from: this.maker,
|
|
164
|
+
maxPriorityFeePerGas,
|
|
165
|
+
maxFeePerGas,
|
|
166
|
+
});
|
|
165
167
|
});
|
|
166
168
|
}
|
|
167
169
|
getAllOrders() {
|
|
@@ -169,17 +171,6 @@ class TWAPLib {
|
|
|
169
171
|
return lodash_1.default.map(yield this.lens.methods.makerOrders(this.maker).call(), (o) => this.parseOrder(o));
|
|
170
172
|
});
|
|
171
173
|
}
|
|
172
|
-
sendTx(tx, priorityFeePerGas, maxFeePerGas, amount) {
|
|
173
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
-
return yield tx.send({
|
|
175
|
-
from: this.maker,
|
|
176
|
-
gas: Math.floor((yield tx.estimateGas({ from: this.maker, value: amount ? (0, bignumber_js_1.default)(amount).toFixed(0) : undefined })) * 1.2),
|
|
177
|
-
maxPriorityFeePerGas: priorityFeePerGas ? (0, bignumber_js_1.default)(priorityFeePerGas).toFixed(0) : undefined,
|
|
178
|
-
maxFeePerGas: maxFeePerGas ? (0, bignumber_js_1.default)(maxFeePerGas).toFixed(0) : undefined,
|
|
179
|
-
value: amount ? (0, bignumber_js_1.default)(amount).toFixed(0) : undefined,
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
174
|
parseOrder(r) {
|
|
184
175
|
var _a, _b, _c, _d, _e, _f;
|
|
185
176
|
return {
|
|
@@ -218,13 +209,6 @@ class TWAPLib {
|
|
|
218
209
|
return { address, decimals: yield t.decimals(), symbol: yield t.methods.symbol().call() };
|
|
219
210
|
});
|
|
220
211
|
}
|
|
221
|
-
// TODO
|
|
222
|
-
deployTaker(priorityFeePerGas, maxFeePerGas) {
|
|
223
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
-
const taker = (0, web3_candies_1.contract)(exports.takerAbi, "");
|
|
225
|
-
yield this.sendTx(taker.deploy({ data: Taker_json_1.default.bytecode, arguments: [this.config.twapAddress, [this.maker]] }), priorityFeePerGas, maxFeePerGas);
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
212
|
//TODO
|
|
229
213
|
getSwapData(orderId) {
|
|
230
214
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type BN from "bn.js";
|
|
3
2
|
import type BigNumber from "bignumber.js";
|
|
4
3
|
import type { ContractOptions } from "web3-eth-contract";
|
|
5
4
|
import type { EventLog } from "web3-core";
|
|
@@ -14,8 +13,8 @@ export interface IExchange extends BaseContract {
|
|
|
14
13
|
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): IExchange;
|
|
15
14
|
clone(): IExchange;
|
|
16
15
|
methods: {
|
|
17
|
-
getAmountOut(srcToken: string, dstToken: string, amountIn: number | string |
|
|
18
|
-
swap(srcToken: string, dstToken: string, amountIn: number | string |
|
|
16
|
+
getAmountOut(srcToken: string, dstToken: string, amountIn: number | string | BigNumber, data: string | number[]): NonPayableTransactionObject<string>;
|
|
17
|
+
swap(srcToken: string, dstToken: string, amountIn: number | string | BigNumber, amountOutMin: number | string | BigNumber, data: string | number[]): NonPayableTransactionObject<void>;
|
|
19
18
|
};
|
|
20
19
|
events: {
|
|
21
20
|
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type BN from "bn.js";
|
|
3
2
|
import type BigNumber from "bignumber.js";
|
|
4
3
|
import type { ContractOptions } from "web3-eth-contract";
|
|
5
4
|
import type { EventLog } from "web3-core";
|
|
@@ -14,7 +13,7 @@ export interface IWETH extends BaseContract {
|
|
|
14
13
|
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): IWETH;
|
|
15
14
|
clone(): IWETH;
|
|
16
15
|
methods: {
|
|
17
|
-
withdraw(wad: number | string |
|
|
16
|
+
withdraw(wad: number | string | BigNumber): NonPayableTransactionObject<void>;
|
|
18
17
|
};
|
|
19
18
|
events: {
|
|
20
19
|
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type BN from "bn.js";
|
|
3
2
|
import type BigNumber from "bignumber.js";
|
|
4
3
|
import type { ContractOptions } from "web3-eth-contract";
|
|
5
4
|
import type { EventLog } from "web3-core";
|
|
@@ -103,9 +102,9 @@ export interface TWAP extends BaseContract {
|
|
|
103
102
|
STATUS_CANCELED(): NonPayableTransactionObject<string>;
|
|
104
103
|
STATUS_COMPLETED(): NonPayableTransactionObject<string>;
|
|
105
104
|
VERSION(): NonPayableTransactionObject<string>;
|
|
106
|
-
ask(exchange: string, srcToken: string, dstToken: string, srcAmount: number | string |
|
|
107
|
-
bid(id: number | string |
|
|
108
|
-
book(arg0: number | string |
|
|
105
|
+
ask(exchange: string, srcToken: string, dstToken: string, srcAmount: number | string | BigNumber, srcBidAmount: number | string | BigNumber, dstMinAmount: number | string | BigNumber, deadline: number | string | BigNumber, bidDelay: number | string | BigNumber, fillDelay: number | string | BigNumber): NonPayableTransactionObject<string>;
|
|
106
|
+
bid(id: number | string | BigNumber, exchange: string, dstFee: number | string | BigNumber, slippagePercent: number | string | BigNumber, data: string | number[]): NonPayableTransactionObject<void>;
|
|
107
|
+
book(arg0: number | string | BigNumber): NonPayableTransactionObject<{
|
|
109
108
|
id: string;
|
|
110
109
|
status: string;
|
|
111
110
|
filledTime: string;
|
|
@@ -143,12 +142,12 @@ export interface TWAP extends BaseContract {
|
|
|
143
142
|
];
|
|
144
143
|
5: [string, string, string, string, string, string];
|
|
145
144
|
}>;
|
|
146
|
-
cancel(id: number | string |
|
|
147
|
-
fill(id: number | string |
|
|
145
|
+
cancel(id: number | string | BigNumber): NonPayableTransactionObject<void>;
|
|
146
|
+
fill(id: number | string | BigNumber): NonPayableTransactionObject<void>;
|
|
148
147
|
iweth(): NonPayableTransactionObject<string>;
|
|
149
148
|
length(): NonPayableTransactionObject<string>;
|
|
150
|
-
makerOrders(arg0: string, arg1: number | string |
|
|
151
|
-
order(id: number | string |
|
|
149
|
+
makerOrders(arg0: string, arg1: number | string | BigNumber): NonPayableTransactionObject<string>;
|
|
150
|
+
order(id: number | string | BigNumber): NonPayableTransactionObject<[
|
|
152
151
|
string,
|
|
153
152
|
string,
|
|
154
153
|
string,
|
|
@@ -176,8 +175,8 @@ export interface TWAP extends BaseContract {
|
|
|
176
175
|
]
|
|
177
176
|
]>;
|
|
178
177
|
orderIdsByMaker(maker: string): NonPayableTransactionObject<string[]>;
|
|
179
|
-
prune(id: number | string |
|
|
180
|
-
status(arg0: number | string |
|
|
178
|
+
prune(id: number | string | BigNumber): NonPayableTransactionObject<void>;
|
|
179
|
+
status(arg0: number | string | BigNumber): NonPayableTransactionObject<string>;
|
|
181
180
|
};
|
|
182
181
|
events: {
|
|
183
182
|
OrderBid(cb?: Callback<OrderBid>): EventEmitter;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type BN from "bn.js";
|
|
3
2
|
import type BigNumber from "bignumber.js";
|
|
4
3
|
import type { ContractOptions } from "web3-eth-contract";
|
|
5
4
|
import type { EventLog } from "web3-core";
|
|
@@ -14,9 +13,9 @@ export interface IUniswapV2 extends BaseContract {
|
|
|
14
13
|
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): IUniswapV2;
|
|
15
14
|
clone(): IUniswapV2;
|
|
16
15
|
methods: {
|
|
17
|
-
getAmountsOut(amountIn: number | string |
|
|
18
|
-
swapExactTokensForTokens(amountIn: number | string |
|
|
19
|
-
swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn: number | string |
|
|
16
|
+
getAmountsOut(amountIn: number | string | BigNumber, path: string[]): NonPayableTransactionObject<string[]>;
|
|
17
|
+
swapExactTokensForTokens(amountIn: number | string | BigNumber, amountOutMin: number | string | BigNumber, path: string[], to: string, deadline: number | string | BigNumber): NonPayableTransactionObject<string[]>;
|
|
18
|
+
swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn: number | string | BigNumber, amountOutMin: number | string | BigNumber, path: string[], to: string, deadline: number | string | BigNumber): NonPayableTransactionObject<void>;
|
|
20
19
|
};
|
|
21
20
|
events: {
|
|
22
21
|
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type BN from "bn.js";
|
|
3
2
|
import type BigNumber from "bignumber.js";
|
|
4
3
|
import type { ContractOptions } from "web3-eth-contract";
|
|
5
4
|
import type { EventLog } from "web3-core";
|
|
@@ -14,9 +13,9 @@ export interface ParaswapExchange extends BaseContract {
|
|
|
14
13
|
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): ParaswapExchange;
|
|
15
14
|
clone(): ParaswapExchange;
|
|
16
15
|
methods: {
|
|
17
|
-
getAmountOut(arg0: string, arg1: string, arg2: number | string |
|
|
16
|
+
getAmountOut(arg0: string, arg1: string, arg2: number | string | BigNumber, data: string | number[]): NonPayableTransactionObject<string>;
|
|
18
17
|
paraswap(): NonPayableTransactionObject<string>;
|
|
19
|
-
swap(_srcToken: string, _dstToken: string, amountIn: number | string |
|
|
18
|
+
swap(_srcToken: string, _dstToken: string, amountIn: number | string | BigNumber, amountOutMin: number | string | BigNumber, data: string | number[]): NonPayableTransactionObject<void>;
|
|
20
19
|
};
|
|
21
20
|
events: {
|
|
22
21
|
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type BN from "bn.js";
|
|
3
2
|
import type BigNumber from "bignumber.js";
|
|
4
3
|
import type { ContractOptions } from "web3-eth-contract";
|
|
5
4
|
import type { EventLog } from "web3-core";
|
|
@@ -14,8 +13,8 @@ export interface UniswapV2Exchange extends BaseContract {
|
|
|
14
13
|
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): UniswapV2Exchange;
|
|
15
14
|
clone(): UniswapV2Exchange;
|
|
16
15
|
methods: {
|
|
17
|
-
getAmountOut(arg0: string, arg1: string, amountIn: number | string |
|
|
18
|
-
swap(_srcToken: string, arg1: string, amountIn: number | string |
|
|
16
|
+
getAmountOut(arg0: string, arg1: string, amountIn: number | string | BigNumber, data: string | number[]): NonPayableTransactionObject<string>;
|
|
17
|
+
swap(_srcToken: string, arg1: string, amountIn: number | string | BigNumber, amountOutMin: number | string | BigNumber, data: string | number[]): NonPayableTransactionObject<void>;
|
|
19
18
|
uniswap(): NonPayableTransactionObject<string>;
|
|
20
19
|
};
|
|
21
20
|
events: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type BN from "bn.js";
|
|
3
2
|
import type BigNumber from "bignumber.js";
|
|
4
3
|
import type { ContractOptions } from "web3-eth-contract";
|
|
5
4
|
import type { EventLog } from "web3-core";
|
|
@@ -42,7 +41,7 @@ export interface Lens extends BaseContract {
|
|
|
42
41
|
string
|
|
43
42
|
]
|
|
44
43
|
][]>;
|
|
45
|
-
takerBiddableOrders(taker: string, lastIndex: number | string |
|
|
44
|
+
takerBiddableOrders(taker: string, lastIndex: number | string | BigNumber, pageSize: number | string | BigNumber): NonPayableTransactionObject<[
|
|
46
45
|
string,
|
|
47
46
|
string,
|
|
48
47
|
string,
|
|
@@ -69,7 +68,7 @@ export interface Lens extends BaseContract {
|
|
|
69
68
|
string
|
|
70
69
|
]
|
|
71
70
|
][]>;
|
|
72
|
-
takerFillableOrders(taker: string, lastIndex: number | string |
|
|
71
|
+
takerFillableOrders(taker: string, lastIndex: number | string | BigNumber, pageSize: number | string | BigNumber): NonPayableTransactionObject<[
|
|
73
72
|
string,
|
|
74
73
|
string,
|
|
75
74
|
string,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type BN from "bn.js";
|
|
3
2
|
import type BigNumber from "bignumber.js";
|
|
4
3
|
import type { ContractOptions } from "web3-eth-contract";
|
|
5
4
|
import type { EventLog } from "web3-core";
|
|
@@ -14,8 +13,8 @@ export interface Taker extends BaseContract {
|
|
|
14
13
|
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): Taker;
|
|
15
14
|
clone(): Taker;
|
|
16
15
|
methods: {
|
|
17
|
-
bid(id: number | string |
|
|
18
|
-
fill(id: number | string |
|
|
16
|
+
bid(id: number | string | BigNumber, exchange: string, dstFee: number | string | BigNumber, slippagePercent: number | string | BigNumber, data: string | number[]): NonPayableTransactionObject<void>;
|
|
17
|
+
fill(id: number | string | BigNumber, feeExchange: string, feeMinAmountOut: number | string | BigNumber, feeData: string | number[]): NonPayableTransactionObject<void>;
|
|
19
18
|
owners(arg0: string): NonPayableTransactionObject<boolean>;
|
|
20
19
|
rescue(token: string): NonPayableTransactionObject<void>;
|
|
21
20
|
twap(): NonPayableTransactionObject<string>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type BN from "bn.js";
|
|
3
2
|
import type BigNumber from "bignumber.js";
|
|
4
3
|
import type { ContractOptions } from "web3-eth-contract";
|
|
5
4
|
import type { EventLog } from "web3-core";
|
|
@@ -31,16 +30,16 @@ export interface MockDeflationaryToken extends BaseContract {
|
|
|
31
30
|
clone(): MockDeflationaryToken;
|
|
32
31
|
methods: {
|
|
33
32
|
allowance(owner: string, spender: string): NonPayableTransactionObject<string>;
|
|
34
|
-
approve(spender: string, amount: number | string |
|
|
33
|
+
approve(spender: string, amount: number | string | BigNumber): NonPayableTransactionObject<boolean>;
|
|
35
34
|
balanceOf(account: string): NonPayableTransactionObject<string>;
|
|
36
35
|
decimals(): NonPayableTransactionObject<string>;
|
|
37
|
-
decreaseAllowance(spender: string, subtractedValue: number | string |
|
|
38
|
-
increaseAllowance(spender: string, addedValue: number | string |
|
|
36
|
+
decreaseAllowance(spender: string, subtractedValue: number | string | BigNumber): NonPayableTransactionObject<boolean>;
|
|
37
|
+
increaseAllowance(spender: string, addedValue: number | string | BigNumber): NonPayableTransactionObject<boolean>;
|
|
39
38
|
name(): NonPayableTransactionObject<string>;
|
|
40
39
|
symbol(): NonPayableTransactionObject<string>;
|
|
41
40
|
totalSupply(): NonPayableTransactionObject<string>;
|
|
42
|
-
transfer(to: string, amount: number | string |
|
|
43
|
-
transferFrom(from: string, to: string, amount: number | string |
|
|
41
|
+
transfer(to: string, amount: number | string | BigNumber): NonPayableTransactionObject<boolean>;
|
|
42
|
+
transferFrom(from: string, to: string, amount: number | string | BigNumber): NonPayableTransactionObject<boolean>;
|
|
44
43
|
};
|
|
45
44
|
events: {
|
|
46
45
|
Approval(cb?: Callback<Approval>): EventEmitter;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type BN from "bn.js";
|
|
3
2
|
import type BigNumber from "bignumber.js";
|
|
4
3
|
import type { ContractOptions } from "web3-eth-contract";
|
|
5
4
|
import type { EventLog } from "web3-core";
|
|
@@ -14,10 +13,10 @@ export interface MockExchange extends BaseContract {
|
|
|
14
13
|
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): MockExchange;
|
|
15
14
|
clone(): MockExchange;
|
|
16
15
|
methods: {
|
|
17
|
-
amounts(arg0: number | string |
|
|
18
|
-
getAmountOut(arg0: string, arg1: string, arg2: number | string |
|
|
19
|
-
setMockAmounts(_amounts: (number | string |
|
|
20
|
-
swap(_srcToken: string, _dstToken: string, amountIn: number | string |
|
|
16
|
+
amounts(arg0: number | string | BigNumber): NonPayableTransactionObject<string>;
|
|
17
|
+
getAmountOut(arg0: string, arg1: string, arg2: number | string | BigNumber, arg3: string | number[]): NonPayableTransactionObject<string>;
|
|
18
|
+
setMockAmounts(_amounts: (number | string | BigNumber)[]): NonPayableTransactionObject<void>;
|
|
19
|
+
swap(_srcToken: string, _dstToken: string, amountIn: number | string | BigNumber, arg3: number | string | BigNumber, arg4: string | number[]): NonPayableTransactionObject<void>;
|
|
21
20
|
};
|
|
22
21
|
events: {
|
|
23
22
|
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type BN from "bn.js";
|
|
3
2
|
import type BigNumber from "bignumber.js";
|
|
4
3
|
import type { EventEmitter } from "events";
|
|
5
4
|
import type { EventLog, PromiEvent, TransactionReceipt } from "web3-core/types";
|
|
@@ -7,7 +6,7 @@ import type { Contract } from "web3-eth-contract";
|
|
|
7
6
|
export interface EstimateGasOptions {
|
|
8
7
|
from?: string;
|
|
9
8
|
gas?: number;
|
|
10
|
-
value?: number | string |
|
|
9
|
+
value?: number | string | BigNumber;
|
|
11
10
|
}
|
|
12
11
|
export interface EventOptions {
|
|
13
12
|
filter?: object;
|
|
@@ -24,18 +23,18 @@ export interface ContractEventEmitter<T> extends EventEmitter {
|
|
|
24
23
|
on(event: "error", listener: (error: Error) => void): this;
|
|
25
24
|
}
|
|
26
25
|
export interface NonPayableTx {
|
|
27
|
-
nonce?: string | number |
|
|
28
|
-
chainId?: string | number |
|
|
26
|
+
nonce?: string | number | BigNumber;
|
|
27
|
+
chainId?: string | number | BigNumber;
|
|
29
28
|
from?: string;
|
|
30
29
|
to?: string;
|
|
31
30
|
data?: string;
|
|
32
|
-
gas?: string | number |
|
|
33
|
-
maxPriorityFeePerGas?: string | number |
|
|
34
|
-
maxFeePerGas?: string | number |
|
|
35
|
-
gasPrice?: string | number |
|
|
31
|
+
gas?: string | number | BigNumber;
|
|
32
|
+
maxPriorityFeePerGas?: string | number | BigNumber;
|
|
33
|
+
maxFeePerGas?: string | number | BigNumber;
|
|
34
|
+
gasPrice?: string | number | BigNumber;
|
|
36
35
|
}
|
|
37
36
|
export interface PayableTx extends NonPayableTx {
|
|
38
|
-
value?: string | number |
|
|
37
|
+
value?: string | number | BigNumber;
|
|
39
38
|
}
|
|
40
39
|
export interface NonPayableTransactionObject<T> {
|
|
41
40
|
arguments: any[];
|
|
@@ -51,5 +50,5 @@ export interface PayableTransactionObject<T> {
|
|
|
51
50
|
estimateGas(tx?: PayableTx): Promise<number>;
|
|
52
51
|
encodeABI(): string;
|
|
53
52
|
}
|
|
54
|
-
export type BlockType = "latest" | "pending" | "genesis" | "earliest" | number |
|
|
53
|
+
export type BlockType = "latest" | "pending" | "genesis" | "earliest" | number | BigNumber;
|
|
55
54
|
export type BaseContract = Omit<Contract, "clone" | "once">;
|