@magmaprotocol/magma-clmm-sdk 0.5.33 → 0.5.35
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/README.md +1 -1
- package/dist/index.d.ts +169 -13
- package/dist/index.js +654 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +653 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
package/dist/index.mjs
CHANGED
|
@@ -303,6 +303,7 @@ var Voter = "voter";
|
|
|
303
303
|
var RewardDistributor = "reward_distributor";
|
|
304
304
|
var Gauge = "gauge";
|
|
305
305
|
var Minter = "minter";
|
|
306
|
+
var DlmmScript = "dlmm_script";
|
|
306
307
|
var CoinInfoAddress = "0x1::coin::CoinInfo";
|
|
307
308
|
var CoinStoreAddress = "0x1::coin::CoinStore";
|
|
308
309
|
var DeepbookCustodianV2Moudle = "custodian_v2";
|
|
@@ -7389,6 +7390,57 @@ var LockModule = class {
|
|
|
7389
7390
|
}
|
|
7390
7391
|
return locksInfo;
|
|
7391
7392
|
}
|
|
7393
|
+
async locksOfUserV2(user) {
|
|
7394
|
+
const locksInfo = { owner: user, lockInfo: [] };
|
|
7395
|
+
const { distribution } = this._sdk.sdkOptions;
|
|
7396
|
+
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
|
|
7397
|
+
const ownerRes = await this._sdk.fullClient.getOwnedObjectsByPage(user, {
|
|
7398
|
+
options: { showType: true, showContent: true, showDisplay: true, showOwner: true },
|
|
7399
|
+
filter: {
|
|
7400
|
+
MatchAll: [{ Package: distribution.package_id }, { StructType: `${distribution.package_id}::voting_escrow::Lock` }]
|
|
7401
|
+
}
|
|
7402
|
+
});
|
|
7403
|
+
const ids = ownerRes.data.map((item) => item.data.content.id.id);
|
|
7404
|
+
const lockSummary = await this.getAllLockSummary(ids);
|
|
7405
|
+
const lockIncentiveTokens = await this.getAllBribeRewardTokensOfLock(ids);
|
|
7406
|
+
const lockFeeTokens = await this.getAllVotingFeeRewardTokens(ids);
|
|
7407
|
+
const poolIncentiveRewards = await this.getAllIncentiveRewards(lockIncentiveTokens);
|
|
7408
|
+
const poolFeeRewards = await this.getAllFeeRewards(lockFeeTokens);
|
|
7409
|
+
for (const item of ownerRes.data) {
|
|
7410
|
+
const { fields } = item.data.content;
|
|
7411
|
+
const lock_id = fields.id.id;
|
|
7412
|
+
const votingRewards = /* @__PURE__ */ new Map();
|
|
7413
|
+
poolIncentiveRewards.get(lock_id)?.forEach((value, pool) => {
|
|
7414
|
+
if (!votingRewards.has(pool)) {
|
|
7415
|
+
votingRewards.set(pool, []);
|
|
7416
|
+
}
|
|
7417
|
+
votingRewards.get(pool)?.push(...value);
|
|
7418
|
+
});
|
|
7419
|
+
poolFeeRewards.get(lock_id)?.forEach((value, pool) => {
|
|
7420
|
+
if (!votingRewards.has(pool)) {
|
|
7421
|
+
votingRewards.set(pool, []);
|
|
7422
|
+
}
|
|
7423
|
+
votingRewards.get(pool)?.push(...value);
|
|
7424
|
+
});
|
|
7425
|
+
const lockInfo = {
|
|
7426
|
+
lock_id,
|
|
7427
|
+
amount: fields.amount,
|
|
7428
|
+
start: fields.start,
|
|
7429
|
+
end: fields.end,
|
|
7430
|
+
permanent: fields.permanent,
|
|
7431
|
+
rebase_amount: {
|
|
7432
|
+
kind: "rebaseCoin" /* RebaseCoin */,
|
|
7433
|
+
token_addr: magma_token,
|
|
7434
|
+
amount: lockSummary.get(lock_id)?.reward_distributor_claimable || "0"
|
|
7435
|
+
},
|
|
7436
|
+
voting_power: lockSummary.get(lock_id)?.voting_power || "0",
|
|
7437
|
+
// pool => incentive/fee => amount
|
|
7438
|
+
voting_rewards: votingRewards
|
|
7439
|
+
};
|
|
7440
|
+
locksInfo.lockInfo.push(lockInfo);
|
|
7441
|
+
}
|
|
7442
|
+
return locksInfo;
|
|
7443
|
+
}
|
|
7392
7444
|
async locksOfUser(user) {
|
|
7393
7445
|
const locksInfo = { owner: user, lockInfo: [] };
|
|
7394
7446
|
const { distribution } = this._sdk.sdkOptions;
|
|
@@ -7581,6 +7633,57 @@ var LockModule = class {
|
|
|
7581
7633
|
});
|
|
7582
7634
|
return res;
|
|
7583
7635
|
}
|
|
7636
|
+
// Return: lock_id => ALockSummary
|
|
7637
|
+
async getAllLockSummary(lock_ids) {
|
|
7638
|
+
let tx = new Transaction9();
|
|
7639
|
+
for (const lock_id of lock_ids) {
|
|
7640
|
+
tx = await this._aLockSummary(lock_id, tx);
|
|
7641
|
+
}
|
|
7642
|
+
return this._parseLockSummary(tx);
|
|
7643
|
+
}
|
|
7644
|
+
async _aLockSummary(lock_id, tx) {
|
|
7645
|
+
tx = tx || new Transaction9();
|
|
7646
|
+
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
7647
|
+
const { voting_escrow_id, magma_token, voter_id, reward_distributor_id } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
|
|
7648
|
+
const typeArguments = [magma_token];
|
|
7649
|
+
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
7650
|
+
throw Error("this config simulationAccount is not set right");
|
|
7651
|
+
}
|
|
7652
|
+
const args = [
|
|
7653
|
+
tx.object(voter_id),
|
|
7654
|
+
tx.object(voting_escrow_id),
|
|
7655
|
+
tx.object(reward_distributor_id),
|
|
7656
|
+
tx.object(lock_id),
|
|
7657
|
+
tx.object(CLOCK_ADDRESS)
|
|
7658
|
+
];
|
|
7659
|
+
tx.moveCall({
|
|
7660
|
+
target: `${integrate.published_at}::${VotingEscrow}::lock_summary`,
|
|
7661
|
+
arguments: args,
|
|
7662
|
+
typeArguments
|
|
7663
|
+
});
|
|
7664
|
+
return tx;
|
|
7665
|
+
}
|
|
7666
|
+
async _parseLockSummary(tx) {
|
|
7667
|
+
const { simulationAccount } = this.sdk.sdkOptions;
|
|
7668
|
+
const simulateRes = await this.sdk.fullClient.devInspectTransactionBlock({
|
|
7669
|
+
transactionBlock: tx,
|
|
7670
|
+
sender: simulationAccount.address
|
|
7671
|
+
});
|
|
7672
|
+
if (simulateRes.error != null) {
|
|
7673
|
+
throw new Error(`lock_summary error code: ${simulateRes.error ?? "unknown error"}`);
|
|
7674
|
+
}
|
|
7675
|
+
const res = /* @__PURE__ */ new Map();
|
|
7676
|
+
simulateRes.events?.forEach((item) => {
|
|
7677
|
+
if (extractStructTagFromType(item.type).name === `LockSummary`) {
|
|
7678
|
+
res.set(item.parsedJson.lock_id, {
|
|
7679
|
+
fee_incentive_total: item.parsedJson.fee_incentive_total,
|
|
7680
|
+
reward_distributor_claimable: item.parsedJson.reward_distributor_claimable,
|
|
7681
|
+
voting_power: item.parsedJson.voting_power
|
|
7682
|
+
});
|
|
7683
|
+
}
|
|
7684
|
+
});
|
|
7685
|
+
return res;
|
|
7686
|
+
}
|
|
7584
7687
|
async allLockSummary() {
|
|
7585
7688
|
const tx = new Transaction9();
|
|
7586
7689
|
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
@@ -7661,6 +7764,54 @@ var LockModule = class {
|
|
|
7661
7764
|
});
|
|
7662
7765
|
return poolWeights;
|
|
7663
7766
|
}
|
|
7767
|
+
async getAllVotingFeeRewardTokens(lock_ids) {
|
|
7768
|
+
let tx = new Transaction9();
|
|
7769
|
+
for (const lock_id of lock_ids) {
|
|
7770
|
+
tx = await this._getVotingFeeRewardTokens(lock_id, tx);
|
|
7771
|
+
}
|
|
7772
|
+
return this._parseVotingFeeRewardTokens(tx);
|
|
7773
|
+
}
|
|
7774
|
+
async _getVotingFeeRewardTokens(lock_id, tx) {
|
|
7775
|
+
tx = tx || new Transaction9();
|
|
7776
|
+
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
7777
|
+
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
|
|
7778
|
+
const typeArguments = [magma_token];
|
|
7779
|
+
const args = [tx.object(voter_id), tx.object(lock_id)];
|
|
7780
|
+
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
7781
|
+
throw Error("this config simulationAccount is not set right");
|
|
7782
|
+
}
|
|
7783
|
+
tx.moveCall({
|
|
7784
|
+
target: `${integrate.published_at}::${Voter}::get_voting_fee_reward_tokens`,
|
|
7785
|
+
arguments: args,
|
|
7786
|
+
typeArguments
|
|
7787
|
+
});
|
|
7788
|
+
return tx;
|
|
7789
|
+
}
|
|
7790
|
+
async _parseVotingFeeRewardTokens(tx) {
|
|
7791
|
+
const { simulationAccount } = this.sdk.sdkOptions;
|
|
7792
|
+
const simulateRes = await this.sdk.fullClient.devInspectTransactionBlock({
|
|
7793
|
+
transactionBlock: tx,
|
|
7794
|
+
sender: simulationAccount.address
|
|
7795
|
+
});
|
|
7796
|
+
if (simulateRes.error != null) {
|
|
7797
|
+
throw new Error(`all_lock_summary error code: ${simulateRes.error ?? "unknown error"}`);
|
|
7798
|
+
}
|
|
7799
|
+
const poolFeeRewardTokens = /* @__PURE__ */ new Map();
|
|
7800
|
+
simulateRes.events?.forEach((event) => {
|
|
7801
|
+
if (extractStructTagFromType(event.type).name === `EventFeeRewardTokens`) {
|
|
7802
|
+
const { lock_id } = event.parsedJson;
|
|
7803
|
+
if (!poolFeeRewardTokens.has(lock_id)) {
|
|
7804
|
+
poolFeeRewardTokens.set(lock_id, []);
|
|
7805
|
+
}
|
|
7806
|
+
event.parsedJson.list.contents.forEach((poolTokens) => {
|
|
7807
|
+
poolTokens.value.forEach((token) => {
|
|
7808
|
+
poolFeeRewardTokens.get(lock_id)?.push(token.name);
|
|
7809
|
+
});
|
|
7810
|
+
});
|
|
7811
|
+
}
|
|
7812
|
+
});
|
|
7813
|
+
return poolFeeRewardTokens;
|
|
7814
|
+
}
|
|
7664
7815
|
async getVotingFeeRewardTokens(lock_id) {
|
|
7665
7816
|
const tx = new Transaction9();
|
|
7666
7817
|
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
@@ -7684,7 +7835,7 @@ var LockModule = class {
|
|
|
7684
7835
|
}
|
|
7685
7836
|
const poolRewardTokens = /* @__PURE__ */ new Map();
|
|
7686
7837
|
simulateRes.events?.forEach((item) => {
|
|
7687
|
-
if (extractStructTagFromType(item.type).name === `
|
|
7838
|
+
if (extractStructTagFromType(item.type).name === `EventFeeRewardTokens`) {
|
|
7688
7839
|
item.parsedJson.list.contents.forEach((poolTokens) => {
|
|
7689
7840
|
if (!poolRewardTokens.has(poolTokens.key)) {
|
|
7690
7841
|
poolRewardTokens.set(poolTokens.key, []);
|
|
@@ -7697,20 +7848,70 @@ var LockModule = class {
|
|
|
7697
7848
|
});
|
|
7698
7849
|
return poolRewardTokens;
|
|
7699
7850
|
}
|
|
7700
|
-
|
|
7701
|
-
|
|
7851
|
+
// tokens
|
|
7852
|
+
async getAllBribeRewardTokensOfLock(lock_ids) {
|
|
7853
|
+
let tx = new Transaction9();
|
|
7854
|
+
for (const lock_id of lock_ids) {
|
|
7855
|
+
tx = await this._getVotingBribeRewardTokens(lock_id, tx);
|
|
7856
|
+
}
|
|
7857
|
+
return this._parseVotingBribeRewardTokens(tx);
|
|
7858
|
+
}
|
|
7859
|
+
async _getVotingBribeRewardTokens(lock_id, tx) {
|
|
7860
|
+
tx = tx || new Transaction9();
|
|
7702
7861
|
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
7703
7862
|
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
|
|
7704
7863
|
const typeArguments = [magma_token];
|
|
7864
|
+
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
7865
|
+
throw Error("this config simulationAccount is not set right");
|
|
7866
|
+
}
|
|
7705
7867
|
const args = [tx.object(voter_id), tx.object(lock_id)];
|
|
7706
7868
|
tx.moveCall({
|
|
7707
7869
|
target: `${integrate.published_at}::${Voter}::get_voting_bribe_reward_tokens`,
|
|
7708
7870
|
arguments: args,
|
|
7709
7871
|
typeArguments
|
|
7710
7872
|
});
|
|
7873
|
+
return tx;
|
|
7874
|
+
}
|
|
7875
|
+
async _parseVotingBribeRewardTokens(tx) {
|
|
7876
|
+
const { simulationAccount } = this.sdk.sdkOptions;
|
|
7877
|
+
const simulateRes = await this.sdk.fullClient.devInspectTransactionBlock({
|
|
7878
|
+
transactionBlock: tx,
|
|
7879
|
+
sender: simulationAccount.address
|
|
7880
|
+
});
|
|
7881
|
+
if (simulateRes.error != null) {
|
|
7882
|
+
throw new Error(`all_lock_summary error code: ${simulateRes.error ?? "unknown error"}`);
|
|
7883
|
+
}
|
|
7884
|
+
const poolBirbeRewardTokens = /* @__PURE__ */ new Map();
|
|
7885
|
+
simulateRes.events?.forEach((event) => {
|
|
7886
|
+
if (extractStructTagFromType(event.type).name === `EventBribeRewardTokens`) {
|
|
7887
|
+
const { lock_id } = event.parsedJson;
|
|
7888
|
+
if (!poolBirbeRewardTokens.has(lock_id)) {
|
|
7889
|
+
poolBirbeRewardTokens.set(lock_id, []);
|
|
7890
|
+
}
|
|
7891
|
+
event.parsedJson.list.contents.forEach((poolTokens) => {
|
|
7892
|
+
poolTokens.value.forEach((token) => {
|
|
7893
|
+
poolBirbeRewardTokens.get(lock_id)?.push(token.name);
|
|
7894
|
+
});
|
|
7895
|
+
});
|
|
7896
|
+
}
|
|
7897
|
+
});
|
|
7898
|
+
return poolBirbeRewardTokens;
|
|
7899
|
+
}
|
|
7900
|
+
// Return PoolId => tokens
|
|
7901
|
+
async getVotingBribeRewardTokens(lock_id) {
|
|
7902
|
+
const tx = new Transaction9();
|
|
7903
|
+
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
7904
|
+
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
|
|
7905
|
+
const typeArguments = [magma_token];
|
|
7711
7906
|
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
7712
7907
|
throw Error("this config simulationAccount is not set right");
|
|
7713
7908
|
}
|
|
7909
|
+
const args = [tx.object(voter_id), tx.object(lock_id)];
|
|
7910
|
+
tx.moveCall({
|
|
7911
|
+
target: `${integrate.published_at}::${Voter}::get_voting_bribe_reward_tokens`,
|
|
7912
|
+
arguments: args,
|
|
7913
|
+
typeArguments
|
|
7914
|
+
});
|
|
7714
7915
|
const simulateRes = await this.sdk.fullClient.devInspectTransactionBlock({
|
|
7715
7916
|
transactionBlock: tx,
|
|
7716
7917
|
sender: simulationAccount.address
|
|
@@ -7720,7 +7921,7 @@ var LockModule = class {
|
|
|
7720
7921
|
}
|
|
7721
7922
|
const poolBirbeRewardTokens = /* @__PURE__ */ new Map();
|
|
7722
7923
|
simulateRes.events?.forEach((item) => {
|
|
7723
|
-
if (extractStructTagFromType(item.type).name === `
|
|
7924
|
+
if (extractStructTagFromType(item.type).name === `EventBribeRewardTokens`) {
|
|
7724
7925
|
item.parsedJson.list.contents.forEach((poolTokens) => {
|
|
7725
7926
|
if (!poolBirbeRewardTokens.has(poolTokens.key)) {
|
|
7726
7927
|
poolBirbeRewardTokens.set(poolTokens.key, []);
|
|
@@ -7733,6 +7934,68 @@ var LockModule = class {
|
|
|
7733
7934
|
});
|
|
7734
7935
|
return poolBirbeRewardTokens;
|
|
7735
7936
|
}
|
|
7937
|
+
async getAllFeeRewards(fee_tokens) {
|
|
7938
|
+
let tx = new Transaction9();
|
|
7939
|
+
fee_tokens.forEach((tokens, lock_id) => {
|
|
7940
|
+
tx = this._getFeeRewards(lock_id, tokens, tx);
|
|
7941
|
+
});
|
|
7942
|
+
return await this._parseFeeRewards(tx);
|
|
7943
|
+
}
|
|
7944
|
+
_getFeeRewards(lock_id, fee_tokens, tx) {
|
|
7945
|
+
if (fee_tokens.length % 2 !== 0) {
|
|
7946
|
+
fee_tokens.push(fee_tokens[0]);
|
|
7947
|
+
}
|
|
7948
|
+
for (let i = 0; i + 1 < fee_tokens.length; i += 2) {
|
|
7949
|
+
tx = this._getFeeRewardsInner(lock_id, fee_tokens[i], fee_tokens[i + 1], tx);
|
|
7950
|
+
}
|
|
7951
|
+
return tx;
|
|
7952
|
+
}
|
|
7953
|
+
_getFeeRewardsInner(lock_id, token_a, token_b, tx) {
|
|
7954
|
+
tx = tx || new Transaction9();
|
|
7955
|
+
const { integrate } = this.sdk.sdkOptions;
|
|
7956
|
+
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
|
|
7957
|
+
const typeArguments = [magma_token, token_a, token_b];
|
|
7958
|
+
const args = [tx.object(voter_id), tx.object(lock_id), tx.object(CLOCK_ADDRESS)];
|
|
7959
|
+
const targetFunc = `${integrate.published_at}::${Voter}::claimable_voting_fee_rewards`;
|
|
7960
|
+
tx.moveCall({
|
|
7961
|
+
target: targetFunc,
|
|
7962
|
+
arguments: args,
|
|
7963
|
+
typeArguments
|
|
7964
|
+
});
|
|
7965
|
+
return tx;
|
|
7966
|
+
}
|
|
7967
|
+
async _parseFeeRewards(tx) {
|
|
7968
|
+
const { simulationAccount } = this.sdk.sdkOptions;
|
|
7969
|
+
const simulateRes = await this.sdk.fullClient.devInspectTransactionBlock({
|
|
7970
|
+
transactionBlock: tx,
|
|
7971
|
+
sender: simulationAccount.address
|
|
7972
|
+
});
|
|
7973
|
+
if (simulateRes.error != null) {
|
|
7974
|
+
throw new Error(`getPoolIncentiveRewards error code: ${simulateRes.error ?? "unknown error"}`);
|
|
7975
|
+
}
|
|
7976
|
+
const poolFeeRewardTokens = /* @__PURE__ */ new Map();
|
|
7977
|
+
simulateRes.events?.forEach((event) => {
|
|
7978
|
+
if (extractStructTagFromType(event.type).name === `ClaimableVotingFee`) {
|
|
7979
|
+
const { lock_id } = event.parsedJson;
|
|
7980
|
+
if (!poolFeeRewardTokens.has(lock_id)) {
|
|
7981
|
+
poolFeeRewardTokens.set(lock_id, /* @__PURE__ */ new Map());
|
|
7982
|
+
}
|
|
7983
|
+
event.parsedJson.list.contents.forEach((rewardTokens) => {
|
|
7984
|
+
rewardTokens.value.contents.forEach((token) => {
|
|
7985
|
+
if (!poolFeeRewardTokens.get(lock_id)?.has(rewardTokens.key.name)) {
|
|
7986
|
+
poolFeeRewardTokens.get(lock_id)?.set(rewardTokens.key.name, []);
|
|
7987
|
+
}
|
|
7988
|
+
poolFeeRewardTokens.get(lock_id)?.get(rewardTokens.key.name)?.push({
|
|
7989
|
+
kind: "incentiveCoin" /* Incentive */,
|
|
7990
|
+
token_addr: token.key,
|
|
7991
|
+
amount: token.value
|
|
7992
|
+
});
|
|
7993
|
+
});
|
|
7994
|
+
});
|
|
7995
|
+
}
|
|
7996
|
+
});
|
|
7997
|
+
return poolFeeRewardTokens;
|
|
7998
|
+
}
|
|
7736
7999
|
async getPoolFeeRewards(lock_id, tokens) {
|
|
7737
8000
|
const poolFeeRewardTokens = /* @__PURE__ */ new Map();
|
|
7738
8001
|
if (tokens.length === 0) {
|
|
@@ -7783,6 +8046,78 @@ var LockModule = class {
|
|
|
7783
8046
|
});
|
|
7784
8047
|
return poolFeeRewardTokens;
|
|
7785
8048
|
}
|
|
8049
|
+
// params: lock_id => incentive_tokens
|
|
8050
|
+
// lock_id => Pool => rewardTokens
|
|
8051
|
+
async getAllIncentiveRewards(lock_incentive_tokens) {
|
|
8052
|
+
let tx = new Transaction9();
|
|
8053
|
+
lock_incentive_tokens.forEach((tokens, lock_id) => {
|
|
8054
|
+
tx = this._getIncentiveRewards(lock_id, tokens, tx);
|
|
8055
|
+
});
|
|
8056
|
+
return await this._parseIncentiveRewards(tx);
|
|
8057
|
+
}
|
|
8058
|
+
_getIncentiveRewards(lock_id, incentive_tokens, tx) {
|
|
8059
|
+
let i = 0;
|
|
8060
|
+
for (; i + 3 < incentive_tokens.length; i += 3) {
|
|
8061
|
+
this._getIncentiveRewardsInner(lock_id, incentive_tokens.slice(i, i + 3), tx);
|
|
8062
|
+
}
|
|
8063
|
+
return this._getIncentiveRewardsInner(lock_id, incentive_tokens.slice(i), tx);
|
|
8064
|
+
}
|
|
8065
|
+
_getIncentiveRewardsInner(locksId, incentive_tokens, tx) {
|
|
8066
|
+
tx = tx || new Transaction9();
|
|
8067
|
+
if (incentive_tokens.length > 3) {
|
|
8068
|
+
throw Error("Too many tokens");
|
|
8069
|
+
}
|
|
8070
|
+
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8071
|
+
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
|
|
8072
|
+
const typeArguments = [magma_token, ...incentive_tokens];
|
|
8073
|
+
const args = [tx.object(voter_id), tx.object(locksId), tx.object(CLOCK_ADDRESS)];
|
|
8074
|
+
let targetFunc = `${integrate.published_at}::${Voter}::claimable_voting_bribes_${incentive_tokens.length}`;
|
|
8075
|
+
if (incentive_tokens.length === 1) {
|
|
8076
|
+
targetFunc = `${integrate.published_at}::${Voter}::claimable_voting_bribes`;
|
|
8077
|
+
}
|
|
8078
|
+
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
8079
|
+
throw Error("this config simulationAccount is not set right");
|
|
8080
|
+
}
|
|
8081
|
+
tx.moveCall({
|
|
8082
|
+
target: targetFunc,
|
|
8083
|
+
arguments: args,
|
|
8084
|
+
typeArguments
|
|
8085
|
+
});
|
|
8086
|
+
return tx;
|
|
8087
|
+
}
|
|
8088
|
+
async _parseIncentiveRewards(tx) {
|
|
8089
|
+
const { simulationAccount } = this.sdk.sdkOptions;
|
|
8090
|
+
const simulateRes = await this.sdk.fullClient.devInspectTransactionBlock({
|
|
8091
|
+
transactionBlock: tx,
|
|
8092
|
+
sender: simulationAccount.address
|
|
8093
|
+
});
|
|
8094
|
+
if (simulateRes.error != null) {
|
|
8095
|
+
throw new Error(`getPoolIncentiveRewards error code: ${simulateRes.error ?? "unknown error"}`);
|
|
8096
|
+
}
|
|
8097
|
+
const poolBribeRewardTokens = /* @__PURE__ */ new Map();
|
|
8098
|
+
simulateRes.events?.forEach((event) => {
|
|
8099
|
+
if (extractStructTagFromType(event.type).name === `ClaimableVotingBribes`) {
|
|
8100
|
+
const { lock_id } = event.parsedJson;
|
|
8101
|
+
if (!poolBribeRewardTokens.has(lock_id)) {
|
|
8102
|
+
poolBribeRewardTokens.set(lock_id, /* @__PURE__ */ new Map());
|
|
8103
|
+
}
|
|
8104
|
+
event.parsedJson.list.contents.forEach((rewardTokens) => {
|
|
8105
|
+
rewardTokens.value.contents.forEach((token) => {
|
|
8106
|
+
if (!poolBribeRewardTokens.get(lock_id)?.has(rewardTokens.key.name)) {
|
|
8107
|
+
poolBribeRewardTokens.get(lock_id)?.set(rewardTokens.key.name, []);
|
|
8108
|
+
}
|
|
8109
|
+
poolBribeRewardTokens.get(lock_id)?.get(rewardTokens.key.name)?.push({
|
|
8110
|
+
kind: "incentiveCoin" /* Incentive */,
|
|
8111
|
+
token_addr: token.key,
|
|
8112
|
+
amount: token.value
|
|
8113
|
+
});
|
|
8114
|
+
});
|
|
8115
|
+
});
|
|
8116
|
+
}
|
|
8117
|
+
});
|
|
8118
|
+
return poolBribeRewardTokens;
|
|
8119
|
+
}
|
|
8120
|
+
// coin => pool => amount
|
|
7786
8121
|
async getPoolIncentiveRewards(lock_id, incentive_tokens) {
|
|
7787
8122
|
const poolBribeRewardTokens = /* @__PURE__ */ new Map();
|
|
7788
8123
|
if (incentive_tokens.length === 0) {
|
|
@@ -7809,14 +8144,14 @@ var LockModule = class {
|
|
|
7809
8144
|
if (incentive_tokens.length === 1) {
|
|
7810
8145
|
targetFunc = `${integrate.published_at}::${Voter}::claimable_voting_bribes`;
|
|
7811
8146
|
}
|
|
8147
|
+
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
8148
|
+
throw Error("this config simulationAccount is not set right");
|
|
8149
|
+
}
|
|
7812
8150
|
tx.moveCall({
|
|
7813
8151
|
target: targetFunc,
|
|
7814
8152
|
arguments: args,
|
|
7815
8153
|
typeArguments
|
|
7816
8154
|
});
|
|
7817
|
-
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
7818
|
-
throw Error("this config simulationAccount is not set right");
|
|
7819
|
-
}
|
|
7820
8155
|
const simulateRes = await this.sdk.fullClient.devInspectTransactionBlock({
|
|
7821
8156
|
transactionBlock: tx,
|
|
7822
8157
|
sender: simulationAccount.address
|
|
@@ -9465,6 +9800,21 @@ var GaugeModule = class {
|
|
|
9465
9800
|
});
|
|
9466
9801
|
return tx;
|
|
9467
9802
|
}
|
|
9803
|
+
async getAllRewardByPositions(paramsList) {
|
|
9804
|
+
const tx = new Transaction11();
|
|
9805
|
+
const { integrate } = this.sdk.sdkOptions;
|
|
9806
|
+
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
|
|
9807
|
+
paramsList.forEach((params) => {
|
|
9808
|
+
const typeArguments = [params.coinTypeA, params.coinTypeB, magma_token];
|
|
9809
|
+
const args = [tx.object(params.gaugeId), tx.object(params.poolId), tx.object(params.positionId), tx.object(CLOCK_ADDRESS)];
|
|
9810
|
+
tx.moveCall({
|
|
9811
|
+
target: `${integrate.published_at}::${Gauge}::get_reward_by_position`,
|
|
9812
|
+
arguments: args,
|
|
9813
|
+
typeArguments
|
|
9814
|
+
});
|
|
9815
|
+
});
|
|
9816
|
+
return tx;
|
|
9817
|
+
}
|
|
9468
9818
|
async getEpochRewardByPool(pool, incentive_tokens) {
|
|
9469
9819
|
const tx = new Transaction11();
|
|
9470
9820
|
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
@@ -9497,6 +9847,277 @@ var GaugeModule = class {
|
|
|
9497
9847
|
}
|
|
9498
9848
|
};
|
|
9499
9849
|
|
|
9850
|
+
// src/modules/dlmm.ts
|
|
9851
|
+
import { Transaction as Transaction12 } from "@mysten/sui/transactions";
|
|
9852
|
+
import Decimal7 from "decimal.js";
|
|
9853
|
+
import { get_real_id_from_price, get_storage_id_from_real_id } from "@magmaprotocol/calc_dlmm";
|
|
9854
|
+
var DlmmModule = class {
|
|
9855
|
+
_sdk;
|
|
9856
|
+
constructor(sdk) {
|
|
9857
|
+
this._sdk = sdk;
|
|
9858
|
+
}
|
|
9859
|
+
get sdk() {
|
|
9860
|
+
return this._sdk;
|
|
9861
|
+
}
|
|
9862
|
+
// eg: fetch pool active_index
|
|
9863
|
+
async fetchPairParams(params) {
|
|
9864
|
+
const tx = new Transaction12();
|
|
9865
|
+
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
9866
|
+
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
9867
|
+
const args = [tx.object(params.pair)];
|
|
9868
|
+
tx.moveCall({
|
|
9869
|
+
target: `${integrate.published_at}::${DlmmScript}::fetch_pair_params`,
|
|
9870
|
+
arguments: args,
|
|
9871
|
+
typeArguments
|
|
9872
|
+
});
|
|
9873
|
+
const simulateRes = await this.sdk.fullClient.devInspectTransactionBlock({
|
|
9874
|
+
transactionBlock: tx,
|
|
9875
|
+
sender: simulationAccount.address
|
|
9876
|
+
});
|
|
9877
|
+
if (simulateRes.error != null) {
|
|
9878
|
+
throw new Error(`fetchBins error code: ${simulateRes.error ?? "unknown error"}`);
|
|
9879
|
+
}
|
|
9880
|
+
let res = {
|
|
9881
|
+
base_factor: 0,
|
|
9882
|
+
filter_period: 0,
|
|
9883
|
+
decay_period: 0,
|
|
9884
|
+
reduction_factor: 0,
|
|
9885
|
+
variable_fee_control: 0,
|
|
9886
|
+
protocol_share: 0,
|
|
9887
|
+
max_volatility_accumulator: 0,
|
|
9888
|
+
volatility_accumulator: 0,
|
|
9889
|
+
volatility_reference: 0,
|
|
9890
|
+
index_reference: 0,
|
|
9891
|
+
time_of_last_update: 0,
|
|
9892
|
+
oracle_index: 0,
|
|
9893
|
+
active_index: 0
|
|
9894
|
+
};
|
|
9895
|
+
simulateRes.events?.forEach((item) => {
|
|
9896
|
+
console.log(extractStructTagFromType(item.type).name);
|
|
9897
|
+
if (extractStructTagFromType(item.type).name === `EventPairParams`) {
|
|
9898
|
+
res = item.parsedJson.params;
|
|
9899
|
+
}
|
|
9900
|
+
});
|
|
9901
|
+
return res;
|
|
9902
|
+
}
|
|
9903
|
+
// params price: input (b/(10^b_decimal))/(a/(10^a_decimal))
|
|
9904
|
+
price_to_storage_id(price, bin_step, tokenADecimal, tokenBDecimal) {
|
|
9905
|
+
const priceDec = new Decimal7(price);
|
|
9906
|
+
const tenDec = new Decimal7(10);
|
|
9907
|
+
const twoDec = new Decimal7(2);
|
|
9908
|
+
const price_x128 = priceDec.mul(tenDec.pow(tokenBDecimal)).div(tenDec.pow(tokenADecimal)).mul(twoDec.pow(128));
|
|
9909
|
+
const active_id = get_real_id_from_price(price_x128.toFixed(0).toString(), bin_step);
|
|
9910
|
+
return get_storage_id_from_real_id(active_id);
|
|
9911
|
+
}
|
|
9912
|
+
// NOTE: x, y should be sorted
|
|
9913
|
+
async createPairPayload(params) {
|
|
9914
|
+
const storage_id = this.price_to_storage_id(params.priceTokenBPerTokenA, params.bin_step, params.coinADecimal, params.coinBDecimal);
|
|
9915
|
+
const tx = new Transaction12();
|
|
9916
|
+
tx.setSender(this.sdk.senderAddress);
|
|
9917
|
+
const { clmm_pool, dlmm_pool, integrate } = this.sdk.sdkOptions;
|
|
9918
|
+
const { global_config_id } = getPackagerConfigs(clmm_pool);
|
|
9919
|
+
const dlmmConfig = getPackagerConfigs(dlmm_pool);
|
|
9920
|
+
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
9921
|
+
const args = [tx.object(dlmmConfig.factory), tx.object(global_config_id), tx.pure.u16(params.bin_step), tx.pure.u32(storage_id)];
|
|
9922
|
+
tx.moveCall({
|
|
9923
|
+
target: `${integrate.published_at}::${DlmmScript}::create_pair`,
|
|
9924
|
+
typeArguments,
|
|
9925
|
+
arguments: args
|
|
9926
|
+
});
|
|
9927
|
+
return tx;
|
|
9928
|
+
}
|
|
9929
|
+
async createAddLiquidityPayload() {
|
|
9930
|
+
const tx = new Transaction12();
|
|
9931
|
+
return tx;
|
|
9932
|
+
}
|
|
9933
|
+
// Create a position by percent
|
|
9934
|
+
async mintPercent(params) {
|
|
9935
|
+
const tx = new Transaction12();
|
|
9936
|
+
tx.setSender(this.sdk.senderAddress);
|
|
9937
|
+
const { dlmm_pool, integrate } = this.sdk.sdkOptions;
|
|
9938
|
+
const dlmmConfig = getPackagerConfigs(dlmm_pool);
|
|
9939
|
+
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
9940
|
+
const allCoins = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
|
|
9941
|
+
const primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountATotal), params.coinTypeA, false, true);
|
|
9942
|
+
const primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountBTotal), params.coinTypeB, false, true);
|
|
9943
|
+
const args = [
|
|
9944
|
+
tx.object(params.pair),
|
|
9945
|
+
tx.object(dlmmConfig.factory),
|
|
9946
|
+
primaryCoinAInputs.targetCoin,
|
|
9947
|
+
primaryCoinBInputs.targetCoin,
|
|
9948
|
+
tx.pure.u64(params.amountATotal),
|
|
9949
|
+
tx.pure.u64(params.amountBTotal),
|
|
9950
|
+
tx.pure.vector("u32", params.storageIds),
|
|
9951
|
+
tx.pure.vector("u64", params.binsAPercent),
|
|
9952
|
+
tx.pure.vector("u64", params.binsBPercent),
|
|
9953
|
+
tx.pure.address(params.to),
|
|
9954
|
+
tx.object(CLOCK_ADDRESS)
|
|
9955
|
+
];
|
|
9956
|
+
tx.moveCall({
|
|
9957
|
+
target: `${integrate.published_at}::${DlmmScript}::mint_percent`,
|
|
9958
|
+
typeArguments,
|
|
9959
|
+
arguments: args
|
|
9960
|
+
});
|
|
9961
|
+
return tx;
|
|
9962
|
+
}
|
|
9963
|
+
// Create a position by amount
|
|
9964
|
+
async createPositionByAmount(params) {
|
|
9965
|
+
const tx = new Transaction12();
|
|
9966
|
+
tx.setSender(this.sdk.senderAddress);
|
|
9967
|
+
const { dlmm_pool, integrate } = this.sdk.sdkOptions;
|
|
9968
|
+
const dlmmConfig = getPackagerConfigs(dlmm_pool);
|
|
9969
|
+
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
9970
|
+
const allCoins = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
|
|
9971
|
+
const primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountATotal), params.coinTypeA, false, true);
|
|
9972
|
+
const primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountBTotal), params.coinTypeB, false, true);
|
|
9973
|
+
const args = [
|
|
9974
|
+
tx.object(params.pair),
|
|
9975
|
+
tx.object(dlmmConfig.factory),
|
|
9976
|
+
primaryCoinAInputs.targetCoin,
|
|
9977
|
+
primaryCoinBInputs.targetCoin,
|
|
9978
|
+
tx.pure.vector("u32", params.storageIds),
|
|
9979
|
+
tx.pure.vector("u64", params.amountsA),
|
|
9980
|
+
tx.pure.vector("u64", params.amountsB),
|
|
9981
|
+
tx.pure.address(params.to),
|
|
9982
|
+
tx.object(CLOCK_ADDRESS)
|
|
9983
|
+
];
|
|
9984
|
+
tx.moveCall({
|
|
9985
|
+
target: `${integrate.published_at}::${DlmmScript}::mint_amounts`,
|
|
9986
|
+
typeArguments,
|
|
9987
|
+
arguments: args
|
|
9988
|
+
});
|
|
9989
|
+
return tx;
|
|
9990
|
+
}
|
|
9991
|
+
async swap(params) {
|
|
9992
|
+
const tx = new Transaction12();
|
|
9993
|
+
tx.setSender(this.sdk.senderAddress);
|
|
9994
|
+
const { clmm_pool, integrate } = this.sdk.sdkOptions;
|
|
9995
|
+
const { global_config_id } = getPackagerConfigs(clmm_pool);
|
|
9996
|
+
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
9997
|
+
const args = [
|
|
9998
|
+
tx.object(params.pair),
|
|
9999
|
+
tx.object(global_config_id),
|
|
10000
|
+
tx.object(params.coinTypeA),
|
|
10001
|
+
tx.object(params.coinTypeB),
|
|
10002
|
+
tx.pure.u64(params.amountIn),
|
|
10003
|
+
tx.pure.u64(params.minAmountOut),
|
|
10004
|
+
tx.pure.bool(params.swapForY),
|
|
10005
|
+
tx.pure.address(params.to),
|
|
10006
|
+
tx.object(CLOCK_ADDRESS)
|
|
10007
|
+
];
|
|
10008
|
+
tx.moveCall({
|
|
10009
|
+
target: `${integrate.published_at}::${DlmmScript}::swap`,
|
|
10010
|
+
typeArguments,
|
|
10011
|
+
arguments: args
|
|
10012
|
+
});
|
|
10013
|
+
return tx;
|
|
10014
|
+
}
|
|
10015
|
+
async fetchBins(params) {
|
|
10016
|
+
const tx = new Transaction12();
|
|
10017
|
+
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
10018
|
+
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
10019
|
+
const args = [tx.object(params.pair), tx.pure.u64(params.offset), tx.pure.u64(params.limit)];
|
|
10020
|
+
tx.moveCall({
|
|
10021
|
+
target: `${integrate.published_at}::${DlmmScript}::fetch_bins`,
|
|
10022
|
+
arguments: args,
|
|
10023
|
+
typeArguments
|
|
10024
|
+
});
|
|
10025
|
+
const simulateRes = await this.sdk.fullClient.devInspectTransactionBlock({
|
|
10026
|
+
transactionBlock: tx,
|
|
10027
|
+
sender: simulationAccount.address
|
|
10028
|
+
});
|
|
10029
|
+
if (simulateRes.error != null) {
|
|
10030
|
+
throw new Error(`fetchBins error code: ${simulateRes.error ?? "unknown error"}`);
|
|
10031
|
+
}
|
|
10032
|
+
const res = [];
|
|
10033
|
+
simulateRes.events?.forEach((item) => {
|
|
10034
|
+
if (extractStructTagFromType(item.type).name === `EventFetchBins`) {
|
|
10035
|
+
}
|
|
10036
|
+
});
|
|
10037
|
+
return res;
|
|
10038
|
+
}
|
|
10039
|
+
async getPositionLiquidity(params) {
|
|
10040
|
+
const tx = new Transaction12();
|
|
10041
|
+
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
10042
|
+
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
10043
|
+
const args = [tx.object(params.pair), tx.object(params.positionId)];
|
|
10044
|
+
tx.moveCall({
|
|
10045
|
+
target: `${integrate.published_at}::${DlmmScript}::position_liquidity`,
|
|
10046
|
+
arguments: args,
|
|
10047
|
+
typeArguments
|
|
10048
|
+
});
|
|
10049
|
+
const simulateRes = await this.sdk.fullClient.devInspectTransactionBlock({
|
|
10050
|
+
transactionBlock: tx,
|
|
10051
|
+
sender: simulationAccount.address
|
|
10052
|
+
});
|
|
10053
|
+
if (simulateRes.error != null) {
|
|
10054
|
+
throw new Error(`fetchBins error code: ${simulateRes.error ?? "unknown error"}`);
|
|
10055
|
+
}
|
|
10056
|
+
const out = {
|
|
10057
|
+
shares: 0,
|
|
10058
|
+
liquidity: 0,
|
|
10059
|
+
x_equivalent: 0,
|
|
10060
|
+
y_equivalent: 0,
|
|
10061
|
+
bin_ids: [],
|
|
10062
|
+
bin_x_eq: [],
|
|
10063
|
+
bin_y_eq: [],
|
|
10064
|
+
bin_liquidity: []
|
|
10065
|
+
};
|
|
10066
|
+
simulateRes.events?.forEach((item) => {
|
|
10067
|
+
if (extractStructTagFromType(item.type).name === `EventPositionLiquidity`) {
|
|
10068
|
+
out.shares = item.parsedJson.shares;
|
|
10069
|
+
out.liquidity = item.parsedJson.liquidity;
|
|
10070
|
+
out.x_equivalent = item.parsedJson.x_equivalent;
|
|
10071
|
+
out.y_equivalent = item.parsedJson.y_equivalent;
|
|
10072
|
+
out.bin_ids = item.parsedJson.bin_id;
|
|
10073
|
+
out.bin_x_eq = item.parsedJson.bin_x_eq;
|
|
10074
|
+
out.bin_y_eq = item.parsedJson.bin_y_eq;
|
|
10075
|
+
out.bin_liquidity = item.parsedJson.bin_liquidity;
|
|
10076
|
+
}
|
|
10077
|
+
});
|
|
10078
|
+
return out;
|
|
10079
|
+
}
|
|
10080
|
+
async getPairLiquidity(params) {
|
|
10081
|
+
const tx = new Transaction12();
|
|
10082
|
+
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
10083
|
+
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
10084
|
+
const args = [tx.object(params.pair)];
|
|
10085
|
+
tx.moveCall({
|
|
10086
|
+
target: `${integrate.published_at}::${DlmmScript}::pair_liquidity`,
|
|
10087
|
+
arguments: args,
|
|
10088
|
+
typeArguments
|
|
10089
|
+
});
|
|
10090
|
+
const simulateRes = await this.sdk.fullClient.devInspectTransactionBlock({
|
|
10091
|
+
transactionBlock: tx,
|
|
10092
|
+
sender: simulationAccount.address
|
|
10093
|
+
});
|
|
10094
|
+
if (simulateRes.error != null) {
|
|
10095
|
+
throw new Error(`fetchBins error code: ${simulateRes.error ?? "unknown error"}`);
|
|
10096
|
+
}
|
|
10097
|
+
const out = {
|
|
10098
|
+
shares: 0,
|
|
10099
|
+
liquidity: 0,
|
|
10100
|
+
x: 0,
|
|
10101
|
+
y: 0,
|
|
10102
|
+
bin_ids: [],
|
|
10103
|
+
bin_x: [],
|
|
10104
|
+
bin_y: []
|
|
10105
|
+
};
|
|
10106
|
+
simulateRes.events?.forEach((item) => {
|
|
10107
|
+
if (extractStructTagFromType(item.type).name === `EventPositionLiquidity`) {
|
|
10108
|
+
out.shares = item.parsedJson.shares;
|
|
10109
|
+
out.liquidity = item.parsedJson.liquidity;
|
|
10110
|
+
out.x = item.parsedJson.x;
|
|
10111
|
+
out.y = item.parsedJson.y;
|
|
10112
|
+
out.bin_ids = item.bin_ids;
|
|
10113
|
+
out.bin_x = item.bin_x;
|
|
10114
|
+
out.bin_y = item.bin_y;
|
|
10115
|
+
}
|
|
10116
|
+
});
|
|
10117
|
+
return out;
|
|
10118
|
+
}
|
|
10119
|
+
};
|
|
10120
|
+
|
|
9500
10121
|
// src/sdk.ts
|
|
9501
10122
|
var MagmaClmmSDK = class {
|
|
9502
10123
|
_cache = {};
|
|
@@ -9521,6 +10142,7 @@ var MagmaClmmSDK = class {
|
|
|
9521
10142
|
*/
|
|
9522
10143
|
_lock;
|
|
9523
10144
|
_gauge;
|
|
10145
|
+
_dlmm;
|
|
9524
10146
|
/**
|
|
9525
10147
|
* Provide interact with a position rewarder interface.
|
|
9526
10148
|
*/
|
|
@@ -9558,6 +10180,7 @@ var MagmaClmmSDK = class {
|
|
|
9558
10180
|
this._swap = new SwapModule(this);
|
|
9559
10181
|
this._lock = new LockModule(this);
|
|
9560
10182
|
this._gauge = new GaugeModule(this);
|
|
10183
|
+
this._dlmm = new DlmmModule(this);
|
|
9561
10184
|
this._pool = new PoolModule(this);
|
|
9562
10185
|
this._position = new PositionModule(this);
|
|
9563
10186
|
this._rewarder = new RewarderModule(this);
|
|
@@ -9595,6 +10218,9 @@ var MagmaClmmSDK = class {
|
|
|
9595
10218
|
get Gauge() {
|
|
9596
10219
|
return this._gauge;
|
|
9597
10220
|
}
|
|
10221
|
+
get Dlmm() {
|
|
10222
|
+
return this._dlmm;
|
|
10223
|
+
}
|
|
9598
10224
|
/**
|
|
9599
10225
|
* Getter for the fullClient property.
|
|
9600
10226
|
* @returns {RpcModule} The fullClient property value.
|
|
@@ -9768,6 +10394,7 @@ var main_default = MagmaClmmSDK;
|
|
|
9768
10394
|
var SDKConfig = {
|
|
9769
10395
|
clmmConfig: {
|
|
9770
10396
|
pools_id: "0xfa145b9de10fe858be81edd1c6cdffcf27be9d016de02a1345eb1009a68ba8b2",
|
|
10397
|
+
// clmm and dlmm both use this global_config
|
|
9771
10398
|
global_config_id: "0x4c4e1402401f72c7d8533d0ed8d5f8949da363c7a3319ccef261ffe153d32f8a",
|
|
9772
10399
|
global_vault_id: "0xa7e1102f222b6eb81ccc8a126e7feb2353342be9df6f6646a77c4519da29c071",
|
|
9773
10400
|
admin_cap_id: "0x89c1a321291d15ddae5a086c9abc533dff697fde3d89e0ca836c41af73e36a75"
|
|
@@ -9787,7 +10414,11 @@ var SDKConfig = {
|
|
|
9787
10414
|
distribution_cfg: "0xaff8d151ac29317201151f97d28c546b3c5923d8cfc5499f40dea61c4022c949",
|
|
9788
10415
|
magma_token: "0x7161c6c6bb65f852797c8f7f5c4f8d57adaf796e1b840921f9e23fabeadfd54e::magma::MAGMA",
|
|
9789
10416
|
minter_id: "0x4fa5766cd83b33b215b139fec27ac344040f3bbd84fcbee7b61fc671aadc51fa"
|
|
9790
|
-
}
|
|
10417
|
+
},
|
|
10418
|
+
dlmmConfig: {
|
|
10419
|
+
factory: ""
|
|
10420
|
+
},
|
|
10421
|
+
gaugeConfig: {}
|
|
9791
10422
|
};
|
|
9792
10423
|
var clmmMainnet = {
|
|
9793
10424
|
fullRpcUrl: getFullnodeUrl("mainnet"),
|
|
@@ -9804,6 +10435,11 @@ var clmmMainnet = {
|
|
|
9804
10435
|
published_at: "0x4a35d3dfef55ed3631b7158544c6322a23bc434fe4fca1234cb680ce0505f82d",
|
|
9805
10436
|
config: SDKConfig.clmmConfig
|
|
9806
10437
|
},
|
|
10438
|
+
dlmm_pool: {
|
|
10439
|
+
package_id: "",
|
|
10440
|
+
published_at: "",
|
|
10441
|
+
config: SDKConfig.dlmmConfig
|
|
10442
|
+
},
|
|
9807
10443
|
distribution: {
|
|
9808
10444
|
package_id: "0xee4a1f231dc45a303389998fe26c4e39278cf68b404b32e4f0b9769129b8267b",
|
|
9809
10445
|
published_at: "0xee4a1f231dc45a303389998fe26c4e39278cf68b404b32e4f0b9769129b8267b"
|
|
@@ -9857,6 +10493,9 @@ var SDKConfig2 = {
|
|
|
9857
10493
|
distribution_cfg: "0x94e23846c975e2faf89a61bfc2b10ad64decab9069eb1f9fc39752b010868c74",
|
|
9858
10494
|
magma_token: "0x45ac2371c33ca0df8dc784d62c8ce5126d42edd8c56820396524dff2ae0619b1::magma_token::MAGMA_TOKEN",
|
|
9859
10495
|
minter_id: "0x89435d6b2a510ba50ca23303f10e91ec058f138a88f69a43fe03cd22edb214c5"
|
|
10496
|
+
},
|
|
10497
|
+
dlmmConfig: {
|
|
10498
|
+
factory: ""
|
|
9860
10499
|
}
|
|
9861
10500
|
};
|
|
9862
10501
|
var clmmTestnet = {
|
|
@@ -9871,6 +10510,11 @@ var clmmTestnet = {
|
|
|
9871
10510
|
published_at: "0x23e0b5ab4aa63d0e6fd98fa5e247bcf9b36ad716b479d39e56b2ba9ff631e09d",
|
|
9872
10511
|
config: SDKConfig2.clmmConfig
|
|
9873
10512
|
},
|
|
10513
|
+
dlmm_pool: {
|
|
10514
|
+
package_id: "",
|
|
10515
|
+
published_at: "",
|
|
10516
|
+
config: SDKConfig2.dlmmConfig
|
|
10517
|
+
},
|
|
9874
10518
|
distribution: {
|
|
9875
10519
|
package_id: "0x45ac2371c33ca0df8dc784d62c8ce5126d42edd8c56820396524dff2ae0619b1",
|
|
9876
10520
|
published_at: "0x45ac2371c33ca0df8dc784d62c8ce5126d42edd8c56820396524dff2ae0619b1"
|
|
@@ -9945,6 +10589,7 @@ export {
|
|
|
9945
10589
|
DeepbookCustodianV2Moudle,
|
|
9946
10590
|
DeepbookEndpointsV2Moudle,
|
|
9947
10591
|
DeepbookUtils,
|
|
10592
|
+
DlmmScript,
|
|
9948
10593
|
FEE_RATE_DENOMINATOR,
|
|
9949
10594
|
GAS_SYMBOL,
|
|
9950
10595
|
GAS_TYPE_ARG,
|