@magmaprotocol/magma-clmm-sdk 0.5.86 → 0.5.88

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
@@ -2096,28 +2096,28 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
2096
2096
  }
2097
2097
  case 2 /* Curve */: {
2098
2098
  if (activeId < minBinId) {
2099
- const weights2 = toWeightDecendingOrder(minBinId, maxBinId);
2100
- res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
2101
- }
2102
- if (activeId > maxBinId) {
2103
- const weights2 = toWeightAscendingOrder(minBinId, maxBinId);
2104
- res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
2099
+ const weights = toWeightDecendingOrder(minBinId, maxBinId);
2100
+ res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2101
+ } else if (activeId > maxBinId) {
2102
+ const weights = toWeightAscendingOrder(minBinId, maxBinId);
2103
+ res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2104
+ } else {
2105
+ const weights = toWeightCurve(minBinId, maxBinId, activeId);
2106
+ res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2105
2107
  }
2106
- const weights = toWeightCurve(minBinId, maxBinId, activeId);
2107
- res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2108
2108
  break;
2109
2109
  }
2110
2110
  case 3 /* BidAsk */: {
2111
2111
  if (activeId < minBinId) {
2112
- const weights2 = toWeightAscendingOrder(minBinId, maxBinId);
2113
- res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
2114
- }
2115
- if (activeId > maxBinId) {
2116
- const weights2 = toWeightDecendingOrder(minBinId, maxBinId);
2117
- res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
2112
+ const weights = toWeightAscendingOrder(minBinId, maxBinId);
2113
+ res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2114
+ } else if (activeId > maxBinId) {
2115
+ const weights = toWeightDecendingOrder(minBinId, maxBinId);
2116
+ res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2117
+ } else {
2118
+ const weights = toWeightBidAsk(minBinId, maxBinId, activeId);
2119
+ res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2118
2120
  }
2119
- const weights = toWeightBidAsk(minBinId, maxBinId, activeId);
2120
- res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2121
2121
  break;
2122
2122
  }
2123
2123
  default:
@@ -11257,10 +11257,10 @@ var DlmmModule = class {
11257
11257
  throw new Error(`fetchPairRewards error code: ${simulateRes.error ?? "unknown error"}`);
11258
11258
  }
11259
11259
  simulateRes.events?.forEach((item) => {
11260
- if (extractStructTagFromType(item.type).name === `EventPositionLiquidity`) {
11260
+ if (extractStructTagFromType(item.type).name === `EventEarnedFees`) {
11261
11261
  out.position_id = item.parsedJson.position_id;
11262
- out.x = item.parsedJson.x;
11263
- out.y = item.parsedJson.y;
11262
+ out.x = item.parsedJson.x.name;
11263
+ out.y = item.parsedJson.y.name;
11264
11264
  out.fee_x = item.parsedJson.fee_x;
11265
11265
  out.fee_y = item.parsedJson.fee_y;
11266
11266
  }
@@ -11294,17 +11294,17 @@ var DlmmModule = class {
11294
11294
  throw new Error(`getEarnedRewards error code: ${simulateRes.error ?? "unknown error"}`);
11295
11295
  }
11296
11296
  simulateRes.events?.forEach((item) => {
11297
- if (extractStructTagFromType(item.type).name === `DlmmEventEarnedRewards`) {
11297
+ if (extractStructTagFromType(item.type).name === `EventEarnedRewards`) {
11298
11298
  out.position_id = item.parsedJson.position_id;
11299
- out.reward = [item.parsedJson.reward];
11299
+ out.reward = [item.parsedJson.reward.name];
11300
11300
  out.amount = [item.parsedJson.amount];
11301
- } else if (extractStructTagFromType(item.type).name === `DlmmEventEarnedRewards2`) {
11301
+ } else if (extractStructTagFromType(item.type).name === `EventEarnedRewards2`) {
11302
11302
  out.position_id = item.parsedJson.position_id;
11303
- out.reward = [item.parsedJson.reward1, item.parsedJson.reward2];
11303
+ out.reward = [item.parsedJson.reward1.name, item.parsedJson.reward2.name];
11304
11304
  out.amount = [item.parsedJson.amount1, item.parsedJson.amount2];
11305
11305
  } else if (extractStructTagFromType(item.type).name === `EventEarnedRewards3`) {
11306
11306
  out.position_id = item.parsedJson.position_id;
11307
- out.reward = [item.parsedJson.reward1, item.parsedJson.reward2, item.parsedJson.reward3];
11307
+ out.reward = [item.parsedJson.reward1.name, item.parsedJson.reward2.name, item.parsedJson.reward3.name];
11308
11308
  out.amount = [item.parsedJson.amount1, item.parsedJson.amount2, item.parsedJson.amount3];
11309
11309
  }
11310
11310
  });