@dhedge/v2-sdk 1.5.2 → 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.
@@ -18702,17 +18702,23 @@ var Utils = /*#__PURE__*/function () {
18702
18702
  _proto.getBalancerJoinPoolTx = /*#__PURE__*/function () {
18703
18703
  var _getBalancerJoinPoolTx = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(pool, balancerPoolId, assets, amountsIn // eslint-disable-next-line @typescript-eslint/no-explicit-any
18704
18704
  ) {
18705
- var iBalancerV2Vault, txData, joinPoolTx;
18705
+ var iBalancerV2Vault, bptAddress, bptIndex, poolAssetsAmounts, txData, joinPoolTx;
18706
18706
  return runtime_1.wrap(function _callee7$(_context7) {
18707
18707
  while (1) {
18708
18708
  switch (_context7.prev = _context7.next) {
18709
18709
  case 0:
18710
18710
  iBalancerV2Vault = new ethers.ethers.utils.Interface(IBalancerV2Vault.abi);
18711
- txData = [balancerPoolId, pool.address, pool.address, [assets, amountsIn, ethers.ethers.utils.defaultAbiCoder.encode(["uint256", "uint256[]", "uint256"], [1, amountsIn, 0]), false]];
18711
+ bptAddress = ethers.ethers.utils.getAddress(balancerPoolId.slice(0, 42));
18712
+ bptIndex = assets.findIndex(function (e) {
18713
+ return e.toLowerCase() === bptAddress.toLocaleLowerCase();
18714
+ });
18715
+ poolAssetsAmounts = amountsIn.slice();
18716
+ if (bptIndex >= 0) poolAssetsAmounts.splice(bptIndex, 1);
18717
+ txData = [balancerPoolId, pool.address, pool.address, [assets, amountsIn, ethers.ethers.utils.defaultAbiCoder.encode(["uint256", "uint256[]", "uint256"], [1, poolAssetsAmounts, 0]), false]];
18712
18718
  joinPoolTx = iBalancerV2Vault.encodeFunctionData("joinPool", txData);
18713
18719
  return _context7.abrupt("return", joinPoolTx);
18714
18720
 
18715
- case 4:
18721
+ case 8:
18716
18722
  case "end":
18717
18723
  return _context7.stop();
18718
18724
  }