@dhedge/v2-sdk 2.0.0 → 2.0.1
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/entities/pool.d.ts +91 -91
- package/dist/services/flatmoney/stableLp.d.ts +4 -4
- package/dist/services/odos/index.d.ts +1 -0
- package/dist/services/toros/completeWithdrawal.d.ts +7 -0
- package/dist/services/toros/easySwapper.d.ts +2 -2
- package/dist/services/toros/initWithdrawal.d.ts +3 -0
- package/dist/services/toros/retry.d.ts +5 -0
- package/dist/services/toros/swapData.d.ts +11 -0
- package/dist/types.d.ts +5 -0
- package/dist/utils/contract.d.ts +3 -2
- package/dist/v2-sdk.cjs.development.js +3905 -1015
- package/dist/v2-sdk.cjs.development.js.map +1 -1
- package/dist/v2-sdk.cjs.production.min.js +1 -1
- package/dist/v2-sdk.cjs.production.min.js.map +1 -1
- package/dist/v2-sdk.esm.js +3905 -1015
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/IAaveLendingPoolAssetGuard.json +645 -0
- package/src/abi/IEasySwapperV2.json +1507 -0
- package/src/entities/pool.ts +231 -141
- package/src/services/flatmoney/stableLp.ts +27 -21
- package/src/services/odos/index.ts +1 -1
- package/src/services/toros/completeWithdrawal.ts +209 -0
- package/src/services/toros/easySwapper.ts +16 -84
- package/src/services/toros/initWithdrawal.ts +166 -0
- package/src/services/toros/retry.ts +28 -0
- package/src/services/toros/swapData.ts +70 -0
- package/src/test/constants.ts +1 -1
- package/src/test/toros.test.ts +10 -8
- package/src/types.ts +8 -0
- package/src/utils/contract.ts +71 -43
package/src/entities/pool.ts
CHANGED
|
@@ -30,7 +30,8 @@ import {
|
|
|
30
30
|
LyraOptionMarket,
|
|
31
31
|
LyraOptionType,
|
|
32
32
|
LyraTradeType,
|
|
33
|
-
LyraPosition
|
|
33
|
+
LyraPosition,
|
|
34
|
+
SDKOptions
|
|
34
35
|
} from "../types";
|
|
35
36
|
|
|
36
37
|
import { Utils } from "./utils";
|
|
@@ -40,10 +41,7 @@ import {
|
|
|
40
41
|
getUniswapV3MintTxData
|
|
41
42
|
} from "../services/uniswap/V3Liquidity";
|
|
42
43
|
import { getUniswapV3SwapTxData } from "../services/uniswap/V3Trade";
|
|
43
|
-
import {
|
|
44
|
-
getCompleteWithdrawalTxData,
|
|
45
|
-
getEasySwapperTxData
|
|
46
|
-
} from "../services/toros/easySwapper";
|
|
44
|
+
import { getEasySwapperTxData } from "../services/toros/easySwapper";
|
|
47
45
|
import { getAaveV3ClaimTxData } from "../services/aave/incentives";
|
|
48
46
|
import {
|
|
49
47
|
getClOwner,
|
|
@@ -87,6 +85,7 @@ import {
|
|
|
87
85
|
} from "../services/pancake/staking";
|
|
88
86
|
import { getOdosSwapTxData } from "../services/odos";
|
|
89
87
|
import { getPendleSwapTxData } from "../services/pendle";
|
|
88
|
+
import { getCompleteWithdrawalTxData } from "../services/toros/completeWithdrawal";
|
|
90
89
|
|
|
91
90
|
export class Pool {
|
|
92
91
|
public readonly poolLogic: Contract;
|
|
@@ -213,7 +212,7 @@ export class Pool {
|
|
|
213
212
|
* @param {string} asset Address of asset
|
|
214
213
|
* @param {BigNumber | string} Amount to be approved
|
|
215
214
|
* @param {any} options Transaction options
|
|
216
|
-
* @param {
|
|
215
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
217
216
|
* @returns {Promise<any>} Transaction
|
|
218
217
|
*/
|
|
219
218
|
async approve(
|
|
@@ -221,7 +220,9 @@ export class Pool {
|
|
|
221
220
|
asset: string,
|
|
222
221
|
amount: BigNumber | string,
|
|
223
222
|
options: any = null,
|
|
224
|
-
|
|
223
|
+
sdkOptions: SDKOptions = {
|
|
224
|
+
estimateGas: false
|
|
225
|
+
}
|
|
225
226
|
): Promise<any> {
|
|
226
227
|
const iERC20 = new ethers.utils.Interface(IERC20.abi);
|
|
227
228
|
const approveTxData = iERC20.encodeFunctionData("approve", [
|
|
@@ -231,7 +232,7 @@ export class Pool {
|
|
|
231
232
|
const tx = await getPoolTxOrGasEstimate(
|
|
232
233
|
this,
|
|
233
234
|
[asset, approveTxData, options],
|
|
234
|
-
|
|
235
|
+
sdkOptions
|
|
235
236
|
);
|
|
236
237
|
return tx;
|
|
237
238
|
}
|
|
@@ -242,7 +243,7 @@ export class Pool {
|
|
|
242
243
|
* @param {string} asset Address of liquidity pool token
|
|
243
244
|
* @param {BigNumber | string} amount Aamount to be approved
|
|
244
245
|
* @param {any} options Transaction options
|
|
245
|
-
* @param {
|
|
246
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
246
247
|
* @returns {Promise<any>} Transaction
|
|
247
248
|
*/
|
|
248
249
|
async approveStaking(
|
|
@@ -250,7 +251,9 @@ export class Pool {
|
|
|
250
251
|
asset: string,
|
|
251
252
|
amount: BigNumber | string,
|
|
252
253
|
options: any = null,
|
|
253
|
-
|
|
254
|
+
sdkOptions: SDKOptions = {
|
|
255
|
+
estimateGas: false
|
|
256
|
+
}
|
|
254
257
|
): Promise<any> {
|
|
255
258
|
const iERC20 = new ethers.utils.Interface(IERC20.abi);
|
|
256
259
|
const approveTxData = iERC20.encodeFunctionData("approve", [
|
|
@@ -260,7 +263,7 @@ export class Pool {
|
|
|
260
263
|
const tx = await getPoolTxOrGasEstimate(
|
|
261
264
|
this,
|
|
262
265
|
[asset, approveTxData, options],
|
|
263
|
-
|
|
266
|
+
sdkOptions
|
|
264
267
|
);
|
|
265
268
|
return tx;
|
|
266
269
|
}
|
|
@@ -271,14 +274,16 @@ export class Pool {
|
|
|
271
274
|
* @param {string} asset Address of liquidity pool token
|
|
272
275
|
* @param {BigNumber | string} amount Aamount to be approved
|
|
273
276
|
* @param {any} options Transaction options
|
|
274
|
-
* @param {
|
|
277
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
275
278
|
* @returns {Promise<any>} Transaction
|
|
276
279
|
*/
|
|
277
280
|
async approveUniswapV3Liquidity(
|
|
278
281
|
asset: string,
|
|
279
282
|
amount: BigNumber | string,
|
|
280
283
|
options: any = null,
|
|
281
|
-
|
|
284
|
+
sdkOptions: SDKOptions = {
|
|
285
|
+
estimateGas: false
|
|
286
|
+
}
|
|
282
287
|
): Promise<any> {
|
|
283
288
|
const iERC20 = new ethers.utils.Interface(IERC20.abi);
|
|
284
289
|
const approveTxData = iERC20.encodeFunctionData("approve", [
|
|
@@ -288,7 +293,7 @@ export class Pool {
|
|
|
288
293
|
const tx = await getPoolTxOrGasEstimate(
|
|
289
294
|
this,
|
|
290
295
|
[asset, approveTxData, options],
|
|
291
|
-
|
|
296
|
+
sdkOptions
|
|
292
297
|
);
|
|
293
298
|
return tx;
|
|
294
299
|
}
|
|
@@ -299,7 +304,7 @@ export class Pool {
|
|
|
299
304
|
* @param {string} asset Address of asset
|
|
300
305
|
* @param {BigNumber | string} amount to be approved
|
|
301
306
|
* @param {any} options Transaction options
|
|
302
|
-
* @param {
|
|
307
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
303
308
|
* @returns {Promise<any>} Transaction
|
|
304
309
|
*/
|
|
305
310
|
async approveSpender(
|
|
@@ -307,7 +312,9 @@ export class Pool {
|
|
|
307
312
|
asset: string,
|
|
308
313
|
amount: BigNumber | string,
|
|
309
314
|
options: any = null,
|
|
310
|
-
|
|
315
|
+
sdkOptions: SDKOptions = {
|
|
316
|
+
estimateGas: false
|
|
317
|
+
}
|
|
311
318
|
): Promise<any> {
|
|
312
319
|
const iERC20 = new ethers.utils.Interface(IERC20.abi);
|
|
313
320
|
const approveTxData = iERC20.encodeFunctionData("approve", [
|
|
@@ -317,7 +324,7 @@ export class Pool {
|
|
|
317
324
|
const tx = await getPoolTxOrGasEstimate(
|
|
318
325
|
this,
|
|
319
326
|
[asset, approveTxData, options],
|
|
320
|
-
|
|
327
|
+
sdkOptions
|
|
321
328
|
);
|
|
322
329
|
return tx;
|
|
323
330
|
}
|
|
@@ -328,7 +335,7 @@ export class Pool {
|
|
|
328
335
|
* @param {string} asset Address of asset
|
|
329
336
|
* @param {string} tokenId NFT id
|
|
330
337
|
* @param {any} options Transaction options
|
|
331
|
-
* @param {
|
|
338
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
332
339
|
* @returns {Promise<any>} Transaction
|
|
333
340
|
*/
|
|
334
341
|
async approveSpenderNFT(
|
|
@@ -336,7 +343,9 @@ export class Pool {
|
|
|
336
343
|
asset: string,
|
|
337
344
|
tokenId: string,
|
|
338
345
|
options: any = null,
|
|
339
|
-
|
|
346
|
+
sdkOptions: SDKOptions = {
|
|
347
|
+
estimateGas: false
|
|
348
|
+
}
|
|
340
349
|
): Promise<any> {
|
|
341
350
|
const iERC721 = new ethers.utils.Interface(IERC721.abi);
|
|
342
351
|
const approveTxData = iERC721.encodeFunctionData("approve", [
|
|
@@ -346,7 +355,7 @@ export class Pool {
|
|
|
346
355
|
const tx = await getPoolTxOrGasEstimate(
|
|
347
356
|
this,
|
|
348
357
|
[asset, approveTxData, options],
|
|
349
|
-
|
|
358
|
+
sdkOptions
|
|
350
359
|
);
|
|
351
360
|
return tx;
|
|
352
361
|
}
|
|
@@ -359,7 +368,7 @@ export class Pool {
|
|
|
359
368
|
* @param {BigNumber | string} amountIn Amount
|
|
360
369
|
* @param {number} slippage Slippage tolerance in %
|
|
361
370
|
* @param {any} options Transaction options
|
|
362
|
-
* @param {
|
|
371
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
363
372
|
* @returns {Promise<any>} Transaction
|
|
364
373
|
*/
|
|
365
374
|
async trade(
|
|
@@ -369,7 +378,9 @@ export class Pool {
|
|
|
369
378
|
amountIn: BigNumber | string,
|
|
370
379
|
slippage = 0.5,
|
|
371
380
|
options: any = null,
|
|
372
|
-
|
|
381
|
+
sdkOptions: SDKOptions = {
|
|
382
|
+
estimateGas: false
|
|
383
|
+
}
|
|
373
384
|
): Promise<any> {
|
|
374
385
|
let swapTxData: string;
|
|
375
386
|
let minAmountOut: string | null = null;
|
|
@@ -455,7 +466,7 @@ export class Pool {
|
|
|
455
466
|
const tx = await getPoolTxOrGasEstimate(
|
|
456
467
|
this,
|
|
457
468
|
[routerAddress[this.network][dapp], swapTxData, options, minAmountOut],
|
|
458
|
-
|
|
469
|
+
sdkOptions
|
|
459
470
|
);
|
|
460
471
|
return tx;
|
|
461
472
|
}
|
|
@@ -468,7 +479,7 @@ export class Pool {
|
|
|
468
479
|
* @param {BigNumber | string} amountA Amount first asset
|
|
469
480
|
* @param {BigNumber | string} amountB Amount second asset
|
|
470
481
|
* @param {any} options Transaction options
|
|
471
|
-
* @param {
|
|
482
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
472
483
|
* @returns {Promise<any>} Transaction
|
|
473
484
|
*/
|
|
474
485
|
async addLiquidity(
|
|
@@ -478,7 +489,9 @@ export class Pool {
|
|
|
478
489
|
amountA: BigNumber | string,
|
|
479
490
|
amountB: BigNumber | string,
|
|
480
491
|
options: any = null,
|
|
481
|
-
|
|
492
|
+
sdkOptions: SDKOptions = {
|
|
493
|
+
estimateGas: false
|
|
494
|
+
}
|
|
482
495
|
): Promise<any> {
|
|
483
496
|
const iUniswapV2Router = new ethers.utils.Interface(IUniswapV2Router.abi);
|
|
484
497
|
const addLiquidityTxData = iUniswapV2Router.encodeFunctionData(
|
|
@@ -497,7 +510,7 @@ export class Pool {
|
|
|
497
510
|
const tx = await getPoolTxOrGasEstimate(
|
|
498
511
|
this,
|
|
499
512
|
[routerAddress[this.network][dapp], addLiquidityTxData, options],
|
|
500
|
-
|
|
513
|
+
sdkOptions
|
|
501
514
|
);
|
|
502
515
|
return tx;
|
|
503
516
|
}
|
|
@@ -509,7 +522,7 @@ export class Pool {
|
|
|
509
522
|
* @param {string} assetB Second asset
|
|
510
523
|
* @param {BigNumber | string} amount Amount of liquidity pool tokens
|
|
511
524
|
* @param {any} options Transaction options
|
|
512
|
-
* @param {
|
|
525
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
513
526
|
* @returns {Promise<any>} Transaction
|
|
514
527
|
*/
|
|
515
528
|
async removeLiquidity(
|
|
@@ -518,7 +531,9 @@ export class Pool {
|
|
|
518
531
|
assetB: string,
|
|
519
532
|
amount: string | BigNumber,
|
|
520
533
|
options: any = null,
|
|
521
|
-
|
|
534
|
+
sdkOptions: SDKOptions = {
|
|
535
|
+
estimateGas: false
|
|
536
|
+
}
|
|
522
537
|
): Promise<any> {
|
|
523
538
|
const iUniswapV2Router = new ethers.utils.Interface(IUniswapV2Router.abi);
|
|
524
539
|
const removeLiquidityTxData = iUniswapV2Router.encodeFunctionData(
|
|
@@ -528,7 +543,7 @@ export class Pool {
|
|
|
528
543
|
const tx = await getPoolTxOrGasEstimate(
|
|
529
544
|
this,
|
|
530
545
|
[routerAddress[this.network][dapp], removeLiquidityTxData, options],
|
|
531
|
-
|
|
546
|
+
sdkOptions
|
|
532
547
|
);
|
|
533
548
|
return tx;
|
|
534
549
|
}
|
|
@@ -539,7 +554,7 @@ export class Pool {
|
|
|
539
554
|
* @param {string} asset Liquidity pool token
|
|
540
555
|
* @param {BigNumber | string} amount Amount of liquidity pool tokens
|
|
541
556
|
* @param {any} options Transaction options
|
|
542
|
-
* @param {
|
|
557
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
543
558
|
* @returns {Promise<any>} Transaction
|
|
544
559
|
*/
|
|
545
560
|
async stake(
|
|
@@ -547,7 +562,9 @@ export class Pool {
|
|
|
547
562
|
asset: string,
|
|
548
563
|
amount: BigNumber | string,
|
|
549
564
|
options: any = null,
|
|
550
|
-
|
|
565
|
+
sdkOptions: SDKOptions = {
|
|
566
|
+
estimateGas: false
|
|
567
|
+
}
|
|
551
568
|
): Promise<any> {
|
|
552
569
|
const iMiniChefV2 = new ethers.utils.Interface(IMiniChefV2.abi);
|
|
553
570
|
const poolId = await this.utils.getLpPoolId(dapp, asset);
|
|
@@ -559,7 +576,7 @@ export class Pool {
|
|
|
559
576
|
const tx = await getPoolTxOrGasEstimate(
|
|
560
577
|
this,
|
|
561
578
|
[stakingAddress[this.network][dapp], stakeTxData, options],
|
|
562
|
-
|
|
579
|
+
sdkOptions
|
|
563
580
|
);
|
|
564
581
|
return tx;
|
|
565
582
|
}
|
|
@@ -570,7 +587,7 @@ export class Pool {
|
|
|
570
587
|
* @param {string} gauge Gauge contract address
|
|
571
588
|
* @param {BigNumber | string} amount Amount of liquidity pool tokens or token ID for Velodrome CL
|
|
572
589
|
* @param {any} options Transaction options
|
|
573
|
-
* @param {
|
|
590
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
574
591
|
* @returns {Promise<any>} Transaction
|
|
575
592
|
*/
|
|
576
593
|
async stakeInGauge(
|
|
@@ -578,7 +595,9 @@ export class Pool {
|
|
|
578
595
|
gauge: string,
|
|
579
596
|
amount: BigNumber | string,
|
|
580
597
|
options: any = null,
|
|
581
|
-
|
|
598
|
+
sdkOptions: SDKOptions = {
|
|
599
|
+
estimateGas: false
|
|
600
|
+
}
|
|
582
601
|
): Promise<any> {
|
|
583
602
|
let stakeTxData;
|
|
584
603
|
switch (dapp) {
|
|
@@ -613,7 +632,7 @@ export class Pool {
|
|
|
613
632
|
const tx = await getPoolTxOrGasEstimate(
|
|
614
633
|
this,
|
|
615
634
|
[txTo, stakeTxData, options],
|
|
616
|
-
|
|
635
|
+
sdkOptions
|
|
617
636
|
);
|
|
618
637
|
return tx;
|
|
619
638
|
}
|
|
@@ -624,7 +643,7 @@ export class Pool {
|
|
|
624
643
|
* @param {string} asset Liquidity pool token
|
|
625
644
|
* @param {BigNumber | string} amount Amount of liquidity pool tokens
|
|
626
645
|
* @param {any} options Transaction options
|
|
627
|
-
* @param {
|
|
646
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
628
647
|
* @returns {Promise<any>} Transaction
|
|
629
648
|
*/
|
|
630
649
|
async unStake(
|
|
@@ -632,7 +651,9 @@ export class Pool {
|
|
|
632
651
|
asset: string,
|
|
633
652
|
amount: BigNumber | string,
|
|
634
653
|
options: any = null,
|
|
635
|
-
|
|
654
|
+
sdkOptions: SDKOptions = {
|
|
655
|
+
estimateGas: false
|
|
656
|
+
}
|
|
636
657
|
): Promise<any> {
|
|
637
658
|
const iMiniChefV2 = new ethers.utils.Interface(IMiniChefV2.abi);
|
|
638
659
|
const poolId = await this.utils.getLpPoolId(dapp, asset);
|
|
@@ -644,7 +665,7 @@ export class Pool {
|
|
|
644
665
|
const tx = await getPoolTxOrGasEstimate(
|
|
645
666
|
this,
|
|
646
667
|
[stakingAddress[this.network][dapp], unStakeTxData, options],
|
|
647
|
-
|
|
668
|
+
sdkOptions
|
|
648
669
|
);
|
|
649
670
|
return tx;
|
|
650
671
|
}
|
|
@@ -654,14 +675,16 @@ export class Pool {
|
|
|
654
675
|
* @param {string} gauge Gauge contract address
|
|
655
676
|
* @param {BigNumber | string} amount Amount of liquidity pool tokens or CL token ID
|
|
656
677
|
* @param {any} options Transaction options
|
|
657
|
-
* @param {
|
|
678
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
658
679
|
* @returns {Promise<any>} Transaction
|
|
659
680
|
*/
|
|
660
681
|
async unstakeFromGauge(
|
|
661
682
|
gauge: string,
|
|
662
683
|
amount: BigNumber | string,
|
|
663
684
|
options: any = null,
|
|
664
|
-
|
|
685
|
+
sdkOptions: SDKOptions = {
|
|
686
|
+
estimateGas: false
|
|
687
|
+
}
|
|
665
688
|
): Promise<any> {
|
|
666
689
|
let unstakeTxData;
|
|
667
690
|
const rewardsGauge = new ethers.utils.Interface(IBalancerRewardsGauge.abi);
|
|
@@ -678,7 +701,7 @@ export class Pool {
|
|
|
678
701
|
const tx = await getPoolTxOrGasEstimate(
|
|
679
702
|
this,
|
|
680
703
|
[gauge, unstakeTxData, options],
|
|
681
|
-
|
|
704
|
+
sdkOptions
|
|
682
705
|
);
|
|
683
706
|
return tx;
|
|
684
707
|
}
|
|
@@ -690,7 +713,7 @@ export class Pool {
|
|
|
690
713
|
* @param {BigNumber | string} amount Amount of asset to lend
|
|
691
714
|
* @param {number} referralCode Code from Aave referral program
|
|
692
715
|
* @param {any} options Transaction options
|
|
693
|
-
* @param {
|
|
716
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
694
717
|
* @returns {Promise<any>} Transaction
|
|
695
718
|
*/
|
|
696
719
|
async lend(
|
|
@@ -699,7 +722,9 @@ export class Pool {
|
|
|
699
722
|
amount: BigNumber | string,
|
|
700
723
|
referralCode = 0,
|
|
701
724
|
options: any = null,
|
|
702
|
-
|
|
725
|
+
sdkOptions: SDKOptions = {
|
|
726
|
+
estimateGas: false
|
|
727
|
+
}
|
|
703
728
|
): Promise<any> {
|
|
704
729
|
const iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
|
|
705
730
|
const depositTxData = iLendingPool.encodeFunctionData(Transaction.DEPOSIT, [
|
|
@@ -712,7 +737,7 @@ export class Pool {
|
|
|
712
737
|
const tx = await getPoolTxOrGasEstimate(
|
|
713
738
|
this,
|
|
714
739
|
[routerAddress[this.network][dapp], depositTxData, options],
|
|
715
|
-
|
|
740
|
+
sdkOptions
|
|
716
741
|
);
|
|
717
742
|
return tx;
|
|
718
743
|
}
|
|
@@ -723,7 +748,7 @@ export class Pool {
|
|
|
723
748
|
* @param {string} asset Asset
|
|
724
749
|
* @param {BigNumber | string} amount Amount of asset to lend
|
|
725
750
|
* @param {any} options Transaction options
|
|
726
|
-
* @param {
|
|
751
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
727
752
|
* @returns {Promise<any>} Transaction
|
|
728
753
|
*/
|
|
729
754
|
async lendCompoundV3(
|
|
@@ -731,7 +756,9 @@ export class Pool {
|
|
|
731
756
|
asset: string,
|
|
732
757
|
amount: BigNumber | string,
|
|
733
758
|
options: any = null,
|
|
734
|
-
|
|
759
|
+
sdkOptions: SDKOptions = {
|
|
760
|
+
estimateGas: false
|
|
761
|
+
}
|
|
735
762
|
): Promise<any> {
|
|
736
763
|
const supplyTxData = await getCompoundV3LendTxData(
|
|
737
764
|
this,
|
|
@@ -743,7 +770,7 @@ export class Pool {
|
|
|
743
770
|
const tx = await getPoolTxOrGasEstimate(
|
|
744
771
|
this,
|
|
745
772
|
[market, supplyTxData, options],
|
|
746
|
-
|
|
773
|
+
sdkOptions
|
|
747
774
|
);
|
|
748
775
|
return tx;
|
|
749
776
|
}
|
|
@@ -754,7 +781,7 @@ export class Pool {
|
|
|
754
781
|
* @param {string} asset Asset
|
|
755
782
|
* @param {BigNumber | string} amount Amount of asset to lend
|
|
756
783
|
* @param {any} options Transaction options
|
|
757
|
-
* @param {
|
|
784
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
758
785
|
* @returns {Promise<any>} Transaction
|
|
759
786
|
*/
|
|
760
787
|
async withdrawDeposit(
|
|
@@ -762,7 +789,9 @@ export class Pool {
|
|
|
762
789
|
asset: string,
|
|
763
790
|
amount: BigNumber | string,
|
|
764
791
|
options: any = null,
|
|
765
|
-
|
|
792
|
+
sdkOptions: SDKOptions = {
|
|
793
|
+
estimateGas: false
|
|
794
|
+
}
|
|
766
795
|
): Promise<any> {
|
|
767
796
|
const iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
|
|
768
797
|
const withdrawTxData = iLendingPool.encodeFunctionData(
|
|
@@ -773,7 +802,7 @@ export class Pool {
|
|
|
773
802
|
const tx = await getPoolTxOrGasEstimate(
|
|
774
803
|
this,
|
|
775
804
|
[routerAddress[this.network][dapp], withdrawTxData, options],
|
|
776
|
-
|
|
805
|
+
sdkOptions
|
|
777
806
|
);
|
|
778
807
|
return tx;
|
|
779
808
|
}
|
|
@@ -784,7 +813,7 @@ export class Pool {
|
|
|
784
813
|
* @param {string} asset Asset
|
|
785
814
|
* @param {BigNumber | string} amount Amount of asset to withdraw
|
|
786
815
|
* @param {any} options Transaction options
|
|
787
|
-
* @param {
|
|
816
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
788
817
|
* @returns {Promise<any>} Transaction
|
|
789
818
|
*/
|
|
790
819
|
async withdrawCompoundV3(
|
|
@@ -792,7 +821,9 @@ export class Pool {
|
|
|
792
821
|
asset: string,
|
|
793
822
|
amount: BigNumber | string,
|
|
794
823
|
options: any = null,
|
|
795
|
-
|
|
824
|
+
sdkOptions: SDKOptions = {
|
|
825
|
+
estimateGas: false
|
|
826
|
+
}
|
|
796
827
|
): Promise<any> {
|
|
797
828
|
const withdrawTxData = await getCompoundV3WithdrawTxData(
|
|
798
829
|
this,
|
|
@@ -804,7 +835,7 @@ export class Pool {
|
|
|
804
835
|
const tx = await getPoolTxOrGasEstimate(
|
|
805
836
|
this,
|
|
806
837
|
[market, withdrawTxData, options],
|
|
807
|
-
|
|
838
|
+
sdkOptions
|
|
808
839
|
);
|
|
809
840
|
return tx;
|
|
810
841
|
}
|
|
@@ -816,7 +847,7 @@ export class Pool {
|
|
|
816
847
|
* @param {BigNumber | string} amount Amount of asset to lend
|
|
817
848
|
* @param {number} referralCode Code from Aave referral program
|
|
818
849
|
* @param {any} options Transaction options
|
|
819
|
-
* @param {
|
|
850
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
820
851
|
* @returns {Promise<any>} Transaction
|
|
821
852
|
*/
|
|
822
853
|
async borrow(
|
|
@@ -825,7 +856,9 @@ export class Pool {
|
|
|
825
856
|
amount: BigNumber | string,
|
|
826
857
|
referralCode = 0,
|
|
827
858
|
options: any = null,
|
|
828
|
-
|
|
859
|
+
sdkOptions: SDKOptions = {
|
|
860
|
+
estimateGas: false
|
|
861
|
+
}
|
|
829
862
|
): Promise<any> {
|
|
830
863
|
const iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
|
|
831
864
|
const borrowTxData = iLendingPool.encodeFunctionData(Transaction.BORROW, [
|
|
@@ -838,7 +871,7 @@ export class Pool {
|
|
|
838
871
|
const tx = await getPoolTxOrGasEstimate(
|
|
839
872
|
this,
|
|
840
873
|
[routerAddress[this.network][dapp], borrowTxData, options],
|
|
841
|
-
|
|
874
|
+
sdkOptions
|
|
842
875
|
);
|
|
843
876
|
return tx;
|
|
844
877
|
}
|
|
@@ -849,7 +882,7 @@ export class Pool {
|
|
|
849
882
|
* @param {string} asset Asset
|
|
850
883
|
* @param {BigNumber | string} amount Amount of asset to lend
|
|
851
884
|
* @param {any} options Transaction options
|
|
852
|
-
* @param {
|
|
885
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
853
886
|
* @returns {Promise<any>} Transaction
|
|
854
887
|
*/
|
|
855
888
|
async repay(
|
|
@@ -857,7 +890,9 @@ export class Pool {
|
|
|
857
890
|
asset: string,
|
|
858
891
|
amount: BigNumber | string,
|
|
859
892
|
options: any = null,
|
|
860
|
-
|
|
893
|
+
sdkOptions: SDKOptions = {
|
|
894
|
+
estimateGas: false
|
|
895
|
+
}
|
|
861
896
|
): Promise<any> {
|
|
862
897
|
const iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
|
|
863
898
|
const repayTxData = iLendingPool.encodeFunctionData(Transaction.REPAY, [
|
|
@@ -869,7 +904,7 @@ export class Pool {
|
|
|
869
904
|
const tx = await getPoolTxOrGasEstimate(
|
|
870
905
|
this,
|
|
871
906
|
[routerAddress[this.network][dapp], repayTxData, options],
|
|
872
|
-
|
|
907
|
+
sdkOptions
|
|
873
908
|
);
|
|
874
909
|
return tx;
|
|
875
910
|
}
|
|
@@ -879,14 +914,16 @@ export class Pool {
|
|
|
879
914
|
* @param {Dapp} dapp Platform like Sushiswap or Uniswap
|
|
880
915
|
* @param {string} asset Liquidity pool token
|
|
881
916
|
* @param {any} options Transaction option
|
|
882
|
-
* @param {
|
|
917
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
883
918
|
* @returns {Promise<any>} Transaction
|
|
884
919
|
*/
|
|
885
920
|
async harvestRewards(
|
|
886
921
|
dapp: Dapp,
|
|
887
922
|
asset: string,
|
|
888
923
|
options: any = null,
|
|
889
|
-
|
|
924
|
+
sdkOptions: SDKOptions = {
|
|
925
|
+
estimateGas: false
|
|
926
|
+
}
|
|
890
927
|
): Promise<any> {
|
|
891
928
|
const iMiniChefV2 = new ethers.utils.Interface(IMiniChefV2.abi);
|
|
892
929
|
const poolId = await this.utils.getLpPoolId(dapp, asset);
|
|
@@ -897,7 +934,7 @@ export class Pool {
|
|
|
897
934
|
const tx = await getPoolTxOrGasEstimate(
|
|
898
935
|
this,
|
|
899
936
|
[stakingAddress[this.network][dapp], harvestTxData, options],
|
|
900
|
-
|
|
937
|
+
sdkOptions
|
|
901
938
|
);
|
|
902
939
|
return tx;
|
|
903
940
|
}
|
|
@@ -962,7 +999,7 @@ export class Pool {
|
|
|
962
999
|
* @param {string[] | } assetsIn Array of balancer pool assets
|
|
963
1000
|
* @param {BigNumber[] | string[]} amountsIn Array of maximum amounts to provide to pool
|
|
964
1001
|
* @param {any} options Transaction options
|
|
965
|
-
* @param {
|
|
1002
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
966
1003
|
* @returns {Promise<any>} Transaction
|
|
967
1004
|
*/
|
|
968
1005
|
async joinBalancerPool(
|
|
@@ -970,7 +1007,9 @@ export class Pool {
|
|
|
970
1007
|
assets: string[],
|
|
971
1008
|
amountsIn: string[] | BigNumber[],
|
|
972
1009
|
options: any = null,
|
|
973
|
-
|
|
1010
|
+
sdkOptions: SDKOptions = {
|
|
1011
|
+
estimateGas: false
|
|
1012
|
+
}
|
|
974
1013
|
): Promise<any> {
|
|
975
1014
|
const joinPoolTxData = this.utils.getBalancerJoinPoolTx(
|
|
976
1015
|
this,
|
|
@@ -981,7 +1020,7 @@ export class Pool {
|
|
|
981
1020
|
const tx = await getPoolTxOrGasEstimate(
|
|
982
1021
|
this,
|
|
983
1022
|
[routerAddress[this.network][Dapp.BALANCER], joinPoolTxData, options],
|
|
984
|
-
|
|
1023
|
+
sdkOptions
|
|
985
1024
|
);
|
|
986
1025
|
return tx;
|
|
987
1026
|
}
|
|
@@ -993,7 +1032,7 @@ export class Pool {
|
|
|
993
1032
|
* @param {BigNumber | string } amount Amount of pool tokens to withdraw
|
|
994
1033
|
* @param { null | number } singleExitAssetIndex Index of asset to withdraw to
|
|
995
1034
|
* @param {any} options Transaction options
|
|
996
|
-
* @param {
|
|
1035
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
997
1036
|
* @returns {Promise<any>} Transaction
|
|
998
1037
|
*/
|
|
999
1038
|
async exitBalancerPool(
|
|
@@ -1002,7 +1041,9 @@ export class Pool {
|
|
|
1002
1041
|
amount: string | BigNumber,
|
|
1003
1042
|
singleExitAssetIndex: number | null = null,
|
|
1004
1043
|
options: any = null,
|
|
1005
|
-
|
|
1044
|
+
sdkOptions: SDKOptions = {
|
|
1045
|
+
estimateGas: false
|
|
1046
|
+
}
|
|
1006
1047
|
): Promise<any> {
|
|
1007
1048
|
const exitPoolTxData = this.utils.getBalancerExitPoolTx(
|
|
1008
1049
|
this,
|
|
@@ -1014,7 +1055,7 @@ export class Pool {
|
|
|
1014
1055
|
const tx = await getPoolTxOrGasEstimate(
|
|
1015
1056
|
this,
|
|
1016
1057
|
[routerAddress[this.network][Dapp.BALANCER], exitPoolTxData, options],
|
|
1017
|
-
|
|
1058
|
+
sdkOptions
|
|
1018
1059
|
);
|
|
1019
1060
|
return tx;
|
|
1020
1061
|
}
|
|
@@ -1023,13 +1064,15 @@ export class Pool {
|
|
|
1023
1064
|
* Claim rewards from Aave platform
|
|
1024
1065
|
* @param {string[]} assets Aave tokens (deposit/debt) hold by pool
|
|
1025
1066
|
* @param {any} options Transaction options
|
|
1026
|
-
* @param {
|
|
1067
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1027
1068
|
* @returns {Promise<any>} Transaction
|
|
1028
1069
|
*/
|
|
1029
1070
|
async harvestAaveRewards(
|
|
1030
1071
|
assets: string[],
|
|
1031
1072
|
options: any = null,
|
|
1032
|
-
|
|
1073
|
+
sdkOptions: SDKOptions = {
|
|
1074
|
+
estimateGas: false
|
|
1075
|
+
}
|
|
1033
1076
|
): Promise<any> {
|
|
1034
1077
|
const aaveIncentivesAddress = stakingAddress[this.network][
|
|
1035
1078
|
Dapp.AAVE
|
|
@@ -1052,7 +1095,7 @@ export class Pool {
|
|
|
1052
1095
|
const tx = await getPoolTxOrGasEstimate(
|
|
1053
1096
|
this,
|
|
1054
1097
|
[aaveIncentivesAddress, claimTxData, options],
|
|
1055
|
-
|
|
1098
|
+
sdkOptions
|
|
1056
1099
|
);
|
|
1057
1100
|
return tx;
|
|
1058
1101
|
}
|
|
@@ -1062,14 +1105,16 @@ export class Pool {
|
|
|
1062
1105
|
* @param {string[]} assets Assets invested in Aave
|
|
1063
1106
|
* @param {string} rewardAssets Reward token address
|
|
1064
1107
|
* @param {any} options Transaction options
|
|
1065
|
-
* @param {
|
|
1108
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1066
1109
|
* @returns {Promise<any>} Transaction
|
|
1067
1110
|
*/
|
|
1068
1111
|
async harvestAaveV3Rewards(
|
|
1069
1112
|
assets: string[],
|
|
1070
1113
|
rewardAsset: string,
|
|
1071
1114
|
options: any = null,
|
|
1072
|
-
|
|
1115
|
+
sdkOptions: SDKOptions = {
|
|
1116
|
+
estimateGas: false
|
|
1117
|
+
}
|
|
1073
1118
|
): Promise<any> {
|
|
1074
1119
|
const claimTxData = await getAaveV3ClaimTxData(this, assets, rewardAsset);
|
|
1075
1120
|
const tx = await getPoolTxOrGasEstimate(
|
|
@@ -1079,7 +1124,7 @@ export class Pool {
|
|
|
1079
1124
|
claimTxData,
|
|
1080
1125
|
options
|
|
1081
1126
|
],
|
|
1082
|
-
|
|
1127
|
+
sdkOptions
|
|
1083
1128
|
);
|
|
1084
1129
|
return tx;
|
|
1085
1130
|
}
|
|
@@ -1088,13 +1133,15 @@ export class Pool {
|
|
|
1088
1133
|
* Claim rewards from CompoundV3
|
|
1089
1134
|
* @param {string} asset Compound lending asset
|
|
1090
1135
|
* @param {any} options Transaction options
|
|
1091
|
-
* @param {
|
|
1136
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1092
1137
|
* @returns {Promise<any>} Transaction
|
|
1093
1138
|
*/
|
|
1094
1139
|
async harvestCompoundV3Rewards(
|
|
1095
1140
|
asset: string,
|
|
1096
1141
|
options: any = null,
|
|
1097
|
-
|
|
1142
|
+
sdkOptions: SDKOptions = {
|
|
1143
|
+
estimateGas: false
|
|
1144
|
+
}
|
|
1098
1145
|
): Promise<any> {
|
|
1099
1146
|
const claimTxData = await getCompoundV3ClaimTxData(this, asset);
|
|
1100
1147
|
const tx = await getPoolTxOrGasEstimate(
|
|
@@ -1104,7 +1151,7 @@ export class Pool {
|
|
|
1104
1151
|
claimTxData,
|
|
1105
1152
|
options
|
|
1106
1153
|
],
|
|
1107
|
-
|
|
1154
|
+
sdkOptions
|
|
1108
1155
|
);
|
|
1109
1156
|
return tx;
|
|
1110
1157
|
}
|
|
@@ -1122,7 +1169,7 @@ export class Pool {
|
|
|
1122
1169
|
* @param { number } maxTick Upper tick range
|
|
1123
1170
|
* @param { number } feeAmountOrTickSpacing Fee tier UniswapV3 or tick spacing VelodromeCL
|
|
1124
1171
|
* @param {any} options Transaction options
|
|
1125
|
-
* @param {
|
|
1172
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1126
1173
|
* @returns {Promise<any>} Transaction
|
|
1127
1174
|
*/
|
|
1128
1175
|
async addLiquidityUniswapV3(
|
|
@@ -1142,7 +1189,9 @@ export class Pool {
|
|
|
1142
1189
|
maxTick: number | null,
|
|
1143
1190
|
feeAmountOrTickSpacing: number,
|
|
1144
1191
|
options: any = null,
|
|
1145
|
-
|
|
1192
|
+
sdkOptions: SDKOptions = {
|
|
1193
|
+
estimateGas: false
|
|
1194
|
+
}
|
|
1146
1195
|
): Promise<any> {
|
|
1147
1196
|
if (
|
|
1148
1197
|
(minPrice === null || maxPrice === null) &&
|
|
@@ -1173,7 +1222,7 @@ export class Pool {
|
|
|
1173
1222
|
mintTxData,
|
|
1174
1223
|
options
|
|
1175
1224
|
],
|
|
1176
|
-
|
|
1225
|
+
sdkOptions
|
|
1177
1226
|
);
|
|
1178
1227
|
return tx;
|
|
1179
1228
|
}
|
|
@@ -1184,7 +1233,7 @@ export class Pool {
|
|
|
1184
1233
|
* @param {string} tokenId Token Id of UniswapV3 position
|
|
1185
1234
|
* @param {number} amount Amount in percent of assets to be removed
|
|
1186
1235
|
* @param {any} options Transaction options
|
|
1187
|
-
* @param {
|
|
1236
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1188
1237
|
* @returns {Promise<any>} Transaction
|
|
1189
1238
|
*/
|
|
1190
1239
|
async decreaseLiquidity(
|
|
@@ -1192,7 +1241,9 @@ export class Pool {
|
|
|
1192
1241
|
tokenId: string,
|
|
1193
1242
|
amount = 100,
|
|
1194
1243
|
options: any = null,
|
|
1195
|
-
|
|
1244
|
+
sdkOptions: SDKOptions = {
|
|
1245
|
+
estimateGas: false
|
|
1246
|
+
}
|
|
1196
1247
|
): Promise<any> {
|
|
1197
1248
|
let dappAddress;
|
|
1198
1249
|
let isStaked = false;
|
|
@@ -1236,7 +1287,7 @@ export class Pool {
|
|
|
1236
1287
|
const tx = await getPoolTxOrGasEstimate(
|
|
1237
1288
|
this,
|
|
1238
1289
|
[dappAddress, txData, options],
|
|
1239
|
-
|
|
1290
|
+
sdkOptions
|
|
1240
1291
|
);
|
|
1241
1292
|
return tx;
|
|
1242
1293
|
}
|
|
@@ -1248,7 +1299,7 @@ export class Pool {
|
|
|
1248
1299
|
* @param {BigNumber | string} amountA Amount first asset
|
|
1249
1300
|
* @param {BigNumber | string} amountB Amount second asset
|
|
1250
1301
|
* @param {any} options Transaction options
|
|
1251
|
-
* @param {
|
|
1302
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1252
1303
|
* @returns {Promise<any>} Transaction
|
|
1253
1304
|
*/
|
|
1254
1305
|
async increaseLiquidity(
|
|
@@ -1257,7 +1308,9 @@ export class Pool {
|
|
|
1257
1308
|
amountA: BigNumber | string,
|
|
1258
1309
|
amountB: BigNumber | string,
|
|
1259
1310
|
options: any = null,
|
|
1260
|
-
|
|
1311
|
+
sdkOptions: SDKOptions = {
|
|
1312
|
+
estimateGas: false
|
|
1313
|
+
}
|
|
1261
1314
|
): Promise<any> {
|
|
1262
1315
|
let dappAddress;
|
|
1263
1316
|
let isStaked = false;
|
|
@@ -1302,7 +1355,7 @@ export class Pool {
|
|
|
1302
1355
|
const tx = await getPoolTxOrGasEstimate(
|
|
1303
1356
|
this,
|
|
1304
1357
|
[dappAddress, txData, options],
|
|
1305
|
-
|
|
1358
|
+
sdkOptions
|
|
1306
1359
|
);
|
|
1307
1360
|
return tx;
|
|
1308
1361
|
}
|
|
@@ -1312,14 +1365,16 @@ export class Pool {
|
|
|
1312
1365
|
* @param {Dapp} dapp Platform either UniswapV3 or Arrakis
|
|
1313
1366
|
* @param {string} tokenId Token Id of UniswapV3 or Gauge address
|
|
1314
1367
|
* @param {any} options Transaction option
|
|
1315
|
-
* @param {
|
|
1368
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1316
1369
|
* @returns {Promise<any>} Transaction
|
|
1317
1370
|
*/
|
|
1318
1371
|
async claimFees(
|
|
1319
1372
|
dapp: Dapp,
|
|
1320
1373
|
tokenId: string,
|
|
1321
1374
|
options: any = null,
|
|
1322
|
-
|
|
1375
|
+
sdkOptions: SDKOptions = {
|
|
1376
|
+
estimateGas: false
|
|
1377
|
+
}
|
|
1323
1378
|
): Promise<any> {
|
|
1324
1379
|
let txData;
|
|
1325
1380
|
let contractAddress;
|
|
@@ -1378,7 +1433,7 @@ export class Pool {
|
|
|
1378
1433
|
const tx = await getPoolTxOrGasEstimate(
|
|
1379
1434
|
this,
|
|
1380
1435
|
[contractAddress, txData, options],
|
|
1381
|
-
|
|
1436
|
+
sdkOptions
|
|
1382
1437
|
);
|
|
1383
1438
|
return tx;
|
|
1384
1439
|
}
|
|
@@ -1389,7 +1444,7 @@ export class Pool {
|
|
|
1389
1444
|
* @param {string} tokenId Token Id
|
|
1390
1445
|
* @param {string[]} rewards Reward tokens
|
|
1391
1446
|
* @param {any} options Transaction option
|
|
1392
|
-
* @param {
|
|
1447
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1393
1448
|
* @returns {Promise<any>} Transaction
|
|
1394
1449
|
*/
|
|
1395
1450
|
async getRewards(
|
|
@@ -1397,7 +1452,9 @@ export class Pool {
|
|
|
1397
1452
|
tokenId: string,
|
|
1398
1453
|
rewards: string[],
|
|
1399
1454
|
options: any = null,
|
|
1400
|
-
|
|
1455
|
+
sdkOptions: SDKOptions = {
|
|
1456
|
+
estimateGas: false
|
|
1457
|
+
}
|
|
1401
1458
|
): Promise<any> {
|
|
1402
1459
|
const tx = await getPoolTxOrGasEstimate(
|
|
1403
1460
|
this,
|
|
@@ -1406,7 +1463,7 @@ export class Pool {
|
|
|
1406
1463
|
getRewardsTxDta(tokenId, rewards),
|
|
1407
1464
|
options
|
|
1408
1465
|
],
|
|
1409
|
-
|
|
1466
|
+
sdkOptions
|
|
1410
1467
|
);
|
|
1411
1468
|
return tx;
|
|
1412
1469
|
}
|
|
@@ -1420,7 +1477,7 @@ export class Pool {
|
|
|
1420
1477
|
* @param { FeeAmount } feeAmount Fee tier (Low 0.05%, Medium 0.3%, High 1%)
|
|
1421
1478
|
* @param {number} slippage Slippage tolerance in %
|
|
1422
1479
|
* @param {any} options Transaction options
|
|
1423
|
-
* @param {
|
|
1480
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1424
1481
|
* @returns {Promise<any>} Transaction
|
|
1425
1482
|
*/
|
|
1426
1483
|
async tradeUniswapV3(
|
|
@@ -1430,7 +1487,9 @@ export class Pool {
|
|
|
1430
1487
|
feeAmount: number,
|
|
1431
1488
|
slippage = 0.5,
|
|
1432
1489
|
options: any = null,
|
|
1433
|
-
|
|
1490
|
+
sdkOptions: SDKOptions = {
|
|
1491
|
+
estimateGas: false
|
|
1492
|
+
}
|
|
1434
1493
|
): Promise<any> {
|
|
1435
1494
|
const swapxData = await getUniswapV3SwapTxData(
|
|
1436
1495
|
this,
|
|
@@ -1443,7 +1502,7 @@ export class Pool {
|
|
|
1443
1502
|
const tx = await getPoolTxOrGasEstimate(
|
|
1444
1503
|
this,
|
|
1445
1504
|
[routerAddress[this.network][Dapp.UNISWAPV3], swapxData, options],
|
|
1446
|
-
|
|
1505
|
+
sdkOptions
|
|
1447
1506
|
);
|
|
1448
1507
|
return tx;
|
|
1449
1508
|
}
|
|
@@ -1456,7 +1515,7 @@ export class Pool {
|
|
|
1456
1515
|
* @param {BigNumber | string} amountB Amount second asset
|
|
1457
1516
|
* @param { boolean } isStable Is stable pool
|
|
1458
1517
|
* @param {any} options Transaction options
|
|
1459
|
-
* @param {
|
|
1518
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1460
1519
|
* @returns {Promise<any>} Transaction
|
|
1461
1520
|
*/
|
|
1462
1521
|
async addLiquidityVelodrome(
|
|
@@ -1466,7 +1525,9 @@ export class Pool {
|
|
|
1466
1525
|
amountB: BigNumber | string,
|
|
1467
1526
|
isStable: boolean,
|
|
1468
1527
|
options: any = null,
|
|
1469
|
-
|
|
1528
|
+
sdkOptions: SDKOptions = {
|
|
1529
|
+
estimateGas: false
|
|
1530
|
+
}
|
|
1470
1531
|
): Promise<any> {
|
|
1471
1532
|
const tx = await getPoolTxOrGasEstimate(
|
|
1472
1533
|
this,
|
|
@@ -1482,7 +1543,7 @@ export class Pool {
|
|
|
1482
1543
|
),
|
|
1483
1544
|
options
|
|
1484
1545
|
],
|
|
1485
|
-
|
|
1546
|
+
sdkOptions
|
|
1486
1547
|
);
|
|
1487
1548
|
return tx;
|
|
1488
1549
|
}
|
|
@@ -1494,7 +1555,7 @@ export class Pool {
|
|
|
1494
1555
|
* @param {BigNumber | string} amount Amount of LP tokens
|
|
1495
1556
|
* @param { boolean } isStable Is stable pool
|
|
1496
1557
|
* @param {any} options Transaction options
|
|
1497
|
-
* @param {
|
|
1558
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1498
1559
|
* @returns {Promise<any>} Transaction
|
|
1499
1560
|
*/
|
|
1500
1561
|
async removeLiquidityVelodrome(
|
|
@@ -1503,7 +1564,9 @@ export class Pool {
|
|
|
1503
1564
|
amount: BigNumber | string,
|
|
1504
1565
|
isStable: boolean,
|
|
1505
1566
|
options: any = null,
|
|
1506
|
-
|
|
1567
|
+
sdkOptions: SDKOptions = {
|
|
1568
|
+
estimateGas: false
|
|
1569
|
+
}
|
|
1507
1570
|
): Promise<any> {
|
|
1508
1571
|
const tx = await getPoolTxOrGasEstimate(
|
|
1509
1572
|
this,
|
|
@@ -1518,7 +1581,7 @@ export class Pool {
|
|
|
1518
1581
|
),
|
|
1519
1582
|
options
|
|
1520
1583
|
],
|
|
1521
|
-
|
|
1584
|
+
sdkOptions
|
|
1522
1585
|
);
|
|
1523
1586
|
return tx;
|
|
1524
1587
|
}
|
|
@@ -1531,7 +1594,7 @@ export class Pool {
|
|
|
1531
1594
|
* @param {BigNumber | string} amountB Amount second asset
|
|
1532
1595
|
* @param { boolean } isStable Is stable pool
|
|
1533
1596
|
* @param {any} options Transaction options
|
|
1534
|
-
* @param {
|
|
1597
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1535
1598
|
* @returns {Promise<any>} Transaction
|
|
1536
1599
|
*/
|
|
1537
1600
|
async addLiquidityVelodromeV2(
|
|
@@ -1541,7 +1604,9 @@ export class Pool {
|
|
|
1541
1604
|
amountB: BigNumber | string,
|
|
1542
1605
|
isStable: boolean,
|
|
1543
1606
|
options: any = null,
|
|
1544
|
-
|
|
1607
|
+
sdkOptions: SDKOptions = {
|
|
1608
|
+
estimateGas: false
|
|
1609
|
+
}
|
|
1545
1610
|
): Promise<any> {
|
|
1546
1611
|
const tx = await getPoolTxOrGasEstimate(
|
|
1547
1612
|
this,
|
|
@@ -1557,7 +1622,7 @@ export class Pool {
|
|
|
1557
1622
|
),
|
|
1558
1623
|
options
|
|
1559
1624
|
],
|
|
1560
|
-
|
|
1625
|
+
sdkOptions
|
|
1561
1626
|
);
|
|
1562
1627
|
return tx;
|
|
1563
1628
|
}
|
|
@@ -1569,7 +1634,7 @@ export class Pool {
|
|
|
1569
1634
|
* @param {BigNumber | string} amount Amount of LP tokens
|
|
1570
1635
|
* @param { boolean } isStable Is stable pool
|
|
1571
1636
|
* @param {any} options Transaction options
|
|
1572
|
-
* @param {
|
|
1637
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1573
1638
|
* @returns {Promise<any>} Transaction
|
|
1574
1639
|
*/
|
|
1575
1640
|
async removeLiquidityVelodromeV2(
|
|
@@ -1578,7 +1643,9 @@ export class Pool {
|
|
|
1578
1643
|
amount: BigNumber | string,
|
|
1579
1644
|
isStable: boolean,
|
|
1580
1645
|
options: any = null,
|
|
1581
|
-
|
|
1646
|
+
sdkOptions: SDKOptions = {
|
|
1647
|
+
estimateGas: false
|
|
1648
|
+
}
|
|
1582
1649
|
): Promise<any> {
|
|
1583
1650
|
const tx = await getPoolTxOrGasEstimate(
|
|
1584
1651
|
this,
|
|
@@ -1593,7 +1660,7 @@ export class Pool {
|
|
|
1593
1660
|
),
|
|
1594
1661
|
options
|
|
1595
1662
|
],
|
|
1596
|
-
|
|
1663
|
+
sdkOptions
|
|
1597
1664
|
);
|
|
1598
1665
|
return tx;
|
|
1599
1666
|
}
|
|
@@ -1607,7 +1674,7 @@ export class Pool {
|
|
|
1607
1674
|
* @param {BigNumber | string} amountB Amount second asset
|
|
1608
1675
|
* @param { boolean } isStable Is stable pool
|
|
1609
1676
|
* @param {any} options Transaction options
|
|
1610
|
-
* @param {
|
|
1677
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1611
1678
|
* @returns {Promise<any>} Transaction
|
|
1612
1679
|
*/
|
|
1613
1680
|
async addLiquidityV2(
|
|
@@ -1618,7 +1685,9 @@ export class Pool {
|
|
|
1618
1685
|
amountB: BigNumber | string,
|
|
1619
1686
|
isStable: boolean,
|
|
1620
1687
|
options: any = null,
|
|
1621
|
-
|
|
1688
|
+
sdkOptions: SDKOptions = {
|
|
1689
|
+
estimateGas: false
|
|
1690
|
+
}
|
|
1622
1691
|
): Promise<any> {
|
|
1623
1692
|
const tx = await getPoolTxOrGasEstimate(
|
|
1624
1693
|
this,
|
|
@@ -1634,7 +1703,7 @@ export class Pool {
|
|
|
1634
1703
|
),
|
|
1635
1704
|
options
|
|
1636
1705
|
],
|
|
1637
|
-
|
|
1706
|
+
sdkOptions
|
|
1638
1707
|
);
|
|
1639
1708
|
return tx;
|
|
1640
1709
|
}
|
|
@@ -1647,7 +1716,7 @@ export class Pool {
|
|
|
1647
1716
|
* @param {BigNumber | string} amount Amount of LP tokens
|
|
1648
1717
|
* @param { boolean } isStable Is stable pool
|
|
1649
1718
|
* @param {any} options Transaction options
|
|
1650
|
-
* @param {
|
|
1719
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1651
1720
|
* @returns {Promise<any>} Transaction
|
|
1652
1721
|
*/
|
|
1653
1722
|
async removeLiquidityV2(
|
|
@@ -1657,7 +1726,9 @@ export class Pool {
|
|
|
1657
1726
|
amount: BigNumber | string,
|
|
1658
1727
|
isStable: boolean,
|
|
1659
1728
|
options: any = null,
|
|
1660
|
-
|
|
1729
|
+
sdkOptions: SDKOptions = {
|
|
1730
|
+
estimateGas: false
|
|
1731
|
+
}
|
|
1661
1732
|
): Promise<any> {
|
|
1662
1733
|
const tx = await getPoolTxOrGasEstimate(
|
|
1663
1734
|
this,
|
|
@@ -1672,7 +1743,7 @@ export class Pool {
|
|
|
1672
1743
|
),
|
|
1673
1744
|
options
|
|
1674
1745
|
],
|
|
1675
|
-
|
|
1746
|
+
sdkOptions
|
|
1676
1747
|
);
|
|
1677
1748
|
return tx;
|
|
1678
1749
|
}
|
|
@@ -1689,7 +1760,7 @@ export class Pool {
|
|
|
1689
1760
|
* @param {BigNumber | string } collateralChangeAmount Collateral amount to add when shorting options and to remove when covering shorts
|
|
1690
1761
|
* @param {boolean} isCoveredCall Selling covered call options
|
|
1691
1762
|
* @param {any} options Transaction options
|
|
1692
|
-
* @param {
|
|
1763
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1693
1764
|
* @returns {Promise<any>} Transaction
|
|
1694
1765
|
*/
|
|
1695
1766
|
async tradeLyraOption(
|
|
@@ -1703,7 +1774,9 @@ export class Pool {
|
|
|
1703
1774
|
collateralChangeAmount: BigNumber | string = "0",
|
|
1704
1775
|
isCoveredCall = false,
|
|
1705
1776
|
options: any = null,
|
|
1706
|
-
|
|
1777
|
+
sdkOptions: SDKOptions = {
|
|
1778
|
+
estimateGas: false
|
|
1779
|
+
}
|
|
1707
1780
|
): Promise<any> {
|
|
1708
1781
|
const swapxData = await getLyraOptionTxData(
|
|
1709
1782
|
this,
|
|
@@ -1720,7 +1793,7 @@ export class Pool {
|
|
|
1720
1793
|
const tx = await getPoolTxOrGasEstimate(
|
|
1721
1794
|
this,
|
|
1722
1795
|
[routerAddress[this.network][Dapp.LYRA], swapxData, options],
|
|
1723
|
-
|
|
1796
|
+
sdkOptions
|
|
1724
1797
|
);
|
|
1725
1798
|
return tx;
|
|
1726
1799
|
}
|
|
@@ -1738,19 +1811,21 @@ export class Pool {
|
|
|
1738
1811
|
* @param {string} market Address of futures market
|
|
1739
1812
|
* @param {BigNumber | string } changeAmount Amount to increase/decrease margin
|
|
1740
1813
|
* @param {any} options Transaction options
|
|
1741
|
-
* @param {
|
|
1814
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1742
1815
|
* @returns {Promise<any>} Transaction
|
|
1743
1816
|
*/
|
|
1744
1817
|
async changeFuturesMargin(
|
|
1745
1818
|
market: string,
|
|
1746
1819
|
changeAmount: BigNumber | string,
|
|
1747
1820
|
options: any = null,
|
|
1748
|
-
|
|
1821
|
+
sdkOptions: SDKOptions = {
|
|
1822
|
+
estimateGas: false
|
|
1823
|
+
}
|
|
1749
1824
|
): Promise<any> {
|
|
1750
1825
|
const tx = await getPoolTxOrGasEstimate(
|
|
1751
1826
|
this,
|
|
1752
1827
|
[market, getFuturesChangeMarginTxData(changeAmount), options],
|
|
1753
|
-
|
|
1828
|
+
sdkOptions
|
|
1754
1829
|
);
|
|
1755
1830
|
return tx;
|
|
1756
1831
|
}
|
|
@@ -1760,14 +1835,16 @@ export class Pool {
|
|
|
1760
1835
|
* @param {string} market Address of futures market
|
|
1761
1836
|
* @param {BigNumber | string } changeAmount Negative for short, positive for long
|
|
1762
1837
|
* @param {any} options Transaction options
|
|
1763
|
-
* @param {
|
|
1838
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1764
1839
|
* @returns {Promise<any>} Transaction
|
|
1765
1840
|
*/
|
|
1766
1841
|
async changeFuturesPosition(
|
|
1767
1842
|
market: string,
|
|
1768
1843
|
changeAmount: BigNumber | string,
|
|
1769
1844
|
options: any = null,
|
|
1770
|
-
|
|
1845
|
+
sdkOptions: SDKOptions = {
|
|
1846
|
+
estimateGas: false
|
|
1847
|
+
}
|
|
1771
1848
|
): Promise<any> {
|
|
1772
1849
|
const txData = await getFuturesChangePositionTxData(
|
|
1773
1850
|
changeAmount,
|
|
@@ -1777,7 +1854,7 @@ export class Pool {
|
|
|
1777
1854
|
const tx = await getPoolTxOrGasEstimate(
|
|
1778
1855
|
this,
|
|
1779
1856
|
[market, txData, options],
|
|
1780
|
-
|
|
1857
|
+
sdkOptions
|
|
1781
1858
|
);
|
|
1782
1859
|
return tx;
|
|
1783
1860
|
}
|
|
@@ -1786,19 +1863,21 @@ export class Pool {
|
|
|
1786
1863
|
*
|
|
1787
1864
|
* @param {string} market Address of futures market
|
|
1788
1865
|
* @param {any} options Transaction options
|
|
1789
|
-
* @param {
|
|
1866
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1790
1867
|
* @returns {Promise<any>} Transaction
|
|
1791
1868
|
*/
|
|
1792
1869
|
async cancelFuturesOrder(
|
|
1793
1870
|
market: string,
|
|
1794
1871
|
options: any = null,
|
|
1795
|
-
|
|
1872
|
+
sdkOptions: SDKOptions = {
|
|
1873
|
+
estimateGas: false
|
|
1874
|
+
}
|
|
1796
1875
|
): Promise<any> {
|
|
1797
1876
|
const txData = await getFuturesCancelOrderTxData(this);
|
|
1798
1877
|
const tx = await getPoolTxOrGasEstimate(
|
|
1799
1878
|
this,
|
|
1800
1879
|
[market, txData, options],
|
|
1801
|
-
|
|
1880
|
+
sdkOptions
|
|
1802
1881
|
);
|
|
1803
1882
|
return tx;
|
|
1804
1883
|
}
|
|
@@ -1831,20 +1910,22 @@ export class Pool {
|
|
|
1831
1910
|
* @param {string} tokenAddress Address of the token to vest
|
|
1832
1911
|
* @param {BigNumber | string } changeAmount Negative for short, positive for long
|
|
1833
1912
|
* @param {any} options Transaction options
|
|
1834
|
-
* @param {
|
|
1913
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1835
1914
|
* @returns {Promise<any>} Transaction
|
|
1836
1915
|
*/
|
|
1837
1916
|
async vestTokens(
|
|
1838
1917
|
tokenAddress: string,
|
|
1839
1918
|
amount: BigNumber | string,
|
|
1840
1919
|
options: any = null,
|
|
1841
|
-
|
|
1920
|
+
sdkOptions: SDKOptions = {
|
|
1921
|
+
estimateGas: false
|
|
1922
|
+
}
|
|
1842
1923
|
): Promise<any> {
|
|
1843
1924
|
const txData = await getCreateVestTxData(amount);
|
|
1844
1925
|
const tx = await getPoolTxOrGasEstimate(
|
|
1845
1926
|
this,
|
|
1846
1927
|
[tokenAddress, txData, options],
|
|
1847
|
-
|
|
1928
|
+
sdkOptions
|
|
1848
1929
|
);
|
|
1849
1930
|
return tx;
|
|
1850
1931
|
}
|
|
@@ -1854,20 +1935,22 @@ export class Pool {
|
|
|
1854
1935
|
* @param {string} tokenAddress Address of the token to vest
|
|
1855
1936
|
* @param {number } id position Id of the vested tokens
|
|
1856
1937
|
* @param {any} options Transaction options
|
|
1857
|
-
* @param {
|
|
1938
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1858
1939
|
* @returns {Promise<any>} Transaction
|
|
1859
1940
|
*/
|
|
1860
1941
|
async exitVestedToken(
|
|
1861
1942
|
tokenAddress: string,
|
|
1862
1943
|
id: number,
|
|
1863
1944
|
options: any = null,
|
|
1864
|
-
|
|
1945
|
+
sdkOptions: SDKOptions = {
|
|
1946
|
+
estimateGas: false
|
|
1947
|
+
}
|
|
1865
1948
|
): Promise<any> {
|
|
1866
1949
|
const txData = await getExitVestTxData(id);
|
|
1867
1950
|
const tx = await getPoolTxOrGasEstimate(
|
|
1868
1951
|
this,
|
|
1869
1952
|
[tokenAddress, txData, options],
|
|
1870
|
-
|
|
1953
|
+
sdkOptions
|
|
1871
1954
|
);
|
|
1872
1955
|
return tx;
|
|
1873
1956
|
}
|
|
@@ -1878,7 +1961,7 @@ export class Pool {
|
|
|
1878
1961
|
* @param { number } slippage slippage, 0.5 represents 0.5%
|
|
1879
1962
|
* @param { number | null } maxKeeperFeeInUsd 5 represents $5; null will skip the maxKeeperFee check
|
|
1880
1963
|
* @param {any} options Transaction options
|
|
1881
|
-
* @param {
|
|
1964
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1882
1965
|
* @returns {Promise<any>} Transaction
|
|
1883
1966
|
*/
|
|
1884
1967
|
async mintUnitViaFlatMoney(
|
|
@@ -1886,7 +1969,9 @@ export class Pool {
|
|
|
1886
1969
|
slippage = 0.5,
|
|
1887
1970
|
maxKeeperFeeInUsd: number | null,
|
|
1888
1971
|
options: any = null,
|
|
1889
|
-
|
|
1972
|
+
sdkOptions: SDKOptions = {
|
|
1973
|
+
estimateGas: false
|
|
1974
|
+
}
|
|
1890
1975
|
): Promise<any> {
|
|
1891
1976
|
const tx = await mintUnitViaFlatMoney(
|
|
1892
1977
|
this,
|
|
@@ -1894,7 +1979,7 @@ export class Pool {
|
|
|
1894
1979
|
slippage,
|
|
1895
1980
|
maxKeeperFeeInUsd,
|
|
1896
1981
|
options,
|
|
1897
|
-
|
|
1982
|
+
sdkOptions
|
|
1898
1983
|
);
|
|
1899
1984
|
return tx;
|
|
1900
1985
|
}
|
|
@@ -1905,7 +1990,7 @@ export class Pool {
|
|
|
1905
1990
|
* @param { number } slippage slippage, 0.5 represents 0.5%
|
|
1906
1991
|
* @param { number | null } maxKeeperFeeInUsd 5 represents $5; null will skip the maxKeeperFee check
|
|
1907
1992
|
* @param {any} options Transaction options
|
|
1908
|
-
* @param {
|
|
1993
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1909
1994
|
* @returns {Promise<any>} Transaction
|
|
1910
1995
|
*/
|
|
1911
1996
|
async redeemUnitViaFlatMoney(
|
|
@@ -1913,7 +1998,9 @@ export class Pool {
|
|
|
1913
1998
|
slippage = 0.5,
|
|
1914
1999
|
maxKeeperFeeInUsd: number | null,
|
|
1915
2000
|
options: any = null,
|
|
1916
|
-
|
|
2001
|
+
sdkOptions: SDKOptions = {
|
|
2002
|
+
estimateGas: false
|
|
2003
|
+
}
|
|
1917
2004
|
): Promise<any> {
|
|
1918
2005
|
const tx = await redeemUnitViaFlatMoney(
|
|
1919
2006
|
this,
|
|
@@ -1921,7 +2008,7 @@ export class Pool {
|
|
|
1921
2008
|
slippage,
|
|
1922
2009
|
maxKeeperFeeInUsd,
|
|
1923
2010
|
options,
|
|
1924
|
-
|
|
2011
|
+
sdkOptions
|
|
1925
2012
|
);
|
|
1926
2013
|
return tx;
|
|
1927
2014
|
}
|
|
@@ -1939,24 +2026,27 @@ export class Pool {
|
|
|
1939
2026
|
* @param {string} destinationToken Address of destination asset
|
|
1940
2027
|
* @param {number} slippage Slippage tolerance in %
|
|
1941
2028
|
* @param {any} options Transaction options
|
|
1942
|
-
* @param {
|
|
2029
|
+
* @param {SDKOptions} sdkOptions SDK options including estimateGas
|
|
1943
2030
|
* @returns {Promise<any>} Transaction
|
|
1944
2031
|
*/
|
|
1945
2032
|
async completeTorosWithdrawal(
|
|
1946
2033
|
destinationToken: string,
|
|
1947
2034
|
slippage = 0.5,
|
|
1948
2035
|
options: any = null,
|
|
1949
|
-
|
|
2036
|
+
sdkOptions: SDKOptions = {
|
|
2037
|
+
estimateGas: false
|
|
2038
|
+
}
|
|
1950
2039
|
): Promise<any> {
|
|
1951
2040
|
const txData = await getCompleteWithdrawalTxData(
|
|
1952
2041
|
this,
|
|
1953
2042
|
destinationToken,
|
|
1954
|
-
slippage
|
|
2043
|
+
slippage * 100,
|
|
2044
|
+
false
|
|
1955
2045
|
);
|
|
1956
2046
|
const tx = await getPoolTxOrGasEstimate(
|
|
1957
2047
|
this,
|
|
1958
2048
|
[routerAddress[this.network].toros, txData, options],
|
|
1959
|
-
|
|
2049
|
+
sdkOptions
|
|
1960
2050
|
);
|
|
1961
2051
|
return tx;
|
|
1962
2052
|
}
|