@magmaprotocol/magma-clmm-sdk 0.5.16 → 0.5.18
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 +42 -20
- package/dist/index.js +45 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7638,7 +7638,7 @@ var LockModule = class {
|
|
|
7638
7638
|
sender: simulationAccount.address
|
|
7639
7639
|
});
|
|
7640
7640
|
if (simulateRes.error != null) {
|
|
7641
|
-
throw new Error(`
|
|
7641
|
+
throw new Error(`getPoolBribeRewardTokens error code: ${simulateRes.error ?? "unknown error"}`);
|
|
7642
7642
|
}
|
|
7643
7643
|
const poolBirbeRewardTokens = /* @__PURE__ */ new Map();
|
|
7644
7644
|
simulateRes.events?.forEach((item) => {
|
|
@@ -9072,6 +9072,7 @@ var GaugeModule = class {
|
|
|
9072
9072
|
const stakedPositionOfPool = await this.getUserStakedPositionInfoOfPool(userAddr, pool, gauger, coins[0], coins[1]);
|
|
9073
9073
|
console.log("stakedPositionOfPool", stakedPositionOfPool);
|
|
9074
9074
|
stakedPositionOfPool.forEach((value) => {
|
|
9075
|
+
;
|
|
9075
9076
|
value.infos.forEach((info) => {
|
|
9076
9077
|
res.push({
|
|
9077
9078
|
coin_type_a: coins[0],
|
|
@@ -9189,6 +9190,49 @@ var GaugeModule = class {
|
|
|
9189
9190
|
});
|
|
9190
9191
|
return res;
|
|
9191
9192
|
}
|
|
9193
|
+
async getRewardByPosition(params) {
|
|
9194
|
+
const tx = new Transaction11();
|
|
9195
|
+
const { integrate } = this.sdk.sdkOptions;
|
|
9196
|
+
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
|
|
9197
|
+
const typeArguments = [params.coinTypeA, params.coinTypeB, magma_token];
|
|
9198
|
+
const args = [tx.object(params.gaugeId), tx.object(params.poolId), tx.object(params.positionId), tx.object(CLOCK_ADDRESS)];
|
|
9199
|
+
tx.moveCall({
|
|
9200
|
+
target: `${integrate.published_at}::${Gauge}::get_reward_by_position`,
|
|
9201
|
+
arguments: args,
|
|
9202
|
+
typeArguments
|
|
9203
|
+
});
|
|
9204
|
+
return tx;
|
|
9205
|
+
}
|
|
9206
|
+
async getEpochRewardByPool(pool, incentive_tokens) {
|
|
9207
|
+
const tx = new Transaction11();
|
|
9208
|
+
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
9209
|
+
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
|
|
9210
|
+
const typeArguments = [magma_token, ...incentive_tokens];
|
|
9211
|
+
const args = [tx.object(voter_id), tx.object(pool), tx.object(CLOCK_ADDRESS)];
|
|
9212
|
+
let targetFunc = `${integrate.published_at}::${Voter}::epoch_reward_by_pool${incentive_tokens.length}`;
|
|
9213
|
+
if (incentive_tokens.length === 1) {
|
|
9214
|
+
targetFunc = `${integrate.published_at}::${Voter}::epoch_reward_by_pool`;
|
|
9215
|
+
}
|
|
9216
|
+
tx.moveCall({
|
|
9217
|
+
target: targetFunc,
|
|
9218
|
+
arguments: args,
|
|
9219
|
+
typeArguments
|
|
9220
|
+
});
|
|
9221
|
+
const simulateRes = await this.sdk.fullClient.devInspectTransactionBlock({
|
|
9222
|
+
transactionBlock: tx,
|
|
9223
|
+
sender: simulationAccount.address
|
|
9224
|
+
});
|
|
9225
|
+
if (simulateRes.error != null) {
|
|
9226
|
+
throw new Error(`getEpochRewardByPool error code: ${simulateRes.error ?? "unknown error"}`);
|
|
9227
|
+
}
|
|
9228
|
+
const res = /* @__PURE__ */ new Map();
|
|
9229
|
+
simulateRes.events?.forEach((item) => {
|
|
9230
|
+
if (extractStructTagFromType(item.type).name === `EventPoolIncentivesAmount`) {
|
|
9231
|
+
res.set(item.parsedJson.token, item.parsedJson.amount);
|
|
9232
|
+
}
|
|
9233
|
+
});
|
|
9234
|
+
return res;
|
|
9235
|
+
}
|
|
9192
9236
|
};
|
|
9193
9237
|
|
|
9194
9238
|
// src/sdk.ts
|