@magmaprotocol/magma-clmm-sdk 0.5.104 → 0.5.106

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
@@ -10423,6 +10423,7 @@ import {
10423
10423
  get_storage_id_from_real_id
10424
10424
  } from "@magmaprotocol/calc_dlmm";
10425
10425
  import Decimal10 from "decimal.js";
10426
+ import BN22 from "bn.js";
10426
10427
  var AlmmModule = class {
10427
10428
  _sdk;
10428
10429
  _cache = {};
@@ -10449,6 +10450,18 @@ var AlmmModule = class {
10449
10450
  throw new ClmmpoolsError(`Invalid objects. error: ${obj.error}`, "InvalidType" /* InvalidType */);
10450
10451
  }
10451
10452
  const fields = getObjectFields(obj);
10453
+ const rewarders = [];
10454
+ fields.rewarder_manager.fields.rewarders.forEach((item) => {
10455
+ const { emissions_per_second } = item.fields;
10456
+ const emissionSeconds = MathUtil.fromX64(new BN22(emissions_per_second));
10457
+ const emissionsEveryDay = Math.floor(emissionSeconds.toNumber() * 60 * 60 * 24);
10458
+ rewarders.push({
10459
+ emissions_per_second,
10460
+ coinAddress: extractStructTagFromType(item.fields.reward_coin.fields.name).source_address,
10461
+ growth_global: item.fields.growth_global,
10462
+ emissionsEveryDay
10463
+ });
10464
+ });
10452
10465
  const poolInfo = {
10453
10466
  pool_id: fields.id.id,
10454
10467
  bin_step: fields.bin_step,
@@ -10460,7 +10473,8 @@ var AlmmModule = class {
10460
10473
  real_bin_id: get_real_id(fields.params.fields.active_index),
10461
10474
  coinAmountA: fields.reserve_x,
10462
10475
  coinAmountB: fields.reserve_y,
10463
- liquidity: fields.liquidity
10476
+ liquidity: fields.liquidity,
10477
+ rewarder_infos: rewarders
10464
10478
  };
10465
10479
  poolList.push(poolInfo);
10466
10480
  this.updateCache(`${fields.id.id}_getPoolObject`, poolInfo, cacheTime24h);
@@ -10843,8 +10857,18 @@ var AlmmModule = class {
10843
10857
  });
10844
10858
  return tx;
10845
10859
  }
10846
- async collectFeeAndReward(params) {
10860
+ async collectFeeAndRewardList(paramsList) {
10847
10861
  let tx = new Transaction12();
10862
+ for (let index = 0; index < paramsList.length; index++) {
10863
+ const params = paramsList[index];
10864
+ tx = await this.collectFeeAndReward(params);
10865
+ }
10866
+ return tx;
10867
+ }
10868
+ async collectFeeAndReward(params, tx) {
10869
+ if (!tx) {
10870
+ tx = new Transaction12();
10871
+ }
10848
10872
  tx = await this.collectFees(params);
10849
10873
  if (params.rewards_token.length > 0) {
10850
10874
  tx = await this.collectReward(params, tx);