@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.js CHANGED
@@ -11128,7 +11128,6 @@ var DlmmModule = class {
11128
11128
  filter: { Package: this._sdk.sdkOptions.dlmm_pool.package_id }
11129
11129
  });
11130
11130
  const hasAssignPoolIds = assignPoolIds.length > 0;
11131
- const pools = [];
11132
11131
  for (const item of ownerRes.data) {
11133
11132
  const type = extractStructTagFromType(item.data.type);
11134
11133
  if (type.full_address === this.buildPositionType()) {
@@ -11144,31 +11143,29 @@ var DlmmModule = class {
11144
11143
  }
11145
11144
  }
11146
11145
  }
11147
- const pool_coins = await this.getPoolCoins(pools);
11148
- const _params = [];
11149
- for (const [key, value] of pool_coins.entries()) {
11150
- _params.push({
11151
- pool_id: key,
11152
- coin_a: value[0],
11153
- coin_b: value[1]
11154
- });
11155
- }
11156
11146
  const poolMap = /* @__PURE__ */ new Set();
11157
11147
  for (const item of allPosition) {
11158
11148
  poolMap.add(item.pool);
11159
11149
  }
11160
11150
  const poolList = await this.getPoolInfo(Array.from(poolMap));
11161
11151
  this.updateCache(`${DlmmScript}_positionList_poolList`, poolList, cacheTime24h);
11152
+ const _params = [];
11153
+ for (const pool of poolList) {
11154
+ _params.push({
11155
+ pool_id: pool.pool_id,
11156
+ coin_a: pool.coin_a,
11157
+ coin_b: pool.coin_b
11158
+ });
11159
+ }
11162
11160
  const pool_reward_coins = await this.getPairRewarders(_params);
11163
11161
  const out = [];
11164
11162
  for (const item of allPosition) {
11165
11163
  const pool = poolList.find((pool2) => pool2.pool_id === item.pool);
11166
- const coins = pool_coins.get(item.pool) || ["", ""];
11167
11164
  const positionLiquidity = await this.getPositionLiquidity({
11168
11165
  pair: item.pool,
11169
11166
  positionId: item.pos_object_id,
11170
- coinTypeA: coins[0],
11171
- coinTypeB: coins[1]
11167
+ coinTypeA: pool?.coin_a,
11168
+ coinTypeB: pool?.coin_b
11172
11169
  });
11173
11170
  const rewards_token = pool_reward_coins.get(item.pool) || [];
11174
11171
  let positionRewards = { position_id: item.pos_object_id, reward: [], amount: [] };
@@ -11176,16 +11173,16 @@ var DlmmModule = class {
11176
11173
  positionRewards = await this.getEarnedRewards({
11177
11174
  pool_id: item.pool,
11178
11175
  position_id: item.pos_object_id,
11179
- coin_a: coins[0],
11180
- coin_b: coins[1],
11176
+ coin_a: pool?.coin_a,
11177
+ coin_b: pool?.coin_b,
11181
11178
  rewards_token: pool_reward_coins.get(item.pool) || []
11182
11179
  });
11183
11180
  }
11184
11181
  const positionFees = await this.getEarnedFees({
11185
11182
  pool_id: item.pool,
11186
11183
  position_id: item.pos_object_id,
11187
- coin_a: coins[0],
11188
- coin_b: coins[1]
11184
+ coin_a: pool?.coin_a,
11185
+ coin_b: pool?.coin_b
11189
11186
  });
11190
11187
  out.push({
11191
11188
  position: item,