@magmaprotocol/magma-clmm-sdk 0.5.7 → 0.5.8
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 +2 -0
- package/dist/index.js +86 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1318,6 +1318,7 @@ type MagmaConfigs = {
|
|
|
1318
1318
|
voting_escrow_id: SuiObjectIdType;
|
|
1319
1319
|
magma_token: SuiAddressType;
|
|
1320
1320
|
reward_distributor_id: SuiObjectIdType;
|
|
1321
|
+
distribution_cfg: SuiObjectIdType;
|
|
1321
1322
|
minter_id: SuiObjectIdType;
|
|
1322
1323
|
};
|
|
1323
1324
|
/**
|
|
@@ -3045,6 +3046,7 @@ declare class LockModule implements IModule {
|
|
|
3045
3046
|
pokePayload(params: PokeParams): Promise<Transaction>;
|
|
3046
3047
|
claimVotingBribe(locks: string[], incentive_tokens: string[]): Promise<Transaction>;
|
|
3047
3048
|
locksOfUser(user: string): Promise<LocksInfo>;
|
|
3049
|
+
aLockInfo(lockId: string): Promise<LockInfo>;
|
|
3048
3050
|
aLockSummary(lock_id: string): Promise<ALockSummary>;
|
|
3049
3051
|
allLockSummary(): Promise<AllLockSummary>;
|
|
3050
3052
|
poolWeights(pools: string[]): Promise<PoolWeight[]>;
|
package/dist/index.js
CHANGED
|
@@ -3219,7 +3219,7 @@ var _TransactionUtil = class {
|
|
|
3219
3219
|
tx.setSender(sdk.senderAddress);
|
|
3220
3220
|
tx.setGasBudget(1e8);
|
|
3221
3221
|
const { integrate } = sdk.sdkOptions;
|
|
3222
|
-
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(sdk.sdkOptions.magma_config);
|
|
3222
|
+
const { distribution_cfg, voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(sdk.sdkOptions.magma_config);
|
|
3223
3223
|
const typeArguments = [magma_token];
|
|
3224
3224
|
const functionName = "vote";
|
|
3225
3225
|
const pools = tx.pure.vector("id", params.pools);
|
|
@@ -3227,7 +3227,15 @@ var _TransactionUtil = class {
|
|
|
3227
3227
|
elements: params.weights.map((weight) => tx.pure.u64(weight)),
|
|
3228
3228
|
type: "u64"
|
|
3229
3229
|
});
|
|
3230
|
-
const args = [
|
|
3230
|
+
const args = [
|
|
3231
|
+
tx.object(distribution_cfg),
|
|
3232
|
+
tx.object(voter_id),
|
|
3233
|
+
tx.object(voting_escrow_id),
|
|
3234
|
+
tx.object(params.lockId),
|
|
3235
|
+
pools,
|
|
3236
|
+
weights,
|
|
3237
|
+
tx.object(CLOCK_ADDRESS)
|
|
3238
|
+
];
|
|
3231
3239
|
tx.moveCall({
|
|
3232
3240
|
target: `${integrate.published_at}::${Voter}::${functionName}`,
|
|
3233
3241
|
typeArguments,
|
|
@@ -3289,10 +3297,16 @@ var _TransactionUtil = class {
|
|
|
3289
3297
|
const tx = new import_transactions.Transaction();
|
|
3290
3298
|
tx.setSender(sdk.senderAddress);
|
|
3291
3299
|
const { integrate } = sdk.sdkOptions;
|
|
3292
|
-
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(sdk.sdkOptions.magma_config);
|
|
3300
|
+
const { distribution_cfg, voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(sdk.sdkOptions.magma_config);
|
|
3293
3301
|
const typeArguments = [magma_token];
|
|
3294
3302
|
const functionName = "poke";
|
|
3295
|
-
const args = [
|
|
3303
|
+
const args = [
|
|
3304
|
+
tx.object(distribution_cfg),
|
|
3305
|
+
tx.object(voter_id),
|
|
3306
|
+
tx.object(voting_escrow_id),
|
|
3307
|
+
tx.object(params.lockId),
|
|
3308
|
+
tx.object(CLOCK_ADDRESS)
|
|
3309
|
+
];
|
|
3296
3310
|
tx.moveCall({
|
|
3297
3311
|
target: `${integrate.published_at}::${Voter}::${functionName}`,
|
|
3298
3312
|
typeArguments,
|
|
@@ -7491,6 +7505,62 @@ var LockModule = class {
|
|
|
7491
7505
|
}
|
|
7492
7506
|
return locksInfo;
|
|
7493
7507
|
}
|
|
7508
|
+
async aLockInfo(lockId) {
|
|
7509
|
+
const aLockSummary = await this.aLockSummary(lockId);
|
|
7510
|
+
const lockObj = await this._sdk.fullClient.getObject({
|
|
7511
|
+
id: lockId,
|
|
7512
|
+
options: {
|
|
7513
|
+
showContent: true,
|
|
7514
|
+
showDisplay: true,
|
|
7515
|
+
showOwner: true,
|
|
7516
|
+
showPreviousTransaction: true,
|
|
7517
|
+
showStorageRebate: true,
|
|
7518
|
+
showType: true
|
|
7519
|
+
}
|
|
7520
|
+
});
|
|
7521
|
+
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
|
|
7522
|
+
const poolIncentiveTokens = await this.getVotingBribeRewardTokens(lockId);
|
|
7523
|
+
const incentiveTokens = [];
|
|
7524
|
+
poolIncentiveTokens.forEach((value, key) => {
|
|
7525
|
+
incentiveTokens.push(...value);
|
|
7526
|
+
});
|
|
7527
|
+
const poolIncentiveRewards = await this.getPoolIncentiveRewrads(incentiveTokens, lockId);
|
|
7528
|
+
const votingRewards = /* @__PURE__ */ new Map();
|
|
7529
|
+
poolIncentiveRewards.forEach((value, coin) => {
|
|
7530
|
+
value.forEach((amount, pool) => {
|
|
7531
|
+
if (!votingRewards.has(pool)) {
|
|
7532
|
+
votingRewards.set(pool, []);
|
|
7533
|
+
}
|
|
7534
|
+
votingRewards.get(pool)?.push({
|
|
7535
|
+
kind: "incentiveCoin" /* Incentive */,
|
|
7536
|
+
token_addr: coin,
|
|
7537
|
+
amount: amount.toString()
|
|
7538
|
+
});
|
|
7539
|
+
});
|
|
7540
|
+
});
|
|
7541
|
+
if (lockObj.error != null || lockObj.data?.content?.dataType !== "moveObject") {
|
|
7542
|
+
throw new ClmmpoolsError(
|
|
7543
|
+
`getPool error code: ${lockObj.error?.code ?? "unknown error"}, please check config and object id`,
|
|
7544
|
+
"InvalidLockObject" /* InvalidLockObject */
|
|
7545
|
+
);
|
|
7546
|
+
}
|
|
7547
|
+
const fields = getObjectFields(lockObj);
|
|
7548
|
+
const lockInfo = {
|
|
7549
|
+
lock_id: lockId,
|
|
7550
|
+
amount: fields.amount,
|
|
7551
|
+
start: fields.start,
|
|
7552
|
+
end: fields.end,
|
|
7553
|
+
permanent: fields.permanent,
|
|
7554
|
+
rebase_amount: {
|
|
7555
|
+
kind: "rebaseCoin" /* RebaseCoin */,
|
|
7556
|
+
token_addr: magma_token,
|
|
7557
|
+
amount: aLockSummary.reward_distributor_claimable
|
|
7558
|
+
},
|
|
7559
|
+
voting_power: aLockSummary.voting_power,
|
|
7560
|
+
voting_rewards: votingRewards
|
|
7561
|
+
};
|
|
7562
|
+
return lockInfo;
|
|
7563
|
+
}
|
|
7494
7564
|
async aLockSummary(lock_id) {
|
|
7495
7565
|
const tx = new import_transactions9.Transaction();
|
|
7496
7566
|
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
@@ -8841,6 +8911,7 @@ var ConfigModule = class {
|
|
|
8841
8911
|
voter_id: "",
|
|
8842
8912
|
minter_id: "",
|
|
8843
8913
|
reward_distributor_id: "",
|
|
8914
|
+
distribution_cfg: "",
|
|
8844
8915
|
magma_token: "",
|
|
8845
8916
|
voting_escrow_id: ""
|
|
8846
8917
|
};
|
|
@@ -9392,11 +9463,12 @@ var SDKConfig = {
|
|
|
9392
9463
|
launchpad_pools_handle: "0x5e194a8efcf653830daf85a85b52e3ae8f65dc39481d54b2382acda25068375c",
|
|
9393
9464
|
clmm_pools_handle: "0x37f60eb2d9d227949b95da8fea810db3c32d1e1fa8ed87434fc51664f87d83cb",
|
|
9394
9465
|
global_config_id: "0x4f32c00706e7bdbce532acdcfc0afd91b14defd5ffc9e2723a0ce7ed84f5d380",
|
|
9395
|
-
voter_id: "
|
|
9396
|
-
voting_escrow_id: "
|
|
9397
|
-
reward_distributor_id: "
|
|
9398
|
-
|
|
9399
|
-
|
|
9466
|
+
voter_id: "0xe8e0c266602404caa463f85bee4ccf6000c8c2566204a3949400a06857295ceb",
|
|
9467
|
+
voting_escrow_id: "0x143aab8c7c13c58a94d99ae281b4226f1877abc21bc01b9d75b58a7217fc3b2c",
|
|
9468
|
+
reward_distributor_id: "0x93bf24d3db08f93a02ba90abc7095f8d8086e5a1f72bac8bd866df21defe83ab",
|
|
9469
|
+
distribution_cfg: "0x94e23846c975e2faf89a61bfc2b10ad64decab9069eb1f9fc39752b010868c74",
|
|
9470
|
+
magma_token: "0x3abcdefce1a0ec1252237b69efc6dc3881325d543fceaad2e2f360a02d2f5bd9::magma_token::MAGMA_TOKEN",
|
|
9471
|
+
minter_id: "0x92877b638c3febf8576d0d7caebf9a2c43753b2e441669fb434e709458ece345"
|
|
9400
9472
|
}
|
|
9401
9473
|
};
|
|
9402
9474
|
var clmmMainnet = {
|
|
@@ -9415,12 +9487,12 @@ var clmmMainnet = {
|
|
|
9415
9487
|
config: SDKConfig.clmmConfig
|
|
9416
9488
|
},
|
|
9417
9489
|
distribution: {
|
|
9418
|
-
package_id: "
|
|
9419
|
-
published_at: "
|
|
9490
|
+
package_id: "0x3abcdefce1a0ec1252237b69efc6dc3881325d543fceaad2e2f360a02d2f5bd9",
|
|
9491
|
+
published_at: "0x3abcdefce1a0ec1252237b69efc6dc3881325d543fceaad2e2f360a02d2f5bd9"
|
|
9420
9492
|
},
|
|
9421
9493
|
integrate: {
|
|
9422
|
-
package_id: "
|
|
9423
|
-
published_at: "
|
|
9494
|
+
package_id: "0x6e3ae31a16362c563c0fef5293348d262646882a10c307f20f6be8577960f1ef",
|
|
9495
|
+
published_at: "0x6e3ae31a16362c563c0fef5293348d262646882a10c307f20f6be8577960f1ef"
|
|
9424
9496
|
},
|
|
9425
9497
|
deepbook: {
|
|
9426
9498
|
package_id: "0x000000000000000000000000000000000000000000000000000000000000dee9",
|
|
@@ -9464,6 +9536,7 @@ var SDKConfig2 = {
|
|
|
9464
9536
|
voter_id: "0x59571991a5c7041c4376d980061af5c7a6d8345006d6b5167bd1f00fc17b8ddb",
|
|
9465
9537
|
voting_escrow_id: "0x9081c8044719135da4ff2d52907fcd40c19e2a40750cbba4c1d6a59610ae1446",
|
|
9466
9538
|
reward_distributor_id: "0xdf213d8e0ca49c8f4a508e7d3b3a6983c4aafd639f7c99479fc75fb4451d752e",
|
|
9539
|
+
distribution_cfg: "0x94e23846c975e2faf89a61bfc2b10ad64decab9069eb1f9fc39752b010868c74",
|
|
9467
9540
|
magma_token: "0x45ac2371c33ca0df8dc784d62c8ce5126d42edd8c56820396524dff2ae0619b1::magma_token::MAGMA_TOKEN",
|
|
9468
9541
|
minter_id: "0x89435d6b2a510ba50ca23303f10e91ec058f138a88f69a43fe03cd22edb214c5"
|
|
9469
9542
|
}
|