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