@magmaprotocol/magma-clmm-sdk 0.5.78 → 0.5.80
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 +26 -15
- package/dist/index.js +175 -150
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +175 -150
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1975,7 +1975,7 @@ function toAmountAskSide(activeId, binStep, totalAmount, distributions) {
|
|
|
1975
1975
|
});
|
|
1976
1976
|
}
|
|
1977
1977
|
function toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, distributions) {
|
|
1978
|
-
if (activeId > distributions[distributions.length - 1].binId) {
|
|
1978
|
+
if (activeId > distributions[distributions.length - 1].binId || amountX.isZero()) {
|
|
1979
1979
|
const amounts = toAmountBidSide(activeId, amountY, distributions);
|
|
1980
1980
|
return amounts.map((bin) => {
|
|
1981
1981
|
return {
|
|
@@ -1985,7 +1985,7 @@ function toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBi
|
|
|
1985
1985
|
};
|
|
1986
1986
|
});
|
|
1987
1987
|
}
|
|
1988
|
-
if (activeId < distributions[0].binId) {
|
|
1988
|
+
if (activeId < distributions[0].binId || amountY.isZero()) {
|
|
1989
1989
|
const amounts = toAmountAskSide(activeId, binStep, amountX, distributions);
|
|
1990
1990
|
return amounts.map((bin) => {
|
|
1991
1991
|
return {
|
|
@@ -2100,6 +2100,26 @@ var StrategyType = /* @__PURE__ */ ((StrategyType2) => {
|
|
|
2100
2100
|
StrategyType2[StrategyType2["BidAsk"] = 3] = "BidAsk";
|
|
2101
2101
|
return StrategyType2;
|
|
2102
2102
|
})(StrategyType || {});
|
|
2103
|
+
function toWeightDecendingOrder(minBinId, maxBinId) {
|
|
2104
|
+
const distributions = [];
|
|
2105
|
+
for (let i = minBinId; i <= maxBinId; i++) {
|
|
2106
|
+
distributions.push({
|
|
2107
|
+
binId: i,
|
|
2108
|
+
weight: maxBinId - i + 1
|
|
2109
|
+
});
|
|
2110
|
+
}
|
|
2111
|
+
return distributions;
|
|
2112
|
+
}
|
|
2113
|
+
function toWeightAscendingOrder(minBinId, maxBinId) {
|
|
2114
|
+
const distributions = [];
|
|
2115
|
+
for (let i = minBinId; i <= maxBinId; i++) {
|
|
2116
|
+
distributions.push({
|
|
2117
|
+
binId: i,
|
|
2118
|
+
weight: i - minBinId + 1
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
return distributions;
|
|
2122
|
+
}
|
|
2103
2123
|
function toWeightSpotBalanced(minBinId, maxBinId) {
|
|
2104
2124
|
const distributions = [];
|
|
2105
2125
|
for (let i = minBinId; i <= maxBinId; i++) {
|
|
@@ -2216,10 +2236,26 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
|
|
|
2216
2236
|
return toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
|
|
2217
2237
|
}
|
|
2218
2238
|
case 2 /* Curve */: {
|
|
2239
|
+
if (activeId < minBinId) {
|
|
2240
|
+
const weights2 = toWeightDecendingOrder(minBinId, maxBinId);
|
|
2241
|
+
return toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
|
|
2242
|
+
}
|
|
2243
|
+
if (activeId > maxBinId) {
|
|
2244
|
+
const weights2 = toWeightAscendingOrder(minBinId, maxBinId);
|
|
2245
|
+
return toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
|
|
2246
|
+
}
|
|
2219
2247
|
const weights = toWeightCurve(minBinId, maxBinId, activeId);
|
|
2220
2248
|
return toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
|
|
2221
2249
|
}
|
|
2222
2250
|
case 3 /* BidAsk */: {
|
|
2251
|
+
if (activeId < minBinId) {
|
|
2252
|
+
const weights2 = toWeightAscendingOrder(minBinId, maxBinId);
|
|
2253
|
+
return toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
|
|
2254
|
+
}
|
|
2255
|
+
if (activeId > maxBinId) {
|
|
2256
|
+
const weights2 = toWeightDecendingOrder(minBinId, maxBinId);
|
|
2257
|
+
return toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
|
|
2258
|
+
}
|
|
2223
2259
|
const weights = toWeightBidAsk(minBinId, maxBinId, activeId);
|
|
2224
2260
|
return toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
|
|
2225
2261
|
}
|
|
@@ -3579,14 +3615,14 @@ var _TransactionUtil = class {
|
|
|
3579
3615
|
static buildCreateLockTransaction(sdk, params, allCoinAsset) {
|
|
3580
3616
|
let tx = new import_transactions.Transaction();
|
|
3581
3617
|
tx.setSender(sdk.senderAddress);
|
|
3582
|
-
const { magma_token } = getPackagerConfigs(sdk.sdkOptions.
|
|
3618
|
+
const { magma_token } = getPackagerConfigs(sdk.sdkOptions.ve33);
|
|
3583
3619
|
const lockCoinInput = _TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(params.amount), magma_token, false, true);
|
|
3584
3620
|
tx = _TransactionUtil.buildCreateTransactionArgs(tx, params, sdk.sdkOptions, lockCoinInput);
|
|
3585
3621
|
return tx;
|
|
3586
3622
|
}
|
|
3587
3623
|
static buildCreateTransactionArgs(tx, params, sdkOptions, lockCoinInput) {
|
|
3588
|
-
const { integrate } = sdkOptions;
|
|
3589
|
-
const { voting_escrow_id, magma_token } = getPackagerConfigs(
|
|
3624
|
+
const { integrate, ve33 } = sdkOptions;
|
|
3625
|
+
const { voting_escrow_id, magma_token } = getPackagerConfigs(ve33);
|
|
3590
3626
|
const typeArguments = [magma_token];
|
|
3591
3627
|
const functionName = "create_lock";
|
|
3592
3628
|
const coins = tx.makeMoveVec({ elements: [lockCoinInput.targetCoin] });
|
|
@@ -3605,7 +3641,7 @@ var _TransactionUtil = class {
|
|
|
3605
3641
|
return tx;
|
|
3606
3642
|
}
|
|
3607
3643
|
static buildIncreaseLockAmountTransaction(sdk, params, allCoinAsset) {
|
|
3608
|
-
const { magma_token } = getPackagerConfigs(sdk.sdkOptions.
|
|
3644
|
+
const { magma_token } = getPackagerConfigs(sdk.sdkOptions.ve33);
|
|
3609
3645
|
let tx = new import_transactions.Transaction();
|
|
3610
3646
|
tx.setSender(sdk.senderAddress);
|
|
3611
3647
|
const lockCoinInput = _TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(params.amount), magma_token, false, true);
|
|
@@ -3613,8 +3649,8 @@ var _TransactionUtil = class {
|
|
|
3613
3649
|
return tx;
|
|
3614
3650
|
}
|
|
3615
3651
|
static buildIncreaseLockAmountTransactionArgs(tx, params, sdkOptions, increaseCoinInput) {
|
|
3616
|
-
const { integrate } = sdkOptions;
|
|
3617
|
-
const { voting_escrow_id, magma_token } = getPackagerConfigs(
|
|
3652
|
+
const { integrate, ve33 } = sdkOptions;
|
|
3653
|
+
const { voting_escrow_id, magma_token } = getPackagerConfigs(ve33);
|
|
3618
3654
|
const typeArguments = [magma_token];
|
|
3619
3655
|
const functionName = "increase_amount_single_coin";
|
|
3620
3656
|
const args = [tx.object(voting_escrow_id), tx.object(params.lockId), increaseCoinInput.targetCoin, tx.object(CLOCK_ADDRESS)];
|
|
@@ -3629,8 +3665,8 @@ var _TransactionUtil = class {
|
|
|
3629
3665
|
static buildMergeLockTransaction(sdk, params) {
|
|
3630
3666
|
const tx = new import_transactions.Transaction();
|
|
3631
3667
|
tx.setSender(sdk.senderAddress);
|
|
3632
|
-
const { integrate } = sdk.sdkOptions;
|
|
3633
|
-
const { voter_id, voting_escrow_id, magma_token, distribution_cfg } = getPackagerConfigs(
|
|
3668
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3669
|
+
const { voter_id, voting_escrow_id, magma_token, distribution_cfg } = getPackagerConfigs(ve33);
|
|
3634
3670
|
const typeArguments = [magma_token];
|
|
3635
3671
|
const functionName = "merge_locks";
|
|
3636
3672
|
const args = [
|
|
@@ -3652,8 +3688,8 @@ var _TransactionUtil = class {
|
|
|
3652
3688
|
static buildTransferLockTransaction(sdk, params) {
|
|
3653
3689
|
const tx = new import_transactions.Transaction();
|
|
3654
3690
|
tx.setSender(sdk.senderAddress);
|
|
3655
|
-
const { integrate } = sdk.sdkOptions;
|
|
3656
|
-
const { voting_escrow_id, magma_token } = getPackagerConfigs(
|
|
3691
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3692
|
+
const { voting_escrow_id, magma_token } = getPackagerConfigs(ve33);
|
|
3657
3693
|
const typeArguments = [magma_token];
|
|
3658
3694
|
const functionName = "transfer";
|
|
3659
3695
|
const args = [tx.object(voting_escrow_id), tx.object(params.lockId), tx.object(params.to), tx.object(CLOCK_ADDRESS)];
|
|
@@ -3670,8 +3706,8 @@ var _TransactionUtil = class {
|
|
|
3670
3706
|
tx.setSender(sdk.senderAddress);
|
|
3671
3707
|
const oneDay = 24 * 60 * 60;
|
|
3672
3708
|
const newLockDuration = Math.ceil((params.newLockEndAt - Date.now() / 1e3) / oneDay);
|
|
3673
|
-
const { integrate } = sdk.sdkOptions;
|
|
3674
|
-
const { voting_escrow_id, magma_token } = getPackagerConfigs(
|
|
3709
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3710
|
+
const { voting_escrow_id, magma_token } = getPackagerConfigs(ve33);
|
|
3675
3711
|
const typeArguments = [magma_token];
|
|
3676
3712
|
const functionName = "increase_unlock_time";
|
|
3677
3713
|
const args = [tx.object(voting_escrow_id), tx.object(params.lockId), tx.pure.u64(newLockDuration), tx.object(CLOCK_ADDRESS)];
|
|
@@ -3686,8 +3722,8 @@ var _TransactionUtil = class {
|
|
|
3686
3722
|
static buildLockPermanentTransaction(sdk, params) {
|
|
3687
3723
|
const tx = new import_transactions.Transaction();
|
|
3688
3724
|
tx.setSender(sdk.senderAddress);
|
|
3689
|
-
const { integrate } = sdk.sdkOptions;
|
|
3690
|
-
const { voting_escrow_id, magma_token } = getPackagerConfigs(
|
|
3725
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3726
|
+
const { voting_escrow_id, magma_token } = getPackagerConfigs(ve33);
|
|
3691
3727
|
const typeArguments = [magma_token];
|
|
3692
3728
|
const functionName = "lock_permanent";
|
|
3693
3729
|
const args = [tx.object(voting_escrow_id), tx.object(params.lockId), tx.object(CLOCK_ADDRESS)];
|
|
@@ -3701,8 +3737,8 @@ var _TransactionUtil = class {
|
|
|
3701
3737
|
static buildUnlockPermanentTransaction(sdk, params) {
|
|
3702
3738
|
const tx = new import_transactions.Transaction();
|
|
3703
3739
|
tx.setSender(sdk.senderAddress);
|
|
3704
|
-
const { integrate } = sdk.sdkOptions;
|
|
3705
|
-
const { voting_escrow_id, magma_token, distribution_cfg, voter_id } = getPackagerConfigs(
|
|
3740
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3741
|
+
const { voting_escrow_id, magma_token, distribution_cfg, voter_id } = getPackagerConfigs(ve33);
|
|
3706
3742
|
const typeArguments = [magma_token];
|
|
3707
3743
|
const functionName = "unlock_permanent";
|
|
3708
3744
|
const args = [
|
|
@@ -3722,8 +3758,8 @@ var _TransactionUtil = class {
|
|
|
3722
3758
|
static buildBurnLockTransaction(sdk, lockId) {
|
|
3723
3759
|
const tx = new import_transactions.Transaction();
|
|
3724
3760
|
tx.setSender(sdk.senderAddress);
|
|
3725
|
-
const { integrate } = sdk.sdkOptions;
|
|
3726
|
-
const { voting_escrow_id, magma_token, distribution_cfg, voter_id } = getPackagerConfigs(
|
|
3761
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3762
|
+
const { voting_escrow_id, magma_token, distribution_cfg, voter_id } = getPackagerConfigs(ve33);
|
|
3727
3763
|
const typeArguments = [magma_token];
|
|
3728
3764
|
const functionName = "burn_lock";
|
|
3729
3765
|
const args = [
|
|
@@ -3743,8 +3779,8 @@ var _TransactionUtil = class {
|
|
|
3743
3779
|
static buildSplitLockTransaction(sdk, lockId, splitAmount) {
|
|
3744
3780
|
const tx = new import_transactions.Transaction();
|
|
3745
3781
|
tx.setSender(sdk.senderAddress);
|
|
3746
|
-
const { integrate } = sdk.sdkOptions;
|
|
3747
|
-
const { voting_escrow_id, magma_token, distribution_cfg, voter_id } = getPackagerConfigs(
|
|
3782
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3783
|
+
const { voting_escrow_id, magma_token, distribution_cfg, voter_id } = getPackagerConfigs(ve33);
|
|
3748
3784
|
const typeArguments = [magma_token];
|
|
3749
3785
|
const functionName = "split_lock";
|
|
3750
3786
|
const args = [
|
|
@@ -3765,8 +3801,8 @@ var _TransactionUtil = class {
|
|
|
3765
3801
|
static buildVoteTransaction(sdk, params) {
|
|
3766
3802
|
const tx = new import_transactions.Transaction();
|
|
3767
3803
|
tx.setSender(sdk.senderAddress);
|
|
3768
|
-
const { integrate } = sdk.sdkOptions;
|
|
3769
|
-
const { distribution_cfg, voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(
|
|
3804
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3805
|
+
const { distribution_cfg, voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
3770
3806
|
const typeArguments = [magma_token];
|
|
3771
3807
|
const functionName = "vote";
|
|
3772
3808
|
const pools = tx.pure.vector("id", params.pools);
|
|
@@ -3793,8 +3829,8 @@ var _TransactionUtil = class {
|
|
|
3793
3829
|
static buildClaimVotingRewardsTransaction(sdk, params) {
|
|
3794
3830
|
const tx = new import_transactions.Transaction();
|
|
3795
3831
|
tx.setSender(sdk.senderAddress);
|
|
3796
|
-
const { integrate } = sdk.sdkOptions;
|
|
3797
|
-
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(
|
|
3832
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3833
|
+
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
3798
3834
|
const typeArguments = [magma_token, params.coinAType, params.coinBType];
|
|
3799
3835
|
const functionName = "claim_voting_fee_rewards_single";
|
|
3800
3836
|
const args = [tx.object(voter_id), tx.object(voting_escrow_id), tx.object(params.locks), tx.object(CLOCK_ADDRESS)];
|
|
@@ -3808,8 +3844,8 @@ var _TransactionUtil = class {
|
|
|
3808
3844
|
static buildClaimVotingRewardsPoolsTransaction(sdk, params) {
|
|
3809
3845
|
const tx = new import_transactions.Transaction();
|
|
3810
3846
|
tx.setSender(sdk.senderAddress);
|
|
3811
|
-
const { integrate, distribution } = sdk.sdkOptions;
|
|
3812
|
-
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(
|
|
3847
|
+
const { integrate, distribution, ve33 } = sdk.sdkOptions;
|
|
3848
|
+
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
3813
3849
|
const typeArguments = [magma_token, params.coinAType, params.coinBType];
|
|
3814
3850
|
const functionName = "claim_voting_fee_rewards";
|
|
3815
3851
|
const locks = tx.makeMoveVec({
|
|
@@ -3827,8 +3863,8 @@ var _TransactionUtil = class {
|
|
|
3827
3863
|
static buildClaimAndLockRebases(sdk, params) {
|
|
3828
3864
|
const tx = new import_transactions.Transaction();
|
|
3829
3865
|
tx.setSender(sdk.senderAddress);
|
|
3830
|
-
const { integrate } = sdk.sdkOptions;
|
|
3831
|
-
const { voting_escrow_id, magma_token, reward_distributor_id } = getPackagerConfigs(
|
|
3866
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3867
|
+
const { voting_escrow_id, magma_token, reward_distributor_id } = getPackagerConfigs(ve33);
|
|
3832
3868
|
const typeArguments = [magma_token];
|
|
3833
3869
|
const functionName = "claim_and_lock";
|
|
3834
3870
|
const args = [tx.object(reward_distributor_id), tx.object(voting_escrow_id), tx.object(params.lockId), tx.object(CLOCK_ADDRESS)];
|
|
@@ -3842,8 +3878,8 @@ var _TransactionUtil = class {
|
|
|
3842
3878
|
static buildPoke(sdk, params) {
|
|
3843
3879
|
const tx = new import_transactions.Transaction();
|
|
3844
3880
|
tx.setSender(sdk.senderAddress);
|
|
3845
|
-
const { integrate } = sdk.sdkOptions;
|
|
3846
|
-
const { distribution_cfg, voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(
|
|
3881
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3882
|
+
const { distribution_cfg, voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
3847
3883
|
const typeArguments = [magma_token];
|
|
3848
3884
|
const functionName = "poke";
|
|
3849
3885
|
const args = [
|
|
@@ -3863,8 +3899,8 @@ var _TransactionUtil = class {
|
|
|
3863
3899
|
static buildClaimVotingBribe(sdk, locks, incentive_tokens) {
|
|
3864
3900
|
const tx = new import_transactions.Transaction();
|
|
3865
3901
|
tx.setSender(sdk.senderAddress);
|
|
3866
|
-
const { integrate, distribution } = sdk.sdkOptions;
|
|
3867
|
-
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(
|
|
3902
|
+
const { integrate, distribution, ve33 } = sdk.sdkOptions;
|
|
3903
|
+
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
3868
3904
|
const typeArguments = [magma_token, ...incentive_tokens];
|
|
3869
3905
|
let targetFunc = `${integrate.published_at}::${Voter}::claim_voting_bribes_${incentive_tokens.length}`;
|
|
3870
3906
|
if (incentive_tokens.length === 1) {
|
|
@@ -6881,45 +6917,21 @@ var RewarderModule = class {
|
|
|
6881
6917
|
* @param tx
|
|
6882
6918
|
* @returns
|
|
6883
6919
|
*/
|
|
6884
|
-
async batchCollectRewardePayload(params, tx
|
|
6920
|
+
async batchCollectRewardePayload(params, tx) {
|
|
6885
6921
|
if (!checkInvalidSuiAddress(this._sdk.senderAddress)) {
|
|
6886
6922
|
throw new ClmmpoolsError("this config sdk senderAddress is not set right", "InvalidSendAddress" /* InvalidSendAddress */);
|
|
6887
6923
|
}
|
|
6888
6924
|
const allCoinAsset = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress, null);
|
|
6889
6925
|
tx = tx || new import_transactions6.Transaction();
|
|
6890
|
-
const
|
|
6926
|
+
const coinIdList = [];
|
|
6891
6927
|
params.forEach((item) => {
|
|
6892
6928
|
const coinTypeA = normalizeCoinType(item.coinTypeA);
|
|
6893
6929
|
const coinTypeB = normalizeCoinType(item.coinTypeB);
|
|
6894
6930
|
if (item.collect_fee) {
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
} else {
|
|
6900
|
-
coinAInput = {
|
|
6901
|
-
targetCoin: inputCoinA,
|
|
6902
|
-
remainCoins: [],
|
|
6903
|
-
isMintZeroCoin: false,
|
|
6904
|
-
tragetCoinAmount: "0"
|
|
6905
|
-
};
|
|
6906
|
-
}
|
|
6907
|
-
coinIdMaps[coinTypeA] = coinAInput;
|
|
6908
|
-
}
|
|
6909
|
-
let coinBInput = coinIdMaps[coinTypeB];
|
|
6910
|
-
if (coinBInput == null) {
|
|
6911
|
-
if (inputCoinB == null) {
|
|
6912
|
-
coinBInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeB, false);
|
|
6913
|
-
} else {
|
|
6914
|
-
coinBInput = {
|
|
6915
|
-
targetCoin: inputCoinB,
|
|
6916
|
-
remainCoins: [],
|
|
6917
|
-
isMintZeroCoin: false,
|
|
6918
|
-
tragetCoinAmount: "0"
|
|
6919
|
-
};
|
|
6920
|
-
}
|
|
6921
|
-
coinIdMaps[coinTypeB] = coinBInput;
|
|
6922
|
-
}
|
|
6931
|
+
const coinAInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeA, false, true);
|
|
6932
|
+
const coinBInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeB, false, true);
|
|
6933
|
+
coinIdList.push({ coin: coinAInput, coin_addr: coinTypeA });
|
|
6934
|
+
coinIdList.push({ coin: coinBInput, coin_addr: coinTypeB });
|
|
6923
6935
|
tx = this._sdk.Position.createCollectFeeNoSendPaylod(
|
|
6924
6936
|
{
|
|
6925
6937
|
pool_id: item.pool_id,
|
|
@@ -6935,20 +6947,14 @@ var RewarderModule = class {
|
|
|
6935
6947
|
const primaryCoinInputs = [];
|
|
6936
6948
|
item.rewarder_coin_types.forEach((type) => {
|
|
6937
6949
|
const coinType = normalizeCoinType(type);
|
|
6938
|
-
|
|
6939
|
-
if (coinInput === void 0) {
|
|
6940
|
-
coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinType, false);
|
|
6941
|
-
coinIdMaps[coinType] = coinInput;
|
|
6942
|
-
}
|
|
6950
|
+
const coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinType, false, true);
|
|
6943
6951
|
primaryCoinInputs.push(coinInput.targetCoin);
|
|
6952
|
+
coinIdList.push({ coin: coinInput, coin_addr: coinType });
|
|
6944
6953
|
});
|
|
6945
6954
|
tx = this.createCollectRewarderNoSendPaylod(item, tx, primaryCoinInputs);
|
|
6946
6955
|
});
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
if (value.isMintZeroCoin) {
|
|
6950
|
-
TransactionUtil.buildTransferCoin(this._sdk, tx, value.targetCoin, key, this._sdk.senderAddress);
|
|
6951
|
-
}
|
|
6956
|
+
coinIdList.forEach((item) => {
|
|
6957
|
+
TransactionUtil.buildTransferCoin(this._sdk, tx, item.coin.targetCoin, item.coin_addr, this._sdk.senderAddress);
|
|
6952
6958
|
});
|
|
6953
6959
|
return tx;
|
|
6954
6960
|
}
|
|
@@ -7737,8 +7743,8 @@ var SwapModule = class {
|
|
|
7737
7743
|
* @returns {Promise<PreSwapParams>} A promise that resolves to the swap data.
|
|
7738
7744
|
*/
|
|
7739
7745
|
async preswap(params) {
|
|
7740
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
7741
|
-
const { global_config_id } = getPackagerConfigs(
|
|
7746
|
+
const { integrate, simulationAccount, clmm_pool } = this.sdk.sdkOptions;
|
|
7747
|
+
const { global_config_id } = getPackagerConfigs(clmm_pool);
|
|
7742
7748
|
const tx = new import_transactions8.Transaction();
|
|
7743
7749
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
7744
7750
|
const args = [
|
|
@@ -8005,8 +8011,8 @@ var LockModule = class {
|
|
|
8005
8011
|
}
|
|
8006
8012
|
const tx = new import_transactions9.Transaction();
|
|
8007
8013
|
tx.setSender(this.sdk.senderAddress);
|
|
8008
|
-
const { integrate } = this.sdk.sdkOptions;
|
|
8009
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8014
|
+
const { integrate, ve33 } = this.sdk.sdkOptions;
|
|
8015
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8010
8016
|
const typeArguments = [magma_token, params.coinType];
|
|
8011
8017
|
const allCoinAsset = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
|
|
8012
8018
|
const coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(params.amount), params.coinType, false, true);
|
|
@@ -8031,8 +8037,8 @@ var LockModule = class {
|
|
|
8031
8037
|
if (incentiveTokens.length < 1 || incentiveTokens.length > 3) {
|
|
8032
8038
|
throw Error("incentiveTokens length must be between 1 and 3");
|
|
8033
8039
|
}
|
|
8034
|
-
const { integrate } = this.sdk.sdkOptions;
|
|
8035
|
-
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(
|
|
8040
|
+
const { integrate, ve33 } = this.sdk.sdkOptions;
|
|
8041
|
+
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8036
8042
|
const typeArguments = [magma_token, ...feeTokens, ...incentiveTokens];
|
|
8037
8043
|
let targetFunc = `${integrate.published_at}::${Voter}::claim_voting_bribes_for_single_pool${incentiveTokens.length}`;
|
|
8038
8044
|
if (incentiveTokens.length === 1) {
|
|
@@ -8050,8 +8056,8 @@ var LockModule = class {
|
|
|
8050
8056
|
}
|
|
8051
8057
|
async fastLocksOfUser(user) {
|
|
8052
8058
|
const locksInfo = { owner: user, lockInfo: [] };
|
|
8053
|
-
const { distribution } = this._sdk.sdkOptions;
|
|
8054
|
-
const { magma_token } = getPackagerConfigs(
|
|
8059
|
+
const { distribution, ve33 } = this._sdk.sdkOptions;
|
|
8060
|
+
const { magma_token } = getPackagerConfigs(ve33);
|
|
8055
8061
|
const ownerRes = await this._sdk.fullClient.getOwnedObjectsByPage(user, {
|
|
8056
8062
|
options: { showType: true, showContent: true, showDisplay: true, showOwner: true },
|
|
8057
8063
|
filter: {
|
|
@@ -8085,8 +8091,8 @@ var LockModule = class {
|
|
|
8085
8091
|
}
|
|
8086
8092
|
async locksOfUserV2(user) {
|
|
8087
8093
|
const locksInfo = { owner: user, lockInfo: [] };
|
|
8088
|
-
const { distribution } = this._sdk.sdkOptions;
|
|
8089
|
-
const { magma_token } = getPackagerConfigs(
|
|
8094
|
+
const { distribution, ve33 } = this._sdk.sdkOptions;
|
|
8095
|
+
const { magma_token } = getPackagerConfigs(ve33);
|
|
8090
8096
|
const ownerRes = await this._sdk.fullClient.getOwnedObjectsByPage(user, {
|
|
8091
8097
|
options: { showType: true, showContent: true, showDisplay: true, showOwner: true },
|
|
8092
8098
|
filter: {
|
|
@@ -8136,8 +8142,8 @@ var LockModule = class {
|
|
|
8136
8142
|
}
|
|
8137
8143
|
async locksOfUser(user) {
|
|
8138
8144
|
const locksInfo = { owner: user, lockInfo: [] };
|
|
8139
|
-
const { distribution } = this._sdk.sdkOptions;
|
|
8140
|
-
const { magma_token } = getPackagerConfigs(
|
|
8145
|
+
const { distribution, ve33 } = this._sdk.sdkOptions;
|
|
8146
|
+
const { magma_token } = getPackagerConfigs(ve33);
|
|
8141
8147
|
const ownerRes = await this._sdk.fullClient.getOwnedObjectsByPage(user, {
|
|
8142
8148
|
options: { showType: true, showContent: true, showDisplay: true, showOwner: true },
|
|
8143
8149
|
filter: {
|
|
@@ -8225,7 +8231,7 @@ var LockModule = class {
|
|
|
8225
8231
|
"InvalidLockObject" /* InvalidLockObject */
|
|
8226
8232
|
);
|
|
8227
8233
|
}
|
|
8228
|
-
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
8234
|
+
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
8229
8235
|
const aLockSummary = await this.aLockSummary(lockId);
|
|
8230
8236
|
const poolIncentiveTokens = await this.getVotingBribeRewardTokens(lockId);
|
|
8231
8237
|
const poolFeeTokens = await this.getVotingFeeRewardTokens(lockId);
|
|
@@ -8283,8 +8289,8 @@ var LockModule = class {
|
|
|
8283
8289
|
}
|
|
8284
8290
|
async aLockSummary(lock_id) {
|
|
8285
8291
|
const tx = new import_transactions9.Transaction();
|
|
8286
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8287
|
-
const { voting_escrow_id, magma_token, voter_id, reward_distributor_id } = getPackagerConfigs(
|
|
8292
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8293
|
+
const { voting_escrow_id, magma_token, voter_id, reward_distributor_id } = getPackagerConfigs(ve33);
|
|
8288
8294
|
const typeArguments = [magma_token];
|
|
8289
8295
|
const args = [
|
|
8290
8296
|
tx.object(voter_id),
|
|
@@ -8336,8 +8342,8 @@ var LockModule = class {
|
|
|
8336
8342
|
}
|
|
8337
8343
|
async _aLockSummary(lock_id, tx) {
|
|
8338
8344
|
tx = tx || new import_transactions9.Transaction();
|
|
8339
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8340
|
-
const { voting_escrow_id, magma_token, voter_id, reward_distributor_id } = getPackagerConfigs(
|
|
8345
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8346
|
+
const { voting_escrow_id, magma_token, voter_id, reward_distributor_id } = getPackagerConfigs(ve33);
|
|
8341
8347
|
const typeArguments = [magma_token];
|
|
8342
8348
|
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
8343
8349
|
throw Error("this config simulationAccount is not set right");
|
|
@@ -8379,8 +8385,8 @@ var LockModule = class {
|
|
|
8379
8385
|
}
|
|
8380
8386
|
async allLockSummary() {
|
|
8381
8387
|
const tx = new import_transactions9.Transaction();
|
|
8382
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8383
|
-
const { voting_escrow_id, magma_token, voter_id, minter_id } = getPackagerConfigs(
|
|
8388
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8389
|
+
const { voting_escrow_id, magma_token, voter_id, minter_id } = getPackagerConfigs(ve33);
|
|
8384
8390
|
const typeArguments = [magma_token];
|
|
8385
8391
|
const args = [tx.object(minter_id), tx.object(voter_id), tx.object(voting_escrow_id), tx.object(CLOCK_ADDRESS)];
|
|
8386
8392
|
tx.moveCall({
|
|
@@ -8424,8 +8430,8 @@ var LockModule = class {
|
|
|
8424
8430
|
}
|
|
8425
8431
|
async poolWeights(pools) {
|
|
8426
8432
|
const tx = new import_transactions9.Transaction();
|
|
8427
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8428
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8433
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8434
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8429
8435
|
const typeArguments = [magma_token];
|
|
8430
8436
|
const poolsParams = tx.pure.vector("id", pools);
|
|
8431
8437
|
const args = [tx.object(voter_id), poolsParams];
|
|
@@ -8466,8 +8472,8 @@ var LockModule = class {
|
|
|
8466
8472
|
}
|
|
8467
8473
|
async _getVotingFeeRewardTokens(lock_id, tx) {
|
|
8468
8474
|
tx = tx || new import_transactions9.Transaction();
|
|
8469
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8470
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8475
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8476
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8471
8477
|
const typeArguments = [magma_token];
|
|
8472
8478
|
const args = [tx.object(voter_id), tx.object(lock_id)];
|
|
8473
8479
|
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
@@ -8507,8 +8513,8 @@ var LockModule = class {
|
|
|
8507
8513
|
}
|
|
8508
8514
|
async getVotingFeeRewardTokens(lock_id) {
|
|
8509
8515
|
const tx = new import_transactions9.Transaction();
|
|
8510
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8511
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8516
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8517
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8512
8518
|
const typeArguments = [magma_token];
|
|
8513
8519
|
const args = [tx.object(voter_id), tx.object(lock_id)];
|
|
8514
8520
|
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
@@ -8551,8 +8557,8 @@ var LockModule = class {
|
|
|
8551
8557
|
}
|
|
8552
8558
|
async _getVotingBribeRewardTokens(lock_id, tx) {
|
|
8553
8559
|
tx = tx || new import_transactions9.Transaction();
|
|
8554
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8555
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8560
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8561
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8556
8562
|
const typeArguments = [magma_token];
|
|
8557
8563
|
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
8558
8564
|
throw Error("this config simulationAccount is not set right");
|
|
@@ -8593,8 +8599,8 @@ var LockModule = class {
|
|
|
8593
8599
|
// Return PoolId => tokens
|
|
8594
8600
|
async getVotingBribeRewardTokens(lock_id) {
|
|
8595
8601
|
const tx = new import_transactions9.Transaction();
|
|
8596
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8597
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8602
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8603
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8598
8604
|
const typeArguments = [magma_token];
|
|
8599
8605
|
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
8600
8606
|
throw Error("this config simulationAccount is not set right");
|
|
@@ -8645,8 +8651,8 @@ var LockModule = class {
|
|
|
8645
8651
|
}
|
|
8646
8652
|
_getFeeRewardsInner(lock_id, token_a, token_b, tx) {
|
|
8647
8653
|
tx = tx || new import_transactions9.Transaction();
|
|
8648
|
-
const { integrate } = this.sdk.sdkOptions;
|
|
8649
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8654
|
+
const { integrate, ve33 } = this.sdk.sdkOptions;
|
|
8655
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8650
8656
|
const typeArguments = [magma_token, token_a, token_b];
|
|
8651
8657
|
const args = [tx.object(voter_id), tx.object(lock_id), tx.object(CLOCK_ADDRESS)];
|
|
8652
8658
|
const targetFunc = `${integrate.published_at}::${Voter}::claimable_voting_fee_rewards`;
|
|
@@ -8705,8 +8711,8 @@ var LockModule = class {
|
|
|
8705
8711
|
// if you have many tokens, call this function multi times
|
|
8706
8712
|
async _getPoolFeeRewards(lock_id, token_a, token_b, poolFeeRewardTokens) {
|
|
8707
8713
|
const tx = new import_transactions9.Transaction();
|
|
8708
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8709
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8714
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8715
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8710
8716
|
const typeArguments = [magma_token, token_a, token_b];
|
|
8711
8717
|
const args = [tx.object(voter_id), tx.object(lock_id), tx.object(CLOCK_ADDRESS)];
|
|
8712
8718
|
const targetFunc = `${integrate.published_at}::${Voter}::claimable_voting_fee_rewards`;
|
|
@@ -8760,8 +8766,8 @@ var LockModule = class {
|
|
|
8760
8766
|
if (incentive_tokens.length > 3) {
|
|
8761
8767
|
throw Error("Too many tokens");
|
|
8762
8768
|
}
|
|
8763
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8764
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8769
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8770
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8765
8771
|
const typeArguments = [magma_token, ...incentive_tokens];
|
|
8766
8772
|
const args = [tx.object(voter_id), tx.object(locksId), tx.object(CLOCK_ADDRESS)];
|
|
8767
8773
|
let targetFunc = `${integrate.published_at}::${Voter}::claimable_voting_bribes_${incentive_tokens.length}`;
|
|
@@ -8829,8 +8835,8 @@ var LockModule = class {
|
|
|
8829
8835
|
throw Error("Too many tokens");
|
|
8830
8836
|
}
|
|
8831
8837
|
const tx = new import_transactions9.Transaction();
|
|
8832
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8833
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8838
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8839
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8834
8840
|
const typeArguments = [magma_token, ...incentive_tokens];
|
|
8835
8841
|
const args = [tx.object(voter_id), tx.object(locksId), tx.object(CLOCK_ADDRESS)];
|
|
8836
8842
|
let targetFunc = `${integrate.published_at}::${Voter}::claimable_voting_bribes_${incentive_tokens.length}`;
|
|
@@ -8868,8 +8874,8 @@ var LockModule = class {
|
|
|
8868
8874
|
}
|
|
8869
8875
|
async getPoolBribeRewardTokens(pool_id) {
|
|
8870
8876
|
const tx = new import_transactions9.Transaction();
|
|
8871
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8872
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8877
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8878
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8873
8879
|
const typeArguments = [magma_token];
|
|
8874
8880
|
const args = [tx.object(voter_id), tx.object(pool_id)];
|
|
8875
8881
|
tx.moveCall({
|
|
@@ -8904,8 +8910,8 @@ var LockModule = class {
|
|
|
8904
8910
|
}
|
|
8905
8911
|
async getLockVotingStats(lockId) {
|
|
8906
8912
|
const tx = new import_transactions9.Transaction();
|
|
8907
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8908
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8913
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8914
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8909
8915
|
const args = [tx.object(voter_id), tx.object(lockId), tx.object(CLOCK_ADDRESS)];
|
|
8910
8916
|
const typeArguments = [magma_token];
|
|
8911
8917
|
tx.moveCall({
|
|
@@ -10008,16 +10014,9 @@ var ConfigModule = class {
|
|
|
10008
10014
|
launchpad_pools_id: "",
|
|
10009
10015
|
clmm_pools_id: "",
|
|
10010
10016
|
admin_cap_id: "",
|
|
10011
|
-
global_config_id: "",
|
|
10012
10017
|
coin_list_handle: "",
|
|
10013
10018
|
launchpad_pools_handle: "",
|
|
10014
|
-
clmm_pools_handle: ""
|
|
10015
|
-
voter_id: "",
|
|
10016
|
-
minter_id: "",
|
|
10017
|
-
reward_distributor_id: "",
|
|
10018
|
-
distribution_cfg: "",
|
|
10019
|
-
magma_token: "",
|
|
10020
|
-
voting_escrow_id: ""
|
|
10019
|
+
clmm_pools_handle: ""
|
|
10021
10020
|
};
|
|
10022
10021
|
if (objects.data.length > 0) {
|
|
10023
10022
|
for (const item of objects.data) {
|
|
@@ -10033,7 +10032,6 @@ var ConfigModule = class {
|
|
|
10033
10032
|
tokenConfig.clmm_pools_id = item.parsedJson.pools_id;
|
|
10034
10033
|
break;
|
|
10035
10034
|
case `InitConfigEvent`:
|
|
10036
|
-
tokenConfig.global_config_id = item.parsedJson.global_config_id;
|
|
10037
10035
|
tokenConfig.admin_cap_id = item.parsedJson.admin_cap_id;
|
|
10038
10036
|
break;
|
|
10039
10037
|
default:
|
|
@@ -10306,7 +10304,7 @@ var GaugeModule = class {
|
|
|
10306
10304
|
if (gauge === void 0) {
|
|
10307
10305
|
throw Error(`Fetch gauge of pool ${params.poolId} failed`);
|
|
10308
10306
|
}
|
|
10309
|
-
const { distribution_cfg, magma_token } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10307
|
+
const { distribution_cfg, magma_token } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10310
10308
|
const { clmm_pool, integrate } = this.sdk.sdkOptions;
|
|
10311
10309
|
const clmmConfig = getPackagerConfigs(clmm_pool);
|
|
10312
10310
|
const typeArguments = [params.coinTypeA, params.coinTypeB, magma_token];
|
|
@@ -10333,7 +10331,7 @@ var GaugeModule = class {
|
|
|
10333
10331
|
if (gauge === void 0) {
|
|
10334
10332
|
throw Error(`Fetch gauge of pool ${params.poolId} failed`);
|
|
10335
10333
|
}
|
|
10336
|
-
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10334
|
+
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10337
10335
|
const { integrate } = this.sdk.sdkOptions;
|
|
10338
10336
|
const typeArguments = [params.coinTypeA, params.coinTypeB, magma_token];
|
|
10339
10337
|
const args = [tx.object(gauge), tx.object(params.poolId), tx.object(params.positionId), tx.object(CLOCK_ADDRESS)];
|
|
@@ -10383,7 +10381,7 @@ var GaugeModule = class {
|
|
|
10383
10381
|
async getUserStakedPositionInfoOfPool(userAddr, pool, gauger, poolCoinA, poolCoinB) {
|
|
10384
10382
|
const tx = new import_transactions11.Transaction();
|
|
10385
10383
|
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
10386
|
-
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10384
|
+
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10387
10385
|
const typeArguments = [poolCoinA, poolCoinB, magma_token];
|
|
10388
10386
|
const args = [tx.object(voter_id), tx.object(gauger), tx.object(pool), tx.pure.address(userAddr), tx.object(CLOCK_ADDRESS)];
|
|
10389
10387
|
tx.moveCall({
|
|
@@ -10407,7 +10405,7 @@ var GaugeModule = class {
|
|
|
10407
10405
|
async getPoolGaguers() {
|
|
10408
10406
|
const tx = new import_transactions11.Transaction();
|
|
10409
10407
|
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
10410
|
-
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10408
|
+
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10411
10409
|
const typeArguments = [magma_token];
|
|
10412
10410
|
const args = [tx.object(voter_id)];
|
|
10413
10411
|
tx.moveCall({
|
|
@@ -10447,7 +10445,7 @@ var GaugeModule = class {
|
|
|
10447
10445
|
async getEmissions() {
|
|
10448
10446
|
const tx = new import_transactions11.Transaction();
|
|
10449
10447
|
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
10450
|
-
const { magma_token, minter_id, voting_escrow_id } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10448
|
+
const { magma_token, minter_id, voting_escrow_id } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10451
10449
|
const typeArguments = [magma_token];
|
|
10452
10450
|
const args = [tx.object(minter_id), tx.object(voting_escrow_id)];
|
|
10453
10451
|
tx.moveCall({
|
|
@@ -10481,7 +10479,7 @@ var GaugeModule = class {
|
|
|
10481
10479
|
async getRewardByPosition(params) {
|
|
10482
10480
|
const tx = new import_transactions11.Transaction();
|
|
10483
10481
|
const { integrate } = this.sdk.sdkOptions;
|
|
10484
|
-
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10482
|
+
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10485
10483
|
const typeArguments = [params.coinTypeA, params.coinTypeB, magma_token];
|
|
10486
10484
|
const args = [tx.object(params.gaugeId), tx.object(params.poolId), tx.object(params.positionId), tx.object(CLOCK_ADDRESS)];
|
|
10487
10485
|
tx.moveCall({
|
|
@@ -10494,7 +10492,7 @@ var GaugeModule = class {
|
|
|
10494
10492
|
async getAllRewardByPositions(paramsList) {
|
|
10495
10493
|
const tx = new import_transactions11.Transaction();
|
|
10496
10494
|
const { integrate } = this.sdk.sdkOptions;
|
|
10497
|
-
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10495
|
+
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10498
10496
|
paramsList.forEach((params) => {
|
|
10499
10497
|
const typeArguments = [params.coinTypeA, params.coinTypeB, magma_token];
|
|
10500
10498
|
const args = [tx.object(params.gaugeId), tx.object(params.poolId), tx.object(params.positionId), tx.object(CLOCK_ADDRESS)];
|
|
@@ -10509,7 +10507,7 @@ var GaugeModule = class {
|
|
|
10509
10507
|
async getEpochRewardByPool(pool, incentive_tokens) {
|
|
10510
10508
|
const tx = new import_transactions11.Transaction();
|
|
10511
10509
|
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
10512
|
-
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10510
|
+
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10513
10511
|
const typeArguments = [magma_token, ...incentive_tokens];
|
|
10514
10512
|
const args = [tx.object(voter_id), tx.object(pool), tx.object(CLOCK_ADDRESS)];
|
|
10515
10513
|
let targetFunc = `${integrate.published_at}::${Voter}::epoch_reward_by_pool${incentive_tokens.length}`;
|
|
@@ -10640,8 +10638,18 @@ var DlmmModule = class {
|
|
|
10640
10638
|
});
|
|
10641
10639
|
return tx;
|
|
10642
10640
|
}
|
|
10643
|
-
// async mintByStrategySingle(params: MintByStrategySingleParams): Promise<Transaction> {}
|
|
10644
10641
|
async mintByStrategy(params) {
|
|
10642
|
+
if (params.fixCoinA && params.fixCoinB) {
|
|
10643
|
+
if (params.amountATotal === 0 || params.amountBTotal === 0) {
|
|
10644
|
+
if (params.active_bin < params.max_bin && params.active_bin > params.min_bin) {
|
|
10645
|
+
if (params.amountATotal > 0) {
|
|
10646
|
+
params.min_bin = params.active_bin;
|
|
10647
|
+
} else if (params.amountBTotal > 0) {
|
|
10648
|
+
params.max_bin = params.active_bin;
|
|
10649
|
+
}
|
|
10650
|
+
}
|
|
10651
|
+
}
|
|
10652
|
+
}
|
|
10645
10653
|
const tx = new import_transactions12.Transaction();
|
|
10646
10654
|
const slippage = new import_decimal13.default(params.slippage);
|
|
10647
10655
|
const lower_slippage = new import_decimal13.default(1).sub(slippage.div(new import_decimal13.default(1e4)));
|
|
@@ -10660,12 +10668,14 @@ var DlmmModule = class {
|
|
|
10660
10668
|
let primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountBTotal), params.coinTypeB, false, true);
|
|
10661
10669
|
let amount_min = 0;
|
|
10662
10670
|
let amount_max = 0;
|
|
10663
|
-
if (params.fixCoinA) {
|
|
10671
|
+
if (params.fixCoinA && params.fixCoinB) {
|
|
10672
|
+
primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountATotal), params.coinTypeB, false, true);
|
|
10673
|
+
primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountBTotal), params.coinTypeB, false, true);
|
|
10674
|
+
} else if (params.fixCoinA) {
|
|
10664
10675
|
amount_min = new import_decimal13.default(params.amountBTotal).mul(lower_slippage).toDecimalPlaces(0).toNumber();
|
|
10665
10676
|
amount_max = new import_decimal13.default(params.amountBTotal).mul(upper_slippage).toDecimalPlaces(0).toNumber();
|
|
10666
10677
|
primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(amount_max), params.coinTypeB, false, true);
|
|
10667
|
-
}
|
|
10668
|
-
if (params.fixCoinB) {
|
|
10678
|
+
} else if (params.fixCoinB) {
|
|
10669
10679
|
amount_min = new import_decimal13.default(params.amountATotal).mul(lower_slippage).toDecimalPlaces(0).toNumber();
|
|
10670
10680
|
amount_max = new import_decimal13.default(params.amountATotal).mul(upper_slippage).toDecimalPlaces(0).toNumber();
|
|
10671
10681
|
primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(amount_max), params.coinTypeB, false, true);
|
|
@@ -10681,7 +10691,9 @@ var DlmmModule = class {
|
|
|
10681
10691
|
tx.object(dlmmConfig.factory),
|
|
10682
10692
|
primaryCoinAInputs.targetCoin,
|
|
10683
10693
|
primaryCoinBInputs.targetCoin,
|
|
10694
|
+
tx.pure.bool(params.fixCoinA),
|
|
10684
10695
|
tx.pure.u64(params.amountATotal),
|
|
10696
|
+
tx.pure.bool(params.fixCoinB),
|
|
10685
10697
|
tx.pure.u64(params.amountBTotal),
|
|
10686
10698
|
tx.pure.u8(params.strategy),
|
|
10687
10699
|
tx.pure.u32((0, import_calc_dlmm3.get_storage_id_from_real_id)(params.min_bin)),
|
|
@@ -11714,8 +11726,9 @@ var SDKConfig = {
|
|
|
11714
11726
|
admin_cap_id: "0x39d78781750e193ce35c45ff32c6c0c3f2941fa3ddaf8595c90c555589ddb113",
|
|
11715
11727
|
coin_list_handle: "0x49136005e90e28c4695419ed4194cc240603f1ea8eb84e62275eaff088a71063",
|
|
11716
11728
|
launchpad_pools_handle: "0x5e194a8efcf653830daf85a85b52e3ae8f65dc39481d54b2382acda25068375c",
|
|
11717
|
-
clmm_pools_handle: "0x37f60eb2d9d227949b95da8fea810db3c32d1e1fa8ed87434fc51664f87d83cb"
|
|
11718
|
-
|
|
11729
|
+
clmm_pools_handle: "0x37f60eb2d9d227949b95da8fea810db3c32d1e1fa8ed87434fc51664f87d83cb"
|
|
11730
|
+
},
|
|
11731
|
+
ve33Config: {
|
|
11719
11732
|
voter_id: "0xaab0f3a90da96d29d743e09c269e1ae48ec1bae52a28cd38c49c5dc8c1bf92b8",
|
|
11720
11733
|
voting_escrow_id: "0x7ab45fbe01da26e07ba21757916d540c8747cf7daa88f3171e13db17373d5adc",
|
|
11721
11734
|
reward_distributor_id: "0x9f4f882245e49fd9213278dfbcb63a14fdbdd2ce7e25e9353a0cecdca30de853",
|
|
@@ -11733,6 +11746,11 @@ var clmmMainnet = {
|
|
|
11733
11746
|
simulationAccount: {
|
|
11734
11747
|
address: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
11735
11748
|
},
|
|
11749
|
+
ve33: {
|
|
11750
|
+
package_id: "0x7ab45fbe01da26e07ba21757916d540c8747cf7daa88f3171e13db17373d5adc",
|
|
11751
|
+
published_at: "0x7ab45fbe01da26e07ba21757916d540c8747cf7daa88f3171e13db17373d5adc",
|
|
11752
|
+
config: SDKConfig.ve33Config
|
|
11753
|
+
},
|
|
11736
11754
|
magma_config: {
|
|
11737
11755
|
package_id: "0x95b8d278b876cae22206131fb9724f701c9444515813042f54f0a426c9a3bc2f",
|
|
11738
11756
|
published_at: "0x95b8d278b876cae22206131fb9724f701c9444515813042f54f0a426c9a3bc2f",
|
|
@@ -11781,8 +11799,8 @@ function initMainnetSDK(fullNodeUrl, simulationAccount) {
|
|
|
11781
11799
|
var import_client3 = require("@mysten/sui/client");
|
|
11782
11800
|
var SDKConfig2 = {
|
|
11783
11801
|
clmmConfig: {
|
|
11784
|
-
pools_id: "
|
|
11785
|
-
global_config_id: "
|
|
11802
|
+
pools_id: "0xd7037b38ae757d7a69b61146b27c288600b9aefbffbf884b856881dff6a4f27b",
|
|
11803
|
+
global_config_id: "0x83baa8b07800029302f75ac6906240e86cf05066d37eedcabc61a0d6b6dc6eda",
|
|
11786
11804
|
global_vault_id: "0xf78d2ee3c312f298882cb680695e5e8c81b1d441a646caccc058006c2851ddea",
|
|
11787
11805
|
admin_cap_id: "0xa456f86a53fc31e1243f065738ff1fc93f5a62cc080ff894a0fb3747556a799b"
|
|
11788
11806
|
},
|
|
@@ -11790,11 +11808,13 @@ var SDKConfig2 = {
|
|
|
11790
11808
|
coin_list_id: "0x257eb2ba592a5480bba0a97d05338fab17cc3283f8df6998a0e12e4ab9b84478",
|
|
11791
11809
|
launchpad_pools_id: "0xdc3a7bd66a6dcff73c77c866e87d73826e446e9171f34e1c1b656377314f94da",
|
|
11792
11810
|
clmm_pools_id: "0x26c85500f5dd2983bf35123918a144de24e18936d0b234ef2b49fbb2d3d6307d",
|
|
11793
|
-
admin_cap_id: "
|
|
11811
|
+
admin_cap_id: "0xd328ff427794b8ca0a69c3ebb0c0e4d2e81267ec4ba36e11487362c6508a4c0f",
|
|
11794
11812
|
coin_list_handle: "0x3204350fc603609c91675e07b8f9ac0999b9607d83845086321fca7f469de235",
|
|
11795
11813
|
launchpad_pools_handle: "0xae67ff87c34aceea4d28107f9c6c62e297a111e9f8e70b9abbc2f4c9f5ec20fd",
|
|
11796
|
-
clmm_pools_handle: "0xd28736923703342b4752f5ed8c2f2a5c0cb2336c30e1fed42b387234ce8408ec"
|
|
11797
|
-
|
|
11814
|
+
clmm_pools_handle: "0xd28736923703342b4752f5ed8c2f2a5c0cb2336c30e1fed42b387234ce8408ec"
|
|
11815
|
+
},
|
|
11816
|
+
ve33Config: {
|
|
11817
|
+
// global_config_id: '0xbbe54f3c2bd06c5ab7f93950025bff6710c9a83836d7145636fea383b315774d',
|
|
11798
11818
|
voter_id: "0x59571991a5c7041c4376d980061af5c7a6d8345006d6b5167bd1f00fc17b8ddb",
|
|
11799
11819
|
voting_escrow_id: "0x9081c8044719135da4ff2d52907fcd40c19e2a40750cbba4c1d6a59610ae1446",
|
|
11800
11820
|
reward_distributor_id: "0xdf213d8e0ca49c8f4a508e7d3b3a6983c4aafd639f7c99479fc75fb4451d752e",
|
|
@@ -11809,13 +11829,18 @@ var SDKConfig2 = {
|
|
|
11809
11829
|
var clmmTestnet = {
|
|
11810
11830
|
fullRpcUrl: (0, import_client3.getFullnodeUrl)("testnet"),
|
|
11811
11831
|
magma_config: {
|
|
11812
|
-
package_id: "
|
|
11813
|
-
published_at: "
|
|
11832
|
+
package_id: "",
|
|
11833
|
+
published_at: "",
|
|
11814
11834
|
config: SDKConfig2.magmaConfig
|
|
11815
11835
|
},
|
|
11836
|
+
ve33: {
|
|
11837
|
+
package_id: "0x7ab45fbe01da26e07ba21757916d540c8747cf7daa88f3171e13db17373d5adc",
|
|
11838
|
+
published_at: "0x7ab45fbe01da26e07ba21757916d540c8747cf7daa88f3171e13db17373d5adc",
|
|
11839
|
+
config: SDKConfig2.ve33Config
|
|
11840
|
+
},
|
|
11816
11841
|
clmm_pool: {
|
|
11817
|
-
package_id: "
|
|
11818
|
-
published_at: "
|
|
11842
|
+
package_id: "0xca1b84a430d03e22dae08a7273c8e9dcfdb40b7f559574105f008600eeb7b4bd",
|
|
11843
|
+
published_at: "0xca1b84a430d03e22dae08a7273c8e9dcfdb40b7f559574105f008600eeb7b4bd",
|
|
11819
11844
|
config: SDKConfig2.clmmConfig
|
|
11820
11845
|
},
|
|
11821
11846
|
dlmm_pool: {
|
|
@@ -11828,8 +11853,8 @@ var clmmTestnet = {
|
|
|
11828
11853
|
published_at: "0x45ac2371c33ca0df8dc784d62c8ce5126d42edd8c56820396524dff2ae0619b1"
|
|
11829
11854
|
},
|
|
11830
11855
|
integrate: {
|
|
11831
|
-
package_id: "
|
|
11832
|
-
published_at: "
|
|
11856
|
+
package_id: "0x975672d26fc9ba026a35f2001951fbcf5e37e75aca41db7c762d61b4e1e64986",
|
|
11857
|
+
published_at: "0x975672d26fc9ba026a35f2001951fbcf5e37e75aca41db7c762d61b4e1e64986"
|
|
11833
11858
|
},
|
|
11834
11859
|
simulationAccount: {
|
|
11835
11860
|
address: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
@@ -11846,7 +11871,7 @@ var clmmTestnet = {
|
|
|
11846
11871
|
package_id: "0x56d90d0c055edb534b11e7548270bb458fd47c69b77bf40c14d5eb00e6e6cf64",
|
|
11847
11872
|
published_at: "0x56d90d0c055edb534b11e7548270bb458fd47c69b77bf40c14d5eb00e6e6cf64"
|
|
11848
11873
|
},
|
|
11849
|
-
aggregatorUrl: "https://
|
|
11874
|
+
aggregatorUrl: "https://testnet.magmafinance.io/api/router",
|
|
11850
11875
|
swapCountUrl: "https://api-sui.devmagma.com/v2/sui/swap/count"
|
|
11851
11876
|
};
|
|
11852
11877
|
function initTestnetSDK(fullNodeUrl, simulationAccount) {
|