@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.mjs
CHANGED
|
@@ -1755,7 +1755,7 @@ function toAmountAskSide(activeId, binStep, totalAmount, distributions) {
|
|
|
1755
1755
|
});
|
|
1756
1756
|
}
|
|
1757
1757
|
function toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, distributions) {
|
|
1758
|
-
if (activeId > distributions[distributions.length - 1].binId) {
|
|
1758
|
+
if (activeId > distributions[distributions.length - 1].binId || amountX.isZero()) {
|
|
1759
1759
|
const amounts = toAmountBidSide(activeId, amountY, distributions);
|
|
1760
1760
|
return amounts.map((bin) => {
|
|
1761
1761
|
return {
|
|
@@ -1765,7 +1765,7 @@ function toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBi
|
|
|
1765
1765
|
};
|
|
1766
1766
|
});
|
|
1767
1767
|
}
|
|
1768
|
-
if (activeId < distributions[0].binId) {
|
|
1768
|
+
if (activeId < distributions[0].binId || amountY.isZero()) {
|
|
1769
1769
|
const amounts = toAmountAskSide(activeId, binStep, amountX, distributions);
|
|
1770
1770
|
return amounts.map((bin) => {
|
|
1771
1771
|
return {
|
|
@@ -1880,6 +1880,26 @@ var StrategyType = /* @__PURE__ */ ((StrategyType2) => {
|
|
|
1880
1880
|
StrategyType2[StrategyType2["BidAsk"] = 3] = "BidAsk";
|
|
1881
1881
|
return StrategyType2;
|
|
1882
1882
|
})(StrategyType || {});
|
|
1883
|
+
function toWeightDecendingOrder(minBinId, maxBinId) {
|
|
1884
|
+
const distributions = [];
|
|
1885
|
+
for (let i = minBinId; i <= maxBinId; i++) {
|
|
1886
|
+
distributions.push({
|
|
1887
|
+
binId: i,
|
|
1888
|
+
weight: maxBinId - i + 1
|
|
1889
|
+
});
|
|
1890
|
+
}
|
|
1891
|
+
return distributions;
|
|
1892
|
+
}
|
|
1893
|
+
function toWeightAscendingOrder(minBinId, maxBinId) {
|
|
1894
|
+
const distributions = [];
|
|
1895
|
+
for (let i = minBinId; i <= maxBinId; i++) {
|
|
1896
|
+
distributions.push({
|
|
1897
|
+
binId: i,
|
|
1898
|
+
weight: i - minBinId + 1
|
|
1899
|
+
});
|
|
1900
|
+
}
|
|
1901
|
+
return distributions;
|
|
1902
|
+
}
|
|
1883
1903
|
function toWeightSpotBalanced(minBinId, maxBinId) {
|
|
1884
1904
|
const distributions = [];
|
|
1885
1905
|
for (let i = minBinId; i <= maxBinId; i++) {
|
|
@@ -1996,10 +2016,26 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
|
|
|
1996
2016
|
return toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
|
|
1997
2017
|
}
|
|
1998
2018
|
case 2 /* Curve */: {
|
|
2019
|
+
if (activeId < minBinId) {
|
|
2020
|
+
const weights2 = toWeightDecendingOrder(minBinId, maxBinId);
|
|
2021
|
+
return toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
|
|
2022
|
+
}
|
|
2023
|
+
if (activeId > maxBinId) {
|
|
2024
|
+
const weights2 = toWeightAscendingOrder(minBinId, maxBinId);
|
|
2025
|
+
return toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
|
|
2026
|
+
}
|
|
1999
2027
|
const weights = toWeightCurve(minBinId, maxBinId, activeId);
|
|
2000
2028
|
return toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
|
|
2001
2029
|
}
|
|
2002
2030
|
case 3 /* BidAsk */: {
|
|
2031
|
+
if (activeId < minBinId) {
|
|
2032
|
+
const weights2 = toWeightAscendingOrder(minBinId, maxBinId);
|
|
2033
|
+
return toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
|
|
2034
|
+
}
|
|
2035
|
+
if (activeId > maxBinId) {
|
|
2036
|
+
const weights2 = toWeightDecendingOrder(minBinId, maxBinId);
|
|
2037
|
+
return toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights2);
|
|
2038
|
+
}
|
|
2003
2039
|
const weights = toWeightBidAsk(minBinId, maxBinId, activeId);
|
|
2004
2040
|
return toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBin, amountYInActiveBin, weights);
|
|
2005
2041
|
}
|
|
@@ -3359,14 +3395,14 @@ var _TransactionUtil = class {
|
|
|
3359
3395
|
static buildCreateLockTransaction(sdk, params, allCoinAsset) {
|
|
3360
3396
|
let tx = new Transaction();
|
|
3361
3397
|
tx.setSender(sdk.senderAddress);
|
|
3362
|
-
const { magma_token } = getPackagerConfigs(sdk.sdkOptions.
|
|
3398
|
+
const { magma_token } = getPackagerConfigs(sdk.sdkOptions.ve33);
|
|
3363
3399
|
const lockCoinInput = _TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(params.amount), magma_token, false, true);
|
|
3364
3400
|
tx = _TransactionUtil.buildCreateTransactionArgs(tx, params, sdk.sdkOptions, lockCoinInput);
|
|
3365
3401
|
return tx;
|
|
3366
3402
|
}
|
|
3367
3403
|
static buildCreateTransactionArgs(tx, params, sdkOptions, lockCoinInput) {
|
|
3368
|
-
const { integrate } = sdkOptions;
|
|
3369
|
-
const { voting_escrow_id, magma_token } = getPackagerConfigs(
|
|
3404
|
+
const { integrate, ve33 } = sdkOptions;
|
|
3405
|
+
const { voting_escrow_id, magma_token } = getPackagerConfigs(ve33);
|
|
3370
3406
|
const typeArguments = [magma_token];
|
|
3371
3407
|
const functionName = "create_lock";
|
|
3372
3408
|
const coins = tx.makeMoveVec({ elements: [lockCoinInput.targetCoin] });
|
|
@@ -3385,7 +3421,7 @@ var _TransactionUtil = class {
|
|
|
3385
3421
|
return tx;
|
|
3386
3422
|
}
|
|
3387
3423
|
static buildIncreaseLockAmountTransaction(sdk, params, allCoinAsset) {
|
|
3388
|
-
const { magma_token } = getPackagerConfigs(sdk.sdkOptions.
|
|
3424
|
+
const { magma_token } = getPackagerConfigs(sdk.sdkOptions.ve33);
|
|
3389
3425
|
let tx = new Transaction();
|
|
3390
3426
|
tx.setSender(sdk.senderAddress);
|
|
3391
3427
|
const lockCoinInput = _TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(params.amount), magma_token, false, true);
|
|
@@ -3393,8 +3429,8 @@ var _TransactionUtil = class {
|
|
|
3393
3429
|
return tx;
|
|
3394
3430
|
}
|
|
3395
3431
|
static buildIncreaseLockAmountTransactionArgs(tx, params, sdkOptions, increaseCoinInput) {
|
|
3396
|
-
const { integrate } = sdkOptions;
|
|
3397
|
-
const { voting_escrow_id, magma_token } = getPackagerConfigs(
|
|
3432
|
+
const { integrate, ve33 } = sdkOptions;
|
|
3433
|
+
const { voting_escrow_id, magma_token } = getPackagerConfigs(ve33);
|
|
3398
3434
|
const typeArguments = [magma_token];
|
|
3399
3435
|
const functionName = "increase_amount_single_coin";
|
|
3400
3436
|
const args = [tx.object(voting_escrow_id), tx.object(params.lockId), increaseCoinInput.targetCoin, tx.object(CLOCK_ADDRESS)];
|
|
@@ -3409,8 +3445,8 @@ var _TransactionUtil = class {
|
|
|
3409
3445
|
static buildMergeLockTransaction(sdk, params) {
|
|
3410
3446
|
const tx = new Transaction();
|
|
3411
3447
|
tx.setSender(sdk.senderAddress);
|
|
3412
|
-
const { integrate } = sdk.sdkOptions;
|
|
3413
|
-
const { voter_id, voting_escrow_id, magma_token, distribution_cfg } = getPackagerConfigs(
|
|
3448
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3449
|
+
const { voter_id, voting_escrow_id, magma_token, distribution_cfg } = getPackagerConfigs(ve33);
|
|
3414
3450
|
const typeArguments = [magma_token];
|
|
3415
3451
|
const functionName = "merge_locks";
|
|
3416
3452
|
const args = [
|
|
@@ -3432,8 +3468,8 @@ var _TransactionUtil = class {
|
|
|
3432
3468
|
static buildTransferLockTransaction(sdk, params) {
|
|
3433
3469
|
const tx = new Transaction();
|
|
3434
3470
|
tx.setSender(sdk.senderAddress);
|
|
3435
|
-
const { integrate } = sdk.sdkOptions;
|
|
3436
|
-
const { voting_escrow_id, magma_token } = getPackagerConfigs(
|
|
3471
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3472
|
+
const { voting_escrow_id, magma_token } = getPackagerConfigs(ve33);
|
|
3437
3473
|
const typeArguments = [magma_token];
|
|
3438
3474
|
const functionName = "transfer";
|
|
3439
3475
|
const args = [tx.object(voting_escrow_id), tx.object(params.lockId), tx.object(params.to), tx.object(CLOCK_ADDRESS)];
|
|
@@ -3450,8 +3486,8 @@ var _TransactionUtil = class {
|
|
|
3450
3486
|
tx.setSender(sdk.senderAddress);
|
|
3451
3487
|
const oneDay = 24 * 60 * 60;
|
|
3452
3488
|
const newLockDuration = Math.ceil((params.newLockEndAt - Date.now() / 1e3) / oneDay);
|
|
3453
|
-
const { integrate } = sdk.sdkOptions;
|
|
3454
|
-
const { voting_escrow_id, magma_token } = getPackagerConfigs(
|
|
3489
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3490
|
+
const { voting_escrow_id, magma_token } = getPackagerConfigs(ve33);
|
|
3455
3491
|
const typeArguments = [magma_token];
|
|
3456
3492
|
const functionName = "increase_unlock_time";
|
|
3457
3493
|
const args = [tx.object(voting_escrow_id), tx.object(params.lockId), tx.pure.u64(newLockDuration), tx.object(CLOCK_ADDRESS)];
|
|
@@ -3466,8 +3502,8 @@ var _TransactionUtil = class {
|
|
|
3466
3502
|
static buildLockPermanentTransaction(sdk, params) {
|
|
3467
3503
|
const tx = new Transaction();
|
|
3468
3504
|
tx.setSender(sdk.senderAddress);
|
|
3469
|
-
const { integrate } = sdk.sdkOptions;
|
|
3470
|
-
const { voting_escrow_id, magma_token } = getPackagerConfigs(
|
|
3505
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3506
|
+
const { voting_escrow_id, magma_token } = getPackagerConfigs(ve33);
|
|
3471
3507
|
const typeArguments = [magma_token];
|
|
3472
3508
|
const functionName = "lock_permanent";
|
|
3473
3509
|
const args = [tx.object(voting_escrow_id), tx.object(params.lockId), tx.object(CLOCK_ADDRESS)];
|
|
@@ -3481,8 +3517,8 @@ var _TransactionUtil = class {
|
|
|
3481
3517
|
static buildUnlockPermanentTransaction(sdk, params) {
|
|
3482
3518
|
const tx = new Transaction();
|
|
3483
3519
|
tx.setSender(sdk.senderAddress);
|
|
3484
|
-
const { integrate } = sdk.sdkOptions;
|
|
3485
|
-
const { voting_escrow_id, magma_token, distribution_cfg, voter_id } = getPackagerConfigs(
|
|
3520
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3521
|
+
const { voting_escrow_id, magma_token, distribution_cfg, voter_id } = getPackagerConfigs(ve33);
|
|
3486
3522
|
const typeArguments = [magma_token];
|
|
3487
3523
|
const functionName = "unlock_permanent";
|
|
3488
3524
|
const args = [
|
|
@@ -3502,8 +3538,8 @@ var _TransactionUtil = class {
|
|
|
3502
3538
|
static buildBurnLockTransaction(sdk, lockId) {
|
|
3503
3539
|
const tx = new Transaction();
|
|
3504
3540
|
tx.setSender(sdk.senderAddress);
|
|
3505
|
-
const { integrate } = sdk.sdkOptions;
|
|
3506
|
-
const { voting_escrow_id, magma_token, distribution_cfg, voter_id } = getPackagerConfigs(
|
|
3541
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3542
|
+
const { voting_escrow_id, magma_token, distribution_cfg, voter_id } = getPackagerConfigs(ve33);
|
|
3507
3543
|
const typeArguments = [magma_token];
|
|
3508
3544
|
const functionName = "burn_lock";
|
|
3509
3545
|
const args = [
|
|
@@ -3523,8 +3559,8 @@ var _TransactionUtil = class {
|
|
|
3523
3559
|
static buildSplitLockTransaction(sdk, lockId, splitAmount) {
|
|
3524
3560
|
const tx = new Transaction();
|
|
3525
3561
|
tx.setSender(sdk.senderAddress);
|
|
3526
|
-
const { integrate } = sdk.sdkOptions;
|
|
3527
|
-
const { voting_escrow_id, magma_token, distribution_cfg, voter_id } = getPackagerConfigs(
|
|
3562
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3563
|
+
const { voting_escrow_id, magma_token, distribution_cfg, voter_id } = getPackagerConfigs(ve33);
|
|
3528
3564
|
const typeArguments = [magma_token];
|
|
3529
3565
|
const functionName = "split_lock";
|
|
3530
3566
|
const args = [
|
|
@@ -3545,8 +3581,8 @@ var _TransactionUtil = class {
|
|
|
3545
3581
|
static buildVoteTransaction(sdk, params) {
|
|
3546
3582
|
const tx = new Transaction();
|
|
3547
3583
|
tx.setSender(sdk.senderAddress);
|
|
3548
|
-
const { integrate } = sdk.sdkOptions;
|
|
3549
|
-
const { distribution_cfg, voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(
|
|
3584
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3585
|
+
const { distribution_cfg, voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
3550
3586
|
const typeArguments = [magma_token];
|
|
3551
3587
|
const functionName = "vote";
|
|
3552
3588
|
const pools = tx.pure.vector("id", params.pools);
|
|
@@ -3573,8 +3609,8 @@ var _TransactionUtil = class {
|
|
|
3573
3609
|
static buildClaimVotingRewardsTransaction(sdk, params) {
|
|
3574
3610
|
const tx = new Transaction();
|
|
3575
3611
|
tx.setSender(sdk.senderAddress);
|
|
3576
|
-
const { integrate } = sdk.sdkOptions;
|
|
3577
|
-
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(
|
|
3612
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3613
|
+
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
3578
3614
|
const typeArguments = [magma_token, params.coinAType, params.coinBType];
|
|
3579
3615
|
const functionName = "claim_voting_fee_rewards_single";
|
|
3580
3616
|
const args = [tx.object(voter_id), tx.object(voting_escrow_id), tx.object(params.locks), tx.object(CLOCK_ADDRESS)];
|
|
@@ -3588,8 +3624,8 @@ var _TransactionUtil = class {
|
|
|
3588
3624
|
static buildClaimVotingRewardsPoolsTransaction(sdk, params) {
|
|
3589
3625
|
const tx = new Transaction();
|
|
3590
3626
|
tx.setSender(sdk.senderAddress);
|
|
3591
|
-
const { integrate, distribution } = sdk.sdkOptions;
|
|
3592
|
-
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(
|
|
3627
|
+
const { integrate, distribution, ve33 } = sdk.sdkOptions;
|
|
3628
|
+
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
3593
3629
|
const typeArguments = [magma_token, params.coinAType, params.coinBType];
|
|
3594
3630
|
const functionName = "claim_voting_fee_rewards";
|
|
3595
3631
|
const locks = tx.makeMoveVec({
|
|
@@ -3607,8 +3643,8 @@ var _TransactionUtil = class {
|
|
|
3607
3643
|
static buildClaimAndLockRebases(sdk, params) {
|
|
3608
3644
|
const tx = new Transaction();
|
|
3609
3645
|
tx.setSender(sdk.senderAddress);
|
|
3610
|
-
const { integrate } = sdk.sdkOptions;
|
|
3611
|
-
const { voting_escrow_id, magma_token, reward_distributor_id } = getPackagerConfigs(
|
|
3646
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3647
|
+
const { voting_escrow_id, magma_token, reward_distributor_id } = getPackagerConfigs(ve33);
|
|
3612
3648
|
const typeArguments = [magma_token];
|
|
3613
3649
|
const functionName = "claim_and_lock";
|
|
3614
3650
|
const args = [tx.object(reward_distributor_id), tx.object(voting_escrow_id), tx.object(params.lockId), tx.object(CLOCK_ADDRESS)];
|
|
@@ -3622,8 +3658,8 @@ var _TransactionUtil = class {
|
|
|
3622
3658
|
static buildPoke(sdk, params) {
|
|
3623
3659
|
const tx = new Transaction();
|
|
3624
3660
|
tx.setSender(sdk.senderAddress);
|
|
3625
|
-
const { integrate } = sdk.sdkOptions;
|
|
3626
|
-
const { distribution_cfg, voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(
|
|
3661
|
+
const { integrate, ve33 } = sdk.sdkOptions;
|
|
3662
|
+
const { distribution_cfg, voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
3627
3663
|
const typeArguments = [magma_token];
|
|
3628
3664
|
const functionName = "poke";
|
|
3629
3665
|
const args = [
|
|
@@ -3643,8 +3679,8 @@ var _TransactionUtil = class {
|
|
|
3643
3679
|
static buildClaimVotingBribe(sdk, locks, incentive_tokens) {
|
|
3644
3680
|
const tx = new Transaction();
|
|
3645
3681
|
tx.setSender(sdk.senderAddress);
|
|
3646
|
-
const { integrate, distribution } = sdk.sdkOptions;
|
|
3647
|
-
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(
|
|
3682
|
+
const { integrate, distribution, ve33 } = sdk.sdkOptions;
|
|
3683
|
+
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
3648
3684
|
const typeArguments = [magma_token, ...incentive_tokens];
|
|
3649
3685
|
let targetFunc = `${integrate.published_at}::${Voter}::claim_voting_bribes_${incentive_tokens.length}`;
|
|
3650
3686
|
if (incentive_tokens.length === 1) {
|
|
@@ -6661,45 +6697,21 @@ var RewarderModule = class {
|
|
|
6661
6697
|
* @param tx
|
|
6662
6698
|
* @returns
|
|
6663
6699
|
*/
|
|
6664
|
-
async batchCollectRewardePayload(params, tx
|
|
6700
|
+
async batchCollectRewardePayload(params, tx) {
|
|
6665
6701
|
if (!checkInvalidSuiAddress(this._sdk.senderAddress)) {
|
|
6666
6702
|
throw new ClmmpoolsError("this config sdk senderAddress is not set right", "InvalidSendAddress" /* InvalidSendAddress */);
|
|
6667
6703
|
}
|
|
6668
6704
|
const allCoinAsset = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress, null);
|
|
6669
6705
|
tx = tx || new Transaction6();
|
|
6670
|
-
const
|
|
6706
|
+
const coinIdList = [];
|
|
6671
6707
|
params.forEach((item) => {
|
|
6672
6708
|
const coinTypeA = normalizeCoinType(item.coinTypeA);
|
|
6673
6709
|
const coinTypeB = normalizeCoinType(item.coinTypeB);
|
|
6674
6710
|
if (item.collect_fee) {
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
} else {
|
|
6680
|
-
coinAInput = {
|
|
6681
|
-
targetCoin: inputCoinA,
|
|
6682
|
-
remainCoins: [],
|
|
6683
|
-
isMintZeroCoin: false,
|
|
6684
|
-
tragetCoinAmount: "0"
|
|
6685
|
-
};
|
|
6686
|
-
}
|
|
6687
|
-
coinIdMaps[coinTypeA] = coinAInput;
|
|
6688
|
-
}
|
|
6689
|
-
let coinBInput = coinIdMaps[coinTypeB];
|
|
6690
|
-
if (coinBInput == null) {
|
|
6691
|
-
if (inputCoinB == null) {
|
|
6692
|
-
coinBInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeB, false);
|
|
6693
|
-
} else {
|
|
6694
|
-
coinBInput = {
|
|
6695
|
-
targetCoin: inputCoinB,
|
|
6696
|
-
remainCoins: [],
|
|
6697
|
-
isMintZeroCoin: false,
|
|
6698
|
-
tragetCoinAmount: "0"
|
|
6699
|
-
};
|
|
6700
|
-
}
|
|
6701
|
-
coinIdMaps[coinTypeB] = coinBInput;
|
|
6702
|
-
}
|
|
6711
|
+
const coinAInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeA, false, true);
|
|
6712
|
+
const coinBInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeB, false, true);
|
|
6713
|
+
coinIdList.push({ coin: coinAInput, coin_addr: coinTypeA });
|
|
6714
|
+
coinIdList.push({ coin: coinBInput, coin_addr: coinTypeB });
|
|
6703
6715
|
tx = this._sdk.Position.createCollectFeeNoSendPaylod(
|
|
6704
6716
|
{
|
|
6705
6717
|
pool_id: item.pool_id,
|
|
@@ -6715,20 +6727,14 @@ var RewarderModule = class {
|
|
|
6715
6727
|
const primaryCoinInputs = [];
|
|
6716
6728
|
item.rewarder_coin_types.forEach((type) => {
|
|
6717
6729
|
const coinType = normalizeCoinType(type);
|
|
6718
|
-
|
|
6719
|
-
if (coinInput === void 0) {
|
|
6720
|
-
coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinType, false);
|
|
6721
|
-
coinIdMaps[coinType] = coinInput;
|
|
6722
|
-
}
|
|
6730
|
+
const coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinType, false, true);
|
|
6723
6731
|
primaryCoinInputs.push(coinInput.targetCoin);
|
|
6732
|
+
coinIdList.push({ coin: coinInput, coin_addr: coinType });
|
|
6724
6733
|
});
|
|
6725
6734
|
tx = this.createCollectRewarderNoSendPaylod(item, tx, primaryCoinInputs);
|
|
6726
6735
|
});
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
if (value.isMintZeroCoin) {
|
|
6730
|
-
TransactionUtil.buildTransferCoin(this._sdk, tx, value.targetCoin, key, this._sdk.senderAddress);
|
|
6731
|
-
}
|
|
6736
|
+
coinIdList.forEach((item) => {
|
|
6737
|
+
TransactionUtil.buildTransferCoin(this._sdk, tx, item.coin.targetCoin, item.coin_addr, this._sdk.senderAddress);
|
|
6732
6738
|
});
|
|
6733
6739
|
return tx;
|
|
6734
6740
|
}
|
|
@@ -7517,8 +7523,8 @@ var SwapModule = class {
|
|
|
7517
7523
|
* @returns {Promise<PreSwapParams>} A promise that resolves to the swap data.
|
|
7518
7524
|
*/
|
|
7519
7525
|
async preswap(params) {
|
|
7520
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
7521
|
-
const { global_config_id } = getPackagerConfigs(
|
|
7526
|
+
const { integrate, simulationAccount, clmm_pool } = this.sdk.sdkOptions;
|
|
7527
|
+
const { global_config_id } = getPackagerConfigs(clmm_pool);
|
|
7522
7528
|
const tx = new Transaction8();
|
|
7523
7529
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
7524
7530
|
const args = [
|
|
@@ -7785,8 +7791,8 @@ var LockModule = class {
|
|
|
7785
7791
|
}
|
|
7786
7792
|
const tx = new Transaction9();
|
|
7787
7793
|
tx.setSender(this.sdk.senderAddress);
|
|
7788
|
-
const { integrate } = this.sdk.sdkOptions;
|
|
7789
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
7794
|
+
const { integrate, ve33 } = this.sdk.sdkOptions;
|
|
7795
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
7790
7796
|
const typeArguments = [magma_token, params.coinType];
|
|
7791
7797
|
const allCoinAsset = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
|
|
7792
7798
|
const coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(params.amount), params.coinType, false, true);
|
|
@@ -7811,8 +7817,8 @@ var LockModule = class {
|
|
|
7811
7817
|
if (incentiveTokens.length < 1 || incentiveTokens.length > 3) {
|
|
7812
7818
|
throw Error("incentiveTokens length must be between 1 and 3");
|
|
7813
7819
|
}
|
|
7814
|
-
const { integrate } = this.sdk.sdkOptions;
|
|
7815
|
-
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(
|
|
7820
|
+
const { integrate, ve33 } = this.sdk.sdkOptions;
|
|
7821
|
+
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
7816
7822
|
const typeArguments = [magma_token, ...feeTokens, ...incentiveTokens];
|
|
7817
7823
|
let targetFunc = `${integrate.published_at}::${Voter}::claim_voting_bribes_for_single_pool${incentiveTokens.length}`;
|
|
7818
7824
|
if (incentiveTokens.length === 1) {
|
|
@@ -7830,8 +7836,8 @@ var LockModule = class {
|
|
|
7830
7836
|
}
|
|
7831
7837
|
async fastLocksOfUser(user) {
|
|
7832
7838
|
const locksInfo = { owner: user, lockInfo: [] };
|
|
7833
|
-
const { distribution } = this._sdk.sdkOptions;
|
|
7834
|
-
const { magma_token } = getPackagerConfigs(
|
|
7839
|
+
const { distribution, ve33 } = this._sdk.sdkOptions;
|
|
7840
|
+
const { magma_token } = getPackagerConfigs(ve33);
|
|
7835
7841
|
const ownerRes = await this._sdk.fullClient.getOwnedObjectsByPage(user, {
|
|
7836
7842
|
options: { showType: true, showContent: true, showDisplay: true, showOwner: true },
|
|
7837
7843
|
filter: {
|
|
@@ -7865,8 +7871,8 @@ var LockModule = class {
|
|
|
7865
7871
|
}
|
|
7866
7872
|
async locksOfUserV2(user) {
|
|
7867
7873
|
const locksInfo = { owner: user, lockInfo: [] };
|
|
7868
|
-
const { distribution } = this._sdk.sdkOptions;
|
|
7869
|
-
const { magma_token } = getPackagerConfigs(
|
|
7874
|
+
const { distribution, ve33 } = this._sdk.sdkOptions;
|
|
7875
|
+
const { magma_token } = getPackagerConfigs(ve33);
|
|
7870
7876
|
const ownerRes = await this._sdk.fullClient.getOwnedObjectsByPage(user, {
|
|
7871
7877
|
options: { showType: true, showContent: true, showDisplay: true, showOwner: true },
|
|
7872
7878
|
filter: {
|
|
@@ -7916,8 +7922,8 @@ var LockModule = class {
|
|
|
7916
7922
|
}
|
|
7917
7923
|
async locksOfUser(user) {
|
|
7918
7924
|
const locksInfo = { owner: user, lockInfo: [] };
|
|
7919
|
-
const { distribution } = this._sdk.sdkOptions;
|
|
7920
|
-
const { magma_token } = getPackagerConfigs(
|
|
7925
|
+
const { distribution, ve33 } = this._sdk.sdkOptions;
|
|
7926
|
+
const { magma_token } = getPackagerConfigs(ve33);
|
|
7921
7927
|
const ownerRes = await this._sdk.fullClient.getOwnedObjectsByPage(user, {
|
|
7922
7928
|
options: { showType: true, showContent: true, showDisplay: true, showOwner: true },
|
|
7923
7929
|
filter: {
|
|
@@ -8005,7 +8011,7 @@ var LockModule = class {
|
|
|
8005
8011
|
"InvalidLockObject" /* InvalidLockObject */
|
|
8006
8012
|
);
|
|
8007
8013
|
}
|
|
8008
|
-
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
8014
|
+
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
8009
8015
|
const aLockSummary = await this.aLockSummary(lockId);
|
|
8010
8016
|
const poolIncentiveTokens = await this.getVotingBribeRewardTokens(lockId);
|
|
8011
8017
|
const poolFeeTokens = await this.getVotingFeeRewardTokens(lockId);
|
|
@@ -8063,8 +8069,8 @@ var LockModule = class {
|
|
|
8063
8069
|
}
|
|
8064
8070
|
async aLockSummary(lock_id) {
|
|
8065
8071
|
const tx = new Transaction9();
|
|
8066
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8067
|
-
const { voting_escrow_id, magma_token, voter_id, reward_distributor_id } = getPackagerConfigs(
|
|
8072
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8073
|
+
const { voting_escrow_id, magma_token, voter_id, reward_distributor_id } = getPackagerConfigs(ve33);
|
|
8068
8074
|
const typeArguments = [magma_token];
|
|
8069
8075
|
const args = [
|
|
8070
8076
|
tx.object(voter_id),
|
|
@@ -8116,8 +8122,8 @@ var LockModule = class {
|
|
|
8116
8122
|
}
|
|
8117
8123
|
async _aLockSummary(lock_id, tx) {
|
|
8118
8124
|
tx = tx || new Transaction9();
|
|
8119
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8120
|
-
const { voting_escrow_id, magma_token, voter_id, reward_distributor_id } = getPackagerConfigs(
|
|
8125
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8126
|
+
const { voting_escrow_id, magma_token, voter_id, reward_distributor_id } = getPackagerConfigs(ve33);
|
|
8121
8127
|
const typeArguments = [magma_token];
|
|
8122
8128
|
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
8123
8129
|
throw Error("this config simulationAccount is not set right");
|
|
@@ -8159,8 +8165,8 @@ var LockModule = class {
|
|
|
8159
8165
|
}
|
|
8160
8166
|
async allLockSummary() {
|
|
8161
8167
|
const tx = new Transaction9();
|
|
8162
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8163
|
-
const { voting_escrow_id, magma_token, voter_id, minter_id } = getPackagerConfigs(
|
|
8168
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8169
|
+
const { voting_escrow_id, magma_token, voter_id, minter_id } = getPackagerConfigs(ve33);
|
|
8164
8170
|
const typeArguments = [magma_token];
|
|
8165
8171
|
const args = [tx.object(minter_id), tx.object(voter_id), tx.object(voting_escrow_id), tx.object(CLOCK_ADDRESS)];
|
|
8166
8172
|
tx.moveCall({
|
|
@@ -8204,8 +8210,8 @@ var LockModule = class {
|
|
|
8204
8210
|
}
|
|
8205
8211
|
async poolWeights(pools) {
|
|
8206
8212
|
const tx = new Transaction9();
|
|
8207
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8208
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8213
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8214
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8209
8215
|
const typeArguments = [magma_token];
|
|
8210
8216
|
const poolsParams = tx.pure.vector("id", pools);
|
|
8211
8217
|
const args = [tx.object(voter_id), poolsParams];
|
|
@@ -8246,8 +8252,8 @@ var LockModule = class {
|
|
|
8246
8252
|
}
|
|
8247
8253
|
async _getVotingFeeRewardTokens(lock_id, tx) {
|
|
8248
8254
|
tx = tx || new Transaction9();
|
|
8249
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8250
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8255
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8256
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8251
8257
|
const typeArguments = [magma_token];
|
|
8252
8258
|
const args = [tx.object(voter_id), tx.object(lock_id)];
|
|
8253
8259
|
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
@@ -8287,8 +8293,8 @@ var LockModule = class {
|
|
|
8287
8293
|
}
|
|
8288
8294
|
async getVotingFeeRewardTokens(lock_id) {
|
|
8289
8295
|
const tx = new Transaction9();
|
|
8290
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8291
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8296
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8297
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8292
8298
|
const typeArguments = [magma_token];
|
|
8293
8299
|
const args = [tx.object(voter_id), tx.object(lock_id)];
|
|
8294
8300
|
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
@@ -8331,8 +8337,8 @@ var LockModule = class {
|
|
|
8331
8337
|
}
|
|
8332
8338
|
async _getVotingBribeRewardTokens(lock_id, tx) {
|
|
8333
8339
|
tx = tx || new Transaction9();
|
|
8334
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8335
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8340
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8341
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8336
8342
|
const typeArguments = [magma_token];
|
|
8337
8343
|
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
8338
8344
|
throw Error("this config simulationAccount is not set right");
|
|
@@ -8373,8 +8379,8 @@ var LockModule = class {
|
|
|
8373
8379
|
// Return PoolId => tokens
|
|
8374
8380
|
async getVotingBribeRewardTokens(lock_id) {
|
|
8375
8381
|
const tx = new Transaction9();
|
|
8376
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8377
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8382
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8383
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8378
8384
|
const typeArguments = [magma_token];
|
|
8379
8385
|
if (!checkInvalidSuiAddress(simulationAccount.address)) {
|
|
8380
8386
|
throw Error("this config simulationAccount is not set right");
|
|
@@ -8425,8 +8431,8 @@ var LockModule = class {
|
|
|
8425
8431
|
}
|
|
8426
8432
|
_getFeeRewardsInner(lock_id, token_a, token_b, tx) {
|
|
8427
8433
|
tx = tx || new Transaction9();
|
|
8428
|
-
const { integrate } = this.sdk.sdkOptions;
|
|
8429
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8434
|
+
const { integrate, ve33 } = this.sdk.sdkOptions;
|
|
8435
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8430
8436
|
const typeArguments = [magma_token, token_a, token_b];
|
|
8431
8437
|
const args = [tx.object(voter_id), tx.object(lock_id), tx.object(CLOCK_ADDRESS)];
|
|
8432
8438
|
const targetFunc = `${integrate.published_at}::${Voter}::claimable_voting_fee_rewards`;
|
|
@@ -8485,8 +8491,8 @@ var LockModule = class {
|
|
|
8485
8491
|
// if you have many tokens, call this function multi times
|
|
8486
8492
|
async _getPoolFeeRewards(lock_id, token_a, token_b, poolFeeRewardTokens) {
|
|
8487
8493
|
const tx = new Transaction9();
|
|
8488
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8489
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8494
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8495
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8490
8496
|
const typeArguments = [magma_token, token_a, token_b];
|
|
8491
8497
|
const args = [tx.object(voter_id), tx.object(lock_id), tx.object(CLOCK_ADDRESS)];
|
|
8492
8498
|
const targetFunc = `${integrate.published_at}::${Voter}::claimable_voting_fee_rewards`;
|
|
@@ -8540,8 +8546,8 @@ var LockModule = class {
|
|
|
8540
8546
|
if (incentive_tokens.length > 3) {
|
|
8541
8547
|
throw Error("Too many tokens");
|
|
8542
8548
|
}
|
|
8543
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8544
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8549
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8550
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8545
8551
|
const typeArguments = [magma_token, ...incentive_tokens];
|
|
8546
8552
|
const args = [tx.object(voter_id), tx.object(locksId), tx.object(CLOCK_ADDRESS)];
|
|
8547
8553
|
let targetFunc = `${integrate.published_at}::${Voter}::claimable_voting_bribes_${incentive_tokens.length}`;
|
|
@@ -8609,8 +8615,8 @@ var LockModule = class {
|
|
|
8609
8615
|
throw Error("Too many tokens");
|
|
8610
8616
|
}
|
|
8611
8617
|
const tx = new Transaction9();
|
|
8612
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8613
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8618
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8619
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8614
8620
|
const typeArguments = [magma_token, ...incentive_tokens];
|
|
8615
8621
|
const args = [tx.object(voter_id), tx.object(locksId), tx.object(CLOCK_ADDRESS)];
|
|
8616
8622
|
let targetFunc = `${integrate.published_at}::${Voter}::claimable_voting_bribes_${incentive_tokens.length}`;
|
|
@@ -8648,8 +8654,8 @@ var LockModule = class {
|
|
|
8648
8654
|
}
|
|
8649
8655
|
async getPoolBribeRewardTokens(pool_id) {
|
|
8650
8656
|
const tx = new Transaction9();
|
|
8651
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8652
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8657
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8658
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8653
8659
|
const typeArguments = [magma_token];
|
|
8654
8660
|
const args = [tx.object(voter_id), tx.object(pool_id)];
|
|
8655
8661
|
tx.moveCall({
|
|
@@ -8684,8 +8690,8 @@ var LockModule = class {
|
|
|
8684
8690
|
}
|
|
8685
8691
|
async getLockVotingStats(lockId) {
|
|
8686
8692
|
const tx = new Transaction9();
|
|
8687
|
-
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
8688
|
-
const { magma_token, voter_id } = getPackagerConfigs(
|
|
8693
|
+
const { integrate, simulationAccount, ve33 } = this.sdk.sdkOptions;
|
|
8694
|
+
const { magma_token, voter_id } = getPackagerConfigs(ve33);
|
|
8689
8695
|
const args = [tx.object(voter_id), tx.object(lockId), tx.object(CLOCK_ADDRESS)];
|
|
8690
8696
|
const typeArguments = [magma_token];
|
|
8691
8697
|
tx.moveCall({
|
|
@@ -9788,16 +9794,9 @@ var ConfigModule = class {
|
|
|
9788
9794
|
launchpad_pools_id: "",
|
|
9789
9795
|
clmm_pools_id: "",
|
|
9790
9796
|
admin_cap_id: "",
|
|
9791
|
-
global_config_id: "",
|
|
9792
9797
|
coin_list_handle: "",
|
|
9793
9798
|
launchpad_pools_handle: "",
|
|
9794
|
-
clmm_pools_handle: ""
|
|
9795
|
-
voter_id: "",
|
|
9796
|
-
minter_id: "",
|
|
9797
|
-
reward_distributor_id: "",
|
|
9798
|
-
distribution_cfg: "",
|
|
9799
|
-
magma_token: "",
|
|
9800
|
-
voting_escrow_id: ""
|
|
9799
|
+
clmm_pools_handle: ""
|
|
9801
9800
|
};
|
|
9802
9801
|
if (objects.data.length > 0) {
|
|
9803
9802
|
for (const item of objects.data) {
|
|
@@ -9813,7 +9812,6 @@ var ConfigModule = class {
|
|
|
9813
9812
|
tokenConfig.clmm_pools_id = item.parsedJson.pools_id;
|
|
9814
9813
|
break;
|
|
9815
9814
|
case `InitConfigEvent`:
|
|
9816
|
-
tokenConfig.global_config_id = item.parsedJson.global_config_id;
|
|
9817
9815
|
tokenConfig.admin_cap_id = item.parsedJson.admin_cap_id;
|
|
9818
9816
|
break;
|
|
9819
9817
|
default:
|
|
@@ -10088,7 +10086,7 @@ var GaugeModule = class {
|
|
|
10088
10086
|
if (gauge === void 0) {
|
|
10089
10087
|
throw Error(`Fetch gauge of pool ${params.poolId} failed`);
|
|
10090
10088
|
}
|
|
10091
|
-
const { distribution_cfg, magma_token } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10089
|
+
const { distribution_cfg, magma_token } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10092
10090
|
const { clmm_pool, integrate } = this.sdk.sdkOptions;
|
|
10093
10091
|
const clmmConfig = getPackagerConfigs(clmm_pool);
|
|
10094
10092
|
const typeArguments = [params.coinTypeA, params.coinTypeB, magma_token];
|
|
@@ -10115,7 +10113,7 @@ var GaugeModule = class {
|
|
|
10115
10113
|
if (gauge === void 0) {
|
|
10116
10114
|
throw Error(`Fetch gauge of pool ${params.poolId} failed`);
|
|
10117
10115
|
}
|
|
10118
|
-
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10116
|
+
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10119
10117
|
const { integrate } = this.sdk.sdkOptions;
|
|
10120
10118
|
const typeArguments = [params.coinTypeA, params.coinTypeB, magma_token];
|
|
10121
10119
|
const args = [tx.object(gauge), tx.object(params.poolId), tx.object(params.positionId), tx.object(CLOCK_ADDRESS)];
|
|
@@ -10165,7 +10163,7 @@ var GaugeModule = class {
|
|
|
10165
10163
|
async getUserStakedPositionInfoOfPool(userAddr, pool, gauger, poolCoinA, poolCoinB) {
|
|
10166
10164
|
const tx = new Transaction11();
|
|
10167
10165
|
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
10168
|
-
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10166
|
+
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10169
10167
|
const typeArguments = [poolCoinA, poolCoinB, magma_token];
|
|
10170
10168
|
const args = [tx.object(voter_id), tx.object(gauger), tx.object(pool), tx.pure.address(userAddr), tx.object(CLOCK_ADDRESS)];
|
|
10171
10169
|
tx.moveCall({
|
|
@@ -10189,7 +10187,7 @@ var GaugeModule = class {
|
|
|
10189
10187
|
async getPoolGaguers() {
|
|
10190
10188
|
const tx = new Transaction11();
|
|
10191
10189
|
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
10192
|
-
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10190
|
+
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10193
10191
|
const typeArguments = [magma_token];
|
|
10194
10192
|
const args = [tx.object(voter_id)];
|
|
10195
10193
|
tx.moveCall({
|
|
@@ -10229,7 +10227,7 @@ var GaugeModule = class {
|
|
|
10229
10227
|
async getEmissions() {
|
|
10230
10228
|
const tx = new Transaction11();
|
|
10231
10229
|
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
10232
|
-
const { magma_token, minter_id, voting_escrow_id } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10230
|
+
const { magma_token, minter_id, voting_escrow_id } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10233
10231
|
const typeArguments = [magma_token];
|
|
10234
10232
|
const args = [tx.object(minter_id), tx.object(voting_escrow_id)];
|
|
10235
10233
|
tx.moveCall({
|
|
@@ -10263,7 +10261,7 @@ var GaugeModule = class {
|
|
|
10263
10261
|
async getRewardByPosition(params) {
|
|
10264
10262
|
const tx = new Transaction11();
|
|
10265
10263
|
const { integrate } = this.sdk.sdkOptions;
|
|
10266
|
-
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10264
|
+
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10267
10265
|
const typeArguments = [params.coinTypeA, params.coinTypeB, magma_token];
|
|
10268
10266
|
const args = [tx.object(params.gaugeId), tx.object(params.poolId), tx.object(params.positionId), tx.object(CLOCK_ADDRESS)];
|
|
10269
10267
|
tx.moveCall({
|
|
@@ -10276,7 +10274,7 @@ var GaugeModule = class {
|
|
|
10276
10274
|
async getAllRewardByPositions(paramsList) {
|
|
10277
10275
|
const tx = new Transaction11();
|
|
10278
10276
|
const { integrate } = this.sdk.sdkOptions;
|
|
10279
|
-
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10277
|
+
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10280
10278
|
paramsList.forEach((params) => {
|
|
10281
10279
|
const typeArguments = [params.coinTypeA, params.coinTypeB, magma_token];
|
|
10282
10280
|
const args = [tx.object(params.gaugeId), tx.object(params.poolId), tx.object(params.positionId), tx.object(CLOCK_ADDRESS)];
|
|
@@ -10291,7 +10289,7 @@ var GaugeModule = class {
|
|
|
10291
10289
|
async getEpochRewardByPool(pool, incentive_tokens) {
|
|
10292
10290
|
const tx = new Transaction11();
|
|
10293
10291
|
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
10294
|
-
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.
|
|
10292
|
+
const { magma_token, voter_id } = getPackagerConfigs(this.sdk.sdkOptions.ve33);
|
|
10295
10293
|
const typeArguments = [magma_token, ...incentive_tokens];
|
|
10296
10294
|
const args = [tx.object(voter_id), tx.object(pool), tx.object(CLOCK_ADDRESS)];
|
|
10297
10295
|
let targetFunc = `${integrate.published_at}::${Voter}::epoch_reward_by_pool${incentive_tokens.length}`;
|
|
@@ -10427,8 +10425,18 @@ var DlmmModule = class {
|
|
|
10427
10425
|
});
|
|
10428
10426
|
return tx;
|
|
10429
10427
|
}
|
|
10430
|
-
// async mintByStrategySingle(params: MintByStrategySingleParams): Promise<Transaction> {}
|
|
10431
10428
|
async mintByStrategy(params) {
|
|
10429
|
+
if (params.fixCoinA && params.fixCoinB) {
|
|
10430
|
+
if (params.amountATotal === 0 || params.amountBTotal === 0) {
|
|
10431
|
+
if (params.active_bin < params.max_bin && params.active_bin > params.min_bin) {
|
|
10432
|
+
if (params.amountATotal > 0) {
|
|
10433
|
+
params.min_bin = params.active_bin;
|
|
10434
|
+
} else if (params.amountBTotal > 0) {
|
|
10435
|
+
params.max_bin = params.active_bin;
|
|
10436
|
+
}
|
|
10437
|
+
}
|
|
10438
|
+
}
|
|
10439
|
+
}
|
|
10432
10440
|
const tx = new Transaction12();
|
|
10433
10441
|
const slippage = new Decimal10(params.slippage);
|
|
10434
10442
|
const lower_slippage = new Decimal10(1).sub(slippage.div(new Decimal10(1e4)));
|
|
@@ -10447,12 +10455,14 @@ var DlmmModule = class {
|
|
|
10447
10455
|
let primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountBTotal), params.coinTypeB, false, true);
|
|
10448
10456
|
let amount_min = 0;
|
|
10449
10457
|
let amount_max = 0;
|
|
10450
|
-
if (params.fixCoinA) {
|
|
10458
|
+
if (params.fixCoinA && params.fixCoinB) {
|
|
10459
|
+
primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountATotal), params.coinTypeB, false, true);
|
|
10460
|
+
primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountBTotal), params.coinTypeB, false, true);
|
|
10461
|
+
} else if (params.fixCoinA) {
|
|
10451
10462
|
amount_min = new Decimal10(params.amountBTotal).mul(lower_slippage).toDecimalPlaces(0).toNumber();
|
|
10452
10463
|
amount_max = new Decimal10(params.amountBTotal).mul(upper_slippage).toDecimalPlaces(0).toNumber();
|
|
10453
10464
|
primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(amount_max), params.coinTypeB, false, true);
|
|
10454
|
-
}
|
|
10455
|
-
if (params.fixCoinB) {
|
|
10465
|
+
} else if (params.fixCoinB) {
|
|
10456
10466
|
amount_min = new Decimal10(params.amountATotal).mul(lower_slippage).toDecimalPlaces(0).toNumber();
|
|
10457
10467
|
amount_max = new Decimal10(params.amountATotal).mul(upper_slippage).toDecimalPlaces(0).toNumber();
|
|
10458
10468
|
primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(amount_max), params.coinTypeB, false, true);
|
|
@@ -10468,7 +10478,9 @@ var DlmmModule = class {
|
|
|
10468
10478
|
tx.object(dlmmConfig.factory),
|
|
10469
10479
|
primaryCoinAInputs.targetCoin,
|
|
10470
10480
|
primaryCoinBInputs.targetCoin,
|
|
10481
|
+
tx.pure.bool(params.fixCoinA),
|
|
10471
10482
|
tx.pure.u64(params.amountATotal),
|
|
10483
|
+
tx.pure.bool(params.fixCoinB),
|
|
10472
10484
|
tx.pure.u64(params.amountBTotal),
|
|
10473
10485
|
tx.pure.u8(params.strategy),
|
|
10474
10486
|
tx.pure.u32(get_storage_id_from_real_id(params.min_bin)),
|
|
@@ -11501,8 +11513,9 @@ var SDKConfig = {
|
|
|
11501
11513
|
admin_cap_id: "0x39d78781750e193ce35c45ff32c6c0c3f2941fa3ddaf8595c90c555589ddb113",
|
|
11502
11514
|
coin_list_handle: "0x49136005e90e28c4695419ed4194cc240603f1ea8eb84e62275eaff088a71063",
|
|
11503
11515
|
launchpad_pools_handle: "0x5e194a8efcf653830daf85a85b52e3ae8f65dc39481d54b2382acda25068375c",
|
|
11504
|
-
clmm_pools_handle: "0x37f60eb2d9d227949b95da8fea810db3c32d1e1fa8ed87434fc51664f87d83cb"
|
|
11505
|
-
|
|
11516
|
+
clmm_pools_handle: "0x37f60eb2d9d227949b95da8fea810db3c32d1e1fa8ed87434fc51664f87d83cb"
|
|
11517
|
+
},
|
|
11518
|
+
ve33Config: {
|
|
11506
11519
|
voter_id: "0xaab0f3a90da96d29d743e09c269e1ae48ec1bae52a28cd38c49c5dc8c1bf92b8",
|
|
11507
11520
|
voting_escrow_id: "0x7ab45fbe01da26e07ba21757916d540c8747cf7daa88f3171e13db17373d5adc",
|
|
11508
11521
|
reward_distributor_id: "0x9f4f882245e49fd9213278dfbcb63a14fdbdd2ce7e25e9353a0cecdca30de853",
|
|
@@ -11520,6 +11533,11 @@ var clmmMainnet = {
|
|
|
11520
11533
|
simulationAccount: {
|
|
11521
11534
|
address: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
11522
11535
|
},
|
|
11536
|
+
ve33: {
|
|
11537
|
+
package_id: "0x7ab45fbe01da26e07ba21757916d540c8747cf7daa88f3171e13db17373d5adc",
|
|
11538
|
+
published_at: "0x7ab45fbe01da26e07ba21757916d540c8747cf7daa88f3171e13db17373d5adc",
|
|
11539
|
+
config: SDKConfig.ve33Config
|
|
11540
|
+
},
|
|
11523
11541
|
magma_config: {
|
|
11524
11542
|
package_id: "0x95b8d278b876cae22206131fb9724f701c9444515813042f54f0a426c9a3bc2f",
|
|
11525
11543
|
published_at: "0x95b8d278b876cae22206131fb9724f701c9444515813042f54f0a426c9a3bc2f",
|
|
@@ -11568,8 +11586,8 @@ function initMainnetSDK(fullNodeUrl, simulationAccount) {
|
|
|
11568
11586
|
import { getFullnodeUrl as getFullnodeUrl2 } from "@mysten/sui/client";
|
|
11569
11587
|
var SDKConfig2 = {
|
|
11570
11588
|
clmmConfig: {
|
|
11571
|
-
pools_id: "
|
|
11572
|
-
global_config_id: "
|
|
11589
|
+
pools_id: "0xd7037b38ae757d7a69b61146b27c288600b9aefbffbf884b856881dff6a4f27b",
|
|
11590
|
+
global_config_id: "0x83baa8b07800029302f75ac6906240e86cf05066d37eedcabc61a0d6b6dc6eda",
|
|
11573
11591
|
global_vault_id: "0xf78d2ee3c312f298882cb680695e5e8c81b1d441a646caccc058006c2851ddea",
|
|
11574
11592
|
admin_cap_id: "0xa456f86a53fc31e1243f065738ff1fc93f5a62cc080ff894a0fb3747556a799b"
|
|
11575
11593
|
},
|
|
@@ -11577,11 +11595,13 @@ var SDKConfig2 = {
|
|
|
11577
11595
|
coin_list_id: "0x257eb2ba592a5480bba0a97d05338fab17cc3283f8df6998a0e12e4ab9b84478",
|
|
11578
11596
|
launchpad_pools_id: "0xdc3a7bd66a6dcff73c77c866e87d73826e446e9171f34e1c1b656377314f94da",
|
|
11579
11597
|
clmm_pools_id: "0x26c85500f5dd2983bf35123918a144de24e18936d0b234ef2b49fbb2d3d6307d",
|
|
11580
|
-
admin_cap_id: "
|
|
11598
|
+
admin_cap_id: "0xd328ff427794b8ca0a69c3ebb0c0e4d2e81267ec4ba36e11487362c6508a4c0f",
|
|
11581
11599
|
coin_list_handle: "0x3204350fc603609c91675e07b8f9ac0999b9607d83845086321fca7f469de235",
|
|
11582
11600
|
launchpad_pools_handle: "0xae67ff87c34aceea4d28107f9c6c62e297a111e9f8e70b9abbc2f4c9f5ec20fd",
|
|
11583
|
-
clmm_pools_handle: "0xd28736923703342b4752f5ed8c2f2a5c0cb2336c30e1fed42b387234ce8408ec"
|
|
11584
|
-
|
|
11601
|
+
clmm_pools_handle: "0xd28736923703342b4752f5ed8c2f2a5c0cb2336c30e1fed42b387234ce8408ec"
|
|
11602
|
+
},
|
|
11603
|
+
ve33Config: {
|
|
11604
|
+
// global_config_id: '0xbbe54f3c2bd06c5ab7f93950025bff6710c9a83836d7145636fea383b315774d',
|
|
11585
11605
|
voter_id: "0x59571991a5c7041c4376d980061af5c7a6d8345006d6b5167bd1f00fc17b8ddb",
|
|
11586
11606
|
voting_escrow_id: "0x9081c8044719135da4ff2d52907fcd40c19e2a40750cbba4c1d6a59610ae1446",
|
|
11587
11607
|
reward_distributor_id: "0xdf213d8e0ca49c8f4a508e7d3b3a6983c4aafd639f7c99479fc75fb4451d752e",
|
|
@@ -11596,13 +11616,18 @@ var SDKConfig2 = {
|
|
|
11596
11616
|
var clmmTestnet = {
|
|
11597
11617
|
fullRpcUrl: getFullnodeUrl2("testnet"),
|
|
11598
11618
|
magma_config: {
|
|
11599
|
-
package_id: "
|
|
11600
|
-
published_at: "
|
|
11619
|
+
package_id: "",
|
|
11620
|
+
published_at: "",
|
|
11601
11621
|
config: SDKConfig2.magmaConfig
|
|
11602
11622
|
},
|
|
11623
|
+
ve33: {
|
|
11624
|
+
package_id: "0x7ab45fbe01da26e07ba21757916d540c8747cf7daa88f3171e13db17373d5adc",
|
|
11625
|
+
published_at: "0x7ab45fbe01da26e07ba21757916d540c8747cf7daa88f3171e13db17373d5adc",
|
|
11626
|
+
config: SDKConfig2.ve33Config
|
|
11627
|
+
},
|
|
11603
11628
|
clmm_pool: {
|
|
11604
|
-
package_id: "
|
|
11605
|
-
published_at: "
|
|
11629
|
+
package_id: "0xca1b84a430d03e22dae08a7273c8e9dcfdb40b7f559574105f008600eeb7b4bd",
|
|
11630
|
+
published_at: "0xca1b84a430d03e22dae08a7273c8e9dcfdb40b7f559574105f008600eeb7b4bd",
|
|
11606
11631
|
config: SDKConfig2.clmmConfig
|
|
11607
11632
|
},
|
|
11608
11633
|
dlmm_pool: {
|
|
@@ -11615,8 +11640,8 @@ var clmmTestnet = {
|
|
|
11615
11640
|
published_at: "0x45ac2371c33ca0df8dc784d62c8ce5126d42edd8c56820396524dff2ae0619b1"
|
|
11616
11641
|
},
|
|
11617
11642
|
integrate: {
|
|
11618
|
-
package_id: "
|
|
11619
|
-
published_at: "
|
|
11643
|
+
package_id: "0x975672d26fc9ba026a35f2001951fbcf5e37e75aca41db7c762d61b4e1e64986",
|
|
11644
|
+
published_at: "0x975672d26fc9ba026a35f2001951fbcf5e37e75aca41db7c762d61b4e1e64986"
|
|
11620
11645
|
},
|
|
11621
11646
|
simulationAccount: {
|
|
11622
11647
|
address: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
@@ -11633,7 +11658,7 @@ var clmmTestnet = {
|
|
|
11633
11658
|
package_id: "0x56d90d0c055edb534b11e7548270bb458fd47c69b77bf40c14d5eb00e6e6cf64",
|
|
11634
11659
|
published_at: "0x56d90d0c055edb534b11e7548270bb458fd47c69b77bf40c14d5eb00e6e6cf64"
|
|
11635
11660
|
},
|
|
11636
|
-
aggregatorUrl: "https://
|
|
11661
|
+
aggregatorUrl: "https://testnet.magmafinance.io/api/router",
|
|
11637
11662
|
swapCountUrl: "https://api-sui.devmagma.com/v2/sui/swap/count"
|
|
11638
11663
|
};
|
|
11639
11664
|
function initTestnetSDK(fullNodeUrl, simulationAccount) {
|