@dhedge/v2-sdk 2.0.0 → 2.0.2

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.
@@ -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,7 +378,9 @@ 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;
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
- estimateGas
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 {boolean} estimateGas Simulate/estimate gas
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
- estimateGas = false
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
- estimateGas
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 {boolean} estimateGas Simulate/estimate gas
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
- estimateGas = false
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
- estimateGas
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 {boolean} estimateGas Simulate/estimate gas
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
- estimateGas = false
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
- estimateGas
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 {boolean} estimateGas Simulate/estimate gas
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
- estimateGas = false
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
- estimateGas
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 {boolean} estimateGas Simulate/estimate gas
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
- estimateGas = false
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
- estimateGas
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 {boolean} estimateGas Simulate/estimate gas
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
- estimateGas = false
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
- estimateGas
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 {boolean} estimateGas Simulate/estimate gas
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
- estimateGas = false
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
- estimateGas
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 {boolean} estimateGas Simulate/estimate gas
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
- estimateGas = false
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
- estimateGas
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 {boolean} estimateGas Simulate/estimate gas
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
- estimateGas = false
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
- estimateGas
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 {boolean} estimateGas Simulate/estimate gas
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
- estimateGas = false
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
- estimateGas
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 {boolean} estimateGas Simulate/estimate gas
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
- estimateGas = false
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
- estimateGas
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 {boolean} estimateGas Simulate/estimate gas
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
- estimateGas = false
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
- estimateGas
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 {boolean} estimateGas Simulate/estimate gas
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
- estimateGas = false
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
- estimateGas
937
+ sdkOptions
901
938
  );
902
939
  return tx;
903
940
  }
@@ -956,13 +993,35 @@ export class Pool {
956
993
  return tx;
957
994
  }
958
995
 
996
+ /**
997
+ * Sets a pool private or public
998
+ * @param {boolean} _private True for private, false for public
999
+ * @param {any} options Transaction options
1000
+ * @param {boolean} estimateGas Simulate/estimate gas
1001
+ * @returns {Promise<any>} Transaction
1002
+ */
1003
+ async setPrivate(
1004
+ _private: boolean,
1005
+ options: any = null,
1006
+ estimateGas = false
1007
+ ): Promise<any> {
1008
+ if (estimateGas) {
1009
+ return await this.managerLogic.estimateGas.setPoolPrivate(
1010
+ _private,
1011
+ options
1012
+ );
1013
+ }
1014
+ const tx = await this.managerLogic.setPoolPrivate(_private, options);
1015
+ return tx;
1016
+ }
1017
+
959
1018
  /**
960
1019
  * Invest into a Balancer pool
961
1020
  * @param {string} poolId Balancer pool id
962
1021
  * @param {string[] | } assetsIn Array of balancer pool assets
963
1022
  * @param {BigNumber[] | string[]} amountsIn Array of maximum amounts to provide to pool
964
1023
  * @param {any} options Transaction options
965
- * @param {boolean} estimateGas Simulate/estimate gas
1024
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
966
1025
  * @returns {Promise<any>} Transaction
967
1026
  */
968
1027
  async joinBalancerPool(
@@ -970,7 +1029,9 @@ export class Pool {
970
1029
  assets: string[],
971
1030
  amountsIn: string[] | BigNumber[],
972
1031
  options: any = null,
973
- estimateGas = false
1032
+ sdkOptions: SDKOptions = {
1033
+ estimateGas: false
1034
+ }
974
1035
  ): Promise<any> {
975
1036
  const joinPoolTxData = this.utils.getBalancerJoinPoolTx(
976
1037
  this,
@@ -981,7 +1042,7 @@ export class Pool {
981
1042
  const tx = await getPoolTxOrGasEstimate(
982
1043
  this,
983
1044
  [routerAddress[this.network][Dapp.BALANCER], joinPoolTxData, options],
984
- estimateGas
1045
+ sdkOptions
985
1046
  );
986
1047
  return tx;
987
1048
  }
@@ -993,7 +1054,7 @@ export class Pool {
993
1054
  * @param {BigNumber | string } amount Amount of pool tokens to withdraw
994
1055
  * @param { null | number } singleExitAssetIndex Index of asset to withdraw to
995
1056
  * @param {any} options Transaction options
996
- * @param {boolean} estimateGas Simulate/estimate gas
1057
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
997
1058
  * @returns {Promise<any>} Transaction
998
1059
  */
999
1060
  async exitBalancerPool(
@@ -1002,7 +1063,9 @@ export class Pool {
1002
1063
  amount: string | BigNumber,
1003
1064
  singleExitAssetIndex: number | null = null,
1004
1065
  options: any = null,
1005
- estimateGas = false
1066
+ sdkOptions: SDKOptions = {
1067
+ estimateGas: false
1068
+ }
1006
1069
  ): Promise<any> {
1007
1070
  const exitPoolTxData = this.utils.getBalancerExitPoolTx(
1008
1071
  this,
@@ -1014,7 +1077,7 @@ export class Pool {
1014
1077
  const tx = await getPoolTxOrGasEstimate(
1015
1078
  this,
1016
1079
  [routerAddress[this.network][Dapp.BALANCER], exitPoolTxData, options],
1017
- estimateGas
1080
+ sdkOptions
1018
1081
  );
1019
1082
  return tx;
1020
1083
  }
@@ -1023,13 +1086,15 @@ export class Pool {
1023
1086
  * Claim rewards from Aave platform
1024
1087
  * @param {string[]} assets Aave tokens (deposit/debt) hold by pool
1025
1088
  * @param {any} options Transaction options
1026
- * @param {boolean} estimateGas Simulate/estimate gas
1089
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1027
1090
  * @returns {Promise<any>} Transaction
1028
1091
  */
1029
1092
  async harvestAaveRewards(
1030
1093
  assets: string[],
1031
1094
  options: any = null,
1032
- estimateGas = false
1095
+ sdkOptions: SDKOptions = {
1096
+ estimateGas: false
1097
+ }
1033
1098
  ): Promise<any> {
1034
1099
  const aaveIncentivesAddress = stakingAddress[this.network][
1035
1100
  Dapp.AAVE
@@ -1052,7 +1117,7 @@ export class Pool {
1052
1117
  const tx = await getPoolTxOrGasEstimate(
1053
1118
  this,
1054
1119
  [aaveIncentivesAddress, claimTxData, options],
1055
- estimateGas
1120
+ sdkOptions
1056
1121
  );
1057
1122
  return tx;
1058
1123
  }
@@ -1062,14 +1127,16 @@ export class Pool {
1062
1127
  * @param {string[]} assets Assets invested in Aave
1063
1128
  * @param {string} rewardAssets Reward token address
1064
1129
  * @param {any} options Transaction options
1065
- * @param {boolean} estimateGas Simulate/estimate gas
1130
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1066
1131
  * @returns {Promise<any>} Transaction
1067
1132
  */
1068
1133
  async harvestAaveV3Rewards(
1069
1134
  assets: string[],
1070
1135
  rewardAsset: string,
1071
1136
  options: any = null,
1072
- estimateGas = false
1137
+ sdkOptions: SDKOptions = {
1138
+ estimateGas: false
1139
+ }
1073
1140
  ): Promise<any> {
1074
1141
  const claimTxData = await getAaveV3ClaimTxData(this, assets, rewardAsset);
1075
1142
  const tx = await getPoolTxOrGasEstimate(
@@ -1079,7 +1146,7 @@ export class Pool {
1079
1146
  claimTxData,
1080
1147
  options
1081
1148
  ],
1082
- estimateGas
1149
+ sdkOptions
1083
1150
  );
1084
1151
  return tx;
1085
1152
  }
@@ -1088,13 +1155,15 @@ export class Pool {
1088
1155
  * Claim rewards from CompoundV3
1089
1156
  * @param {string} asset Compound lending asset
1090
1157
  * @param {any} options Transaction options
1091
- * @param {boolean} estimateGas Simulate/estimate gas
1158
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1092
1159
  * @returns {Promise<any>} Transaction
1093
1160
  */
1094
1161
  async harvestCompoundV3Rewards(
1095
1162
  asset: string,
1096
1163
  options: any = null,
1097
- estimateGas = false
1164
+ sdkOptions: SDKOptions = {
1165
+ estimateGas: false
1166
+ }
1098
1167
  ): Promise<any> {
1099
1168
  const claimTxData = await getCompoundV3ClaimTxData(this, asset);
1100
1169
  const tx = await getPoolTxOrGasEstimate(
@@ -1104,7 +1173,7 @@ export class Pool {
1104
1173
  claimTxData,
1105
1174
  options
1106
1175
  ],
1107
- estimateGas
1176
+ sdkOptions
1108
1177
  );
1109
1178
  return tx;
1110
1179
  }
@@ -1122,7 +1191,7 @@ export class Pool {
1122
1191
  * @param { number } maxTick Upper tick range
1123
1192
  * @param { number } feeAmountOrTickSpacing Fee tier UniswapV3 or tick spacing VelodromeCL
1124
1193
  * @param {any} options Transaction options
1125
- * @param {boolean} estimateGas Simulate/estimate gas
1194
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1126
1195
  * @returns {Promise<any>} Transaction
1127
1196
  */
1128
1197
  async addLiquidityUniswapV3(
@@ -1142,7 +1211,9 @@ export class Pool {
1142
1211
  maxTick: number | null,
1143
1212
  feeAmountOrTickSpacing: number,
1144
1213
  options: any = null,
1145
- estimateGas = false
1214
+ sdkOptions: SDKOptions = {
1215
+ estimateGas: false
1216
+ }
1146
1217
  ): Promise<any> {
1147
1218
  if (
1148
1219
  (minPrice === null || maxPrice === null) &&
@@ -1173,7 +1244,7 @@ export class Pool {
1173
1244
  mintTxData,
1174
1245
  options
1175
1246
  ],
1176
- estimateGas
1247
+ sdkOptions
1177
1248
  );
1178
1249
  return tx;
1179
1250
  }
@@ -1184,7 +1255,7 @@ export class Pool {
1184
1255
  * @param {string} tokenId Token Id of UniswapV3 position
1185
1256
  * @param {number} amount Amount in percent of assets to be removed
1186
1257
  * @param {any} options Transaction options
1187
- * @param {boolean} estimateGas Simulate/estimate gas
1258
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1188
1259
  * @returns {Promise<any>} Transaction
1189
1260
  */
1190
1261
  async decreaseLiquidity(
@@ -1192,7 +1263,9 @@ export class Pool {
1192
1263
  tokenId: string,
1193
1264
  amount = 100,
1194
1265
  options: any = null,
1195
- estimateGas = false
1266
+ sdkOptions: SDKOptions = {
1267
+ estimateGas: false
1268
+ }
1196
1269
  ): Promise<any> {
1197
1270
  let dappAddress;
1198
1271
  let isStaked = false;
@@ -1236,7 +1309,7 @@ export class Pool {
1236
1309
  const tx = await getPoolTxOrGasEstimate(
1237
1310
  this,
1238
1311
  [dappAddress, txData, options],
1239
- estimateGas
1312
+ sdkOptions
1240
1313
  );
1241
1314
  return tx;
1242
1315
  }
@@ -1248,7 +1321,7 @@ export class Pool {
1248
1321
  * @param {BigNumber | string} amountA Amount first asset
1249
1322
  * @param {BigNumber | string} amountB Amount second asset
1250
1323
  * @param {any} options Transaction options
1251
- * @param {boolean} estimateGas Simulate/estimate gas
1324
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1252
1325
  * @returns {Promise<any>} Transaction
1253
1326
  */
1254
1327
  async increaseLiquidity(
@@ -1257,7 +1330,9 @@ export class Pool {
1257
1330
  amountA: BigNumber | string,
1258
1331
  amountB: BigNumber | string,
1259
1332
  options: any = null,
1260
- estimateGas = false
1333
+ sdkOptions: SDKOptions = {
1334
+ estimateGas: false
1335
+ }
1261
1336
  ): Promise<any> {
1262
1337
  let dappAddress;
1263
1338
  let isStaked = false;
@@ -1302,7 +1377,7 @@ export class Pool {
1302
1377
  const tx = await getPoolTxOrGasEstimate(
1303
1378
  this,
1304
1379
  [dappAddress, txData, options],
1305
- estimateGas
1380
+ sdkOptions
1306
1381
  );
1307
1382
  return tx;
1308
1383
  }
@@ -1312,14 +1387,16 @@ export class Pool {
1312
1387
  * @param {Dapp} dapp Platform either UniswapV3 or Arrakis
1313
1388
  * @param {string} tokenId Token Id of UniswapV3 or Gauge address
1314
1389
  * @param {any} options Transaction option
1315
- * @param {boolean} estimateGas Simulate/estimate gas
1390
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1316
1391
  * @returns {Promise<any>} Transaction
1317
1392
  */
1318
1393
  async claimFees(
1319
1394
  dapp: Dapp,
1320
1395
  tokenId: string,
1321
1396
  options: any = null,
1322
- estimateGas = false
1397
+ sdkOptions: SDKOptions = {
1398
+ estimateGas: false
1399
+ }
1323
1400
  ): Promise<any> {
1324
1401
  let txData;
1325
1402
  let contractAddress;
@@ -1378,7 +1455,7 @@ export class Pool {
1378
1455
  const tx = await getPoolTxOrGasEstimate(
1379
1456
  this,
1380
1457
  [contractAddress, txData, options],
1381
- estimateGas
1458
+ sdkOptions
1382
1459
  );
1383
1460
  return tx;
1384
1461
  }
@@ -1389,7 +1466,7 @@ export class Pool {
1389
1466
  * @param {string} tokenId Token Id
1390
1467
  * @param {string[]} rewards Reward tokens
1391
1468
  * @param {any} options Transaction option
1392
- * @param {boolean} estimateGas Simulate/estimate gas
1469
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1393
1470
  * @returns {Promise<any>} Transaction
1394
1471
  */
1395
1472
  async getRewards(
@@ -1397,7 +1474,9 @@ export class Pool {
1397
1474
  tokenId: string,
1398
1475
  rewards: string[],
1399
1476
  options: any = null,
1400
- estimateGas = false
1477
+ sdkOptions: SDKOptions = {
1478
+ estimateGas: false
1479
+ }
1401
1480
  ): Promise<any> {
1402
1481
  const tx = await getPoolTxOrGasEstimate(
1403
1482
  this,
@@ -1406,7 +1485,7 @@ export class Pool {
1406
1485
  getRewardsTxDta(tokenId, rewards),
1407
1486
  options
1408
1487
  ],
1409
- estimateGas
1488
+ sdkOptions
1410
1489
  );
1411
1490
  return tx;
1412
1491
  }
@@ -1420,7 +1499,7 @@ export class Pool {
1420
1499
  * @param { FeeAmount } feeAmount Fee tier (Low 0.05%, Medium 0.3%, High 1%)
1421
1500
  * @param {number} slippage Slippage tolerance in %
1422
1501
  * @param {any} options Transaction options
1423
- * @param {boolean} estimateGas Simulate/estimate gas
1502
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1424
1503
  * @returns {Promise<any>} Transaction
1425
1504
  */
1426
1505
  async tradeUniswapV3(
@@ -1430,7 +1509,9 @@ export class Pool {
1430
1509
  feeAmount: number,
1431
1510
  slippage = 0.5,
1432
1511
  options: any = null,
1433
- estimateGas = false
1512
+ sdkOptions: SDKOptions = {
1513
+ estimateGas: false
1514
+ }
1434
1515
  ): Promise<any> {
1435
1516
  const swapxData = await getUniswapV3SwapTxData(
1436
1517
  this,
@@ -1443,7 +1524,7 @@ export class Pool {
1443
1524
  const tx = await getPoolTxOrGasEstimate(
1444
1525
  this,
1445
1526
  [routerAddress[this.network][Dapp.UNISWAPV3], swapxData, options],
1446
- estimateGas
1527
+ sdkOptions
1447
1528
  );
1448
1529
  return tx;
1449
1530
  }
@@ -1456,7 +1537,7 @@ export class Pool {
1456
1537
  * @param {BigNumber | string} amountB Amount second asset
1457
1538
  * @param { boolean } isStable Is stable pool
1458
1539
  * @param {any} options Transaction options
1459
- * @param {boolean} estimateGas Simulate/estimate gas
1540
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1460
1541
  * @returns {Promise<any>} Transaction
1461
1542
  */
1462
1543
  async addLiquidityVelodrome(
@@ -1466,7 +1547,9 @@ export class Pool {
1466
1547
  amountB: BigNumber | string,
1467
1548
  isStable: boolean,
1468
1549
  options: any = null,
1469
- estimateGas = false
1550
+ sdkOptions: SDKOptions = {
1551
+ estimateGas: false
1552
+ }
1470
1553
  ): Promise<any> {
1471
1554
  const tx = await getPoolTxOrGasEstimate(
1472
1555
  this,
@@ -1482,7 +1565,7 @@ export class Pool {
1482
1565
  ),
1483
1566
  options
1484
1567
  ],
1485
- estimateGas
1568
+ sdkOptions
1486
1569
  );
1487
1570
  return tx;
1488
1571
  }
@@ -1494,7 +1577,7 @@ export class Pool {
1494
1577
  * @param {BigNumber | string} amount Amount of LP tokens
1495
1578
  * @param { boolean } isStable Is stable pool
1496
1579
  * @param {any} options Transaction options
1497
- * @param {boolean} estimateGas Simulate/estimate gas
1580
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1498
1581
  * @returns {Promise<any>} Transaction
1499
1582
  */
1500
1583
  async removeLiquidityVelodrome(
@@ -1503,7 +1586,9 @@ export class Pool {
1503
1586
  amount: BigNumber | string,
1504
1587
  isStable: boolean,
1505
1588
  options: any = null,
1506
- estimateGas = false
1589
+ sdkOptions: SDKOptions = {
1590
+ estimateGas: false
1591
+ }
1507
1592
  ): Promise<any> {
1508
1593
  const tx = await getPoolTxOrGasEstimate(
1509
1594
  this,
@@ -1518,7 +1603,7 @@ export class Pool {
1518
1603
  ),
1519
1604
  options
1520
1605
  ],
1521
- estimateGas
1606
+ sdkOptions
1522
1607
  );
1523
1608
  return tx;
1524
1609
  }
@@ -1531,7 +1616,7 @@ export class Pool {
1531
1616
  * @param {BigNumber | string} amountB Amount second asset
1532
1617
  * @param { boolean } isStable Is stable pool
1533
1618
  * @param {any} options Transaction options
1534
- * @param {boolean} estimateGas Simulate/estimate gas
1619
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1535
1620
  * @returns {Promise<any>} Transaction
1536
1621
  */
1537
1622
  async addLiquidityVelodromeV2(
@@ -1541,7 +1626,9 @@ export class Pool {
1541
1626
  amountB: BigNumber | string,
1542
1627
  isStable: boolean,
1543
1628
  options: any = null,
1544
- estimateGas = false
1629
+ sdkOptions: SDKOptions = {
1630
+ estimateGas: false
1631
+ }
1545
1632
  ): Promise<any> {
1546
1633
  const tx = await getPoolTxOrGasEstimate(
1547
1634
  this,
@@ -1557,7 +1644,7 @@ export class Pool {
1557
1644
  ),
1558
1645
  options
1559
1646
  ],
1560
- estimateGas
1647
+ sdkOptions
1561
1648
  );
1562
1649
  return tx;
1563
1650
  }
@@ -1569,7 +1656,7 @@ export class Pool {
1569
1656
  * @param {BigNumber | string} amount Amount of LP tokens
1570
1657
  * @param { boolean } isStable Is stable pool
1571
1658
  * @param {any} options Transaction options
1572
- * @param {boolean} estimateGas Simulate/estimate gas
1659
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1573
1660
  * @returns {Promise<any>} Transaction
1574
1661
  */
1575
1662
  async removeLiquidityVelodromeV2(
@@ -1578,7 +1665,9 @@ export class Pool {
1578
1665
  amount: BigNumber | string,
1579
1666
  isStable: boolean,
1580
1667
  options: any = null,
1581
- estimateGas = false
1668
+ sdkOptions: SDKOptions = {
1669
+ estimateGas: false
1670
+ }
1582
1671
  ): Promise<any> {
1583
1672
  const tx = await getPoolTxOrGasEstimate(
1584
1673
  this,
@@ -1593,7 +1682,7 @@ export class Pool {
1593
1682
  ),
1594
1683
  options
1595
1684
  ],
1596
- estimateGas
1685
+ sdkOptions
1597
1686
  );
1598
1687
  return tx;
1599
1688
  }
@@ -1607,7 +1696,7 @@ export class Pool {
1607
1696
  * @param {BigNumber | string} amountB Amount second asset
1608
1697
  * @param { boolean } isStable Is stable pool
1609
1698
  * @param {any} options Transaction options
1610
- * @param {boolean} estimateGas Simulate/estimate gas
1699
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1611
1700
  * @returns {Promise<any>} Transaction
1612
1701
  */
1613
1702
  async addLiquidityV2(
@@ -1618,7 +1707,9 @@ export class Pool {
1618
1707
  amountB: BigNumber | string,
1619
1708
  isStable: boolean,
1620
1709
  options: any = null,
1621
- estimateGas = false
1710
+ sdkOptions: SDKOptions = {
1711
+ estimateGas: false
1712
+ }
1622
1713
  ): Promise<any> {
1623
1714
  const tx = await getPoolTxOrGasEstimate(
1624
1715
  this,
@@ -1634,7 +1725,7 @@ export class Pool {
1634
1725
  ),
1635
1726
  options
1636
1727
  ],
1637
- estimateGas
1728
+ sdkOptions
1638
1729
  );
1639
1730
  return tx;
1640
1731
  }
@@ -1647,7 +1738,7 @@ export class Pool {
1647
1738
  * @param {BigNumber | string} amount Amount of LP tokens
1648
1739
  * @param { boolean } isStable Is stable pool
1649
1740
  * @param {any} options Transaction options
1650
- * @param {boolean} estimateGas Simulate/estimate gas
1741
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1651
1742
  * @returns {Promise<any>} Transaction
1652
1743
  */
1653
1744
  async removeLiquidityV2(
@@ -1657,7 +1748,9 @@ export class Pool {
1657
1748
  amount: BigNumber | string,
1658
1749
  isStable: boolean,
1659
1750
  options: any = null,
1660
- estimateGas = false
1751
+ sdkOptions: SDKOptions = {
1752
+ estimateGas: false
1753
+ }
1661
1754
  ): Promise<any> {
1662
1755
  const tx = await getPoolTxOrGasEstimate(
1663
1756
  this,
@@ -1672,7 +1765,7 @@ export class Pool {
1672
1765
  ),
1673
1766
  options
1674
1767
  ],
1675
- estimateGas
1768
+ sdkOptions
1676
1769
  );
1677
1770
  return tx;
1678
1771
  }
@@ -1689,7 +1782,7 @@ export class Pool {
1689
1782
  * @param {BigNumber | string } collateralChangeAmount Collateral amount to add when shorting options and to remove when covering shorts
1690
1783
  * @param {boolean} isCoveredCall Selling covered call options
1691
1784
  * @param {any} options Transaction options
1692
- * @param {boolean} estimateGas Simulate/estimate gas
1785
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1693
1786
  * @returns {Promise<any>} Transaction
1694
1787
  */
1695
1788
  async tradeLyraOption(
@@ -1703,7 +1796,9 @@ export class Pool {
1703
1796
  collateralChangeAmount: BigNumber | string = "0",
1704
1797
  isCoveredCall = false,
1705
1798
  options: any = null,
1706
- estimateGas = false
1799
+ sdkOptions: SDKOptions = {
1800
+ estimateGas: false
1801
+ }
1707
1802
  ): Promise<any> {
1708
1803
  const swapxData = await getLyraOptionTxData(
1709
1804
  this,
@@ -1720,7 +1815,7 @@ export class Pool {
1720
1815
  const tx = await getPoolTxOrGasEstimate(
1721
1816
  this,
1722
1817
  [routerAddress[this.network][Dapp.LYRA], swapxData, options],
1723
- estimateGas
1818
+ sdkOptions
1724
1819
  );
1725
1820
  return tx;
1726
1821
  }
@@ -1738,19 +1833,21 @@ export class Pool {
1738
1833
  * @param {string} market Address of futures market
1739
1834
  * @param {BigNumber | string } changeAmount Amount to increase/decrease margin
1740
1835
  * @param {any} options Transaction options
1741
- * @param {boolean} estimateGas Simulate/estimate gas
1836
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1742
1837
  * @returns {Promise<any>} Transaction
1743
1838
  */
1744
1839
  async changeFuturesMargin(
1745
1840
  market: string,
1746
1841
  changeAmount: BigNumber | string,
1747
1842
  options: any = null,
1748
- estimateGas = false
1843
+ sdkOptions: SDKOptions = {
1844
+ estimateGas: false
1845
+ }
1749
1846
  ): Promise<any> {
1750
1847
  const tx = await getPoolTxOrGasEstimate(
1751
1848
  this,
1752
1849
  [market, getFuturesChangeMarginTxData(changeAmount), options],
1753
- estimateGas
1850
+ sdkOptions
1754
1851
  );
1755
1852
  return tx;
1756
1853
  }
@@ -1760,14 +1857,16 @@ export class Pool {
1760
1857
  * @param {string} market Address of futures market
1761
1858
  * @param {BigNumber | string } changeAmount Negative for short, positive for long
1762
1859
  * @param {any} options Transaction options
1763
- * @param {boolean} estimateGas Simulate/estimate gas
1860
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1764
1861
  * @returns {Promise<any>} Transaction
1765
1862
  */
1766
1863
  async changeFuturesPosition(
1767
1864
  market: string,
1768
1865
  changeAmount: BigNumber | string,
1769
1866
  options: any = null,
1770
- estimateGas = false
1867
+ sdkOptions: SDKOptions = {
1868
+ estimateGas: false
1869
+ }
1771
1870
  ): Promise<any> {
1772
1871
  const txData = await getFuturesChangePositionTxData(
1773
1872
  changeAmount,
@@ -1777,7 +1876,7 @@ export class Pool {
1777
1876
  const tx = await getPoolTxOrGasEstimate(
1778
1877
  this,
1779
1878
  [market, txData, options],
1780
- estimateGas
1879
+ sdkOptions
1781
1880
  );
1782
1881
  return tx;
1783
1882
  }
@@ -1786,19 +1885,21 @@ export class Pool {
1786
1885
  *
1787
1886
  * @param {string} market Address of futures market
1788
1887
  * @param {any} options Transaction options
1789
- * @param {boolean} estimateGas Simulate/estimate gas
1888
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1790
1889
  * @returns {Promise<any>} Transaction
1791
1890
  */
1792
1891
  async cancelFuturesOrder(
1793
1892
  market: string,
1794
1893
  options: any = null,
1795
- estimateGas = false
1894
+ sdkOptions: SDKOptions = {
1895
+ estimateGas: false
1896
+ }
1796
1897
  ): Promise<any> {
1797
1898
  const txData = await getFuturesCancelOrderTxData(this);
1798
1899
  const tx = await getPoolTxOrGasEstimate(
1799
1900
  this,
1800
1901
  [market, txData, options],
1801
- estimateGas
1902
+ sdkOptions
1802
1903
  );
1803
1904
  return tx;
1804
1905
  }
@@ -1831,20 +1932,22 @@ export class Pool {
1831
1932
  * @param {string} tokenAddress Address of the token to vest
1832
1933
  * @param {BigNumber | string } changeAmount Negative for short, positive for long
1833
1934
  * @param {any} options Transaction options
1834
- * @param {boolean} estimateGas Simulate/estimate gas
1935
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1835
1936
  * @returns {Promise<any>} Transaction
1836
1937
  */
1837
1938
  async vestTokens(
1838
1939
  tokenAddress: string,
1839
1940
  amount: BigNumber | string,
1840
1941
  options: any = null,
1841
- estimateGas = false
1942
+ sdkOptions: SDKOptions = {
1943
+ estimateGas: false
1944
+ }
1842
1945
  ): Promise<any> {
1843
1946
  const txData = await getCreateVestTxData(amount);
1844
1947
  const tx = await getPoolTxOrGasEstimate(
1845
1948
  this,
1846
1949
  [tokenAddress, txData, options],
1847
- estimateGas
1950
+ sdkOptions
1848
1951
  );
1849
1952
  return tx;
1850
1953
  }
@@ -1854,20 +1957,22 @@ export class Pool {
1854
1957
  * @param {string} tokenAddress Address of the token to vest
1855
1958
  * @param {number } id position Id of the vested tokens
1856
1959
  * @param {any} options Transaction options
1857
- * @param {boolean} estimateGas Simulate/estimate gas
1960
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1858
1961
  * @returns {Promise<any>} Transaction
1859
1962
  */
1860
1963
  async exitVestedToken(
1861
1964
  tokenAddress: string,
1862
1965
  id: number,
1863
1966
  options: any = null,
1864
- estimateGas = false
1967
+ sdkOptions: SDKOptions = {
1968
+ estimateGas: false
1969
+ }
1865
1970
  ): Promise<any> {
1866
1971
  const txData = await getExitVestTxData(id);
1867
1972
  const tx = await getPoolTxOrGasEstimate(
1868
1973
  this,
1869
1974
  [tokenAddress, txData, options],
1870
- estimateGas
1975
+ sdkOptions
1871
1976
  );
1872
1977
  return tx;
1873
1978
  }
@@ -1878,7 +1983,7 @@ export class Pool {
1878
1983
  * @param { number } slippage slippage, 0.5 represents 0.5%
1879
1984
  * @param { number | null } maxKeeperFeeInUsd 5 represents $5; null will skip the maxKeeperFee check
1880
1985
  * @param {any} options Transaction options
1881
- * @param {boolean} estimateGas Simulate/estimate gas
1986
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1882
1987
  * @returns {Promise<any>} Transaction
1883
1988
  */
1884
1989
  async mintUnitViaFlatMoney(
@@ -1886,7 +1991,9 @@ export class Pool {
1886
1991
  slippage = 0.5,
1887
1992
  maxKeeperFeeInUsd: number | null,
1888
1993
  options: any = null,
1889
- estimateGas = false
1994
+ sdkOptions: SDKOptions = {
1995
+ estimateGas: false
1996
+ }
1890
1997
  ): Promise<any> {
1891
1998
  const tx = await mintUnitViaFlatMoney(
1892
1999
  this,
@@ -1894,7 +2001,7 @@ export class Pool {
1894
2001
  slippage,
1895
2002
  maxKeeperFeeInUsd,
1896
2003
  options,
1897
- estimateGas
2004
+ sdkOptions
1898
2005
  );
1899
2006
  return tx;
1900
2007
  }
@@ -1905,7 +2012,7 @@ export class Pool {
1905
2012
  * @param { number } slippage slippage, 0.5 represents 0.5%
1906
2013
  * @param { number | null } maxKeeperFeeInUsd 5 represents $5; null will skip the maxKeeperFee check
1907
2014
  * @param {any} options Transaction options
1908
- * @param {boolean} estimateGas Simulate/estimate gas
2015
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1909
2016
  * @returns {Promise<any>} Transaction
1910
2017
  */
1911
2018
  async redeemUnitViaFlatMoney(
@@ -1913,7 +2020,9 @@ export class Pool {
1913
2020
  slippage = 0.5,
1914
2021
  maxKeeperFeeInUsd: number | null,
1915
2022
  options: any = null,
1916
- estimateGas = false
2023
+ sdkOptions: SDKOptions = {
2024
+ estimateGas: false
2025
+ }
1917
2026
  ): Promise<any> {
1918
2027
  const tx = await redeemUnitViaFlatMoney(
1919
2028
  this,
@@ -1921,7 +2030,7 @@ export class Pool {
1921
2030
  slippage,
1922
2031
  maxKeeperFeeInUsd,
1923
2032
  options,
1924
- estimateGas
2033
+ sdkOptions
1925
2034
  );
1926
2035
  return tx;
1927
2036
  }
@@ -1939,24 +2048,27 @@ export class Pool {
1939
2048
  * @param {string} destinationToken Address of destination asset
1940
2049
  * @param {number} slippage Slippage tolerance in %
1941
2050
  * @param {any} options Transaction options
1942
- * @param {boolean} estimateGas Simulate/estimate gas
2051
+ * @param {SDKOptions} sdkOptions SDK options including estimateGas
1943
2052
  * @returns {Promise<any>} Transaction
1944
2053
  */
1945
2054
  async completeTorosWithdrawal(
1946
2055
  destinationToken: string,
1947
2056
  slippage = 0.5,
1948
2057
  options: any = null,
1949
- estimateGas = false
2058
+ sdkOptions: SDKOptions = {
2059
+ estimateGas: false
2060
+ }
1950
2061
  ): Promise<any> {
1951
2062
  const txData = await getCompleteWithdrawalTxData(
1952
2063
  this,
1953
2064
  destinationToken,
1954
- slippage
2065
+ slippage * 100,
2066
+ false
1955
2067
  );
1956
2068
  const tx = await getPoolTxOrGasEstimate(
1957
2069
  this,
1958
2070
  [routerAddress[this.network].toros, txData, options],
1959
- estimateGas
2071
+ sdkOptions
1960
2072
  );
1961
2073
  return tx;
1962
2074
  }