@magmaprotocol/magma-clmm-sdk 0.5.111 → 0.5.113
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 +8 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11083,6 +11083,27 @@ 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
|
+
const type = extractStructTagFromType(ownerRes.data.type);
|
|
11099
|
+
if (type.full_address === this.buildPositionType()) {
|
|
11100
|
+
const position = this.buildPosition(ownerRes.data);
|
|
11101
|
+
const cacheKey = `${position.pos_object_id}_getPositionList`;
|
|
11102
|
+
this.updateCache(cacheKey, position, cacheTime24h);
|
|
11103
|
+
allPosition.push(position);
|
|
11104
|
+
}
|
|
11105
|
+
return await this.getUserPositionInfo(allPosition);
|
|
11106
|
+
}
|
|
11086
11107
|
/**
|
|
11087
11108
|
* Gets a list of positions for the given account address.
|
|
11088
11109
|
* @param accountAddress The account address to get positions for.
|
|
@@ -11111,6 +11132,9 @@ var AlmmModule = class {
|
|
|
11111
11132
|
}
|
|
11112
11133
|
}
|
|
11113
11134
|
}
|
|
11135
|
+
return this.getUserPositionInfo(allPosition);
|
|
11136
|
+
}
|
|
11137
|
+
async getUserPositionInfo(allPosition) {
|
|
11114
11138
|
const poolMap = /* @__PURE__ */ new Set();
|
|
11115
11139
|
for (const item of allPosition) {
|
|
11116
11140
|
poolMap.add(item.pool);
|