@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.mjs CHANGED
@@ -3016,7 +3016,7 @@ var _TransactionUtil = class {
3016
3016
  tx.setSender(sdk.senderAddress);
3017
3017
  tx.setGasBudget(1e8);
3018
3018
  const { integrate } = sdk.sdkOptions;
3019
- const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(sdk.sdkOptions.magma_config);
3019
+ const { distribution_cfg, voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(sdk.sdkOptions.magma_config);
3020
3020
  const typeArguments = [magma_token];
3021
3021
  const functionName = "vote";
3022
3022
  const pools = tx.pure.vector("id", params.pools);
@@ -3024,7 +3024,15 @@ var _TransactionUtil = class {
3024
3024
  elements: params.weights.map((weight) => tx.pure.u64(weight)),
3025
3025
  type: "u64"
3026
3026
  });
3027
- const args = [tx.object(voter_id), tx.object(voting_escrow_id), tx.object(params.lockId), pools, weights, tx.object(CLOCK_ADDRESS)];
3027
+ const args = [
3028
+ tx.object(distribution_cfg),
3029
+ tx.object(voter_id),
3030
+ tx.object(voting_escrow_id),
3031
+ tx.object(params.lockId),
3032
+ pools,
3033
+ weights,
3034
+ tx.object(CLOCK_ADDRESS)
3035
+ ];
3028
3036
  tx.moveCall({
3029
3037
  target: `${integrate.published_at}::${Voter}::${functionName}`,
3030
3038
  typeArguments,
@@ -3086,10 +3094,16 @@ var _TransactionUtil = class {
3086
3094
  const tx = new Transaction();
3087
3095
  tx.setSender(sdk.senderAddress);
3088
3096
  const { integrate } = sdk.sdkOptions;
3089
- const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(sdk.sdkOptions.magma_config);
3097
+ const { distribution_cfg, voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(sdk.sdkOptions.magma_config);
3090
3098
  const typeArguments = [magma_token];
3091
3099
  const functionName = "poke";
3092
- const args = [tx.object(voter_id), tx.object(voting_escrow_id), tx.object(params.lockId), tx.object(CLOCK_ADDRESS)];
3100
+ const args = [
3101
+ tx.object(distribution_cfg),
3102
+ tx.object(voter_id),
3103
+ tx.object(voting_escrow_id),
3104
+ tx.object(params.lockId),
3105
+ tx.object(CLOCK_ADDRESS)
3106
+ ];
3093
3107
  tx.moveCall({
3094
3108
  target: `${integrate.published_at}::${Voter}::${functionName}`,
3095
3109
  typeArguments,
@@ -7288,6 +7302,62 @@ var LockModule = class {
7288
7302
  }
7289
7303
  return locksInfo;
7290
7304
  }
7305
+ async aLockInfo(lockId) {
7306
+ const aLockSummary = await this.aLockSummary(lockId);
7307
+ const lockObj = await this._sdk.fullClient.getObject({
7308
+ id: lockId,
7309
+ options: {
7310
+ showContent: true,
7311
+ showDisplay: true,
7312
+ showOwner: true,
7313
+ showPreviousTransaction: true,
7314
+ showStorageRebate: true,
7315
+ showType: true
7316
+ }
7317
+ });
7318
+ const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
7319
+ const poolIncentiveTokens = await this.getVotingBribeRewardTokens(lockId);
7320
+ const incentiveTokens = [];
7321
+ poolIncentiveTokens.forEach((value, key) => {
7322
+ incentiveTokens.push(...value);
7323
+ });
7324
+ const poolIncentiveRewards = await this.getPoolIncentiveRewrads(incentiveTokens, lockId);
7325
+ const votingRewards = /* @__PURE__ */ new Map();
7326
+ poolIncentiveRewards.forEach((value, coin) => {
7327
+ value.forEach((amount, pool) => {
7328
+ if (!votingRewards.has(pool)) {
7329
+ votingRewards.set(pool, []);
7330
+ }
7331
+ votingRewards.get(pool)?.push({
7332
+ kind: "incentiveCoin" /* Incentive */,
7333
+ token_addr: coin,
7334
+ amount: amount.toString()
7335
+ });
7336
+ });
7337
+ });
7338
+ if (lockObj.error != null || lockObj.data?.content?.dataType !== "moveObject") {
7339
+ throw new ClmmpoolsError(
7340
+ `getPool error code: ${lockObj.error?.code ?? "unknown error"}, please check config and object id`,
7341
+ "InvalidLockObject" /* InvalidLockObject */
7342
+ );
7343
+ }
7344
+ const fields = getObjectFields(lockObj);
7345
+ const lockInfo = {
7346
+ lock_id: lockId,
7347
+ amount: fields.amount,
7348
+ start: fields.start,
7349
+ end: fields.end,
7350
+ permanent: fields.permanent,
7351
+ rebase_amount: {
7352
+ kind: "rebaseCoin" /* RebaseCoin */,
7353
+ token_addr: magma_token,
7354
+ amount: aLockSummary.reward_distributor_claimable
7355
+ },
7356
+ voting_power: aLockSummary.voting_power,
7357
+ voting_rewards: votingRewards
7358
+ };
7359
+ return lockInfo;
7360
+ }
7291
7361
  async aLockSummary(lock_id) {
7292
7362
  const tx = new Transaction9();
7293
7363
  const { integrate, simulationAccount } = this.sdk.sdkOptions;
@@ -8638,6 +8708,7 @@ var ConfigModule = class {
8638
8708
  voter_id: "",
8639
8709
  minter_id: "",
8640
8710
  reward_distributor_id: "",
8711
+ distribution_cfg: "",
8641
8712
  magma_token: "",
8642
8713
  voting_escrow_id: ""
8643
8714
  };
@@ -9191,11 +9262,12 @@ var SDKConfig = {
9191
9262
  launchpad_pools_handle: "0x5e194a8efcf653830daf85a85b52e3ae8f65dc39481d54b2382acda25068375c",
9192
9263
  clmm_pools_handle: "0x37f60eb2d9d227949b95da8fea810db3c32d1e1fa8ed87434fc51664f87d83cb",
9193
9264
  global_config_id: "0x4f32c00706e7bdbce532acdcfc0afd91b14defd5ffc9e2723a0ce7ed84f5d380",
9194
- voter_id: "0x2e2fae39d85e991e1adad756f6723bb1aebc33140b8b16897a41171640389f88",
9195
- voting_escrow_id: "0x8c300ccc0cb221feb76d0ed0820ff0873477ab1ada266129d594d539c5cd2f11",
9196
- reward_distributor_id: "0x289c10f62e998a2ee58a982262732af7e329b7b689f4c81b0e16de7c6589669c",
9197
- magma_token: "0x4201f44d506036666a1d9166f7a3450a80c73c551a582684cf39f2dbb3d56461::magma_token::MAGMA_TOKEN",
9198
- minter_id: "0xfaf1c9b59192a3f910f28d46325dbfb3ffcc92df43d11663f3820fec8faf540b"
9265
+ voter_id: "0xe8e0c266602404caa463f85bee4ccf6000c8c2566204a3949400a06857295ceb",
9266
+ voting_escrow_id: "0x143aab8c7c13c58a94d99ae281b4226f1877abc21bc01b9d75b58a7217fc3b2c",
9267
+ reward_distributor_id: "0x93bf24d3db08f93a02ba90abc7095f8d8086e5a1f72bac8bd866df21defe83ab",
9268
+ distribution_cfg: "0x94e23846c975e2faf89a61bfc2b10ad64decab9069eb1f9fc39752b010868c74",
9269
+ magma_token: "0x3abcdefce1a0ec1252237b69efc6dc3881325d543fceaad2e2f360a02d2f5bd9::magma_token::MAGMA_TOKEN",
9270
+ minter_id: "0x92877b638c3febf8576d0d7caebf9a2c43753b2e441669fb434e709458ece345"
9199
9271
  }
9200
9272
  };
9201
9273
  var clmmMainnet = {
@@ -9214,12 +9286,12 @@ var clmmMainnet = {
9214
9286
  config: SDKConfig.clmmConfig
9215
9287
  },
9216
9288
  distribution: {
9217
- package_id: "0x4201f44d506036666a1d9166f7a3450a80c73c551a582684cf39f2dbb3d56461",
9218
- published_at: "0x5c008a2e0aee9a034b19e32bbc119cf6e7b1a0ce1316b2199cde1704d9f64f3c"
9289
+ package_id: "0x3abcdefce1a0ec1252237b69efc6dc3881325d543fceaad2e2f360a02d2f5bd9",
9290
+ published_at: "0x3abcdefce1a0ec1252237b69efc6dc3881325d543fceaad2e2f360a02d2f5bd9"
9219
9291
  },
9220
9292
  integrate: {
9221
- package_id: "0x01268a2afbaf91538f0b9041269fe2780273eb83b642abd4fcacad7b660a3711",
9222
- published_at: "0x01268a2afbaf91538f0b9041269fe2780273eb83b642abd4fcacad7b660a3711"
9293
+ package_id: "0x6e3ae31a16362c563c0fef5293348d262646882a10c307f20f6be8577960f1ef",
9294
+ published_at: "0x6e3ae31a16362c563c0fef5293348d262646882a10c307f20f6be8577960f1ef"
9223
9295
  },
9224
9296
  deepbook: {
9225
9297
  package_id: "0x000000000000000000000000000000000000000000000000000000000000dee9",
@@ -9263,6 +9335,7 @@ var SDKConfig2 = {
9263
9335
  voter_id: "0x59571991a5c7041c4376d980061af5c7a6d8345006d6b5167bd1f00fc17b8ddb",
9264
9336
  voting_escrow_id: "0x9081c8044719135da4ff2d52907fcd40c19e2a40750cbba4c1d6a59610ae1446",
9265
9337
  reward_distributor_id: "0xdf213d8e0ca49c8f4a508e7d3b3a6983c4aafd639f7c99479fc75fb4451d752e",
9338
+ distribution_cfg: "0x94e23846c975e2faf89a61bfc2b10ad64decab9069eb1f9fc39752b010868c74",
9266
9339
  magma_token: "0x45ac2371c33ca0df8dc784d62c8ce5126d42edd8c56820396524dff2ae0619b1::magma_token::MAGMA_TOKEN",
9267
9340
  minter_id: "0x89435d6b2a510ba50ca23303f10e91ec058f138a88f69a43fe03cd22edb214c5"
9268
9341
  }