@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.js CHANGED
@@ -2316,28 +2316,28 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
2316
2316
  }
2317
2317
  case 2 /* Curve */: {
2318
2318
  if (activeId < minBinId) {
2319
- const weights2 = toWeightDecendingOrder(minBinId, maxBinId);
2320
- res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
2321
- }
2322
- if (activeId > maxBinId) {
2323
- const weights2 = toWeightAscendingOrder(minBinId, maxBinId);
2324
- res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
2319
+ const weights = toWeightDecendingOrder(minBinId, maxBinId);
2320
+ res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2321
+ } else if (activeId > maxBinId) {
2322
+ const weights = toWeightAscendingOrder(minBinId, maxBinId);
2323
+ res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2324
+ } else {
2325
+ const weights = toWeightCurve(minBinId, maxBinId, activeId);
2326
+ res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2325
2327
  }
2326
- const weights = toWeightCurve(minBinId, maxBinId, activeId);
2327
- res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2328
2328
  break;
2329
2329
  }
2330
2330
  case 3 /* BidAsk */: {
2331
2331
  if (activeId < minBinId) {
2332
- const weights2 = toWeightAscendingOrder(minBinId, maxBinId);
2333
- res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
2334
- }
2335
- if (activeId > maxBinId) {
2336
- const weights2 = toWeightDecendingOrder(minBinId, maxBinId);
2337
- res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
2332
+ const weights = toWeightAscendingOrder(minBinId, maxBinId);
2333
+ res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2334
+ } else if (activeId > maxBinId) {
2335
+ const weights = toWeightDecendingOrder(minBinId, maxBinId);
2336
+ res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2337
+ } else {
2338
+ const weights = toWeightBidAsk(minBinId, maxBinId, activeId);
2339
+ res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2338
2340
  }
2339
- const weights = toWeightBidAsk(minBinId, maxBinId, activeId);
2340
- res = toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
2341
2341
  break;
2342
2342
  }
2343
2343
  default:
@@ -11470,10 +11470,10 @@ var DlmmModule = class {
11470
11470
  throw new Error(`fetchPairRewards error code: ${simulateRes.error ?? "unknown error"}`);
11471
11471
  }
11472
11472
  simulateRes.events?.forEach((item) => {
11473
- if (extractStructTagFromType(item.type).name === `EventPositionLiquidity`) {
11473
+ if (extractStructTagFromType(item.type).name === `EventEarnedFees`) {
11474
11474
  out.position_id = item.parsedJson.position_id;
11475
- out.x = item.parsedJson.x;
11476
- out.y = item.parsedJson.y;
11475
+ out.x = item.parsedJson.x.name;
11476
+ out.y = item.parsedJson.y.name;
11477
11477
  out.fee_x = item.parsedJson.fee_x;
11478
11478
  out.fee_y = item.parsedJson.fee_y;
11479
11479
  }
@@ -11507,17 +11507,17 @@ var DlmmModule = class {
11507
11507
  throw new Error(`getEarnedRewards error code: ${simulateRes.error ?? "unknown error"}`);
11508
11508
  }
11509
11509
  simulateRes.events?.forEach((item) => {
11510
- if (extractStructTagFromType(item.type).name === `DlmmEventEarnedRewards`) {
11510
+ if (extractStructTagFromType(item.type).name === `EventEarnedRewards`) {
11511
11511
  out.position_id = item.parsedJson.position_id;
11512
- out.reward = [item.parsedJson.reward];
11512
+ out.reward = [item.parsedJson.reward.name];
11513
11513
  out.amount = [item.parsedJson.amount];
11514
- } else if (extractStructTagFromType(item.type).name === `DlmmEventEarnedRewards2`) {
11514
+ } else if (extractStructTagFromType(item.type).name === `EventEarnedRewards2`) {
11515
11515
  out.position_id = item.parsedJson.position_id;
11516
- out.reward = [item.parsedJson.reward1, item.parsedJson.reward2];
11516
+ out.reward = [item.parsedJson.reward1.name, item.parsedJson.reward2.name];
11517
11517
  out.amount = [item.parsedJson.amount1, item.parsedJson.amount2];
11518
11518
  } else if (extractStructTagFromType(item.type).name === `EventEarnedRewards3`) {
11519
11519
  out.position_id = item.parsedJson.position_id;
11520
- out.reward = [item.parsedJson.reward1, item.parsedJson.reward2, item.parsedJson.reward3];
11520
+ out.reward = [item.parsedJson.reward1.name, item.parsedJson.reward2.name, item.parsedJson.reward3.name];
11521
11521
  out.amount = [item.parsedJson.amount1, item.parsedJson.amount2, item.parsedJson.amount3];
11522
11522
  }
11523
11523
  });