@magmaprotocol/magma-clmm-sdk 0.5.81 → 0.5.83

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.
package/dist/index.d.ts CHANGED
@@ -1722,6 +1722,7 @@ type EventBin = {
1722
1722
  rewarder_growth: number[] | string[];
1723
1723
  distribution_growth: number | string;
1724
1724
  distribution_last_updated: number | string;
1725
+ real_bin_id: number;
1725
1726
  };
1726
1727
  type EventPositionLiquidity = {
1727
1728
  shares: number | string;
package/dist/index.js CHANGED
@@ -10664,18 +10664,20 @@ var DlmmModule = class {
10664
10664
  const active_min = (0, import_calc_dlmm3.get_storage_id_from_real_id)((0, import_calc_dlmm3.get_real_id_from_price_x128)(min_price.toDecimalPlaces(0).toString(), params.bin_step));
10665
10665
  const active_max = (0, import_calc_dlmm3.get_storage_id_from_real_id)((0, import_calc_dlmm3.get_real_id_from_price_x128)(max_price.toDecimalPlaces(0).toString(), params.bin_step));
10666
10666
  const allCoins = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
10667
- let primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountATotal), params.coinTypeA, false, true);
10668
- let primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountBTotal), params.coinTypeB, false, true);
10669
10667
  let amount_min = 0;
10670
10668
  let amount_max = 0;
10669
+ let primaryCoinAInputs;
10670
+ let primaryCoinBInputs;
10671
10671
  if (params.fixCoinA && params.fixCoinB) {
10672
10672
  primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountATotal), params.coinTypeA, false, true);
10673
10673
  primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountBTotal), params.coinTypeB, false, true);
10674
10674
  } else if (params.fixCoinA) {
10675
+ primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountATotal), params.coinTypeA, false, true);
10675
10676
  amount_min = new import_decimal13.default(params.amountBTotal).mul(lower_slippage).toDecimalPlaces(0).toNumber();
10676
10677
  amount_max = new import_decimal13.default(params.amountBTotal).mul(upper_slippage).toDecimalPlaces(0).toNumber();
10677
10678
  primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(amount_max), params.coinTypeB, false, true);
10678
10679
  } else if (params.fixCoinB) {
10680
+ primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountBTotal), params.coinTypeB, false, true);
10679
10681
  amount_min = new import_decimal13.default(params.amountATotal).mul(lower_slippage).toDecimalPlaces(0).toNumber();
10680
10682
  amount_max = new import_decimal13.default(params.amountATotal).mul(upper_slippage).toDecimalPlaces(0).toNumber();
10681
10683
  primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(amount_max), params.coinTypeA, false, true);
@@ -11027,7 +11029,10 @@ var DlmmModule = class {
11027
11029
  res = bins;
11028
11030
  }
11029
11031
  });
11030
- return res;
11032
+ res.forEach((bin) => {
11033
+ bin.real_bin_id = (0, import_calc_dlmm3.get_real_id)(Number(bin.storage_id));
11034
+ });
11035
+ return res.sort((a, b) => a.real_bin_id - b.real_bin_id);
11031
11036
  }
11032
11037
  /**
11033
11038
  * Gets a list of positions for the given account address.