@magmaprotocol/magma-clmm-sdk 0.5.28 → 0.5.30
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 +76 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7306,23 +7306,27 @@ var LockModule = class {
|
|
|
7306
7306
|
}
|
|
7307
7307
|
});
|
|
7308
7308
|
for (const item of ownerRes.data) {
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7309
|
+
try {
|
|
7310
|
+
const { fields } = item.data.content;
|
|
7311
|
+
const aLockSummary = await this.aLockSummary(fields.id.id);
|
|
7312
|
+
const lockInfo = {
|
|
7313
|
+
lock_id: fields.id.id,
|
|
7314
|
+
amount: fields.amount,
|
|
7315
|
+
start: fields.start,
|
|
7316
|
+
end: fields.end,
|
|
7317
|
+
permanent: fields.permanent,
|
|
7318
|
+
rebase_amount: {
|
|
7319
|
+
kind: "rebaseCoin" /* RebaseCoin */,
|
|
7320
|
+
token_addr: magma_token,
|
|
7321
|
+
amount: aLockSummary.reward_distributor_claimable
|
|
7322
|
+
},
|
|
7323
|
+
voting_power: aLockSummary.voting_power,
|
|
7324
|
+
voting_rewards: /* @__PURE__ */ new Map()
|
|
7325
|
+
};
|
|
7326
|
+
locksInfo.lockInfo.push(lockInfo);
|
|
7327
|
+
} catch (error) {
|
|
7328
|
+
console.error("fastLocksOfUser error", error);
|
|
7329
|
+
}
|
|
7326
7330
|
}
|
|
7327
7331
|
return locksInfo;
|
|
7328
7332
|
}
|
|
@@ -7337,61 +7341,65 @@ var LockModule = class {
|
|
|
7337
7341
|
}
|
|
7338
7342
|
});
|
|
7339
7343
|
for (const item of ownerRes.data) {
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
votingRewards.
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7344
|
+
try {
|
|
7345
|
+
const { fields } = item.data.content;
|
|
7346
|
+
const aLockSummary = await this.aLockSummary(fields.id.id);
|
|
7347
|
+
const poolIncentiveTokens = await this.getVotingBribeRewardTokens(fields.id.id);
|
|
7348
|
+
const poolFeeTokens = await this.getVotingFeeRewardTokens(fields.id.id);
|
|
7349
|
+
const incentiveTokens = [];
|
|
7350
|
+
poolIncentiveTokens.forEach((value, key) => {
|
|
7351
|
+
incentiveTokens.push(...value);
|
|
7352
|
+
});
|
|
7353
|
+
const feeTokens = [];
|
|
7354
|
+
poolFeeTokens.forEach((value, key) => {
|
|
7355
|
+
feeTokens.push(...value);
|
|
7356
|
+
});
|
|
7357
|
+
const poolIncentiveRewards = await this.getPoolIncentiveRewards(fields.id.id, incentiveTokens);
|
|
7358
|
+
const votingRewards = /* @__PURE__ */ new Map();
|
|
7359
|
+
poolIncentiveRewards.forEach((value, coin) => {
|
|
7360
|
+
value.forEach((amount, pool) => {
|
|
7361
|
+
if (!votingRewards.has(pool)) {
|
|
7362
|
+
votingRewards.set(pool, []);
|
|
7363
|
+
}
|
|
7364
|
+
votingRewards.get(pool)?.push({
|
|
7365
|
+
kind: "incentiveCoin" /* Incentive */,
|
|
7366
|
+
token_addr: coin,
|
|
7367
|
+
amount: amount.toString()
|
|
7368
|
+
});
|
|
7363
7369
|
});
|
|
7364
7370
|
});
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7371
|
+
const poolFeeRewards = await this.getPoolFeeRewards(fields.id.id, feeTokens);
|
|
7372
|
+
poolFeeRewards.forEach((value, coin) => {
|
|
7373
|
+
value.forEach((amount, pool) => {
|
|
7374
|
+
if (!votingRewards.has(pool)) {
|
|
7375
|
+
votingRewards.set(pool, []);
|
|
7376
|
+
}
|
|
7377
|
+
votingRewards.get(pool)?.push({
|
|
7378
|
+
kind: "fee" /* Fee */,
|
|
7379
|
+
token_addr: coin,
|
|
7380
|
+
amount: amount.toString()
|
|
7381
|
+
});
|
|
7376
7382
|
});
|
|
7377
7383
|
});
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7384
|
+
const lockInfo = {
|
|
7385
|
+
lock_id: fields.id.id,
|
|
7386
|
+
amount: fields.amount,
|
|
7387
|
+
start: fields.start,
|
|
7388
|
+
end: fields.end,
|
|
7389
|
+
permanent: fields.permanent,
|
|
7390
|
+
rebase_amount: {
|
|
7391
|
+
kind: "rebaseCoin" /* RebaseCoin */,
|
|
7392
|
+
token_addr: magma_token,
|
|
7393
|
+
amount: aLockSummary.reward_distributor_claimable
|
|
7394
|
+
},
|
|
7395
|
+
voting_power: aLockSummary.voting_power,
|
|
7396
|
+
// pool => incentive/fee => amount
|
|
7397
|
+
voting_rewards: votingRewards
|
|
7398
|
+
};
|
|
7399
|
+
locksInfo.lockInfo.push(lockInfo);
|
|
7400
|
+
} catch (error) {
|
|
7401
|
+
console.error("locksOfUser error", error);
|
|
7402
|
+
}
|
|
7395
7403
|
}
|
|
7396
7404
|
return locksInfo;
|
|
7397
7405
|
}
|