@magmaprotocol/magma-clmm-sdk 0.5.95 → 0.5.97

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
@@ -10646,6 +10646,15 @@ var DlmmModule = class {
10646
10646
  return this._sdk;
10647
10647
  }
10648
10648
  async getPoolInfo(pools) {
10649
+ const cachePoolList = [];
10650
+ pools = pools.filter((poolID) => {
10651
+ const cacheData = this.getCache(`${poolID}_getPoolObject`, false);
10652
+ if (cacheData !== void 0) {
10653
+ cachePoolList.push(cacheData);
10654
+ return false;
10655
+ }
10656
+ return true;
10657
+ });
10649
10658
  const objects = await this._sdk.fullClient.batchGetObjects(pools, { showContent: true });
10650
10659
  const poolList = [];
10651
10660
  objects.forEach((obj) => {
@@ -10653,7 +10662,7 @@ var DlmmModule = class {
10653
10662
  throw new ClmmpoolsError(`Invalid objects. error: ${obj.error}`, "InvalidType" /* InvalidType */);
10654
10663
  }
10655
10664
  const fields = getObjectFields(obj);
10656
- poolList.push({
10665
+ const poolInfo = {
10657
10666
  pool_id: fields.id.id,
10658
10667
  bin_step: fields.bin_step,
10659
10668
  coin_a: fields.x.fields.name,
@@ -10664,9 +10673,11 @@ var DlmmModule = class {
10664
10673
  real_bin_id: (0, import_calc_dlmm3.get_real_id)(fields.params.fields.active_index),
10665
10674
  coinAmountA: fields.reserve_x,
10666
10675
  coinAmountB: fields.reserve_y
10667
- });
10676
+ };
10677
+ poolList.push(poolInfo);
10678
+ this.updateCache(`${fields.id.id}_getPoolObject`, poolInfo, cacheTime24h);
10668
10679
  });
10669
- return poolList;
10680
+ return [...cachePoolList, ...poolList];
10670
10681
  }
10671
10682
  // eg: fetch pool active_index
10672
10683
  async fetchPairParams(params) {
@@ -11292,7 +11303,6 @@ var DlmmModule = class {
11292
11303
  poolMap.add(item.pool);
11293
11304
  }
11294
11305
  const poolList = await this.getPoolInfo(Array.from(poolMap));
11295
- this.updateCache(`${DlmmScript}_positionList_poolList`, poolList, cacheTime24h);
11296
11306
  const _params = [];
11297
11307
  for (const pool of poolList) {
11298
11308
  _params.push({