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