@magmaprotocol/magma-clmm-sdk 0.5.98 → 0.5.100
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 +36 -36
- package/dist/index.js +69 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -303,7 +303,7 @@ var Voter = "voter";
|
|
|
303
303
|
var RewardDistributor = "reward_distributor";
|
|
304
304
|
var Gauge = "gauge";
|
|
305
305
|
var Minter = "minter";
|
|
306
|
-
var
|
|
306
|
+
var AlmmScript = "almm_script";
|
|
307
307
|
var CoinInfoAddress = "0x1::coin::CoinInfo";
|
|
308
308
|
var CoinStoreAddress = "0x1::coin::CoinStore";
|
|
309
309
|
var DeepbookCustodianV2Moudle = "custodian_v2";
|
|
@@ -1592,10 +1592,10 @@ function collectFeesQuote(param) {
|
|
|
1592
1592
|
return updateFees(param.position, fee_growth_inside_a, fee_growth_inside_b);
|
|
1593
1593
|
}
|
|
1594
1594
|
|
|
1595
|
-
// src/math/
|
|
1595
|
+
// src/math/almmStrategy.ts
|
|
1596
1596
|
import BN10 from "bn.js";
|
|
1597
1597
|
|
|
1598
|
-
// src/math/
|
|
1598
|
+
// src/math/almmWeightToAmounts.ts
|
|
1599
1599
|
import BN9 from "bn.js";
|
|
1600
1600
|
import Decimal3 from "decimal.js";
|
|
1601
1601
|
import { get_price_x128_from_real_id } from "@magmaprotocol/calc_dlmm";
|
|
@@ -1876,7 +1876,7 @@ function toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBi
|
|
|
1876
1876
|
});
|
|
1877
1877
|
}
|
|
1878
1878
|
|
|
1879
|
-
// src/math/
|
|
1879
|
+
// src/math/almmStrategy.ts
|
|
1880
1880
|
var StrategyType = /* @__PURE__ */ ((StrategyType2) => {
|
|
1881
1881
|
StrategyType2[StrategyType2["Spot"] = 1] = "Spot";
|
|
1882
1882
|
StrategyType2[StrategyType2["Curve"] = 2] = "Curve";
|
|
@@ -10414,7 +10414,7 @@ var GaugeModule = class {
|
|
|
10414
10414
|
}
|
|
10415
10415
|
};
|
|
10416
10416
|
|
|
10417
|
-
// src/modules/
|
|
10417
|
+
// src/modules/almm.ts
|
|
10418
10418
|
import { Transaction as Transaction12 } from "@mysten/sui/transactions";
|
|
10419
10419
|
import {
|
|
10420
10420
|
get_price_x128_from_real_id as get_price_x128_from_real_id3,
|
|
@@ -10423,7 +10423,7 @@ import {
|
|
|
10423
10423
|
get_storage_id_from_real_id
|
|
10424
10424
|
} from "@magmaprotocol/calc_dlmm";
|
|
10425
10425
|
import Decimal10 from "decimal.js";
|
|
10426
|
-
var
|
|
10426
|
+
var AlmmModule = class {
|
|
10427
10427
|
_sdk;
|
|
10428
10428
|
_cache = {};
|
|
10429
10429
|
constructor(sdk) {
|
|
@@ -10473,7 +10473,7 @@ var DlmmModule = class {
|
|
|
10473
10473
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
10474
10474
|
const args = [tx.object(params.pair)];
|
|
10475
10475
|
tx.moveCall({
|
|
10476
|
-
target: `${integrate.published_at}::${
|
|
10476
|
+
target: `${integrate.published_at}::${AlmmScript}::fetch_pair_params`,
|
|
10477
10477
|
arguments: args,
|
|
10478
10478
|
typeArguments
|
|
10479
10479
|
});
|
|
@@ -10514,19 +10514,19 @@ var DlmmModule = class {
|
|
|
10514
10514
|
);
|
|
10515
10515
|
const tx = new Transaction12();
|
|
10516
10516
|
tx.setSender(this.sdk.senderAddress);
|
|
10517
|
-
const { clmm_pool,
|
|
10517
|
+
const { clmm_pool, almm_pool, integrate } = this.sdk.sdkOptions;
|
|
10518
10518
|
const { global_config_id } = getPackagerConfigs(clmm_pool);
|
|
10519
|
-
const
|
|
10519
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
10520
10520
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
10521
10521
|
const args = [
|
|
10522
|
-
tx.object(
|
|
10522
|
+
tx.object(almmConfig.factory),
|
|
10523
10523
|
tx.object(global_config_id),
|
|
10524
10524
|
tx.pure.u64(params.base_fee),
|
|
10525
10525
|
tx.pure.u16(params.bin_step),
|
|
10526
10526
|
tx.pure.u32(storage_id)
|
|
10527
10527
|
];
|
|
10528
10528
|
tx.moveCall({
|
|
10529
|
-
target: `${integrate.published_at}::${
|
|
10529
|
+
target: `${integrate.published_at}::${AlmmScript}::create_pair`,
|
|
10530
10530
|
typeArguments,
|
|
10531
10531
|
arguments: args
|
|
10532
10532
|
});
|
|
@@ -10549,8 +10549,8 @@ var DlmmModule = class {
|
|
|
10549
10549
|
const lower_slippage = new Decimal10(1).sub(slippage.div(new Decimal10(1e4)));
|
|
10550
10550
|
const upper_slippage = new Decimal10(1).plus(slippage.div(new Decimal10(1e4)));
|
|
10551
10551
|
tx.setSender(this.sdk.senderAddress);
|
|
10552
|
-
const {
|
|
10553
|
-
const
|
|
10552
|
+
const { almm_pool, integrate } = this.sdk.sdkOptions;
|
|
10553
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
10554
10554
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
10555
10555
|
const price = get_price_x128_from_real_id3(params.active_bin, params.bin_step);
|
|
10556
10556
|
const min_price = new Decimal10(price).mul(lower_slippage);
|
|
@@ -10584,7 +10584,7 @@ var DlmmModule = class {
|
|
|
10584
10584
|
}
|
|
10585
10585
|
const args = [
|
|
10586
10586
|
tx.object(params.pair),
|
|
10587
|
-
tx.object(
|
|
10587
|
+
tx.object(almmConfig.factory),
|
|
10588
10588
|
primaryCoinAInputs.targetCoin,
|
|
10589
10589
|
primaryCoinBInputs.targetCoin,
|
|
10590
10590
|
tx.pure.bool(params.fixCoinA),
|
|
@@ -10601,7 +10601,7 @@ var DlmmModule = class {
|
|
|
10601
10601
|
tx.object(CLOCK_ADDRESS)
|
|
10602
10602
|
];
|
|
10603
10603
|
tx.moveCall({
|
|
10604
|
-
target: `${integrate.published_at}::${
|
|
10604
|
+
target: `${integrate.published_at}::${AlmmScript}::mint_by_strategy`,
|
|
10605
10605
|
typeArguments,
|
|
10606
10606
|
arguments: args
|
|
10607
10607
|
});
|
|
@@ -10611,15 +10611,15 @@ var DlmmModule = class {
|
|
|
10611
10611
|
// async mintPercent(params: MintPercentParams): Promise<Transaction> {
|
|
10612
10612
|
// const tx = new Transaction()
|
|
10613
10613
|
// tx.setSender(this.sdk.senderAddress)
|
|
10614
|
-
// const {
|
|
10615
|
-
// const
|
|
10614
|
+
// const { almm_pool, integrate } = this.sdk.sdkOptions
|
|
10615
|
+
// const almmConfig = getPackagerConfigs(almm_pool)
|
|
10616
10616
|
// const typeArguments = [params.coinTypeA, params.coinTypeB]
|
|
10617
10617
|
// const allCoins = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress)
|
|
10618
10618
|
// const primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountATotal), params.coinTypeA, false, true)
|
|
10619
10619
|
// const primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountBTotal), params.coinTypeB, false, true)
|
|
10620
10620
|
// const args = [
|
|
10621
10621
|
// tx.object(params.pair),
|
|
10622
|
-
// tx.object(
|
|
10622
|
+
// tx.object(almmConfig.factory),
|
|
10623
10623
|
// primaryCoinAInputs.targetCoin,
|
|
10624
10624
|
// primaryCoinBInputs.targetCoin,
|
|
10625
10625
|
// tx.pure.u64(params.amountATotal),
|
|
@@ -10631,7 +10631,7 @@ var DlmmModule = class {
|
|
|
10631
10631
|
// tx.object(CLOCK_ADDRESS),
|
|
10632
10632
|
// ]
|
|
10633
10633
|
// tx.moveCall({
|
|
10634
|
-
// target: `${integrate.published_at}::${
|
|
10634
|
+
// target: `${integrate.published_at}::${AlmmScript}::mint_percent`,
|
|
10635
10635
|
// typeArguments,
|
|
10636
10636
|
// arguments: args,
|
|
10637
10637
|
// })
|
|
@@ -10641,15 +10641,15 @@ var DlmmModule = class {
|
|
|
10641
10641
|
// async createPositionByAmount(params: MintAmountParams): Promise<Transaction> {
|
|
10642
10642
|
// const tx = new Transaction()
|
|
10643
10643
|
// tx.setSender(this.sdk.senderAddress)
|
|
10644
|
-
// const {
|
|
10645
|
-
// const
|
|
10644
|
+
// const { almm_pool, integrate } = this.sdk.sdkOptions
|
|
10645
|
+
// const almmConfig = getPackagerConfigs(almm_pool)
|
|
10646
10646
|
// const typeArguments = [params.coinTypeA, params.coinTypeB]
|
|
10647
10647
|
// const allCoins = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress)
|
|
10648
10648
|
// const primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountATotal), params.coinTypeA, false, true)
|
|
10649
10649
|
// const primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountBTotal), params.coinTypeB, false, true)
|
|
10650
10650
|
// const args = [
|
|
10651
10651
|
// tx.object(params.pair),
|
|
10652
|
-
// tx.object(
|
|
10652
|
+
// tx.object(almmConfig.factory),
|
|
10653
10653
|
// primaryCoinAInputs.targetCoin,
|
|
10654
10654
|
// primaryCoinBInputs.targetCoin,
|
|
10655
10655
|
// tx.pure.vector('u32', params.storageIds),
|
|
@@ -10659,7 +10659,7 @@ var DlmmModule = class {
|
|
|
10659
10659
|
// tx.object(CLOCK_ADDRESS),
|
|
10660
10660
|
// ]
|
|
10661
10661
|
// tx.moveCall({
|
|
10662
|
-
// target: `${integrate.published_at}::${
|
|
10662
|
+
// target: `${integrate.published_at}::${AlmmScript}::mint_amounts`,
|
|
10663
10663
|
// typeArguments,
|
|
10664
10664
|
// arguments: args,
|
|
10665
10665
|
// })
|
|
@@ -10677,8 +10677,8 @@ var DlmmModule = class {
|
|
|
10677
10677
|
const lower_slippage = new Decimal10(1).sub(slippage.div(new Decimal10(1e4)));
|
|
10678
10678
|
const upper_slippage = new Decimal10(1).plus(slippage.div(new Decimal10(1e4)));
|
|
10679
10679
|
tx.setSender(this.sdk.senderAddress);
|
|
10680
|
-
const {
|
|
10681
|
-
const
|
|
10680
|
+
const { almm_pool, integrate } = this.sdk.sdkOptions;
|
|
10681
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
10682
10682
|
const price = get_price_x128_from_real_id3(params.active_bin, params.bin_step);
|
|
10683
10683
|
const min_price = new Decimal10(price).mul(lower_slippage);
|
|
10684
10684
|
const max_price = new Decimal10(price).mul(upper_slippage);
|
|
@@ -10712,7 +10712,7 @@ var DlmmModule = class {
|
|
|
10712
10712
|
}
|
|
10713
10713
|
const args = [
|
|
10714
10714
|
tx.object(params.pair),
|
|
10715
|
-
tx.object(
|
|
10715
|
+
tx.object(almmConfig.factory),
|
|
10716
10716
|
tx.object(params.positionId),
|
|
10717
10717
|
primaryCoinAInputs.targetCoin,
|
|
10718
10718
|
primaryCoinBInputs.targetCoin,
|
|
@@ -10728,7 +10728,7 @@ var DlmmModule = class {
|
|
|
10728
10728
|
tx.object(CLOCK_ADDRESS)
|
|
10729
10729
|
];
|
|
10730
10730
|
tx.moveCall({
|
|
10731
|
-
target: `${integrate.published_at}::${
|
|
10731
|
+
target: `${integrate.published_at}::${AlmmScript}::raise_by_strategy`,
|
|
10732
10732
|
typeArguments,
|
|
10733
10733
|
arguments: args
|
|
10734
10734
|
});
|
|
@@ -10740,8 +10740,8 @@ var DlmmModule = class {
|
|
|
10740
10740
|
const lower_slippage = new Decimal10(1).sub(slippage.div(new Decimal10(1e4)));
|
|
10741
10741
|
const upper_slippage = new Decimal10(1).plus(slippage.div(new Decimal10(1e4)));
|
|
10742
10742
|
tx.setSender(this.sdk.senderAddress);
|
|
10743
|
-
const {
|
|
10744
|
-
const
|
|
10743
|
+
const { almm_pool, integrate } = this.sdk.sdkOptions;
|
|
10744
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
10745
10745
|
const price = get_price_x128_from_real_id3(params.active_bin, params.bin_step);
|
|
10746
10746
|
const min_price = new Decimal10(price).mul(lower_slippage);
|
|
10747
10747
|
const max_price = new Decimal10(price).mul(upper_slippage);
|
|
@@ -10775,8 +10775,8 @@ var DlmmModule = class {
|
|
|
10775
10775
|
}
|
|
10776
10776
|
const args = [
|
|
10777
10777
|
tx.object(params.pair),
|
|
10778
|
-
tx.object(
|
|
10779
|
-
tx.object(
|
|
10778
|
+
tx.object(almmConfig.factory),
|
|
10779
|
+
tx.object(almm_pool.config.rewarder_global_vault),
|
|
10780
10780
|
tx.object(params.positionId),
|
|
10781
10781
|
primaryCoinAInputs.targetCoin,
|
|
10782
10782
|
primaryCoinBInputs.targetCoin,
|
|
@@ -10792,7 +10792,7 @@ var DlmmModule = class {
|
|
|
10792
10792
|
tx.object(CLOCK_ADDRESS)
|
|
10793
10793
|
];
|
|
10794
10794
|
tx.moveCall({
|
|
10795
|
-
target: `${integrate.published_at}::${
|
|
10795
|
+
target: `${integrate.published_at}::${AlmmScript}::raise_by_strategy_${params.rewards_token.length}`,
|
|
10796
10796
|
typeArguments,
|
|
10797
10797
|
arguments: args
|
|
10798
10798
|
});
|
|
@@ -10805,10 +10805,10 @@ var DlmmModule = class {
|
|
|
10805
10805
|
const clmmConfigs = getPackagerConfigs(clmm_pool);
|
|
10806
10806
|
const typeArguments = [params.coin_a, params.coin_b, ...params.rewards_token];
|
|
10807
10807
|
let args = [tx.object(params.pool_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
|
|
10808
|
-
let target = `${integrate.published_at}::${
|
|
10808
|
+
let target = `${integrate.published_at}::${AlmmScript}::burn_position`;
|
|
10809
10809
|
if (params.rewards_token.length > 0) {
|
|
10810
10810
|
args = [tx.object(params.pool_id), tx.object(clmmConfigs.global_vault_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
|
|
10811
|
-
target = `${integrate.published_at}::${
|
|
10811
|
+
target = `${integrate.published_at}::${AlmmScript}::burn_position_reward${params.rewards_token.length}`;
|
|
10812
10812
|
}
|
|
10813
10813
|
tx.moveCall({
|
|
10814
10814
|
target,
|
|
@@ -10824,7 +10824,7 @@ var DlmmModule = class {
|
|
|
10824
10824
|
const clmmConfigs = getPackagerConfigs(clmm_pool);
|
|
10825
10825
|
const typeArguments = [params.coin_a, params.coin_b, ...params.rewards_token];
|
|
10826
10826
|
let args = [tx.object(params.pool_id), tx.object(params.position_id), tx.pure.u64(params.delta_percentage), tx.object(CLOCK_ADDRESS)];
|
|
10827
|
-
let target = `${integrate.published_at}::${
|
|
10827
|
+
let target = `${integrate.published_at}::${AlmmScript}::shrink_position`;
|
|
10828
10828
|
if (params.rewards_token.length > 0) {
|
|
10829
10829
|
args = [
|
|
10830
10830
|
tx.object(params.pool_id),
|
|
@@ -10833,7 +10833,7 @@ var DlmmModule = class {
|
|
|
10833
10833
|
tx.pure.u64(params.delta_percentage),
|
|
10834
10834
|
tx.object(CLOCK_ADDRESS)
|
|
10835
10835
|
];
|
|
10836
|
-
target = `${integrate.published_at}::${
|
|
10836
|
+
target = `${integrate.published_at}::${AlmmScript}::shrink_position_reward${params.rewards_token.length}`;
|
|
10837
10837
|
}
|
|
10838
10838
|
tx.moveCall({
|
|
10839
10839
|
target,
|
|
@@ -10862,9 +10862,9 @@ var DlmmModule = class {
|
|
|
10862
10862
|
tx.object(params.position_id),
|
|
10863
10863
|
tx.object(CLOCK_ADDRESS)
|
|
10864
10864
|
];
|
|
10865
|
-
let target = `${integrate.published_at}::${
|
|
10865
|
+
let target = `${integrate.published_at}::${AlmmScript}::collect_reward`;
|
|
10866
10866
|
if (params.rewards_token.length > 1) {
|
|
10867
|
-
target = `${integrate.published_at}::${
|
|
10867
|
+
target = `${integrate.published_at}::${AlmmScript}::collect_reward${params.rewards_token.length}`;
|
|
10868
10868
|
}
|
|
10869
10869
|
tx.moveCall({
|
|
10870
10870
|
target,
|
|
@@ -10879,7 +10879,7 @@ var DlmmModule = class {
|
|
|
10879
10879
|
const { integrate } = this.sdk.sdkOptions;
|
|
10880
10880
|
const typeArguments = [params.coin_a, params.coin_b];
|
|
10881
10881
|
const args = [tx.object(params.pool_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
|
|
10882
|
-
const target = `${integrate.published_at}::${
|
|
10882
|
+
const target = `${integrate.published_at}::${AlmmScript}::collect_fees`;
|
|
10883
10883
|
tx.moveCall({
|
|
10884
10884
|
target,
|
|
10885
10885
|
typeArguments,
|
|
@@ -10890,9 +10890,9 @@ var DlmmModule = class {
|
|
|
10890
10890
|
async createPairAddLiquidity(params) {
|
|
10891
10891
|
const tx = new Transaction12();
|
|
10892
10892
|
tx.setSender(this.sdk.senderAddress);
|
|
10893
|
-
const { clmm_pool,
|
|
10893
|
+
const { clmm_pool, almm_pool, integrate } = this.sdk.sdkOptions;
|
|
10894
10894
|
const { global_config_id } = getPackagerConfigs(clmm_pool);
|
|
10895
|
-
const
|
|
10895
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
10896
10896
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
10897
10897
|
const allCoins = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
|
|
10898
10898
|
const amountATotal = params.amountsX.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
@@ -10904,7 +10904,7 @@ var DlmmModule = class {
|
|
|
10904
10904
|
storageIds.push(get_storage_id_from_real_id(i));
|
|
10905
10905
|
});
|
|
10906
10906
|
const args = [
|
|
10907
|
-
tx.object(
|
|
10907
|
+
tx.object(almmConfig.factory),
|
|
10908
10908
|
tx.object(global_config_id),
|
|
10909
10909
|
tx.pure.u64(params.baseFee),
|
|
10910
10910
|
tx.pure.u16(params.binStep),
|
|
@@ -10917,7 +10917,7 @@ var DlmmModule = class {
|
|
|
10917
10917
|
tx.pure.address(params.to),
|
|
10918
10918
|
tx.object(CLOCK_ADDRESS)
|
|
10919
10919
|
];
|
|
10920
|
-
const target = `${integrate.published_at}::${
|
|
10920
|
+
const target = `${integrate.published_at}::${AlmmScript}::create_pair_add_liquidity`;
|
|
10921
10921
|
tx.moveCall({
|
|
10922
10922
|
target,
|
|
10923
10923
|
typeArguments,
|
|
@@ -10960,7 +10960,7 @@ var DlmmModule = class {
|
|
|
10960
10960
|
tx.object(CLOCK_ADDRESS)
|
|
10961
10961
|
];
|
|
10962
10962
|
tx.moveCall({
|
|
10963
|
-
target: `${integrate.published_at}::${
|
|
10963
|
+
target: `${integrate.published_at}::${AlmmScript}::swap`,
|
|
10964
10964
|
typeArguments,
|
|
10965
10965
|
arguments: args
|
|
10966
10966
|
});
|
|
@@ -10972,7 +10972,7 @@ var DlmmModule = class {
|
|
|
10972
10972
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
10973
10973
|
const args = [tx.object(params.pair), tx.pure.u64(params.offset), tx.pure.u64(params.limit)];
|
|
10974
10974
|
tx.moveCall({
|
|
10975
|
-
target: `${integrate.published_at}::${
|
|
10975
|
+
target: `${integrate.published_at}::${AlmmScript}::fetch_bins`,
|
|
10976
10976
|
arguments: args,
|
|
10977
10977
|
typeArguments
|
|
10978
10978
|
});
|
|
@@ -11001,7 +11001,7 @@ var DlmmModule = class {
|
|
|
11001
11001
|
// * @param assignPoolIds An array of pool IDs to filter the positions by.
|
|
11002
11002
|
// * @returns array of Position objects.
|
|
11003
11003
|
// */
|
|
11004
|
-
// async getUserPositionById(positionId: string, showDisplay = true): Promise<
|
|
11004
|
+
// async getUserPositionById(positionId: string, showDisplay = true): Promise<AlmmPositionInfo> {
|
|
11005
11005
|
// let position
|
|
11006
11006
|
// const ownerRes: any = await this._sdk.fullClient.getObject({
|
|
11007
11007
|
// id: positionId,
|
|
@@ -11011,7 +11011,7 @@ var DlmmModule = class {
|
|
|
11011
11011
|
// if (type.full_address === this.buildPositionType()) {
|
|
11012
11012
|
// position = this.buildPosition(ownerRes)
|
|
11013
11013
|
// } else {
|
|
11014
|
-
// throw new ClmmpoolsError(`
|
|
11014
|
+
// throw new ClmmpoolsError(`Almm Position not exists. Get Position error:${ownerRes.error}`, PositionErrorCode.InvalidPositionObject)
|
|
11015
11015
|
// }
|
|
11016
11016
|
// const poolMap = new Set<string>()
|
|
11017
11017
|
// poolMap.add(position.pool)
|
|
@@ -11033,7 +11033,7 @@ var DlmmModule = class {
|
|
|
11033
11033
|
// coinTypeB: pool!.coin_b,
|
|
11034
11034
|
// })
|
|
11035
11035
|
// const rewards_token = pool_reward_coins.get(position.pool) || []
|
|
11036
|
-
// let positionRewards:
|
|
11036
|
+
// let positionRewards: AlmmEventEarnedRewards = { position_id: position.pos_object_id, reward: [], amount: [] }
|
|
11037
11037
|
// if (rewards_token.length > 0) {
|
|
11038
11038
|
// positionRewards = await this.getEarnedRewards({
|
|
11039
11039
|
// pool_id: position.pool,
|
|
@@ -11067,7 +11067,7 @@ var DlmmModule = class {
|
|
|
11067
11067
|
const allPosition = [];
|
|
11068
11068
|
const ownerRes = await this._sdk.fullClient.getOwnedObjectsByPage(accountAddress, {
|
|
11069
11069
|
options: { showType: true, showContent: true, showDisplay, showOwner: true },
|
|
11070
|
-
filter: { Package: this._sdk.sdkOptions.
|
|
11070
|
+
filter: { Package: this._sdk.sdkOptions.almm_pool.package_id }
|
|
11071
11071
|
});
|
|
11072
11072
|
const hasAssignPoolIds = assignPoolIds.length > 0;
|
|
11073
11073
|
for (const item of ownerRes.data) {
|
|
@@ -11208,7 +11208,7 @@ var DlmmModule = class {
|
|
|
11208
11208
|
}
|
|
11209
11209
|
buildPosition(object) {
|
|
11210
11210
|
if (object.error != null || object.data?.content?.dataType !== "moveObject") {
|
|
11211
|
-
throw new ClmmpoolsError(`
|
|
11211
|
+
throw new ClmmpoolsError(`Almm Position not exists. Get Position error:${object.error}`, "InvalidPositionObject" /* InvalidPositionObject */);
|
|
11212
11212
|
}
|
|
11213
11213
|
const fields = getObjectFields(object);
|
|
11214
11214
|
const ownerWarp = getObjectOwner(object);
|
|
@@ -11235,7 +11235,7 @@ var DlmmModule = class {
|
|
|
11235
11235
|
return poolCoins;
|
|
11236
11236
|
}
|
|
11237
11237
|
buildPositionType() {
|
|
11238
|
-
return `${this._sdk.sdkOptions.
|
|
11238
|
+
return `${this._sdk.sdkOptions.almm_pool.package_id}::Almm_position::Position`;
|
|
11239
11239
|
}
|
|
11240
11240
|
async getPositionsLiquidityLimit(params) {
|
|
11241
11241
|
const out = [];
|
|
@@ -11264,7 +11264,7 @@ var DlmmModule = class {
|
|
|
11264
11264
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
11265
11265
|
const args = [tx.object(params.pair), tx.object(params.positionId)];
|
|
11266
11266
|
tx.moveCall({
|
|
11267
|
-
target: `${integrate.published_at}::${
|
|
11267
|
+
target: `${integrate.published_at}::${AlmmScript}::position_liquidity`,
|
|
11268
11268
|
arguments: args,
|
|
11269
11269
|
typeArguments
|
|
11270
11270
|
});
|
|
@@ -11303,7 +11303,7 @@ var DlmmModule = class {
|
|
|
11303
11303
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
11304
11304
|
const args = [tx.object(params.pair)];
|
|
11305
11305
|
tx.moveCall({
|
|
11306
|
-
target: `${integrate.published_at}::${
|
|
11306
|
+
target: `${integrate.published_at}::${AlmmScript}::pair_liquidity`,
|
|
11307
11307
|
arguments: args,
|
|
11308
11308
|
typeArguments
|
|
11309
11309
|
});
|
|
@@ -11363,7 +11363,7 @@ var DlmmModule = class {
|
|
|
11363
11363
|
const typeArguments = [params.coin_a, params.coin_b];
|
|
11364
11364
|
const args = [tx.object(params.pool_id), tx.object(params.position_id)];
|
|
11365
11365
|
tx.moveCall({
|
|
11366
|
-
target: `${integrate.published_at}::${
|
|
11366
|
+
target: `${integrate.published_at}::${AlmmScript}::earned_fees`,
|
|
11367
11367
|
arguments: args,
|
|
11368
11368
|
typeArguments
|
|
11369
11369
|
});
|
|
@@ -11406,9 +11406,9 @@ var DlmmModule = class {
|
|
|
11406
11406
|
const { integrate } = this.sdk.sdkOptions;
|
|
11407
11407
|
const typeArguments = [params.coin_a, params.coin_b, ...params.rewards_token];
|
|
11408
11408
|
const args = [tx.object(params.pool_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
|
|
11409
|
-
let target = `${integrate.published_at}::${
|
|
11409
|
+
let target = `${integrate.published_at}::${AlmmScript}::earned_rewards`;
|
|
11410
11410
|
if (params.rewards_token.length > 1) {
|
|
11411
|
-
target = `${integrate.published_at}::${
|
|
11411
|
+
target = `${integrate.published_at}::${AlmmScript}::earned_rewards${params.rewards_token.length}`;
|
|
11412
11412
|
}
|
|
11413
11413
|
tx.moveCall({
|
|
11414
11414
|
target,
|
|
@@ -11464,7 +11464,7 @@ var DlmmModule = class {
|
|
|
11464
11464
|
const typeArguments = [params.coin_a, params.coin_b];
|
|
11465
11465
|
const args = [tx.object(params.pool_id)];
|
|
11466
11466
|
tx.moveCall({
|
|
11467
|
-
target: `${integrate.published_at}::${
|
|
11467
|
+
target: `${integrate.published_at}::${AlmmScript}::get_pair_rewarders`,
|
|
11468
11468
|
arguments: args,
|
|
11469
11469
|
typeArguments
|
|
11470
11470
|
});
|
|
@@ -11556,7 +11556,7 @@ var MagmaClmmSDK = class {
|
|
|
11556
11556
|
*/
|
|
11557
11557
|
_lock;
|
|
11558
11558
|
_gauge;
|
|
11559
|
-
|
|
11559
|
+
_almm;
|
|
11560
11560
|
/**
|
|
11561
11561
|
* Provide interact with a position rewarder interface.
|
|
11562
11562
|
*/
|
|
@@ -11594,7 +11594,7 @@ var MagmaClmmSDK = class {
|
|
|
11594
11594
|
this._swap = new SwapModule(this);
|
|
11595
11595
|
this._lock = new LockModule(this);
|
|
11596
11596
|
this._gauge = new GaugeModule(this);
|
|
11597
|
-
this.
|
|
11597
|
+
this._almm = new AlmmModule(this);
|
|
11598
11598
|
this._pool = new PoolModule(this);
|
|
11599
11599
|
this._position = new PositionModule(this);
|
|
11600
11600
|
this._rewarder = new RewarderModule(this);
|
|
@@ -11632,8 +11632,8 @@ var MagmaClmmSDK = class {
|
|
|
11632
11632
|
get Gauge() {
|
|
11633
11633
|
return this._gauge;
|
|
11634
11634
|
}
|
|
11635
|
-
get
|
|
11636
|
-
return this.
|
|
11635
|
+
get Almm() {
|
|
11636
|
+
return this._almm;
|
|
11637
11637
|
}
|
|
11638
11638
|
/**
|
|
11639
11639
|
* Getter for the fullClient property.
|
|
@@ -11830,7 +11830,7 @@ var SDKConfig = {
|
|
|
11830
11830
|
magma_token: "0x7161c6c6bb65f852797c8f7f5c4f8d57adaf796e1b840921f9e23fabeadfd54e::magma::MAGMA",
|
|
11831
11831
|
minter_id: "0x4fa5766cd83b33b215b139fec27ac344040f3bbd84fcbee7b61fc671aadc51fa"
|
|
11832
11832
|
},
|
|
11833
|
-
|
|
11833
|
+
almmConfig: {
|
|
11834
11834
|
factory: "",
|
|
11835
11835
|
rewarder_global_vault: ""
|
|
11836
11836
|
},
|
|
@@ -11856,10 +11856,10 @@ var clmmMainnet = {
|
|
|
11856
11856
|
published_at: "0x4a35d3dfef55ed3631b7158544c6322a23bc434fe4fca1234cb680ce0505f82d",
|
|
11857
11857
|
config: SDKConfig.clmmConfig
|
|
11858
11858
|
},
|
|
11859
|
-
|
|
11859
|
+
almm_pool: {
|
|
11860
11860
|
package_id: "",
|
|
11861
11861
|
published_at: "",
|
|
11862
|
-
config: SDKConfig.
|
|
11862
|
+
config: SDKConfig.almmConfig
|
|
11863
11863
|
},
|
|
11864
11864
|
distribution: {
|
|
11865
11865
|
package_id: "0xee4a1f231dc45a303389998fe26c4e39278cf68b404b32e4f0b9769129b8267b",
|
|
@@ -11917,7 +11917,7 @@ var SDKConfig2 = {
|
|
|
11917
11917
|
magma_token: "0x45ac2371c33ca0df8dc784d62c8ce5126d42edd8c56820396524dff2ae0619b1::magma_token::MAGMA_TOKEN",
|
|
11918
11918
|
minter_id: "0x89435d6b2a510ba50ca23303f10e91ec058f138a88f69a43fe03cd22edb214c5"
|
|
11919
11919
|
},
|
|
11920
|
-
|
|
11920
|
+
almmConfig: {
|
|
11921
11921
|
factory: "",
|
|
11922
11922
|
rewarder_global_vault: ""
|
|
11923
11923
|
}
|
|
@@ -11939,10 +11939,10 @@ var clmmTestnet = {
|
|
|
11939
11939
|
published_at: "0xca1b84a430d03e22dae08a7273c8e9dcfdb40b7f559574105f008600eeb7b4bd",
|
|
11940
11940
|
config: SDKConfig2.clmmConfig
|
|
11941
11941
|
},
|
|
11942
|
-
|
|
11942
|
+
almm_pool: {
|
|
11943
11943
|
package_id: "",
|
|
11944
11944
|
published_at: "",
|
|
11945
|
-
config: SDKConfig2.
|
|
11945
|
+
config: SDKConfig2.almmConfig
|
|
11946
11946
|
},
|
|
11947
11947
|
distribution: {
|
|
11948
11948
|
package_id: "0x45ac2371c33ca0df8dc784d62c8ce5126d42edd8c56820396524dff2ae0619b1",
|
|
@@ -11990,6 +11990,7 @@ function initMagmaSDK(options) {
|
|
|
11990
11990
|
var src_default = MagmaClmmSDK;
|
|
11991
11991
|
export {
|
|
11992
11992
|
AMM_SWAP_MODULE,
|
|
11993
|
+
AlmmScript,
|
|
11993
11994
|
AmountSpecified,
|
|
11994
11995
|
BinMath,
|
|
11995
11996
|
CLOCK_ADDRESS,
|
|
@@ -12019,7 +12020,6 @@ export {
|
|
|
12019
12020
|
DeepbookCustodianV2Moudle,
|
|
12020
12021
|
DeepbookEndpointsV2Moudle,
|
|
12021
12022
|
DeepbookUtils,
|
|
12022
|
-
DlmmScript,
|
|
12023
12023
|
FEE_RATE_DENOMINATOR,
|
|
12024
12024
|
GAS_SYMBOL,
|
|
12025
12025
|
GAS_TYPE_ARG,
|