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