@magmaprotocol/magma-clmm-sdk 0.5.90 → 0.5.92

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.d.ts CHANGED
@@ -3795,11 +3795,13 @@ declare class DlmmModule implements IModule {
3795
3795
  private buildPosition;
3796
3796
  private getPoolCoins;
3797
3797
  private buildPositionType;
3798
- getPositionLiquidity(params: GetPositionLiquidityParams[]): Promise<EventPositionLiquidity[]>;
3798
+ getPositionsLiquidityLimit(params: GetPositionLiquidityParams[]): Promise<EventPositionLiquidity[]>;
3799
+ private getPositionsLiquidity;
3799
3800
  private _getPositionLiquidity;
3800
3801
  private _parsePositionLiquidity;
3801
3802
  getPairLiquidity(params: GetPairLiquidityParams): Promise<EventPairLiquidity>;
3802
- getEarnedFees(params: DlmmCollectFeeParams[]): Promise<DlmmEventEarnedFees[]>;
3803
+ getEarnedFeesLimit(params: DlmmCollectFeeParams[]): Promise<DlmmEventEarnedFees[]>;
3804
+ private getEarnedFees;
3803
3805
  private _getEarnedFees;
3804
3806
  private _parseEarnedFees;
3805
3807
  getEarnedRewards(params: DlmmRewardsParams[]): Promise<DlmmEventEarnedRewards[]>;
package/dist/index.js CHANGED
@@ -10684,7 +10684,7 @@ var DlmmModule = class {
10684
10684
  sender: simulationAccount.address
10685
10685
  });
10686
10686
  if (simulateRes.error != null) {
10687
- throw new Error(`fetchBins error code: ${simulateRes.error ?? "unknown error"}`);
10687
+ throw new Error(`fetchPairParams error code: ${simulateRes.error ?? "unknown error"}`);
10688
10688
  }
10689
10689
  let res = {
10690
10690
  base_factor: 0,
@@ -11183,7 +11183,7 @@ var DlmmModule = class {
11183
11183
  sender: simulationAccount.address
11184
11184
  });
11185
11185
  if (simulateRes.error != null) {
11186
- throw new Error(`fetchBins error code: ${simulateRes.error ?? "unknown error"}`);
11186
+ throw new Error(`swap code: ${simulateRes.error ?? "unknown error"}`);
11187
11187
  }
11188
11188
  let res = [];
11189
11189
  simulateRes.events?.forEach((item) => {
@@ -11279,7 +11279,7 @@ var DlmmModule = class {
11279
11279
  const cacheKey = `${position.pos_object_id}_getPositionList`;
11280
11280
  this.updateCache(cacheKey, position, cacheTime24h);
11281
11281
  if (hasAssignPoolIds) {
11282
- if (assignPoolIds.includes(position.pool)) {
11282
+ if (assignPoolIds.includes(position.pos_object_id)) {
11283
11283
  allPosition.push(position);
11284
11284
  }
11285
11285
  } else {
@@ -11330,9 +11330,9 @@ var DlmmModule = class {
11330
11330
  coin_b: pool.coin_b
11331
11331
  });
11332
11332
  }
11333
- const positionsLiquidity = await this.getPositionLiquidity(positionLiquidityParams);
11333
+ const positionsLiquidity = await this.getPositionsLiquidityLimit(positionLiquidityParams);
11334
11334
  const positionsRewards = await this.getEarnedRewards(dlmmRewardsParams);
11335
- const positionsFees = await this.getEarnedFees(dlmmCollectFeeParams);
11335
+ const positionsFees = await this.getEarnedFeesLimit(dlmmCollectFeeParams);
11336
11336
  const out = [];
11337
11337
  for (let i = 0; i < allPosition.length; i++) {
11338
11338
  const item = allPosition[i];
@@ -11381,7 +11381,21 @@ var DlmmModule = class {
11381
11381
  buildPositionType() {
11382
11382
  return `${this._sdk.sdkOptions.dlmm_pool.package_id}::dlmm_position::Position`;
11383
11383
  }
11384
- async getPositionLiquidity(params) {
11384
+ async getPositionsLiquidityLimit(params) {
11385
+ const out = [];
11386
+ const limit = 2;
11387
+ for (let i = 0; i < params.length; i += limit) {
11388
+ if (i + limit >= params.length) {
11389
+ const res2 = await this.getPositionsLiquidity(params.slice(i, params.length));
11390
+ out.push(...res2);
11391
+ return out;
11392
+ }
11393
+ const res = await this.getPositionsLiquidity(params.slice(i, i + limit));
11394
+ out.push(...res);
11395
+ }
11396
+ return out;
11397
+ }
11398
+ async getPositionsLiquidity(params) {
11385
11399
  let tx = new import_transactions12.Transaction();
11386
11400
  for (const param of params) {
11387
11401
  tx = await this._getPositionLiquidity(param, tx);
@@ -11407,7 +11421,7 @@ var DlmmModule = class {
11407
11421
  sender: simulationAccount.address
11408
11422
  });
11409
11423
  if (simulateRes.error != null) {
11410
- throw new Error(`fetchBins error code: ${simulateRes.error ?? "unknown error"}`);
11424
+ throw new Error(`fetchPositionLiquidity error code: ${simulateRes.error ?? "unknown error"}`);
11411
11425
  }
11412
11426
  const out = [];
11413
11427
  simulateRes.events?.forEach((item) => {
@@ -11442,7 +11456,7 @@ var DlmmModule = class {
11442
11456
  sender: simulationAccount.address
11443
11457
  });
11444
11458
  if (simulateRes.error != null) {
11445
- throw new Error(`fetchBins error code: ${simulateRes.error ?? "unknown error"}`);
11459
+ throw new Error(`getPairLiquidity error code: ${simulateRes.error ?? "unknown error"}`);
11446
11460
  }
11447
11461
  const out = {
11448
11462
  shares: 0,
@@ -11466,7 +11480,22 @@ var DlmmModule = class {
11466
11480
  });
11467
11481
  return out;
11468
11482
  }
11483
+ async getEarnedFeesLimit(params) {
11484
+ const out = [];
11485
+ const limit = 2;
11486
+ for (let i = 0; i < params.length; i += limit) {
11487
+ if (i + limit >= params.length) {
11488
+ const res2 = await this.getEarnedFees(params.slice(i, params.length));
11489
+ out.push(...res2);
11490
+ return out;
11491
+ }
11492
+ const res = await this.getEarnedFees(params.slice(i, i + limit));
11493
+ out.push(...res);
11494
+ }
11495
+ return out;
11496
+ }
11469
11497
  async getEarnedFees(params) {
11498
+ console.log("############ params: ", params);
11470
11499
  let tx = new import_transactions12.Transaction();
11471
11500
  for (const param of params) {
11472
11501
  tx = await this._getEarnedFees(param, tx);
@@ -11566,6 +11595,7 @@ var DlmmModule = class {
11566
11595
  }
11567
11596
  // return pool_id => reward_tokens
11568
11597
  async getPairRewarders(params) {
11598
+ params = [params[0]];
11569
11599
  let tx = new import_transactions12.Transaction();
11570
11600
  for (const param of params) {
11571
11601
  tx = await this._getPairRewarders(param, tx);
@@ -11592,7 +11622,7 @@ var DlmmModule = class {
11592
11622
  });
11593
11623
  const out = /* @__PURE__ */ new Map();
11594
11624
  if (simulateRes.error != null) {
11595
- throw new Error(`fetchBins error code: ${simulateRes.error ?? "unknown error"}`);
11625
+ throw new Error(`getPairReward error code: ${simulateRes.error ?? "unknown error"}`);
11596
11626
  }
11597
11627
  simulateRes.events?.forEach((item) => {
11598
11628
  if (extractStructTagFromType(item.type).name === `EventPairRewardTypes`) {