@magmaprotocol/magma-clmm-sdk 0.5.6 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +8 -3
- package/dist/index.js +171 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +171 -60
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2520,7 +2520,8 @@ var _TransactionUtil = class {
|
|
|
2520
2520
|
params.slippage,
|
|
2521
2521
|
params.coinTypeA,
|
|
2522
2522
|
allCoins,
|
|
2523
|
-
false
|
|
2523
|
+
false,
|
|
2524
|
+
true
|
|
2524
2525
|
);
|
|
2525
2526
|
primaryCoinBInputs = _TransactionUtil.buildAddLiquidityFixTokenCoinInput(
|
|
2526
2527
|
newTx,
|
|
@@ -2529,7 +2530,8 @@ var _TransactionUtil = class {
|
|
|
2529
2530
|
params.slippage,
|
|
2530
2531
|
params.coinTypeB,
|
|
2531
2532
|
allCoins,
|
|
2532
|
-
false
|
|
2533
|
+
false,
|
|
2534
|
+
true
|
|
2533
2535
|
);
|
|
2534
2536
|
} else {
|
|
2535
2537
|
params.amount_b = Number(fixAmount);
|
|
@@ -2540,7 +2542,8 @@ var _TransactionUtil = class {
|
|
|
2540
2542
|
params.slippage,
|
|
2541
2543
|
params.coinTypeA,
|
|
2542
2544
|
allCoins,
|
|
2543
|
-
false
|
|
2545
|
+
false,
|
|
2546
|
+
true
|
|
2544
2547
|
);
|
|
2545
2548
|
primaryCoinBInputs = _TransactionUtil.buildAddLiquidityFixTokenCoinInput(
|
|
2546
2549
|
newTx,
|
|
@@ -2549,10 +2552,11 @@ var _TransactionUtil = class {
|
|
|
2549
2552
|
params.slippage,
|
|
2550
2553
|
params.coinTypeB,
|
|
2551
2554
|
allCoins,
|
|
2552
|
-
false
|
|
2555
|
+
false,
|
|
2556
|
+
true
|
|
2553
2557
|
);
|
|
2554
2558
|
params = _TransactionUtil.fixAddLiquidityFixTokenParams(params, gasEstimateArg.slippage, gasEstimateArg.curSqrtPrice);
|
|
2555
|
-
tx =
|
|
2559
|
+
tx = _TransactionUtil.buildAddLiquidityFixTokenArgs(newTx, sdk, allCoins, params, primaryCoinAInputs, primaryCoinBInputs);
|
|
2556
2560
|
return tx;
|
|
2557
2561
|
}
|
|
2558
2562
|
}
|
|
@@ -2579,7 +2583,8 @@ var _TransactionUtil = class {
|
|
|
2579
2583
|
params.slippage,
|
|
2580
2584
|
params.coinTypeA,
|
|
2581
2585
|
allCoinAsset,
|
|
2582
|
-
false
|
|
2586
|
+
false,
|
|
2587
|
+
true
|
|
2583
2588
|
);
|
|
2584
2589
|
primaryCoinBInputs = _TransactionUtil.buildAddLiquidityFixTokenCoinInput(
|
|
2585
2590
|
tx,
|
|
@@ -2588,7 +2593,8 @@ var _TransactionUtil = class {
|
|
|
2588
2593
|
params.slippage,
|
|
2589
2594
|
params.coinTypeB,
|
|
2590
2595
|
allCoinAsset,
|
|
2591
|
-
false
|
|
2596
|
+
false,
|
|
2597
|
+
true
|
|
2592
2598
|
);
|
|
2593
2599
|
} else {
|
|
2594
2600
|
primaryCoinAInputs = {
|
|
@@ -2670,14 +2676,15 @@ var _TransactionUtil = class {
|
|
|
2670
2676
|
);
|
|
2671
2677
|
return tx;
|
|
2672
2678
|
}
|
|
2673
|
-
static buildAddLiquidityFixTokenCoinInput(tx, need_interval_amount, amount, slippage, coinType, allCoinAsset, buildVector = true) {
|
|
2679
|
+
static buildAddLiquidityFixTokenCoinInput(tx, need_interval_amount, amount, slippage, coinType, allCoinAsset, buildVector = true, fixAmount = true) {
|
|
2674
2680
|
return need_interval_amount ? _TransactionUtil.buildCoinForAmountInterval(
|
|
2675
2681
|
tx,
|
|
2676
2682
|
allCoinAsset,
|
|
2677
2683
|
{ amountSecond: BigInt(reverSlippageAmount(amount, slippage)), amountFirst: BigInt(amount) },
|
|
2678
2684
|
coinType,
|
|
2679
|
-
buildVector
|
|
2680
|
-
|
|
2685
|
+
buildVector,
|
|
2686
|
+
fixAmount
|
|
2687
|
+
) : _TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(amount), coinType, buildVector, fixAmount);
|
|
2681
2688
|
}
|
|
2682
2689
|
/**
|
|
2683
2690
|
* fix add liquidity fix token for coin amount
|
|
@@ -2772,11 +2779,6 @@ var _TransactionUtil = class {
|
|
|
2772
2779
|
max_amount_a = params.amount_a;
|
|
2773
2780
|
min_amount_a = new Decimal4(params.amount_a).div(new Decimal4(1).plus(new Decimal4(params.slippage))).mul(new Decimal4(1).minus(new Decimal4(params.slippage))).toDecimalPlaces(0).toNumber();
|
|
2774
2781
|
}
|
|
2775
|
-
console.log("min_amount_a", min_amount_a);
|
|
2776
|
-
console.log("max_amount_a", max_amount_a);
|
|
2777
|
-
console.log("min_amount_b", min_amount_b);
|
|
2778
|
-
console.log("max_amount_b", max_amount_b);
|
|
2779
|
-
console.log("params.fix_amount_a", params.fix_amount_a);
|
|
2780
2782
|
const args = params.is_open ? [
|
|
2781
2783
|
tx.object(clmmConfig.global_config_id),
|
|
2782
2784
|
tx.object(params.pool_id),
|
|
@@ -3014,7 +3016,7 @@ var _TransactionUtil = class {
|
|
|
3014
3016
|
tx.setSender(sdk.senderAddress);
|
|
3015
3017
|
tx.setGasBudget(1e8);
|
|
3016
3018
|
const { integrate } = sdk.sdkOptions;
|
|
3017
|
-
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(sdk.sdkOptions.magma_config);
|
|
3019
|
+
const { distribution_cfg, voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(sdk.sdkOptions.magma_config);
|
|
3018
3020
|
const typeArguments = [magma_token];
|
|
3019
3021
|
const functionName = "vote";
|
|
3020
3022
|
const pools = tx.pure.vector("id", params.pools);
|
|
@@ -3022,7 +3024,15 @@ var _TransactionUtil = class {
|
|
|
3022
3024
|
elements: params.weights.map((weight) => tx.pure.u64(weight)),
|
|
3023
3025
|
type: "u64"
|
|
3024
3026
|
});
|
|
3025
|
-
const args = [
|
|
3027
|
+
const args = [
|
|
3028
|
+
tx.object(distribution_cfg),
|
|
3029
|
+
tx.object(voter_id),
|
|
3030
|
+
tx.object(voting_escrow_id),
|
|
3031
|
+
tx.object(params.lockId),
|
|
3032
|
+
pools,
|
|
3033
|
+
weights,
|
|
3034
|
+
tx.object(CLOCK_ADDRESS)
|
|
3035
|
+
];
|
|
3026
3036
|
tx.moveCall({
|
|
3027
3037
|
target: `${integrate.published_at}::${Voter}::${functionName}`,
|
|
3028
3038
|
typeArguments,
|
|
@@ -3084,10 +3094,16 @@ var _TransactionUtil = class {
|
|
|
3084
3094
|
const tx = new Transaction();
|
|
3085
3095
|
tx.setSender(sdk.senderAddress);
|
|
3086
3096
|
const { integrate } = sdk.sdkOptions;
|
|
3087
|
-
const { voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(sdk.sdkOptions.magma_config);
|
|
3097
|
+
const { distribution_cfg, voting_escrow_id, magma_token, voter_id } = getPackagerConfigs(sdk.sdkOptions.magma_config);
|
|
3088
3098
|
const typeArguments = [magma_token];
|
|
3089
3099
|
const functionName = "poke";
|
|
3090
|
-
const args = [
|
|
3100
|
+
const args = [
|
|
3101
|
+
tx.object(distribution_cfg),
|
|
3102
|
+
tx.object(voter_id),
|
|
3103
|
+
tx.object(voting_escrow_id),
|
|
3104
|
+
tx.object(params.lockId),
|
|
3105
|
+
tx.object(CLOCK_ADDRESS)
|
|
3106
|
+
];
|
|
3091
3107
|
tx.moveCall({
|
|
3092
3108
|
target: `${integrate.published_at}::${Voter}::${functionName}`,
|
|
3093
3109
|
typeArguments,
|
|
@@ -3331,17 +3347,17 @@ var _TransactionUtil = class {
|
|
|
3331
3347
|
}
|
|
3332
3348
|
return params;
|
|
3333
3349
|
}
|
|
3334
|
-
static async syncBuildCoinInputForAmount(sdk, tx, amount, coinType, buildVector = true) {
|
|
3350
|
+
static async syncBuildCoinInputForAmount(sdk, tx, amount, coinType, buildVector = true, fixAmount = true) {
|
|
3335
3351
|
if (sdk.senderAddress.length === 0) {
|
|
3336
3352
|
throw Error("this config sdk senderAddress is empty");
|
|
3337
3353
|
}
|
|
3338
3354
|
const allCoins = await sdk.getOwnerCoinAssets(sdk.senderAddress, coinType);
|
|
3339
|
-
const primaryCoinInput = _TransactionUtil.buildCoinForAmount(tx, allCoins, amount, coinType, buildVector).targetCoin;
|
|
3355
|
+
const primaryCoinInput = _TransactionUtil.buildCoinForAmount(tx, allCoins, amount, coinType, buildVector, fixAmount).targetCoin;
|
|
3340
3356
|
return primaryCoinInput;
|
|
3341
3357
|
}
|
|
3342
|
-
static buildCoinForAmount(tx, allCoins, amount, coinType, buildVector = true, fixAmount =
|
|
3358
|
+
static buildCoinForAmount(tx, allCoins, amount, coinType, buildVector = true, fixAmount = true) {
|
|
3343
3359
|
const coinAssets = CoinAssist.getCoinAssets(coinType, allCoins);
|
|
3344
|
-
if (amount === BigInt(0)
|
|
3360
|
+
if (amount === BigInt(0)) {
|
|
3345
3361
|
return _TransactionUtil.buildZeroValueCoin(allCoins, tx, coinType, buildVector);
|
|
3346
3362
|
}
|
|
3347
3363
|
const amountTotal = CoinAssist.calculateTotalBalance(coinAssets);
|
|
@@ -3353,18 +3369,41 @@ var _TransactionUtil = class {
|
|
|
3353
3369
|
}
|
|
3354
3370
|
return _TransactionUtil.buildCoin(tx, allCoins, coinAssets, amount, coinType, buildVector, fixAmount);
|
|
3355
3371
|
}
|
|
3356
|
-
static
|
|
3372
|
+
static buildVectorCoin(tx, allCoins, coinAssets, amount, coinType, fixAmount = true) {
|
|
3373
|
+
if (CoinAssist.isSuiCoin(coinType)) {
|
|
3374
|
+
const amountCoin = tx.splitCoins(tx.gas, [tx.pure.u64(amount)]);
|
|
3375
|
+
return {
|
|
3376
|
+
targetCoin: tx.makeMoveVec({ elements: [amountCoin] }),
|
|
3377
|
+
remainCoins: allCoins,
|
|
3378
|
+
tragetCoinAmount: amount.toString(),
|
|
3379
|
+
isMintZeroCoin: false,
|
|
3380
|
+
originalSplitedCoin: tx.gas
|
|
3381
|
+
};
|
|
3382
|
+
}
|
|
3383
|
+
const { targetCoin, originalSplitedCoin, tragetCoinAmount, selectedCoinsResult, coinObjectIds } = this.buildSpitTargeCoin(
|
|
3384
|
+
tx,
|
|
3385
|
+
amount,
|
|
3386
|
+
coinAssets,
|
|
3387
|
+
fixAmount
|
|
3388
|
+
);
|
|
3389
|
+
if (fixAmount) {
|
|
3390
|
+
return {
|
|
3391
|
+
targetCoin: tx.makeMoveVec({ elements: [targetCoin] }),
|
|
3392
|
+
remainCoins: selectedCoinsResult.remainCoins,
|
|
3393
|
+
originalSplitedCoin,
|
|
3394
|
+
tragetCoinAmount,
|
|
3395
|
+
isMintZeroCoin: false
|
|
3396
|
+
};
|
|
3397
|
+
}
|
|
3398
|
+
return {
|
|
3399
|
+
targetCoin: tx.makeMoveVec({ elements: coinObjectIds.map((id) => tx.object(id)) }),
|
|
3400
|
+
remainCoins: selectedCoinsResult.remainCoins,
|
|
3401
|
+
tragetCoinAmount: selectedCoinsResult.amountArray.reduce((a, b) => Number(a) + Number(b), 0).toString(),
|
|
3402
|
+
isMintZeroCoin: false
|
|
3403
|
+
};
|
|
3404
|
+
}
|
|
3405
|
+
static buildOneCoin(tx, coinAssets, amount, coinType, fixAmount = true) {
|
|
3357
3406
|
if (CoinAssist.isSuiCoin(coinType)) {
|
|
3358
|
-
if (buildVector) {
|
|
3359
|
-
const amountCoin2 = tx.splitCoins(tx.gas, [tx.pure.u64(amount)]);
|
|
3360
|
-
return {
|
|
3361
|
-
targetCoin: tx.makeMoveVec({ elements: [amountCoin2] }),
|
|
3362
|
-
remainCoins: allCoins,
|
|
3363
|
-
tragetCoinAmount: amount.toString(),
|
|
3364
|
-
isMintZeroCoin: false,
|
|
3365
|
-
originalSplitedCoin: tx.gas
|
|
3366
|
-
};
|
|
3367
|
-
}
|
|
3368
3407
|
if (amount === 0n && coinAssets.length > 1) {
|
|
3369
3408
|
const selectedCoinsResult3 = CoinAssist.selectCoinObjectIdGreaterThanOrEqual(coinAssets, amount);
|
|
3370
3409
|
return {
|
|
@@ -3384,17 +3423,24 @@ var _TransactionUtil = class {
|
|
|
3384
3423
|
originalSplitedCoin: tx.gas
|
|
3385
3424
|
};
|
|
3386
3425
|
}
|
|
3426
|
+
const { targetCoin, originalSplitedCoin, tragetCoinAmount, selectedCoinsResult } = this.buildSpitTargeCoin(
|
|
3427
|
+
tx,
|
|
3428
|
+
amount,
|
|
3429
|
+
coinAssets,
|
|
3430
|
+
fixAmount
|
|
3431
|
+
);
|
|
3432
|
+
return {
|
|
3433
|
+
targetCoin,
|
|
3434
|
+
remainCoins: selectedCoinsResult.remainCoins,
|
|
3435
|
+
originalSplitedCoin,
|
|
3436
|
+
tragetCoinAmount,
|
|
3437
|
+
isMintZeroCoin: false
|
|
3438
|
+
};
|
|
3439
|
+
}
|
|
3440
|
+
static buildSpitTargeCoin(tx, amount, coinAssets, fixAmount) {
|
|
3387
3441
|
const selectedCoinsResult = CoinAssist.selectCoinObjectIdGreaterThanOrEqual(coinAssets, amount);
|
|
3388
3442
|
const totalSelectedCoinAmount = selectedCoinsResult.amountArray.reduce((a, b) => Number(a) + Number(b), 0).toString();
|
|
3389
3443
|
const coinObjectIds = selectedCoinsResult.objectArray;
|
|
3390
|
-
if (buildVector) {
|
|
3391
|
-
return {
|
|
3392
|
-
targetCoin: tx.makeMoveVec({ elements: coinObjectIds.map((id) => tx.object(id)) }),
|
|
3393
|
-
remainCoins: selectedCoinsResult.remainCoins,
|
|
3394
|
-
tragetCoinAmount: selectedCoinsResult.amountArray.reduce((a, b) => Number(a) + Number(b), 0).toString(),
|
|
3395
|
-
isMintZeroCoin: false
|
|
3396
|
-
};
|
|
3397
|
-
}
|
|
3398
3444
|
const [primaryCoinA, ...mergeCoinAs] = coinObjectIds;
|
|
3399
3445
|
const primaryCoinAObject = tx.object(primaryCoinA);
|
|
3400
3446
|
let targetCoin = primaryCoinAObject;
|
|
@@ -3411,13 +3457,19 @@ var _TransactionUtil = class {
|
|
|
3411
3457
|
originalSplitedCoin = primaryCoinAObject;
|
|
3412
3458
|
}
|
|
3413
3459
|
return {
|
|
3414
|
-
targetCoin,
|
|
3415
|
-
remainCoins: selectedCoinsResult.remainCoins,
|
|
3416
3460
|
originalSplitedCoin,
|
|
3461
|
+
targetCoin,
|
|
3417
3462
|
tragetCoinAmount,
|
|
3418
|
-
|
|
3463
|
+
selectedCoinsResult,
|
|
3464
|
+
coinObjectIds
|
|
3419
3465
|
};
|
|
3420
3466
|
}
|
|
3467
|
+
static buildCoin(tx, allCoins, coinAssets, amount, coinType, buildVector = true, fixAmount = true) {
|
|
3468
|
+
if (buildVector) {
|
|
3469
|
+
return this.buildVectorCoin(tx, allCoins, coinAssets, amount, coinType, fixAmount);
|
|
3470
|
+
}
|
|
3471
|
+
return this.buildOneCoin(tx, coinAssets, amount, coinType, fixAmount);
|
|
3472
|
+
}
|
|
3421
3473
|
static buildZeroValueCoin(allCoins, tx, coinType, buildVector = true) {
|
|
3422
3474
|
const zeroCoin = _TransactionUtil.callMintZeroValueCoin(tx, coinType);
|
|
3423
3475
|
let targetCoin;
|
|
@@ -3433,17 +3485,17 @@ var _TransactionUtil = class {
|
|
|
3433
3485
|
tragetCoinAmount: "0"
|
|
3434
3486
|
};
|
|
3435
3487
|
}
|
|
3436
|
-
static buildCoinForAmountInterval(tx, allCoins, amounts, coinType, buildVector = true) {
|
|
3488
|
+
static buildCoinForAmountInterval(tx, allCoins, amounts, coinType, buildVector = true, fixAmount = true) {
|
|
3437
3489
|
const coinAssets = CoinAssist.getCoinAssets(coinType, allCoins);
|
|
3438
3490
|
if (amounts.amountFirst === BigInt(0)) {
|
|
3439
3491
|
if (coinAssets.length > 0) {
|
|
3440
|
-
return _TransactionUtil.buildCoin(tx, [...allCoins], [...coinAssets], amounts.amountFirst, coinType, buildVector);
|
|
3492
|
+
return _TransactionUtil.buildCoin(tx, [...allCoins], [...coinAssets], amounts.amountFirst, coinType, buildVector, fixAmount);
|
|
3441
3493
|
}
|
|
3442
3494
|
return _TransactionUtil.buildZeroValueCoin(allCoins, tx, coinType, buildVector);
|
|
3443
3495
|
}
|
|
3444
3496
|
const amountTotal = CoinAssist.calculateTotalBalance(coinAssets);
|
|
3445
3497
|
if (amountTotal >= amounts.amountFirst) {
|
|
3446
|
-
return _TransactionUtil.buildCoin(tx, [...allCoins], [...coinAssets], amounts.amountFirst, coinType, buildVector);
|
|
3498
|
+
return _TransactionUtil.buildCoin(tx, [...allCoins], [...coinAssets], amounts.amountFirst, coinType, buildVector, fixAmount);
|
|
3447
3499
|
}
|
|
3448
3500
|
if (amountTotal < amounts.amountSecond) {
|
|
3449
3501
|
throw new ClmmpoolsError(
|
|
@@ -3451,7 +3503,7 @@ var _TransactionUtil = class {
|
|
|
3451
3503
|
"InsufficientBalance" /* InsufficientBalance */
|
|
3452
3504
|
);
|
|
3453
3505
|
}
|
|
3454
|
-
return _TransactionUtil.buildCoin(tx, [...allCoins], [...coinAssets], amounts.amountSecond, coinType, buildVector);
|
|
3506
|
+
return _TransactionUtil.buildCoin(tx, [...allCoins], [...coinAssets], amounts.amountSecond, coinType, buildVector, fixAmount);
|
|
3455
3507
|
}
|
|
3456
3508
|
// ------------------------------------------router-v1-------------------------------------------------//
|
|
3457
3509
|
static async buildRouterSwapTransaction(sdk, params, byAmountIn, allCoinAsset, recipient) {
|
|
@@ -5419,8 +5471,8 @@ var PositionModule = class {
|
|
|
5419
5471
|
let primaryCoinBInputs;
|
|
5420
5472
|
if (inputCoinA == null || inputCoinB == null) {
|
|
5421
5473
|
const allCoinAsset = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
|
|
5422
|
-
primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, max_amount_a, params.coinTypeA, false);
|
|
5423
|
-
primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, max_amount_b, params.coinTypeB, false);
|
|
5474
|
+
primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, max_amount_a, params.coinTypeA, false, true);
|
|
5475
|
+
primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, max_amount_b, params.coinTypeB, false, true);
|
|
5424
5476
|
} else {
|
|
5425
5477
|
primaryCoinAInputs = {
|
|
5426
5478
|
targetCoin: inputCoinA,
|
|
@@ -7250,6 +7302,62 @@ var LockModule = class {
|
|
|
7250
7302
|
}
|
|
7251
7303
|
return locksInfo;
|
|
7252
7304
|
}
|
|
7305
|
+
async aLockInfo(lockId) {
|
|
7306
|
+
const aLockSummary = await this.aLockSummary(lockId);
|
|
7307
|
+
const lockObj = await this._sdk.fullClient.getObject({
|
|
7308
|
+
id: lockId,
|
|
7309
|
+
options: {
|
|
7310
|
+
showContent: true,
|
|
7311
|
+
showDisplay: true,
|
|
7312
|
+
showOwner: true,
|
|
7313
|
+
showPreviousTransaction: true,
|
|
7314
|
+
showStorageRebate: true,
|
|
7315
|
+
showType: true
|
|
7316
|
+
}
|
|
7317
|
+
});
|
|
7318
|
+
const { magma_token } = getPackagerConfigs(this.sdk.sdkOptions.magma_config);
|
|
7319
|
+
const poolIncentiveTokens = await this.getVotingBribeRewardTokens(lockId);
|
|
7320
|
+
const incentiveTokens = [];
|
|
7321
|
+
poolIncentiveTokens.forEach((value, key) => {
|
|
7322
|
+
incentiveTokens.push(...value);
|
|
7323
|
+
});
|
|
7324
|
+
const poolIncentiveRewards = await this.getPoolIncentiveRewrads(incentiveTokens, lockId);
|
|
7325
|
+
const votingRewards = /* @__PURE__ */ new Map();
|
|
7326
|
+
poolIncentiveRewards.forEach((value, coin) => {
|
|
7327
|
+
value.forEach((amount, pool) => {
|
|
7328
|
+
if (!votingRewards.has(pool)) {
|
|
7329
|
+
votingRewards.set(pool, []);
|
|
7330
|
+
}
|
|
7331
|
+
votingRewards.get(pool)?.push({
|
|
7332
|
+
kind: "incentiveCoin" /* Incentive */,
|
|
7333
|
+
token_addr: coin,
|
|
7334
|
+
amount: amount.toString()
|
|
7335
|
+
});
|
|
7336
|
+
});
|
|
7337
|
+
});
|
|
7338
|
+
if (lockObj.error != null || lockObj.data?.content?.dataType !== "moveObject") {
|
|
7339
|
+
throw new ClmmpoolsError(
|
|
7340
|
+
`getPool error code: ${lockObj.error?.code ?? "unknown error"}, please check config and object id`,
|
|
7341
|
+
"InvalidLockObject" /* InvalidLockObject */
|
|
7342
|
+
);
|
|
7343
|
+
}
|
|
7344
|
+
const fields = getObjectFields(lockObj);
|
|
7345
|
+
const lockInfo = {
|
|
7346
|
+
lock_id: lockId,
|
|
7347
|
+
amount: fields.amount,
|
|
7348
|
+
start: fields.start,
|
|
7349
|
+
end: fields.end,
|
|
7350
|
+
permanent: fields.permanent,
|
|
7351
|
+
rebase_amount: {
|
|
7352
|
+
kind: "rebaseCoin" /* RebaseCoin */,
|
|
7353
|
+
token_addr: magma_token,
|
|
7354
|
+
amount: aLockSummary.reward_distributor_claimable
|
|
7355
|
+
},
|
|
7356
|
+
voting_power: aLockSummary.voting_power,
|
|
7357
|
+
voting_rewards: votingRewards
|
|
7358
|
+
};
|
|
7359
|
+
return lockInfo;
|
|
7360
|
+
}
|
|
7253
7361
|
async aLockSummary(lock_id) {
|
|
7254
7362
|
const tx = new Transaction9();
|
|
7255
7363
|
const { integrate, simulationAccount } = this.sdk.sdkOptions;
|
|
@@ -8600,6 +8708,7 @@ var ConfigModule = class {
|
|
|
8600
8708
|
voter_id: "",
|
|
8601
8709
|
minter_id: "",
|
|
8602
8710
|
reward_distributor_id: "",
|
|
8711
|
+
distribution_cfg: "",
|
|
8603
8712
|
magma_token: "",
|
|
8604
8713
|
voting_escrow_id: ""
|
|
8605
8714
|
};
|
|
@@ -9153,11 +9262,12 @@ var SDKConfig = {
|
|
|
9153
9262
|
launchpad_pools_handle: "0x5e194a8efcf653830daf85a85b52e3ae8f65dc39481d54b2382acda25068375c",
|
|
9154
9263
|
clmm_pools_handle: "0x37f60eb2d9d227949b95da8fea810db3c32d1e1fa8ed87434fc51664f87d83cb",
|
|
9155
9264
|
global_config_id: "0x4f32c00706e7bdbce532acdcfc0afd91b14defd5ffc9e2723a0ce7ed84f5d380",
|
|
9156
|
-
voter_id: "
|
|
9157
|
-
voting_escrow_id: "
|
|
9158
|
-
reward_distributor_id: "
|
|
9159
|
-
|
|
9160
|
-
|
|
9265
|
+
voter_id: "0xe8e0c266602404caa463f85bee4ccf6000c8c2566204a3949400a06857295ceb",
|
|
9266
|
+
voting_escrow_id: "0x143aab8c7c13c58a94d99ae281b4226f1877abc21bc01b9d75b58a7217fc3b2c",
|
|
9267
|
+
reward_distributor_id: "0x93bf24d3db08f93a02ba90abc7095f8d8086e5a1f72bac8bd866df21defe83ab",
|
|
9268
|
+
distribution_cfg: "0x94e23846c975e2faf89a61bfc2b10ad64decab9069eb1f9fc39752b010868c74",
|
|
9269
|
+
magma_token: "0x3abcdefce1a0ec1252237b69efc6dc3881325d543fceaad2e2f360a02d2f5bd9::magma_token::MAGMA_TOKEN",
|
|
9270
|
+
minter_id: "0x92877b638c3febf8576d0d7caebf9a2c43753b2e441669fb434e709458ece345"
|
|
9161
9271
|
}
|
|
9162
9272
|
};
|
|
9163
9273
|
var clmmMainnet = {
|
|
@@ -9176,12 +9286,12 @@ var clmmMainnet = {
|
|
|
9176
9286
|
config: SDKConfig.clmmConfig
|
|
9177
9287
|
},
|
|
9178
9288
|
distribution: {
|
|
9179
|
-
package_id: "
|
|
9180
|
-
published_at: "
|
|
9289
|
+
package_id: "0x3abcdefce1a0ec1252237b69efc6dc3881325d543fceaad2e2f360a02d2f5bd9",
|
|
9290
|
+
published_at: "0x3abcdefce1a0ec1252237b69efc6dc3881325d543fceaad2e2f360a02d2f5bd9"
|
|
9181
9291
|
},
|
|
9182
9292
|
integrate: {
|
|
9183
|
-
package_id: "
|
|
9184
|
-
published_at: "
|
|
9293
|
+
package_id: "0x6e3ae31a16362c563c0fef5293348d262646882a10c307f20f6be8577960f1ef",
|
|
9294
|
+
published_at: "0x6e3ae31a16362c563c0fef5293348d262646882a10c307f20f6be8577960f1ef"
|
|
9185
9295
|
},
|
|
9186
9296
|
deepbook: {
|
|
9187
9297
|
package_id: "0x000000000000000000000000000000000000000000000000000000000000dee9",
|
|
@@ -9225,6 +9335,7 @@ var SDKConfig2 = {
|
|
|
9225
9335
|
voter_id: "0x59571991a5c7041c4376d980061af5c7a6d8345006d6b5167bd1f00fc17b8ddb",
|
|
9226
9336
|
voting_escrow_id: "0x9081c8044719135da4ff2d52907fcd40c19e2a40750cbba4c1d6a59610ae1446",
|
|
9227
9337
|
reward_distributor_id: "0xdf213d8e0ca49c8f4a508e7d3b3a6983c4aafd639f7c99479fc75fb4451d752e",
|
|
9338
|
+
distribution_cfg: "0x94e23846c975e2faf89a61bfc2b10ad64decab9069eb1f9fc39752b010868c74",
|
|
9228
9339
|
magma_token: "0x45ac2371c33ca0df8dc784d62c8ce5126d42edd8c56820396524dff2ae0619b1::magma_token::MAGMA_TOKEN",
|
|
9229
9340
|
minter_id: "0x89435d6b2a510ba50ca23303f10e91ec058f138a88f69a43fe03cd22edb214c5"
|
|
9230
9341
|
}
|