@magmaprotocol/magma-clmm-sdk 0.5.48 → 0.5.50

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.mjs CHANGED
@@ -2599,7 +2599,7 @@ var BinMath = class {
2599
2599
  static getBinIdFromPrice(price, binStep, decimalsA, decimalsB) {
2600
2600
  const twoDec = new Decimal6(2);
2601
2601
  const tenDec = new Decimal6(10);
2602
- const realid = get_real_id_from_price_x128(new Decimal6(price).mul(tenDec.pow(decimalsB - decimalsB)).mul(twoDec.pow(128)).toDecimalPlaces(0).toString(), binStep);
2602
+ const realid = get_real_id_from_price_x128(new Decimal6(price).mul(tenDec.pow(decimalsB - decimalsA)).mul(twoDec.pow(128)).toDecimalPlaces(0).toString(), binStep);
2603
2603
  return realid;
2604
2604
  }
2605
2605
  };
@@ -10506,8 +10506,8 @@ var GaugeModule = class {
10506
10506
 
10507
10507
  // src/modules/dlmm.ts
10508
10508
  import { Transaction as Transaction12 } from "@mysten/sui/transactions";
10509
- import Decimal10 from "decimal.js";
10510
10509
  import { get_real_id_from_price_x128 as get_real_id_from_price_x1282, get_storage_id_from_real_id } from "@magmaprotocol/calc_dlmm";
10510
+ import Decimal10 from "decimal.js";
10511
10511
  var DlmmModule = class {
10512
10512
  _sdk;
10513
10513
  constructor(sdk) {
@@ -10814,6 +10814,38 @@ var DlmmModule = class {
10814
10814
  });
10815
10815
  return tx;
10816
10816
  }
10817
+ async createPairAddLiquidity(params) {
10818
+ const tx = new Transaction12();
10819
+ tx.setSender(this.sdk.senderAddress);
10820
+ const { dlmm_pool, integrate } = this.sdk.sdkOptions;
10821
+ const dlmmConfig = getPackagerConfigs(dlmm_pool);
10822
+ const typeArguments = [params.coinTypeA, params.coinTypeB];
10823
+ const allCoins = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
10824
+ const amountATotal = params.amountsX.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
10825
+ const amountBTotal = params.amountsY.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
10826
+ const primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(amountATotal), params.coinTypeA, false, true);
10827
+ const primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(amountBTotal), params.coinTypeB, false, true);
10828
+ const args = [
10829
+ tx.object(dlmmConfig.factory),
10830
+ tx.pure.u64(params.baseFee),
10831
+ tx.pure.u16(params.binStep),
10832
+ tx.pure.u32(params.activeId),
10833
+ primaryCoinAInputs.targetCoin,
10834
+ primaryCoinBInputs.targetCoin,
10835
+ tx.pure.vector("u32", params.storageIds),
10836
+ tx.pure.vector("u64", params.amountsX),
10837
+ tx.pure.vector("u64", params.amountsY),
10838
+ tx.pure.address(params.to),
10839
+ tx.object(CLOCK_ADDRESS)
10840
+ ];
10841
+ const target = `${integrate.published_at}::${DlmmScript}::create_pair_add_liquidity`;
10842
+ tx.moveCall({
10843
+ target,
10844
+ typeArguments,
10845
+ arguments: args
10846
+ });
10847
+ return tx;
10848
+ }
10817
10849
  async swap(params) {
10818
10850
  const tx = new Transaction12();
10819
10851
  tx.setSender(this.sdk.senderAddress);