@magmaprotocol/magma-clmm-sdk 0.5.58 → 0.5.60

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
@@ -10910,7 +10910,6 @@ var DlmmModule = class {
10910
10910
  filter: { Package: this._sdk.sdkOptions.dlmm_pool.package_id }
10911
10911
  });
10912
10912
  const hasAssignPoolIds = assignPoolIds.length > 0;
10913
- const pools = [];
10914
10913
  for (const item of ownerRes.data) {
10915
10914
  const type = extractStructTagFromType(item.data.type);
10916
10915
  if (type.full_address === this.buildPositionType()) {
@@ -10926,31 +10925,29 @@ var DlmmModule = class {
10926
10925
  }
10927
10926
  }
10928
10927
  }
10929
- const pool_coins = await this.getPoolCoins(pools);
10930
- const _params = [];
10931
- for (const [key, value] of pool_coins.entries()) {
10932
- _params.push({
10933
- pool_id: key,
10934
- coin_a: value[0],
10935
- coin_b: value[1]
10936
- });
10937
- }
10938
10928
  const poolMap = /* @__PURE__ */ new Set();
10939
10929
  for (const item of allPosition) {
10940
10930
  poolMap.add(item.pool);
10941
10931
  }
10942
10932
  const poolList = await this.getPoolInfo(Array.from(poolMap));
10943
10933
  this.updateCache(`${DlmmScript}_positionList_poolList`, poolList, cacheTime24h);
10934
+ const _params = [];
10935
+ for (const pool of poolList) {
10936
+ _params.push({
10937
+ pool_id: pool.pool_id,
10938
+ coin_a: pool.coin_a,
10939
+ coin_b: pool.coin_b
10940
+ });
10941
+ }
10944
10942
  const pool_reward_coins = await this.getPairRewarders(_params);
10945
10943
  const out = [];
10946
10944
  for (const item of allPosition) {
10947
10945
  const pool = poolList.find((pool2) => pool2.pool_id === item.pool);
10948
- const coins = pool_coins.get(item.pool) || ["", ""];
10949
10946
  const positionLiquidity = await this.getPositionLiquidity({
10950
10947
  pair: item.pool,
10951
10948
  positionId: item.pos_object_id,
10952
- coinTypeA: coins[0],
10953
- coinTypeB: coins[1]
10949
+ coinTypeA: pool?.coin_a,
10950
+ coinTypeB: pool?.coin_b
10954
10951
  });
10955
10952
  const rewards_token = pool_reward_coins.get(item.pool) || [];
10956
10953
  let positionRewards = { position_id: item.pos_object_id, reward: [], amount: [] };
@@ -10958,16 +10955,16 @@ var DlmmModule = class {
10958
10955
  positionRewards = await this.getEarnedRewards({
10959
10956
  pool_id: item.pool,
10960
10957
  position_id: item.pos_object_id,
10961
- coin_a: coins[0],
10962
- coin_b: coins[1],
10958
+ coin_a: pool?.coin_a,
10959
+ coin_b: pool?.coin_b,
10963
10960
  rewards_token: pool_reward_coins.get(item.pool) || []
10964
10961
  });
10965
10962
  }
10966
10963
  const positionFees = await this.getEarnedFees({
10967
10964
  pool_id: item.pool,
10968
10965
  position_id: item.pos_object_id,
10969
- coin_a: coins[0],
10970
- coin_b: coins[1]
10966
+ coin_a: pool?.coin_a,
10967
+ coin_b: pool?.coin_b
10971
10968
  });
10972
10969
  out.push({
10973
10970
  position: item,