@magmaprotocol/magma-clmm-sdk 0.5.97 → 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 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -69
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ var __publicField = (obj, key, value) => {
|
|
|
36
36
|
var src_exports = {};
|
|
37
37
|
__export(src_exports, {
|
|
38
38
|
AMM_SWAP_MODULE: () => AMM_SWAP_MODULE,
|
|
39
|
+
AlmmScript: () => AlmmScript,
|
|
39
40
|
AmountSpecified: () => AmountSpecified,
|
|
40
41
|
BinMath: () => BinMath,
|
|
41
42
|
CLOCK_ADDRESS: () => CLOCK_ADDRESS,
|
|
@@ -65,7 +66,6 @@ __export(src_exports, {
|
|
|
65
66
|
DeepbookCustodianV2Moudle: () => DeepbookCustodianV2Moudle,
|
|
66
67
|
DeepbookEndpointsV2Moudle: () => DeepbookEndpointsV2Moudle,
|
|
67
68
|
DeepbookUtils: () => DeepbookUtils,
|
|
68
|
-
DlmmScript: () => DlmmScript,
|
|
69
69
|
FEE_RATE_DENOMINATOR: () => FEE_RATE_DENOMINATOR,
|
|
70
70
|
GAS_SYMBOL: () => GAS_SYMBOL,
|
|
71
71
|
GAS_TYPE_ARG: () => GAS_TYPE_ARG,
|
|
@@ -523,7 +523,7 @@ var Voter = "voter";
|
|
|
523
523
|
var RewardDistributor = "reward_distributor";
|
|
524
524
|
var Gauge = "gauge";
|
|
525
525
|
var Minter = "minter";
|
|
526
|
-
var
|
|
526
|
+
var AlmmScript = "almm_script";
|
|
527
527
|
var CoinInfoAddress = "0x1::coin::CoinInfo";
|
|
528
528
|
var CoinStoreAddress = "0x1::coin::CoinStore";
|
|
529
529
|
var DeepbookCustodianV2Moudle = "custodian_v2";
|
|
@@ -1812,10 +1812,10 @@ function collectFeesQuote(param) {
|
|
|
1812
1812
|
return updateFees(param.position, fee_growth_inside_a, fee_growth_inside_b);
|
|
1813
1813
|
}
|
|
1814
1814
|
|
|
1815
|
-
// src/math/
|
|
1815
|
+
// src/math/almmStrategy.ts
|
|
1816
1816
|
var import_bn10 = __toESM(require("bn.js"));
|
|
1817
1817
|
|
|
1818
|
-
// src/math/
|
|
1818
|
+
// src/math/almmWeightToAmounts.ts
|
|
1819
1819
|
var import_bn9 = __toESM(require("bn.js"));
|
|
1820
1820
|
var import_decimal6 = __toESM(require("decimal.js"));
|
|
1821
1821
|
var import_calc_dlmm = require("@magmaprotocol/calc_dlmm");
|
|
@@ -2096,7 +2096,7 @@ function toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBi
|
|
|
2096
2096
|
});
|
|
2097
2097
|
}
|
|
2098
2098
|
|
|
2099
|
-
// src/math/
|
|
2099
|
+
// src/math/almmStrategy.ts
|
|
2100
2100
|
var StrategyType = /* @__PURE__ */ ((StrategyType2) => {
|
|
2101
2101
|
StrategyType2[StrategyType2["Spot"] = 1] = "Spot";
|
|
2102
2102
|
StrategyType2[StrategyType2["Curve"] = 2] = "Curve";
|
|
@@ -10632,11 +10632,11 @@ var GaugeModule = class {
|
|
|
10632
10632
|
}
|
|
10633
10633
|
};
|
|
10634
10634
|
|
|
10635
|
-
// src/modules/
|
|
10635
|
+
// src/modules/almm.ts
|
|
10636
10636
|
var import_transactions12 = require("@mysten/sui/transactions");
|
|
10637
10637
|
var import_calc_dlmm3 = require("@magmaprotocol/calc_dlmm");
|
|
10638
10638
|
var import_decimal13 = __toESM(require("decimal.js"));
|
|
10639
|
-
var
|
|
10639
|
+
var AlmmModule = class {
|
|
10640
10640
|
_sdk;
|
|
10641
10641
|
_cache = {};
|
|
10642
10642
|
constructor(sdk) {
|
|
@@ -10686,7 +10686,7 @@ var DlmmModule = class {
|
|
|
10686
10686
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
10687
10687
|
const args = [tx.object(params.pair)];
|
|
10688
10688
|
tx.moveCall({
|
|
10689
|
-
target: `${integrate.published_at}::${
|
|
10689
|
+
target: `${integrate.published_at}::${AlmmScript}::fetch_pair_params`,
|
|
10690
10690
|
arguments: args,
|
|
10691
10691
|
typeArguments
|
|
10692
10692
|
});
|
|
@@ -10727,19 +10727,19 @@ var DlmmModule = class {
|
|
|
10727
10727
|
);
|
|
10728
10728
|
const tx = new import_transactions12.Transaction();
|
|
10729
10729
|
tx.setSender(this.sdk.senderAddress);
|
|
10730
|
-
const { clmm_pool,
|
|
10730
|
+
const { clmm_pool, almm_pool, integrate } = this.sdk.sdkOptions;
|
|
10731
10731
|
const { global_config_id } = getPackagerConfigs(clmm_pool);
|
|
10732
|
-
const
|
|
10732
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
10733
10733
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
10734
10734
|
const args = [
|
|
10735
|
-
tx.object(
|
|
10735
|
+
tx.object(almmConfig.factory),
|
|
10736
10736
|
tx.object(global_config_id),
|
|
10737
10737
|
tx.pure.u64(params.base_fee),
|
|
10738
10738
|
tx.pure.u16(params.bin_step),
|
|
10739
10739
|
tx.pure.u32(storage_id)
|
|
10740
10740
|
];
|
|
10741
10741
|
tx.moveCall({
|
|
10742
|
-
target: `${integrate.published_at}::${
|
|
10742
|
+
target: `${integrate.published_at}::${AlmmScript}::create_pair`,
|
|
10743
10743
|
typeArguments,
|
|
10744
10744
|
arguments: args
|
|
10745
10745
|
});
|
|
@@ -10762,8 +10762,8 @@ var DlmmModule = class {
|
|
|
10762
10762
|
const lower_slippage = new import_decimal13.default(1).sub(slippage.div(new import_decimal13.default(1e4)));
|
|
10763
10763
|
const upper_slippage = new import_decimal13.default(1).plus(slippage.div(new import_decimal13.default(1e4)));
|
|
10764
10764
|
tx.setSender(this.sdk.senderAddress);
|
|
10765
|
-
const {
|
|
10766
|
-
const
|
|
10765
|
+
const { almm_pool, integrate } = this.sdk.sdkOptions;
|
|
10766
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
10767
10767
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
10768
10768
|
const price = (0, import_calc_dlmm3.get_price_x128_from_real_id)(params.active_bin, params.bin_step);
|
|
10769
10769
|
const min_price = new import_decimal13.default(price).mul(lower_slippage);
|
|
@@ -10797,7 +10797,7 @@ var DlmmModule = class {
|
|
|
10797
10797
|
}
|
|
10798
10798
|
const args = [
|
|
10799
10799
|
tx.object(params.pair),
|
|
10800
|
-
tx.object(
|
|
10800
|
+
tx.object(almmConfig.factory),
|
|
10801
10801
|
primaryCoinAInputs.targetCoin,
|
|
10802
10802
|
primaryCoinBInputs.targetCoin,
|
|
10803
10803
|
tx.pure.bool(params.fixCoinA),
|
|
@@ -10814,7 +10814,7 @@ var DlmmModule = class {
|
|
|
10814
10814
|
tx.object(CLOCK_ADDRESS)
|
|
10815
10815
|
];
|
|
10816
10816
|
tx.moveCall({
|
|
10817
|
-
target: `${integrate.published_at}::${
|
|
10817
|
+
target: `${integrate.published_at}::${AlmmScript}::mint_by_strategy`,
|
|
10818
10818
|
typeArguments,
|
|
10819
10819
|
arguments: args
|
|
10820
10820
|
});
|
|
@@ -10824,15 +10824,15 @@ var DlmmModule = class {
|
|
|
10824
10824
|
// async mintPercent(params: MintPercentParams): Promise<Transaction> {
|
|
10825
10825
|
// const tx = new Transaction()
|
|
10826
10826
|
// tx.setSender(this.sdk.senderAddress)
|
|
10827
|
-
// const {
|
|
10828
|
-
// const
|
|
10827
|
+
// const { almm_pool, integrate } = this.sdk.sdkOptions
|
|
10828
|
+
// const almmConfig = getPackagerConfigs(almm_pool)
|
|
10829
10829
|
// const typeArguments = [params.coinTypeA, params.coinTypeB]
|
|
10830
10830
|
// const allCoins = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress)
|
|
10831
10831
|
// const primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountATotal), params.coinTypeA, false, true)
|
|
10832
10832
|
// const primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountBTotal), params.coinTypeB, false, true)
|
|
10833
10833
|
// const args = [
|
|
10834
10834
|
// tx.object(params.pair),
|
|
10835
|
-
// tx.object(
|
|
10835
|
+
// tx.object(almmConfig.factory),
|
|
10836
10836
|
// primaryCoinAInputs.targetCoin,
|
|
10837
10837
|
// primaryCoinBInputs.targetCoin,
|
|
10838
10838
|
// tx.pure.u64(params.amountATotal),
|
|
@@ -10844,7 +10844,7 @@ var DlmmModule = class {
|
|
|
10844
10844
|
// tx.object(CLOCK_ADDRESS),
|
|
10845
10845
|
// ]
|
|
10846
10846
|
// tx.moveCall({
|
|
10847
|
-
// target: `${integrate.published_at}::${
|
|
10847
|
+
// target: `${integrate.published_at}::${AlmmScript}::mint_percent`,
|
|
10848
10848
|
// typeArguments,
|
|
10849
10849
|
// arguments: args,
|
|
10850
10850
|
// })
|
|
@@ -10854,15 +10854,15 @@ var DlmmModule = class {
|
|
|
10854
10854
|
// async createPositionByAmount(params: MintAmountParams): Promise<Transaction> {
|
|
10855
10855
|
// const tx = new Transaction()
|
|
10856
10856
|
// tx.setSender(this.sdk.senderAddress)
|
|
10857
|
-
// const {
|
|
10858
|
-
// const
|
|
10857
|
+
// const { almm_pool, integrate } = this.sdk.sdkOptions
|
|
10858
|
+
// const almmConfig = getPackagerConfigs(almm_pool)
|
|
10859
10859
|
// const typeArguments = [params.coinTypeA, params.coinTypeB]
|
|
10860
10860
|
// const allCoins = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress)
|
|
10861
10861
|
// const primaryCoinAInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountATotal), params.coinTypeA, false, true)
|
|
10862
10862
|
// const primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(params.amountBTotal), params.coinTypeB, false, true)
|
|
10863
10863
|
// const args = [
|
|
10864
10864
|
// tx.object(params.pair),
|
|
10865
|
-
// tx.object(
|
|
10865
|
+
// tx.object(almmConfig.factory),
|
|
10866
10866
|
// primaryCoinAInputs.targetCoin,
|
|
10867
10867
|
// primaryCoinBInputs.targetCoin,
|
|
10868
10868
|
// tx.pure.vector('u32', params.storageIds),
|
|
@@ -10872,7 +10872,7 @@ var DlmmModule = class {
|
|
|
10872
10872
|
// tx.object(CLOCK_ADDRESS),
|
|
10873
10873
|
// ]
|
|
10874
10874
|
// tx.moveCall({
|
|
10875
|
-
// target: `${integrate.published_at}::${
|
|
10875
|
+
// target: `${integrate.published_at}::${AlmmScript}::mint_amounts`,
|
|
10876
10876
|
// typeArguments,
|
|
10877
10877
|
// arguments: args,
|
|
10878
10878
|
// })
|
|
@@ -10890,8 +10890,8 @@ var DlmmModule = class {
|
|
|
10890
10890
|
const lower_slippage = new import_decimal13.default(1).sub(slippage.div(new import_decimal13.default(1e4)));
|
|
10891
10891
|
const upper_slippage = new import_decimal13.default(1).plus(slippage.div(new import_decimal13.default(1e4)));
|
|
10892
10892
|
tx.setSender(this.sdk.senderAddress);
|
|
10893
|
-
const {
|
|
10894
|
-
const
|
|
10893
|
+
const { almm_pool, integrate } = this.sdk.sdkOptions;
|
|
10894
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
10895
10895
|
const price = (0, import_calc_dlmm3.get_price_x128_from_real_id)(params.active_bin, params.bin_step);
|
|
10896
10896
|
const min_price = new import_decimal13.default(price).mul(lower_slippage);
|
|
10897
10897
|
const max_price = new import_decimal13.default(price).mul(upper_slippage);
|
|
@@ -10925,7 +10925,7 @@ var DlmmModule = class {
|
|
|
10925
10925
|
}
|
|
10926
10926
|
const args = [
|
|
10927
10927
|
tx.object(params.pair),
|
|
10928
|
-
tx.object(
|
|
10928
|
+
tx.object(almmConfig.factory),
|
|
10929
10929
|
tx.object(params.positionId),
|
|
10930
10930
|
primaryCoinAInputs.targetCoin,
|
|
10931
10931
|
primaryCoinBInputs.targetCoin,
|
|
@@ -10941,7 +10941,7 @@ var DlmmModule = class {
|
|
|
10941
10941
|
tx.object(CLOCK_ADDRESS)
|
|
10942
10942
|
];
|
|
10943
10943
|
tx.moveCall({
|
|
10944
|
-
target: `${integrate.published_at}::${
|
|
10944
|
+
target: `${integrate.published_at}::${AlmmScript}::raise_by_strategy`,
|
|
10945
10945
|
typeArguments,
|
|
10946
10946
|
arguments: args
|
|
10947
10947
|
});
|
|
@@ -10953,8 +10953,8 @@ var DlmmModule = class {
|
|
|
10953
10953
|
const lower_slippage = new import_decimal13.default(1).sub(slippage.div(new import_decimal13.default(1e4)));
|
|
10954
10954
|
const upper_slippage = new import_decimal13.default(1).plus(slippage.div(new import_decimal13.default(1e4)));
|
|
10955
10955
|
tx.setSender(this.sdk.senderAddress);
|
|
10956
|
-
const {
|
|
10957
|
-
const
|
|
10956
|
+
const { almm_pool, integrate } = this.sdk.sdkOptions;
|
|
10957
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
10958
10958
|
const price = (0, import_calc_dlmm3.get_price_x128_from_real_id)(params.active_bin, params.bin_step);
|
|
10959
10959
|
const min_price = new import_decimal13.default(price).mul(lower_slippage);
|
|
10960
10960
|
const max_price = new import_decimal13.default(price).mul(upper_slippage);
|
|
@@ -10988,8 +10988,8 @@ var DlmmModule = class {
|
|
|
10988
10988
|
}
|
|
10989
10989
|
const args = [
|
|
10990
10990
|
tx.object(params.pair),
|
|
10991
|
-
tx.object(
|
|
10992
|
-
tx.object(
|
|
10991
|
+
tx.object(almmConfig.factory),
|
|
10992
|
+
tx.object(almm_pool.config.rewarder_global_vault),
|
|
10993
10993
|
tx.object(params.positionId),
|
|
10994
10994
|
primaryCoinAInputs.targetCoin,
|
|
10995
10995
|
primaryCoinBInputs.targetCoin,
|
|
@@ -11005,7 +11005,7 @@ var DlmmModule = class {
|
|
|
11005
11005
|
tx.object(CLOCK_ADDRESS)
|
|
11006
11006
|
];
|
|
11007
11007
|
tx.moveCall({
|
|
11008
|
-
target: `${integrate.published_at}::${
|
|
11008
|
+
target: `${integrate.published_at}::${AlmmScript}::raise_by_strategy_${params.rewards_token.length}`,
|
|
11009
11009
|
typeArguments,
|
|
11010
11010
|
arguments: args
|
|
11011
11011
|
});
|
|
@@ -11018,10 +11018,10 @@ var DlmmModule = class {
|
|
|
11018
11018
|
const clmmConfigs = getPackagerConfigs(clmm_pool);
|
|
11019
11019
|
const typeArguments = [params.coin_a, params.coin_b, ...params.rewards_token];
|
|
11020
11020
|
let args = [tx.object(params.pool_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
|
|
11021
|
-
let target = `${integrate.published_at}::${
|
|
11021
|
+
let target = `${integrate.published_at}::${AlmmScript}::burn_position`;
|
|
11022
11022
|
if (params.rewards_token.length > 0) {
|
|
11023
11023
|
args = [tx.object(params.pool_id), tx.object(clmmConfigs.global_vault_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
|
|
11024
|
-
target = `${integrate.published_at}::${
|
|
11024
|
+
target = `${integrate.published_at}::${AlmmScript}::burn_position_reward${params.rewards_token.length}`;
|
|
11025
11025
|
}
|
|
11026
11026
|
tx.moveCall({
|
|
11027
11027
|
target,
|
|
@@ -11037,7 +11037,7 @@ var DlmmModule = class {
|
|
|
11037
11037
|
const clmmConfigs = getPackagerConfigs(clmm_pool);
|
|
11038
11038
|
const typeArguments = [params.coin_a, params.coin_b, ...params.rewards_token];
|
|
11039
11039
|
let args = [tx.object(params.pool_id), tx.object(params.position_id), tx.pure.u64(params.delta_percentage), tx.object(CLOCK_ADDRESS)];
|
|
11040
|
-
let target = `${integrate.published_at}::${
|
|
11040
|
+
let target = `${integrate.published_at}::${AlmmScript}::shrink_position`;
|
|
11041
11041
|
if (params.rewards_token.length > 0) {
|
|
11042
11042
|
args = [
|
|
11043
11043
|
tx.object(params.pool_id),
|
|
@@ -11046,7 +11046,7 @@ var DlmmModule = class {
|
|
|
11046
11046
|
tx.pure.u64(params.delta_percentage),
|
|
11047
11047
|
tx.object(CLOCK_ADDRESS)
|
|
11048
11048
|
];
|
|
11049
|
-
target = `${integrate.published_at}::${
|
|
11049
|
+
target = `${integrate.published_at}::${AlmmScript}::shrink_position_reward${params.rewards_token.length}`;
|
|
11050
11050
|
}
|
|
11051
11051
|
tx.moveCall({
|
|
11052
11052
|
target,
|
|
@@ -11075,9 +11075,9 @@ var DlmmModule = class {
|
|
|
11075
11075
|
tx.object(params.position_id),
|
|
11076
11076
|
tx.object(CLOCK_ADDRESS)
|
|
11077
11077
|
];
|
|
11078
|
-
let target = `${integrate.published_at}::${
|
|
11078
|
+
let target = `${integrate.published_at}::${AlmmScript}::collect_reward`;
|
|
11079
11079
|
if (params.rewards_token.length > 1) {
|
|
11080
|
-
target = `${integrate.published_at}::${
|
|
11080
|
+
target = `${integrate.published_at}::${AlmmScript}::collect_reward${params.rewards_token.length}`;
|
|
11081
11081
|
}
|
|
11082
11082
|
tx.moveCall({
|
|
11083
11083
|
target,
|
|
@@ -11092,7 +11092,7 @@ var DlmmModule = class {
|
|
|
11092
11092
|
const { integrate } = this.sdk.sdkOptions;
|
|
11093
11093
|
const typeArguments = [params.coin_a, params.coin_b];
|
|
11094
11094
|
const args = [tx.object(params.pool_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
|
|
11095
|
-
const target = `${integrate.published_at}::${
|
|
11095
|
+
const target = `${integrate.published_at}::${AlmmScript}::collect_fees`;
|
|
11096
11096
|
tx.moveCall({
|
|
11097
11097
|
target,
|
|
11098
11098
|
typeArguments,
|
|
@@ -11103,9 +11103,9 @@ var DlmmModule = class {
|
|
|
11103
11103
|
async createPairAddLiquidity(params) {
|
|
11104
11104
|
const tx = new import_transactions12.Transaction();
|
|
11105
11105
|
tx.setSender(this.sdk.senderAddress);
|
|
11106
|
-
const { clmm_pool,
|
|
11106
|
+
const { clmm_pool, almm_pool, integrate } = this.sdk.sdkOptions;
|
|
11107
11107
|
const { global_config_id } = getPackagerConfigs(clmm_pool);
|
|
11108
|
-
const
|
|
11108
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
11109
11109
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
11110
11110
|
const allCoins = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
|
|
11111
11111
|
const amountATotal = params.amountsX.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
@@ -11117,7 +11117,7 @@ var DlmmModule = class {
|
|
|
11117
11117
|
storageIds.push((0, import_calc_dlmm3.get_storage_id_from_real_id)(i));
|
|
11118
11118
|
});
|
|
11119
11119
|
const args = [
|
|
11120
|
-
tx.object(
|
|
11120
|
+
tx.object(almmConfig.factory),
|
|
11121
11121
|
tx.object(global_config_id),
|
|
11122
11122
|
tx.pure.u64(params.baseFee),
|
|
11123
11123
|
tx.pure.u16(params.binStep),
|
|
@@ -11130,7 +11130,7 @@ var DlmmModule = class {
|
|
|
11130
11130
|
tx.pure.address(params.to),
|
|
11131
11131
|
tx.object(CLOCK_ADDRESS)
|
|
11132
11132
|
];
|
|
11133
|
-
const target = `${integrate.published_at}::${
|
|
11133
|
+
const target = `${integrate.published_at}::${AlmmScript}::create_pair_add_liquidity`;
|
|
11134
11134
|
tx.moveCall({
|
|
11135
11135
|
target,
|
|
11136
11136
|
typeArguments,
|
|
@@ -11173,7 +11173,7 @@ var DlmmModule = class {
|
|
|
11173
11173
|
tx.object(CLOCK_ADDRESS)
|
|
11174
11174
|
];
|
|
11175
11175
|
tx.moveCall({
|
|
11176
|
-
target: `${integrate.published_at}::${
|
|
11176
|
+
target: `${integrate.published_at}::${AlmmScript}::swap`,
|
|
11177
11177
|
typeArguments,
|
|
11178
11178
|
arguments: args
|
|
11179
11179
|
});
|
|
@@ -11185,7 +11185,7 @@ var DlmmModule = class {
|
|
|
11185
11185
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
11186
11186
|
const args = [tx.object(params.pair), tx.pure.u64(params.offset), tx.pure.u64(params.limit)];
|
|
11187
11187
|
tx.moveCall({
|
|
11188
|
-
target: `${integrate.published_at}::${
|
|
11188
|
+
target: `${integrate.published_at}::${AlmmScript}::fetch_bins`,
|
|
11189
11189
|
arguments: args,
|
|
11190
11190
|
typeArguments
|
|
11191
11191
|
});
|
|
@@ -11214,7 +11214,7 @@ var DlmmModule = class {
|
|
|
11214
11214
|
// * @param assignPoolIds An array of pool IDs to filter the positions by.
|
|
11215
11215
|
// * @returns array of Position objects.
|
|
11216
11216
|
// */
|
|
11217
|
-
// async getUserPositionById(positionId: string, showDisplay = true): Promise<
|
|
11217
|
+
// async getUserPositionById(positionId: string, showDisplay = true): Promise<AlmmPositionInfo> {
|
|
11218
11218
|
// let position
|
|
11219
11219
|
// const ownerRes: any = await this._sdk.fullClient.getObject({
|
|
11220
11220
|
// id: positionId,
|
|
@@ -11224,7 +11224,7 @@ var DlmmModule = class {
|
|
|
11224
11224
|
// if (type.full_address === this.buildPositionType()) {
|
|
11225
11225
|
// position = this.buildPosition(ownerRes)
|
|
11226
11226
|
// } else {
|
|
11227
|
-
// throw new ClmmpoolsError(`
|
|
11227
|
+
// throw new ClmmpoolsError(`Almm Position not exists. Get Position error:${ownerRes.error}`, PositionErrorCode.InvalidPositionObject)
|
|
11228
11228
|
// }
|
|
11229
11229
|
// const poolMap = new Set<string>()
|
|
11230
11230
|
// poolMap.add(position.pool)
|
|
@@ -11246,7 +11246,7 @@ var DlmmModule = class {
|
|
|
11246
11246
|
// coinTypeB: pool!.coin_b,
|
|
11247
11247
|
// })
|
|
11248
11248
|
// const rewards_token = pool_reward_coins.get(position.pool) || []
|
|
11249
|
-
// let positionRewards:
|
|
11249
|
+
// let positionRewards: AlmmEventEarnedRewards = { position_id: position.pos_object_id, reward: [], amount: [] }
|
|
11250
11250
|
// if (rewards_token.length > 0) {
|
|
11251
11251
|
// positionRewards = await this.getEarnedRewards({
|
|
11252
11252
|
// pool_id: position.pool,
|
|
@@ -11280,7 +11280,7 @@ var DlmmModule = class {
|
|
|
11280
11280
|
const allPosition = [];
|
|
11281
11281
|
const ownerRes = await this._sdk.fullClient.getOwnedObjectsByPage(accountAddress, {
|
|
11282
11282
|
options: { showType: true, showContent: true, showDisplay, showOwner: true },
|
|
11283
|
-
filter: { Package: this._sdk.sdkOptions.
|
|
11283
|
+
filter: { Package: this._sdk.sdkOptions.almm_pool.package_id }
|
|
11284
11284
|
});
|
|
11285
11285
|
const hasAssignPoolIds = assignPoolIds.length > 0;
|
|
11286
11286
|
for (const item of ownerRes.data) {
|
|
@@ -11421,7 +11421,7 @@ var DlmmModule = class {
|
|
|
11421
11421
|
}
|
|
11422
11422
|
buildPosition(object) {
|
|
11423
11423
|
if (object.error != null || object.data?.content?.dataType !== "moveObject") {
|
|
11424
|
-
throw new ClmmpoolsError(`
|
|
11424
|
+
throw new ClmmpoolsError(`Almm Position not exists. Get Position error:${object.error}`, "InvalidPositionObject" /* InvalidPositionObject */);
|
|
11425
11425
|
}
|
|
11426
11426
|
const fields = getObjectFields(object);
|
|
11427
11427
|
const ownerWarp = getObjectOwner(object);
|
|
@@ -11448,7 +11448,7 @@ var DlmmModule = class {
|
|
|
11448
11448
|
return poolCoins;
|
|
11449
11449
|
}
|
|
11450
11450
|
buildPositionType() {
|
|
11451
|
-
return `${this._sdk.sdkOptions.
|
|
11451
|
+
return `${this._sdk.sdkOptions.almm_pool.package_id}::Almm_position::Position`;
|
|
11452
11452
|
}
|
|
11453
11453
|
async getPositionsLiquidityLimit(params) {
|
|
11454
11454
|
const out = [];
|
|
@@ -11477,7 +11477,7 @@ var DlmmModule = class {
|
|
|
11477
11477
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
11478
11478
|
const args = [tx.object(params.pair), tx.object(params.positionId)];
|
|
11479
11479
|
tx.moveCall({
|
|
11480
|
-
target: `${integrate.published_at}::${
|
|
11480
|
+
target: `${integrate.published_at}::${AlmmScript}::position_liquidity`,
|
|
11481
11481
|
arguments: args,
|
|
11482
11482
|
typeArguments
|
|
11483
11483
|
});
|
|
@@ -11516,7 +11516,7 @@ var DlmmModule = class {
|
|
|
11516
11516
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
11517
11517
|
const args = [tx.object(params.pair)];
|
|
11518
11518
|
tx.moveCall({
|
|
11519
|
-
target: `${integrate.published_at}::${
|
|
11519
|
+
target: `${integrate.published_at}::${AlmmScript}::pair_liquidity`,
|
|
11520
11520
|
arguments: args,
|
|
11521
11521
|
typeArguments
|
|
11522
11522
|
});
|
|
@@ -11576,7 +11576,7 @@ var DlmmModule = class {
|
|
|
11576
11576
|
const typeArguments = [params.coin_a, params.coin_b];
|
|
11577
11577
|
const args = [tx.object(params.pool_id), tx.object(params.position_id)];
|
|
11578
11578
|
tx.moveCall({
|
|
11579
|
-
target: `${integrate.published_at}::${
|
|
11579
|
+
target: `${integrate.published_at}::${AlmmScript}::earned_fees`,
|
|
11580
11580
|
arguments: args,
|
|
11581
11581
|
typeArguments
|
|
11582
11582
|
});
|
|
@@ -11619,9 +11619,9 @@ var DlmmModule = class {
|
|
|
11619
11619
|
const { integrate } = this.sdk.sdkOptions;
|
|
11620
11620
|
const typeArguments = [params.coin_a, params.coin_b, ...params.rewards_token];
|
|
11621
11621
|
const args = [tx.object(params.pool_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
|
|
11622
|
-
let target = `${integrate.published_at}::${
|
|
11622
|
+
let target = `${integrate.published_at}::${AlmmScript}::earned_rewards`;
|
|
11623
11623
|
if (params.rewards_token.length > 1) {
|
|
11624
|
-
target = `${integrate.published_at}::${
|
|
11624
|
+
target = `${integrate.published_at}::${AlmmScript}::earned_rewards${params.rewards_token.length}`;
|
|
11625
11625
|
}
|
|
11626
11626
|
tx.moveCall({
|
|
11627
11627
|
target,
|
|
@@ -11665,7 +11665,6 @@ var DlmmModule = class {
|
|
|
11665
11665
|
}
|
|
11666
11666
|
// return pool_id => reward_tokens
|
|
11667
11667
|
async getPairRewarders(params) {
|
|
11668
|
-
params = [params[0]];
|
|
11669
11668
|
let tx = new import_transactions12.Transaction();
|
|
11670
11669
|
for (const param of params) {
|
|
11671
11670
|
tx = await this._getPairRewarders(param, tx);
|
|
@@ -11678,7 +11677,7 @@ var DlmmModule = class {
|
|
|
11678
11677
|
const typeArguments = [params.coin_a, params.coin_b];
|
|
11679
11678
|
const args = [tx.object(params.pool_id)];
|
|
11680
11679
|
tx.moveCall({
|
|
11681
|
-
target: `${integrate.published_at}::${
|
|
11680
|
+
target: `${integrate.published_at}::${AlmmScript}::get_pair_rewarders`,
|
|
11682
11681
|
arguments: args,
|
|
11683
11682
|
typeArguments
|
|
11684
11683
|
});
|
|
@@ -11770,7 +11769,7 @@ var MagmaClmmSDK = class {
|
|
|
11770
11769
|
*/
|
|
11771
11770
|
_lock;
|
|
11772
11771
|
_gauge;
|
|
11773
|
-
|
|
11772
|
+
_almm;
|
|
11774
11773
|
/**
|
|
11775
11774
|
* Provide interact with a position rewarder interface.
|
|
11776
11775
|
*/
|
|
@@ -11808,7 +11807,7 @@ var MagmaClmmSDK = class {
|
|
|
11808
11807
|
this._swap = new SwapModule(this);
|
|
11809
11808
|
this._lock = new LockModule(this);
|
|
11810
11809
|
this._gauge = new GaugeModule(this);
|
|
11811
|
-
this.
|
|
11810
|
+
this._almm = new AlmmModule(this);
|
|
11812
11811
|
this._pool = new PoolModule(this);
|
|
11813
11812
|
this._position = new PositionModule(this);
|
|
11814
11813
|
this._rewarder = new RewarderModule(this);
|
|
@@ -11846,8 +11845,8 @@ var MagmaClmmSDK = class {
|
|
|
11846
11845
|
get Gauge() {
|
|
11847
11846
|
return this._gauge;
|
|
11848
11847
|
}
|
|
11849
|
-
get
|
|
11850
|
-
return this.
|
|
11848
|
+
get Almm() {
|
|
11849
|
+
return this._almm;
|
|
11851
11850
|
}
|
|
11852
11851
|
/**
|
|
11853
11852
|
* Getter for the fullClient property.
|
|
@@ -12044,7 +12043,7 @@ var SDKConfig = {
|
|
|
12044
12043
|
magma_token: "0x7161c6c6bb65f852797c8f7f5c4f8d57adaf796e1b840921f9e23fabeadfd54e::magma::MAGMA",
|
|
12045
12044
|
minter_id: "0x4fa5766cd83b33b215b139fec27ac344040f3bbd84fcbee7b61fc671aadc51fa"
|
|
12046
12045
|
},
|
|
12047
|
-
|
|
12046
|
+
almmConfig: {
|
|
12048
12047
|
factory: "",
|
|
12049
12048
|
rewarder_global_vault: ""
|
|
12050
12049
|
},
|
|
@@ -12070,10 +12069,10 @@ var clmmMainnet = {
|
|
|
12070
12069
|
published_at: "0x4a35d3dfef55ed3631b7158544c6322a23bc434fe4fca1234cb680ce0505f82d",
|
|
12071
12070
|
config: SDKConfig.clmmConfig
|
|
12072
12071
|
},
|
|
12073
|
-
|
|
12072
|
+
almm_pool: {
|
|
12074
12073
|
package_id: "",
|
|
12075
12074
|
published_at: "",
|
|
12076
|
-
config: SDKConfig.
|
|
12075
|
+
config: SDKConfig.almmConfig
|
|
12077
12076
|
},
|
|
12078
12077
|
distribution: {
|
|
12079
12078
|
package_id: "0xee4a1f231dc45a303389998fe26c4e39278cf68b404b32e4f0b9769129b8267b",
|
|
@@ -12131,7 +12130,7 @@ var SDKConfig2 = {
|
|
|
12131
12130
|
magma_token: "0x45ac2371c33ca0df8dc784d62c8ce5126d42edd8c56820396524dff2ae0619b1::magma_token::MAGMA_TOKEN",
|
|
12132
12131
|
minter_id: "0x89435d6b2a510ba50ca23303f10e91ec058f138a88f69a43fe03cd22edb214c5"
|
|
12133
12132
|
},
|
|
12134
|
-
|
|
12133
|
+
almmConfig: {
|
|
12135
12134
|
factory: "",
|
|
12136
12135
|
rewarder_global_vault: ""
|
|
12137
12136
|
}
|
|
@@ -12153,10 +12152,10 @@ var clmmTestnet = {
|
|
|
12153
12152
|
published_at: "0xca1b84a430d03e22dae08a7273c8e9dcfdb40b7f559574105f008600eeb7b4bd",
|
|
12154
12153
|
config: SDKConfig2.clmmConfig
|
|
12155
12154
|
},
|
|
12156
|
-
|
|
12155
|
+
almm_pool: {
|
|
12157
12156
|
package_id: "",
|
|
12158
12157
|
published_at: "",
|
|
12159
|
-
config: SDKConfig2.
|
|
12158
|
+
config: SDKConfig2.almmConfig
|
|
12160
12159
|
},
|
|
12161
12160
|
distribution: {
|
|
12162
12161
|
package_id: "0x45ac2371c33ca0df8dc784d62c8ce5126d42edd8c56820396524dff2ae0619b1",
|
|
@@ -12205,6 +12204,7 @@ var src_default = MagmaClmmSDK;
|
|
|
12205
12204
|
// Annotate the CommonJS export names for ESM import in node:
|
|
12206
12205
|
0 && (module.exports = {
|
|
12207
12206
|
AMM_SWAP_MODULE,
|
|
12207
|
+
AlmmScript,
|
|
12208
12208
|
AmountSpecified,
|
|
12209
12209
|
BinMath,
|
|
12210
12210
|
CLOCK_ADDRESS,
|
|
@@ -12234,7 +12234,6 @@ var src_default = MagmaClmmSDK;
|
|
|
12234
12234
|
DeepbookCustodianV2Moudle,
|
|
12235
12235
|
DeepbookEndpointsV2Moudle,
|
|
12236
12236
|
DeepbookUtils,
|
|
12237
|
-
DlmmScript,
|
|
12238
12237
|
FEE_RATE_DENOMINATOR,
|
|
12239
12238
|
GAS_SYMBOL,
|
|
12240
12239
|
GAS_TYPE_ARG,
|