@dhedge/v2-sdk 1.5.1 → 1.5.3

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.
@@ -10723,13 +10723,13 @@ function _isPool() {
10723
10723
  return _isPool.apply(this, arguments);
10724
10724
  }
10725
10725
 
10726
- function getPoolDepositAsset(_x, _x2) {
10726
+ function getPoolDepositAsset(_x, _x2, _x3) {
10727
10727
  return _getPoolDepositAsset.apply(this, arguments);
10728
10728
  }
10729
10729
 
10730
10730
  function _getPoolDepositAsset() {
10731
- _getPoolDepositAsset = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, poolAddress) {
10732
- var _composition$find;
10731
+ _getPoolDepositAsset = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, poolAddress, investAsset) {
10732
+ var _composition$find, _composition$find2;
10733
10733
 
10734
10734
  var torosPool, composition;
10735
10735
  return runtime_1.wrap(function _callee$(_context) {
@@ -10746,11 +10746,22 @@ function _getPoolDepositAsset() {
10746
10746
 
10747
10747
  case 5:
10748
10748
  composition = _context.sent;
10749
- return _context.abrupt("return", (_composition$find = composition.find(function (e) {
10749
+
10750
+ if (!((_composition$find = composition.find(function (e) {
10751
+ return e.asset.toLowerCase() === investAsset.toLowerCase();
10752
+ })) != null && _composition$find.isDeposit)) {
10753
+ _context.next = 8;
10754
+ break;
10755
+ }
10756
+
10757
+ return _context.abrupt("return", investAsset);
10758
+
10759
+ case 8:
10760
+ return _context.abrupt("return", (_composition$find2 = composition.find(function (e) {
10750
10761
  return e.isDeposit;
10751
- })) == null ? void 0 : _composition$find.asset);
10762
+ })) == null ? void 0 : _composition$find2.asset);
10752
10763
 
10753
- case 7:
10764
+ case 9:
10754
10765
  case "end":
10755
10766
  return _context.stop();
10756
10767
  }
@@ -10760,7 +10771,7 @@ function _getPoolDepositAsset() {
10760
10771
  return _getPoolDepositAsset.apply(this, arguments);
10761
10772
  }
10762
10773
 
10763
- function getTorosPoolTokenPrice(_x3, _x4) {
10774
+ function getTorosPoolTokenPrice(_x4, _x5) {
10764
10775
  return _getTorosPoolTokenPrice.apply(this, arguments);
10765
10776
  }
10766
10777
 
@@ -10792,7 +10803,7 @@ function _getTorosPoolTokenPrice() {
10792
10803
  return _getTorosPoolTokenPrice.apply(this, arguments);
10793
10804
  }
10794
10805
 
10795
- function getEasySwapperDepositQuote(_x5, _x6, _x7, _x8, _x9) {
10806
+ function getEasySwapperDepositQuote(_x6, _x7, _x8, _x9, _x10) {
10796
10807
  return _getEasySwapperDepositQuote.apply(this, arguments);
10797
10808
  }
10798
10809
 
@@ -10820,7 +10831,7 @@ function _getEasySwapperDepositQuote() {
10820
10831
  return _getEasySwapperDepositQuote.apply(this, arguments);
10821
10832
  }
10822
10833
 
10823
- function getEasySwapperWithdrawalQuote(_x10, _x11, _x12, _x13) {
10834
+ function getEasySwapperWithdrawalQuote(_x11, _x12, _x13, _x14) {
10824
10835
  return _getEasySwapperWithdrawalQuote.apply(this, arguments);
10825
10836
  }
10826
10837
 
@@ -10852,7 +10863,7 @@ function _getEasySwapperWithdrawalQuote() {
10852
10863
  return _getEasySwapperWithdrawalQuote.apply(this, arguments);
10853
10864
  }
10854
10865
 
10855
- function getEasySwapperTxData(_x14, _x15, _x16, _x17, _x18) {
10866
+ function getEasySwapperTxData(_x15, _x16, _x17, _x18, _x19) {
10856
10867
  return _getEasySwapperTxData.apply(this, arguments);
10857
10868
  }
10858
10869
 
@@ -10887,7 +10898,7 @@ function _getEasySwapperTxData() {
10887
10898
 
10888
10899
  case 12:
10889
10900
  _context5.next = 14;
10890
- return getPoolDepositAsset(pool, torosAsset);
10901
+ return getPoolDepositAsset(pool, torosAsset, investAsset);
10891
10902
 
10892
10903
  case 14:
10893
10904
  depositAsset = _context5.sent;
@@ -18692,17 +18703,23 @@ var Utils = /*#__PURE__*/function () {
18692
18703
  _proto.getBalancerJoinPoolTx = /*#__PURE__*/function () {
18693
18704
  var _getBalancerJoinPoolTx = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(pool, balancerPoolId, assets, amountsIn // eslint-disable-next-line @typescript-eslint/no-explicit-any
18694
18705
  ) {
18695
- var iBalancerV2Vault, txData, joinPoolTx;
18706
+ var iBalancerV2Vault, bptAddress, bptIndex, poolAssetsAmounts, txData, joinPoolTx;
18696
18707
  return runtime_1.wrap(function _callee7$(_context7) {
18697
18708
  while (1) {
18698
18709
  switch (_context7.prev = _context7.next) {
18699
18710
  case 0:
18700
18711
  iBalancerV2Vault = new ethers.utils.Interface(IBalancerV2Vault.abi);
18701
- txData = [balancerPoolId, pool.address, pool.address, [assets, amountsIn, ethers.utils.defaultAbiCoder.encode(["uint256", "uint256[]", "uint256"], [1, amountsIn, 0]), false]];
18712
+ bptAddress = ethers.utils.getAddress(balancerPoolId.slice(0, 42));
18713
+ bptIndex = assets.findIndex(function (e) {
18714
+ return e.toLowerCase() === bptAddress.toLocaleLowerCase();
18715
+ });
18716
+ poolAssetsAmounts = amountsIn.slice();
18717
+ if (bptIndex >= 0) poolAssetsAmounts.splice(bptIndex, 1);
18718
+ txData = [balancerPoolId, pool.address, pool.address, [assets, amountsIn, ethers.utils.defaultAbiCoder.encode(["uint256", "uint256[]", "uint256"], [1, poolAssetsAmounts, 0]), false]];
18702
18719
  joinPoolTx = iBalancerV2Vault.encodeFunctionData("joinPool", txData);
18703
18720
  return _context7.abrupt("return", joinPoolTx);
18704
18721
 
18705
- case 4:
18722
+ case 8:
18706
18723
  case "end":
18707
18724
  return _context7.stop();
18708
18725
  }