@magmaprotocol/magma-clmm-sdk 0.5.19 → 0.5.20
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 +9 -1
- package/dist/index.js +74 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7271,6 +7271,30 @@ var LockModule = class {
|
|
|
7271
7271
|
}
|
|
7272
7272
|
return TransactionUtil.buildClaimVotingBribe(this.sdk, locks, incentive_tokens);
|
|
7273
7273
|
}
|
|
7274
|
+
async claimVotingFeeAndBribeForPool(lockId, poolId, feeTokens, incentiveTokens) {
|
|
7275
|
+
if (feeTokens.length !== 2) {
|
|
7276
|
+
throw Error("feeTokens length must be 2");
|
|
7277
|
+
}
|
|
7278
|
+
if (incentiveTokens.length < 1 || incentiveTokens.length > 3) {
|
|
7279
|
+
throw Error("incentiveTokens length must be between 1 and 3");
|
|
7280
|
+
}
|
|
7281
|
+
const { integrate } = this.sdk.sdkOptions;
|
|
7282
|
+
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
|
|
7283
|
+
const typeArguments = [magma_token, ...feeTokens, ...incentiveTokens];
|
|
7284
|
+
let targetFunc = `${integrate.published_at}::${Voter}::claim_voting_bribes_for_single_pool${incentiveTokens.length}`;
|
|
7285
|
+
if (incentiveTokens.length === 1) {
|
|
7286
|
+
targetFunc = `${integrate.published_at}::${Voter}::claim_voting_bribes_for_single_pool`;
|
|
7287
|
+
}
|
|
7288
|
+
const tx = new Transaction9();
|
|
7289
|
+
tx.setSender(this.sdk.senderAddress);
|
|
7290
|
+
const args = [tx.object(voter_id), tx.object(voting_escrow_id), tx.object(lockId), tx.object(poolId), tx.object(CLOCK_ADDRESS)];
|
|
7291
|
+
tx.moveCall({
|
|
7292
|
+
target: targetFunc,
|
|
7293
|
+
typeArguments,
|
|
7294
|
+
arguments: args
|
|
7295
|
+
});
|
|
7296
|
+
return tx;
|
|
7297
|
+
}
|
|
7274
7298
|
async locksOfUser(user) {
|
|
7275
7299
|
const locksInfo = { owner: user, lockInfo: [] };
|
|
7276
7300
|
const { distribution } = this._sdk.sdkOptions;
|
|
@@ -7752,6 +7776,46 @@ var LockModule = class {
|
|
|
7752
7776
|
});
|
|
7753
7777
|
return poolBirbeRewardTokens;
|
|
7754
7778
|
}
|
|
7779
|
+
async getLockVotingStats(lockId) {
|
|
7780
|
+
const tx = new Transaction9();
|
|
7781
|
+
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
7782
|
+
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
|
|
7783
|
+
const args = [tx.object(voter_id), tx.object(lockId), tx.object(CLOCK_ADDRESS)];
|
|
7784
|
+
const typeArguments = [magma_token];
|
|
7785
|
+
tx.moveCall({
|
|
7786
|
+
target: `${integrate.published_at}::${Voter}::lock_voting_stats`,
|
|
7787
|
+
arguments: args,
|
|
7788
|
+
typeArguments
|
|
7789
|
+
});
|
|
7790
|
+
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
7791
|
+
throw Error("this config simulationAccount is not set right");
|
|
7792
|
+
}
|
|
7793
|
+
const simulateRes = await this.sdk.fullClient.devInspectTransactionBlock({
|
|
7794
|
+
transactionBlock: tx,
|
|
7795
|
+
sender: simulationAccount.address
|
|
7796
|
+
});
|
|
7797
|
+
if (simulateRes.error != null) {
|
|
7798
|
+
console.log(`error code: ${simulateRes.error ?? "unknown error"}`);
|
|
7799
|
+
return null;
|
|
7800
|
+
}
|
|
7801
|
+
let res = {
|
|
7802
|
+
lock_id: lockId,
|
|
7803
|
+
last_voted_at: "",
|
|
7804
|
+
pools: [],
|
|
7805
|
+
votes: []
|
|
7806
|
+
};
|
|
7807
|
+
simulateRes.events?.forEach((item) => {
|
|
7808
|
+
if (extractStructTagFromType(item.type).name === `EventLockVotingStats`) {
|
|
7809
|
+
res = {
|
|
7810
|
+
lock_id: item.parsedJson.lock_id,
|
|
7811
|
+
last_voted_at: item.parsedJson.last_voted_at,
|
|
7812
|
+
pools: item.parsedJson.pools,
|
|
7813
|
+
votes: item.parsedJson.votes
|
|
7814
|
+
};
|
|
7815
|
+
}
|
|
7816
|
+
});
|
|
7817
|
+
return res;
|
|
7818
|
+
}
|
|
7755
7819
|
};
|
|
7756
7820
|
|
|
7757
7821
|
// src/modules/tokenModule.ts
|
|
@@ -9616,12 +9680,12 @@ var SDKConfig = {
|
|
|
9616
9680
|
launchpad_pools_handle: "0x5e194a8efcf653830daf85a85b52e3ae8f65dc39481d54b2382acda25068375c",
|
|
9617
9681
|
clmm_pools_handle: "0x37f60eb2d9d227949b95da8fea810db3c32d1e1fa8ed87434fc51664f87d83cb",
|
|
9618
9682
|
global_config_id: "0x4f32c00706e7bdbce532acdcfc0afd91b14defd5ffc9e2723a0ce7ed84f5d380",
|
|
9619
|
-
voter_id: "
|
|
9620
|
-
voting_escrow_id: "
|
|
9621
|
-
reward_distributor_id: "
|
|
9622
|
-
distribution_cfg: "
|
|
9623
|
-
magma_token: "
|
|
9624
|
-
minter_id: "
|
|
9683
|
+
voter_id: "0xaab0f3a90da96d29d743e09c269e1ae48ec1bae52a28cd38c49c5dc8c1bf92b8",
|
|
9684
|
+
voting_escrow_id: "0x7ab45fbe01da26e07ba21757916d540c8747cf7daa88f3171e13db17373d5adc",
|
|
9685
|
+
reward_distributor_id: "0x9f4f882245e49fd9213278dfbcb63a14fdbdd2ce7e25e9353a0cecdca30de853",
|
|
9686
|
+
distribution_cfg: "0xaff8d151ac29317201151f97d28c546b3c5923d8cfc5499f40dea61c4022c949",
|
|
9687
|
+
magma_token: "0x7161c6c6bb65f852797c8f7f5c4f8d57adaf796e1b840921f9e23fabeadfd54e::magma::MAGMA",
|
|
9688
|
+
minter_id: "0x4fa5766cd83b33b215b139fec27ac344040f3bbd84fcbee7b61fc671aadc51fa"
|
|
9625
9689
|
}
|
|
9626
9690
|
};
|
|
9627
9691
|
var clmmMainnet = {
|
|
@@ -9640,12 +9704,12 @@ var clmmMainnet = {
|
|
|
9640
9704
|
config: SDKConfig.clmmConfig
|
|
9641
9705
|
},
|
|
9642
9706
|
distribution: {
|
|
9643
|
-
package_id: "
|
|
9644
|
-
published_at: "
|
|
9707
|
+
package_id: "0xee4a1f231dc45a303389998fe26c4e39278cf68b404b32e4f0b9769129b8267b",
|
|
9708
|
+
published_at: "0xee4a1f231dc45a303389998fe26c4e39278cf68b404b32e4f0b9769129b8267b"
|
|
9645
9709
|
},
|
|
9646
9710
|
integrate: {
|
|
9647
|
-
package_id: "
|
|
9648
|
-
published_at: "
|
|
9711
|
+
package_id: "0xc08328e57f004fdd16a38c62df1eaba2be4db74fb9680986cd911460692aaf67",
|
|
9712
|
+
published_at: "0xc08328e57f004fdd16a38c62df1eaba2be4db74fb9680986cd911460692aaf67"
|
|
9649
9713
|
},
|
|
9650
9714
|
deepbook: {
|
|
9651
9715
|
package_id: "0x000000000000000000000000000000000000000000000000000000000000dee9",
|