@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.mjs CHANGED
@@ -10932,13 +10932,17 @@ var DlmmModule = class {
10932
10932
  coinTypeA: coins[0],
10933
10933
  coinTypeB: coins[1]
10934
10934
  });
10935
- const positionRewards = await this.getEarnedRewards({
10936
- pool_id: item.pool,
10937
- position_id: item.pos_object_id,
10938
- coin_a: coins[0],
10939
- coin_b: coins[1],
10940
- rewards_token: pool_reward_coins.get(item.pool) || []
10941
- });
10935
+ const rewards_token = pool_reward_coins.get(item.pool) || [];
10936
+ let positionRewards = { position_id: item.pool, reward: [], amount: [] };
10937
+ if (rewards_token.length > 0) {
10938
+ positionRewards = await this.getEarnedRewards({
10939
+ pool_id: item.pool,
10940
+ position_id: item.pos_object_id,
10941
+ coin_a: coins[0],
10942
+ coin_b: coins[1],
10943
+ rewards_token: pool_reward_coins.get(item.pool) || []
10944
+ });
10945
+ }
10942
10946
  const positionFees = await this.getEarnedFees({
10943
10947
  pool_id: item.pool,
10944
10948
  position_id: item.pos_object_id,
@@ -11069,7 +11073,7 @@ var DlmmModule = class {
11069
11073
  const tx = new Transaction12();
11070
11074
  const { integrate, simulationAccount } = this.sdk.sdkOptions;
11071
11075
  const typeArguments = [params.coin_a, params.coin_b];
11072
- const args = [tx.object(params.pool_id), tx.object(params.position_id)];
11076
+ const args = [tx.object(params.pool_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
11073
11077
  tx.moveCall({
11074
11078
  target: `${integrate.published_at}::${DlmmScript}::earned_fees`,
11075
11079
  arguments: args,
@@ -11104,7 +11108,7 @@ var DlmmModule = class {
11104
11108
  const tx = new Transaction12();
11105
11109
  const { integrate, simulationAccount } = this.sdk.sdkOptions;
11106
11110
  const typeArguments = [params.coin_a, params.coin_b, ...params.rewards_token];
11107
- const args = [tx.object(params.pool_id), tx.object(params.position_id)];
11111
+ const args = [tx.object(params.pool_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
11108
11112
  let target = `${integrate.published_at}::${DlmmScript}::earned_rewards`;
11109
11113
  if (params.rewards_token.length > 1) {
11110
11114
  target = `${integrate.published_at}::${DlmmScript}::earned_rewards${params.rewards_token.length}`;
@@ -11124,7 +11128,7 @@ var DlmmModule = class {
11124
11128
  amount: []
11125
11129
  };
11126
11130
  if (simulateRes.error != null) {
11127
- throw new Error(`fetchBins error code: ${simulateRes.error ?? "unknown error"}`);
11131
+ throw new Error(`getEarnedRewards error code: ${simulateRes.error ?? "unknown error"}`);
11128
11132
  }
11129
11133
  simulateRes.events?.forEach((item) => {
11130
11134
  if (extractStructTagFromType(item.type).name === `DlmmEventEarnedRewards`) {