@magmaprotocol/magma-clmm-sdk 0.5.45 → 0.5.47

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
@@ -1598,10 +1598,10 @@ import BN10 from "bn.js";
1598
1598
  // src/math/dlmmWeightToAmounts.ts
1599
1599
  import BN9 from "bn.js";
1600
1600
  import Decimal3 from "decimal.js";
1601
- import { get_price_from_real_id } from "@magmaprotocol/calc_dlmm";
1601
+ import { get_price_x128_from_real_id } from "@magmaprotocol/calc_dlmm";
1602
1602
  function getPriceOfBinByBinId(binId, binStep) {
1603
1603
  const twoDec = new Decimal3(2);
1604
- const price = new Decimal3(get_price_from_real_id(binId, binStep));
1604
+ const price = new Decimal3(get_price_x128_from_real_id(binId, binStep));
1605
1605
  return price.div(twoDec.pow(128));
1606
1606
  }
1607
1607
  function autoFillYByWeight(activeId, binStep, amountX, amountXInActiveBin, amountYInActiveBin, distributions) {
@@ -2589,11 +2589,11 @@ var SplitSwap = class {
2589
2589
 
2590
2590
  // src/math/bin.ts
2591
2591
  import Decimal6 from "decimal.js";
2592
- import { get_price_from_real_id as get_price_from_real_id2 } from "@magmaprotocol/calc_dlmm";
2592
+ import { get_price_x128_from_real_id as get_price_x128_from_real_id2 } from "@magmaprotocol/calc_dlmm";
2593
2593
  var BinMath = class {
2594
2594
  static getPriceOfBinByBinId(binId, binStep, decimalsA, decimalsB) {
2595
2595
  const twoDec = new Decimal6(2);
2596
- const price = new Decimal6(get_price_from_real_id2(binId, binStep));
2596
+ const price = new Decimal6(get_price_x128_from_real_id2(binId, binStep));
2597
2597
  return price.div(twoDec.pow(128)).mul(Decimal6.pow(10, decimalsA - decimalsB));
2598
2598
  }
2599
2599
  };
@@ -10501,7 +10501,7 @@ var GaugeModule = class {
10501
10501
  // src/modules/dlmm.ts
10502
10502
  import { Transaction as Transaction12 } from "@mysten/sui/transactions";
10503
10503
  import Decimal10 from "decimal.js";
10504
- import { get_real_id_from_price, get_storage_id_from_real_id } from "@magmaprotocol/calc_dlmm";
10504
+ import { get_real_id_from_price_x128 as get_real_id_from_price_x1282, get_storage_id_from_real_id } from "@magmaprotocol/calc_dlmm";
10505
10505
  var DlmmModule = class {
10506
10506
  _sdk;
10507
10507
  constructor(sdk) {
@@ -10577,7 +10577,7 @@ var DlmmModule = class {
10577
10577
  const tenDec = new Decimal10(10);
10578
10578
  const twoDec = new Decimal10(2);
10579
10579
  const price_x128 = priceDec.mul(tenDec.pow(tokenBDecimal)).div(tenDec.pow(tokenADecimal)).mul(twoDec.pow(128));
10580
- const active_id = get_real_id_from_price(price_x128.toFixed(0).toString(), bin_step);
10580
+ const active_id = get_real_id_from_price_x1282(price_x128.toFixed(0).toString(), bin_step);
10581
10581
  return get_storage_id_from_real_id(active_id);
10582
10582
  }
10583
10583
  // NOTE: x, y should be sorted
@@ -10589,7 +10589,13 @@ var DlmmModule = class {
10589
10589
  const { global_config_id } = getPackagerConfigs(clmm_pool);
10590
10590
  const dlmmConfig = getPackagerConfigs(dlmm_pool);
10591
10591
  const typeArguments = [params.coinTypeA, params.coinTypeB];
10592
- const args = [tx.object(dlmmConfig.factory), tx.object(global_config_id), tx.pure.u16(params.bin_step), tx.pure.u32(storage_id)];
10592
+ const args = [
10593
+ tx.object(dlmmConfig.factory),
10594
+ tx.object(global_config_id),
10595
+ tx.pure.u64(params.base_fee),
10596
+ tx.pure.u16(params.bin_step),
10597
+ tx.pure.u32(storage_id)
10598
+ ];
10593
10599
  tx.moveCall({
10594
10600
  target: `${integrate.published_at}::${DlmmScript}::create_pair`,
10595
10601
  typeArguments,
@@ -10597,10 +10603,6 @@ var DlmmModule = class {
10597
10603
  });
10598
10604
  return tx;
10599
10605
  }
10600
- async createAddLiquidityPayload() {
10601
- const tx = new Transaction12();
10602
- return tx;
10603
- }
10604
10606
  // Create a position by percent
10605
10607
  async mintPercent(params) {
10606
10608
  const tx = new Transaction12();