@magmaprotocol/magma-clmm-sdk 0.5.111 → 0.5.112

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
@@ -11083,6 +11083,29 @@ var AlmmModule = class {
11083
11083
  // contractPool: pool,
11084
11084
  // }
11085
11085
  // }
11086
+ /**
11087
+ * Gets a list of positions for the given account address.
11088
+ * @param positionId The account address to get positions for.
11089
+ * @param assignPoolIds An array of pool IDs to filter the positions by.
11090
+ * @returns array of Position objects.
11091
+ */
11092
+ async getUserPositionById(positionId, showDisplay = true) {
11093
+ let allPosition = [];
11094
+ const ownerRes = await this._sdk.fullClient.getObject({
11095
+ id: positionId,
11096
+ options: { showContent: true, showType: true, showDisplay, showOwner: true }
11097
+ });
11098
+ for (const item of ownerRes.data) {
11099
+ const type = extractStructTagFromType(item.data.type);
11100
+ if (type.full_address === this.buildPositionType()) {
11101
+ const position = this.buildPosition(item);
11102
+ const cacheKey = `${position.pos_object_id}_getPositionList`;
11103
+ this.updateCache(cacheKey, position, cacheTime24h);
11104
+ allPosition.push(position);
11105
+ }
11106
+ }
11107
+ return await this.getUserPositionInfo(allPosition);
11108
+ }
11086
11109
  /**
11087
11110
  * Gets a list of positions for the given account address.
11088
11111
  * @param accountAddress The account address to get positions for.
@@ -11111,6 +11134,9 @@ var AlmmModule = class {
11111
11134
  }
11112
11135
  }
11113
11136
  }
11137
+ return this.getUserPositionInfo(allPosition);
11138
+ }
11139
+ async getUserPositionInfo(allPosition) {
11114
11140
  const poolMap = /* @__PURE__ */ new Set();
11115
11141
  for (const item of allPosition) {
11116
11142
  poolMap.add(item.pool);