@magmaprotocol/magma-clmm-sdk 0.5.53 → 0.5.55

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
@@ -11150,13 +11150,17 @@ var DlmmModule = class {
11150
11150
  coinTypeA: coins[0],
11151
11151
  coinTypeB: coins[1]
11152
11152
  });
11153
- const positionRewards = await this.getEarnedRewards({
11154
- pool_id: item.pool,
11155
- position_id: item.pos_object_id,
11156
- coin_a: coins[0],
11157
- coin_b: coins[1],
11158
- rewards_token: pool_reward_coins.get(item.pool) || []
11159
- });
11153
+ const rewards_token = pool_reward_coins.get(item.pool) || [];
11154
+ let positionRewards = { position_id: item.pool, reward: [], amount: [] };
11155
+ if (rewards_token.length > 0) {
11156
+ positionRewards = await this.getEarnedRewards({
11157
+ pool_id: item.pool,
11158
+ position_id: item.pos_object_id,
11159
+ coin_a: coins[0],
11160
+ coin_b: coins[1],
11161
+ rewards_token: pool_reward_coins.get(item.pool) || []
11162
+ });
11163
+ }
11160
11164
  const positionFees = await this.getEarnedFees({
11161
11165
  pool_id: item.pool,
11162
11166
  position_id: item.pos_object_id,
@@ -11287,7 +11291,7 @@ var DlmmModule = class {
11287
11291
  const tx = new import_transactions12.Transaction();
11288
11292
  const { integrate, simulationAccount } = this.sdk.sdkOptions;
11289
11293
  const typeArguments = [params.coin_a, params.coin_b];
11290
- const args = [tx.object(params.pool_id), tx.object(params.position_id)];
11294
+ const args = [tx.object(params.pool_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
11291
11295
  tx.moveCall({
11292
11296
  target: `${integrate.published_at}::${DlmmScript}::earned_fees`,
11293
11297
  arguments: args,
@@ -11322,7 +11326,7 @@ var DlmmModule = class {
11322
11326
  const tx = new import_transactions12.Transaction();
11323
11327
  const { integrate, simulationAccount } = this.sdk.sdkOptions;
11324
11328
  const typeArguments = [params.coin_a, params.coin_b, ...params.rewards_token];
11325
- const args = [tx.object(params.pool_id), tx.object(params.position_id)];
11329
+ const args = [tx.object(params.pool_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
11326
11330
  let target = `${integrate.published_at}::${DlmmScript}::earned_rewards`;
11327
11331
  if (params.rewards_token.length > 1) {
11328
11332
  target = `${integrate.published_at}::${DlmmScript}::earned_rewards${params.rewards_token.length}`;
@@ -11342,7 +11346,7 @@ var DlmmModule = class {
11342
11346
  amount: []
11343
11347
  };
11344
11348
  if (simulateRes.error != null) {
11345
- throw new Error(`fetchBins error code: ${simulateRes.error ?? "unknown error"}`);
11349
+ throw new Error(`getEarnedRewards error code: ${simulateRes.error ?? "unknown error"}`);
11346
11350
  }
11347
11351
  simulateRes.events?.forEach((item) => {
11348
11352
  if (extractStructTagFromType(item.type).name === `DlmmEventEarnedRewards`) {