@magmaprotocol/magma-clmm-sdk 0.5.95 → 0.5.96
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 +14 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10434,13 +10434,22 @@ var DlmmModule = class {
|
|
|
10434
10434
|
}
|
|
10435
10435
|
async getPoolInfo(pools) {
|
|
10436
10436
|
const objects = await this._sdk.fullClient.batchGetObjects(pools, { showContent: true });
|
|
10437
|
+
const cachePoolList = [];
|
|
10438
|
+
pools = pools.filter((poolID) => {
|
|
10439
|
+
const cacheData = this.getCache(`${poolID}_getPoolObject`, false);
|
|
10440
|
+
if (cacheData !== void 0) {
|
|
10441
|
+
cachePoolList.push(cacheData);
|
|
10442
|
+
return false;
|
|
10443
|
+
}
|
|
10444
|
+
return true;
|
|
10445
|
+
});
|
|
10437
10446
|
const poolList = [];
|
|
10438
10447
|
objects.forEach((obj) => {
|
|
10439
10448
|
if (obj.error != null || obj.data?.content?.dataType !== "moveObject") {
|
|
10440
10449
|
throw new ClmmpoolsError(`Invalid objects. error: ${obj.error}`, "InvalidType" /* InvalidType */);
|
|
10441
10450
|
}
|
|
10442
10451
|
const fields = getObjectFields(obj);
|
|
10443
|
-
|
|
10452
|
+
const poolInfo = {
|
|
10444
10453
|
pool_id: fields.id.id,
|
|
10445
10454
|
bin_step: fields.bin_step,
|
|
10446
10455
|
coin_a: fields.x.fields.name,
|
|
@@ -10451,9 +10460,11 @@ var DlmmModule = class {
|
|
|
10451
10460
|
real_bin_id: get_real_id(fields.params.fields.active_index),
|
|
10452
10461
|
coinAmountA: fields.reserve_x,
|
|
10453
10462
|
coinAmountB: fields.reserve_y
|
|
10454
|
-
}
|
|
10463
|
+
};
|
|
10464
|
+
poolList.push(poolInfo);
|
|
10465
|
+
this.updateCache(`${fields.id.id}_getPoolObject`, poolList, cacheTime24h);
|
|
10455
10466
|
});
|
|
10456
|
-
return poolList;
|
|
10467
|
+
return [...cachePoolList, ...poolList];
|
|
10457
10468
|
}
|
|
10458
10469
|
// eg: fetch pool active_index
|
|
10459
10470
|
async fetchPairParams(params) {
|
|
@@ -11079,7 +11090,6 @@ var DlmmModule = class {
|
|
|
11079
11090
|
poolMap.add(item.pool);
|
|
11080
11091
|
}
|
|
11081
11092
|
const poolList = await this.getPoolInfo(Array.from(poolMap));
|
|
11082
|
-
this.updateCache(`${DlmmScript}_positionList_poolList`, poolList, cacheTime24h);
|
|
11083
11093
|
const _params = [];
|
|
11084
11094
|
for (const pool of poolList) {
|
|
11085
11095
|
_params.push({
|