@magmaprotocol/magma-clmm-sdk 0.5.115 → 0.5.117
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 +33 -13
- package/dist/index.js +102 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1708,6 +1708,7 @@ type EventPairParams = {
|
|
|
1708
1708
|
time_of_last_update: number | string;
|
|
1709
1709
|
oracle_index: number;
|
|
1710
1710
|
active_index: number;
|
|
1711
|
+
protocol_variable_share: number;
|
|
1711
1712
|
};
|
|
1712
1713
|
type EventBin = {
|
|
1713
1714
|
storage_id: number | string;
|
|
@@ -1720,11 +1721,14 @@ type EventBin = {
|
|
|
1720
1721
|
fee_y: number | string;
|
|
1721
1722
|
fee_growth_x: number | string;
|
|
1722
1723
|
fee_growth_y: number | string;
|
|
1723
|
-
rewarder_growth:
|
|
1724
|
+
rewarder_growth: RewarderGrowth;
|
|
1724
1725
|
distribution_growth: number | string;
|
|
1725
1726
|
distribution_last_updated: number | string;
|
|
1726
1727
|
real_bin_id: number;
|
|
1727
1728
|
};
|
|
1729
|
+
type RewarderGrowth = {
|
|
1730
|
+
contents: string[];
|
|
1731
|
+
};
|
|
1728
1732
|
type EventPositionLiquidity = {
|
|
1729
1733
|
position_id: string;
|
|
1730
1734
|
shares: number | string;
|
|
@@ -1759,6 +1763,7 @@ type AlmmPoolInfo = {
|
|
|
1759
1763
|
index?: number;
|
|
1760
1764
|
liquidity: string;
|
|
1761
1765
|
rewarder_infos: Rewarder[];
|
|
1766
|
+
params: EventPairParams;
|
|
1762
1767
|
};
|
|
1763
1768
|
type AlmmAddLiquidityParams = {
|
|
1764
1769
|
pool_id: string;
|
|
@@ -1881,7 +1886,7 @@ type MintByStrategyParams = {
|
|
|
1881
1886
|
*/
|
|
1882
1887
|
active_bin: number;
|
|
1883
1888
|
/**
|
|
1884
|
-
* base 10000 =100%
|
|
1889
|
+
* base 10000 = 100%
|
|
1885
1890
|
*/
|
|
1886
1891
|
slippage: number;
|
|
1887
1892
|
};
|
|
@@ -1903,6 +1908,19 @@ type RaiseByStrategyParams = {
|
|
|
1903
1908
|
receiver: string;
|
|
1904
1909
|
rewards_token: string[];
|
|
1905
1910
|
};
|
|
1911
|
+
type EventCreatePair = {
|
|
1912
|
+
pair_id: string;
|
|
1913
|
+
factory_id: string;
|
|
1914
|
+
bin_step: number;
|
|
1915
|
+
active_id: number;
|
|
1916
|
+
params: EventPairParams;
|
|
1917
|
+
token_x: Token;
|
|
1918
|
+
token_y: Token;
|
|
1919
|
+
lp_token_id: string;
|
|
1920
|
+
};
|
|
1921
|
+
type Token = {
|
|
1922
|
+
name: string;
|
|
1923
|
+
};
|
|
1906
1924
|
|
|
1907
1925
|
type BigNumber = Decimal.Value | number | string;
|
|
1908
1926
|
|
|
@@ -2479,9 +2497,9 @@ declare function autoFillXByStrategy(activeId: number, binStep: number, amountY:
|
|
|
2479
2497
|
* @param amountXInActiveBin The amount of X token in the active bin.
|
|
2480
2498
|
* @param amountYInActiveBin The amount of Y token in the active bin.
|
|
2481
2499
|
* @param strategyType The strategy type.
|
|
2482
|
-
* @param mintX The mint info of X token. Get from
|
|
2483
|
-
* @param mintY The mint info of Y token. Get from
|
|
2484
|
-
* @param clock The clock info. Get from
|
|
2500
|
+
* @param mintX The mint info of X token. Get from ALMM instance.
|
|
2501
|
+
* @param mintY The mint info of Y token. Get from ALMM instance.
|
|
2502
|
+
* @param clock The clock info. Get from ALMM instance.
|
|
2485
2503
|
* @returns The distribution of liquidity.
|
|
2486
2504
|
*/
|
|
2487
2505
|
declare function toAmountsBothSideByStrategy(activeId: number, binStep: number, minBinId: number, maxBinId: number, amountX: BN, amountY: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, strategyType: StrategyType): BinDisplay[];
|
|
@@ -2500,8 +2518,8 @@ declare function autoFillXByWeight(activeId: number, binStep: number, amountY: B
|
|
|
2500
2518
|
* @param activeId active bin id
|
|
2501
2519
|
* @param totalAmount total amount of token Y to be distributed
|
|
2502
2520
|
* @param distributions weight distribution of each bin
|
|
2503
|
-
* @param mintY mint of token Y, get from
|
|
2504
|
-
* @param clock clock of the program, for calculating transfer fee, get from
|
|
2521
|
+
* @param mintY mint of token Y, get from ALMM instance
|
|
2522
|
+
* @param clock clock of the program, for calculating transfer fee, get from ALMM instance
|
|
2505
2523
|
* @returns array of {binId, amount} where amount is the amount of token Y in each bin
|
|
2506
2524
|
*/
|
|
2507
2525
|
declare function toAmountBidSide(activeId: number, totalAmount: BN, distributions: {
|
|
@@ -2516,8 +2534,8 @@ declare function toAmountBidSide(activeId: number, totalAmount: BN, distribution
|
|
|
2516
2534
|
* @param activeId active bin id
|
|
2517
2535
|
* @param totalAmount total amount of token Y to be distributed
|
|
2518
2536
|
* @param distributions weight distribution of each bin
|
|
2519
|
-
* @param mintX mint of token X, get from
|
|
2520
|
-
* @param clock clock of the program, for calculating transfer fee, get from
|
|
2537
|
+
* @param mintX mint of token X, get from ALMM instance
|
|
2538
|
+
* @param clock clock of the program, for calculating transfer fee, get from ALMM instance
|
|
2521
2539
|
* @returns array of {binId, amount} where amount is the amount of token X in each bin
|
|
2522
2540
|
*/
|
|
2523
2541
|
declare function toAmountAskSide(activeId: number, binStep: number, totalAmount: BN, distributions: {
|
|
@@ -2538,9 +2556,9 @@ declare function toAmountAskSide(activeId: number, binStep: number, totalAmount:
|
|
|
2538
2556
|
* @param amountXInActiveBin - Amount of token X already in the active bin.
|
|
2539
2557
|
* @param amountYInActiveBin - Amount of token Y already in the active bin.
|
|
2540
2558
|
* @param distributions - Array of bins with their respective weight distributions.
|
|
2541
|
-
* @param mintX - Mint information for token X. Get from
|
|
2542
|
-
* @param mintY - Mint information for token Y. Get from
|
|
2543
|
-
* @param clock - Clock instance. Get from
|
|
2559
|
+
* @param mintX - Mint information for token X. Get from ALMM instance.
|
|
2560
|
+
* @param mintY - Mint information for token Y. Get from ALMM instance.
|
|
2561
|
+
* @param clock - Clock instance. Get from ALMM instance.
|
|
2544
2562
|
* @returns An array of objects containing binId, amountX, and amountY for each bin.
|
|
2545
2563
|
*/
|
|
2546
2564
|
declare function toAmountBothSide(activeId: number, binStep: number, amountX: BN, amountY: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, distributions: {
|
|
@@ -3774,6 +3792,7 @@ declare class AlmmModule implements IModule {
|
|
|
3774
3792
|
private readonly _cache;
|
|
3775
3793
|
constructor(sdk: MagmaClmmSDK);
|
|
3776
3794
|
get sdk(): MagmaClmmSDK;
|
|
3795
|
+
getPools(paginationArgs?: PaginationArgs, forceRefresh?: boolean): Promise<EventCreatePair[]>;
|
|
3777
3796
|
getPoolInfo(pools: string[]): Promise<AlmmPoolInfo[]>;
|
|
3778
3797
|
fetchPairParams(params: FetchPairParams): Promise<EventPairParams>;
|
|
3779
3798
|
createPairPayload(params: CreatePairParams): Promise<Transaction>;
|
|
@@ -3801,6 +3820,7 @@ declare class AlmmModule implements IModule {
|
|
|
3801
3820
|
* Gets a list of positions for the given account address.
|
|
3802
3821
|
* @param accountAddress The account address to get positions for.
|
|
3803
3822
|
* @param assignPoolIds An array of pool IDs to filter the positions by.
|
|
3823
|
+
* @param showDisplay When some testnet rpc nodes can't return object's display data, you can set this option to false, avoid returning errors. Default set true.
|
|
3804
3824
|
* @returns array of Position objects.
|
|
3805
3825
|
*/
|
|
3806
3826
|
getUserPositions(accountAddress: string, assignPoolIds?: string[], showDisplay?: boolean): Promise<AlmmPositionInfo[]>;
|
|
@@ -4572,4 +4592,4 @@ interface InitMagmaSDKOptions {
|
|
|
4572
4592
|
*/
|
|
4573
4593
|
declare function initMagmaSDK(options: InitMagmaSDKOptions): MagmaClmmSDK;
|
|
4574
4594
|
|
|
4575
|
-
export { ALMMSwapParams, AMM_SWAP_MODULE, AddBribeReward, AddLiquidityCommonParams, AddLiquidityFixTokenParams, AddLiquidityParams, AddLiquidityWithProtectionParams, AddressAndDirection, AdjustResult, AggregatorResult, AlmmAddLiquidityParams, AlmmBurnPositionParams, AlmmCollectFeeParams, AlmmCollectRewardParams, AlmmConfig, AlmmCreatePairAddLiquidityParams, AlmmEventEarnedFees, AlmmEventEarnedRewards, AlmmEventPairRewardTypes, AlmmPoolInfo, AlmmPosition, AlmmPositionInfo, AlmmRewardsParams, AlmmScript, AlmmShrinkPosition, AmountSpecified, BasePath, BigNumber, BinDisplay, BinLiquidity, BinMath, Bits, BuildCoinResult, CLOCK_ADDRESS, CachedContent, CalculateRatesParams, CalculateRatesResult, ClaimAndLockParams, ClaimFeesParams, ClaimFeesPoolsParams, ClmmConfig, ClmmExpectSwapModule, ClmmFetcherModule, ClmmIntegratePoolModule, ClmmIntegratePoolV2Module, ClmmIntegratePoolV3Module, ClmmIntegrateRouterModule, ClmmIntegrateRouterWithPartnerModule, ClmmIntegrateUtilsModule, ClmmPartnerModule, ClmmPoolConfig, ClmmPoolUtil, ClmmPositionStatus, ClmmpoolData, ClosePositionParams, CoinAmounts, CoinAsset, CoinAssist, CoinConfig, CoinInfoAddress, CoinNode, CoinPairType, CoinProvider, CoinStoreAddress, CollectFeeParams, CollectFeesQuote, CollectFeesQuoteParam, CollectRewarderParams, ConfigModule, CreateLockParams, CreatePairParams, CreatePartnerEvent, CreatePoolAddLiquidityParams, CreatePoolParams, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, DataPage, DeepbookClobV2Moudle, DeepbookCustodianV2Moudle, DeepbookEndpointsV2Moudle, DeepbookPool, DeepbookUtils, DepositPosition, EpochEmission, EventBin, EventPairLiquidity, EventPairParams, EventPositionLiquidity, FEE_RATE_DENOMINATOR, FaucetCoin, FetchBinsParams, FetchPairParams, FetchParams, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, Gauge, GetPairLiquidityParams, GetPairRewarderParams, GetPositionLiquidityParams, GetRewardByPosition, IncreaseLockAmountParams, IncreaseUnlockTimeParams, LaunchpadPoolConfig, LiquidityAndCoinYResult, LiquidityInput, LockModule, LockPermanentParams, LockVoteEvent, MAX_SQRT_PRICE, MAX_TICK_INDEX, MIN_SQRT_PRICE, MIN_TICK_INDEX, MagmaClmmSDK, MagmaConfigs, MathUtil, MergeLockParams, MintAmountParams, MintByStrategyParams, MintPercentParams, Minter, NFT, ONE, OnePath, OpenPositionAddLiquidityWithProtectionParams, OpenPositionParams, Order, POOL_NO_LIQUIDITY, POOL_STRUCT, Package, PageQuery, PaginationArgs, PathLink, PathProvider, Percentage, PokeParams, Pool, PoolImmutables, PoolInfo, PoolModule, Position, PositionModule, PositionReward, PositionStatus, PositionUtil, PreRouterSwapParams, PreSwapLpChangeParams, PreSwapParams, PreSwapResult, PreSwapWithMultiPoolParams, PriceResult, RaiseByStrategyParams, RemoveLiquidityParams, RewardDistributor, Rewarder, RewarderAmountOwed, RouterModule, RouterModuleV2, RpcModule, SUI_SYSTEM_STATE_OBJECT_ID, SdkOptions, SplitPath, SplitSwap, SplitSwapResult, SplitUnit, StakedPositionOfPool, StrategyType, SuiAddressType, SuiBasicTypes, SuiInputTypes, SuiObjectDataWithContent, SuiObjectIdType, SuiResource, SuiStructTag, SuiTxArg, SwapDirection, SwapModule, SwapParams, SwapResult, SwapStepResult, SwapUtils, SwapWithRouterParams, TICK_ARRAY_SIZE, TWO, Tick, TickData, TickMath, TickUtil, TokenConfig, TokenConfigEvent, TokenInfo, TokenModule, TransPreSwapWithMultiPoolParams, TransactionUtil, TransferLockParams, TxBlock, U128, U128_MAX, U64_MAX, Ve33Config, VoteParams, Voter, VotingEscrow, WithdrawPosition, ZERO, addHexPrefix, adjustForCoinSlippage, adjustForSlippage, asIntN, asUintN, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, bufferToHex, buildClmmPositionName, buildNFT, buildPool, buildPosition, buildPositionReward, buildTickData, buildTickDataByEvent, cacheTime24h, cacheTime5min, checkAddress, checkInvalidSuiAddress, clmmMainnet, clmmTestnet, collectFeesQuote, composeType, computeSwap, computeSwapStep, createSplitAmountArray, createSplitArray, createTestTransferTxPayloadParams, d, decimalsMultiplier, MagmaClmmSDK as default, estPoolAPR, estPosAPRResult, estPositionAPRWithDeltaMethod, estPositionAPRWithMultiMethod, estimateLiquidityForCoinA, estimateLiquidityForCoinB, extractAddressFromType, extractStructTagFromType, findAdjustCoin, fixCoinType, fixSuiObjectId, fromDecimalsAmount, getAmountFixedDelta, getAmountUnfixedDelta, getCoinAFromLiquidity, getCoinBFromLiquidity, getCoinXYForLiquidity, getDefaultSuiInputType, getDeltaA, getDeltaB, getDeltaDownFromOutput, getDeltaUpFromInput, getFutureTime, getLiquidityAndCoinYByCoinX, getLiquidityFromCoinA, getLiquidityFromCoinB, getLowerSqrtPriceFromCoinA, getLowerSqrtPriceFromCoinB, getMoveObject, getMoveObjectType, getMovePackageContent, getNearestTickByTick, getNextSqrtPriceAUp, getNextSqrtPriceBDown, getNextSqrtPriceFromInput, getNextSqrtPriceFromOutput, getObjectDeletedResponse, getObjectDisplay, getObjectFields, getObjectId, getObjectNotExistsResponse, getObjectOwner, getObjectPreviousTransactionDigest, getObjectReference, getObjectType, getObjectVersion, getPackagerConfigs, getPriceOfBinByBinId, getRewardInTickRange, getSuiObjectData, getTickDataFromUrlData, getUpperSqrtPriceFromCoinA, getUpperSqrtPriceFromCoinB, hasPublicTransfer, hexToNumber, hexToString, initMagmaSDK, initMainnetSDK, initTestnetSDK, isSortedSymbols, isSuiObjectResponse, newBits, normalizeCoinType, patchFixSuiObjectId, printTransaction, removeHexPrefix, secretKeyToEd25519Keypair, secretKeyToSecp256k1Keypair, shortAddress, shortString, tickScore, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy, toBuffer, toCoinAmount, toDecimalsAmount, transClmmpoolDataWithoutTicks, utf8to16, withLiquiditySlippage };
|
|
4595
|
+
export { ALMMSwapParams, AMM_SWAP_MODULE, AddBribeReward, AddLiquidityCommonParams, AddLiquidityFixTokenParams, AddLiquidityParams, AddLiquidityWithProtectionParams, AddressAndDirection, AdjustResult, AggregatorResult, AlmmAddLiquidityParams, AlmmBurnPositionParams, AlmmCollectFeeParams, AlmmCollectRewardParams, AlmmConfig, AlmmCreatePairAddLiquidityParams, AlmmEventEarnedFees, AlmmEventEarnedRewards, AlmmEventPairRewardTypes, AlmmPoolInfo, AlmmPosition, AlmmPositionInfo, AlmmRewardsParams, AlmmScript, AlmmShrinkPosition, AmountSpecified, BasePath, BigNumber, BinDisplay, BinLiquidity, BinMath, Bits, BuildCoinResult, CLOCK_ADDRESS, CachedContent, CalculateRatesParams, CalculateRatesResult, ClaimAndLockParams, ClaimFeesParams, ClaimFeesPoolsParams, ClmmConfig, ClmmExpectSwapModule, ClmmFetcherModule, ClmmIntegratePoolModule, ClmmIntegratePoolV2Module, ClmmIntegratePoolV3Module, ClmmIntegrateRouterModule, ClmmIntegrateRouterWithPartnerModule, ClmmIntegrateUtilsModule, ClmmPartnerModule, ClmmPoolConfig, ClmmPoolUtil, ClmmPositionStatus, ClmmpoolData, ClosePositionParams, CoinAmounts, CoinAsset, CoinAssist, CoinConfig, CoinInfoAddress, CoinNode, CoinPairType, CoinProvider, CoinStoreAddress, CollectFeeParams, CollectFeesQuote, CollectFeesQuoteParam, CollectRewarderParams, ConfigModule, CreateLockParams, CreatePairParams, CreatePartnerEvent, CreatePoolAddLiquidityParams, CreatePoolParams, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, DataPage, DeepbookClobV2Moudle, DeepbookCustodianV2Moudle, DeepbookEndpointsV2Moudle, DeepbookPool, DeepbookUtils, DepositPosition, EpochEmission, EventBin, EventCreatePair, EventPairLiquidity, EventPairParams, EventPositionLiquidity, FEE_RATE_DENOMINATOR, FaucetCoin, FetchBinsParams, FetchPairParams, FetchParams, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, Gauge, GetPairLiquidityParams, GetPairRewarderParams, GetPositionLiquidityParams, GetRewardByPosition, IncreaseLockAmountParams, IncreaseUnlockTimeParams, LaunchpadPoolConfig, LiquidityAndCoinYResult, LiquidityInput, LockModule, LockPermanentParams, LockVoteEvent, MAX_SQRT_PRICE, MAX_TICK_INDEX, MIN_SQRT_PRICE, MIN_TICK_INDEX, MagmaClmmSDK, MagmaConfigs, MathUtil, MergeLockParams, MintAmountParams, MintByStrategyParams, MintPercentParams, Minter, NFT, ONE, OnePath, OpenPositionAddLiquidityWithProtectionParams, OpenPositionParams, Order, POOL_NO_LIQUIDITY, POOL_STRUCT, Package, PageQuery, PaginationArgs, PathLink, PathProvider, Percentage, PokeParams, Pool, PoolImmutables, PoolInfo, PoolModule, Position, PositionModule, PositionReward, PositionStatus, PositionUtil, PreRouterSwapParams, PreSwapLpChangeParams, PreSwapParams, PreSwapResult, PreSwapWithMultiPoolParams, PriceResult, RaiseByStrategyParams, RemoveLiquidityParams, RewardDistributor, Rewarder, RewarderAmountOwed, RewarderGrowth, RouterModule, RouterModuleV2, RpcModule, SUI_SYSTEM_STATE_OBJECT_ID, SdkOptions, SplitPath, SplitSwap, SplitSwapResult, SplitUnit, StakedPositionOfPool, StrategyType, SuiAddressType, SuiBasicTypes, SuiInputTypes, SuiObjectDataWithContent, SuiObjectIdType, SuiResource, SuiStructTag, SuiTxArg, SwapDirection, SwapModule, SwapParams, SwapResult, SwapStepResult, SwapUtils, SwapWithRouterParams, TICK_ARRAY_SIZE, TWO, Tick, TickData, TickMath, TickUtil, Token, TokenConfig, TokenConfigEvent, TokenInfo, TokenModule, TransPreSwapWithMultiPoolParams, TransactionUtil, TransferLockParams, TxBlock, U128, U128_MAX, U64_MAX, Ve33Config, VoteParams, Voter, VotingEscrow, WithdrawPosition, ZERO, addHexPrefix, adjustForCoinSlippage, adjustForSlippage, asIntN, asUintN, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, bufferToHex, buildClmmPositionName, buildNFT, buildPool, buildPosition, buildPositionReward, buildTickData, buildTickDataByEvent, cacheTime24h, cacheTime5min, checkAddress, checkInvalidSuiAddress, clmmMainnet, clmmTestnet, collectFeesQuote, composeType, computeSwap, computeSwapStep, createSplitAmountArray, createSplitArray, createTestTransferTxPayloadParams, d, decimalsMultiplier, MagmaClmmSDK as default, estPoolAPR, estPosAPRResult, estPositionAPRWithDeltaMethod, estPositionAPRWithMultiMethod, estimateLiquidityForCoinA, estimateLiquidityForCoinB, extractAddressFromType, extractStructTagFromType, findAdjustCoin, fixCoinType, fixSuiObjectId, fromDecimalsAmount, getAmountFixedDelta, getAmountUnfixedDelta, getCoinAFromLiquidity, getCoinBFromLiquidity, getCoinXYForLiquidity, getDefaultSuiInputType, getDeltaA, getDeltaB, getDeltaDownFromOutput, getDeltaUpFromInput, getFutureTime, getLiquidityAndCoinYByCoinX, getLiquidityFromCoinA, getLiquidityFromCoinB, getLowerSqrtPriceFromCoinA, getLowerSqrtPriceFromCoinB, getMoveObject, getMoveObjectType, getMovePackageContent, getNearestTickByTick, getNextSqrtPriceAUp, getNextSqrtPriceBDown, getNextSqrtPriceFromInput, getNextSqrtPriceFromOutput, getObjectDeletedResponse, getObjectDisplay, getObjectFields, getObjectId, getObjectNotExistsResponse, getObjectOwner, getObjectPreviousTransactionDigest, getObjectReference, getObjectType, getObjectVersion, getPackagerConfigs, getPriceOfBinByBinId, getRewardInTickRange, getSuiObjectData, getTickDataFromUrlData, getUpperSqrtPriceFromCoinA, getUpperSqrtPriceFromCoinB, hasPublicTransfer, hexToNumber, hexToString, initMagmaSDK, initMainnetSDK, initTestnetSDK, isSortedSymbols, isSuiObjectResponse, newBits, normalizeCoinType, patchFixSuiObjectId, printTransaction, removeHexPrefix, secretKeyToEd25519Keypair, secretKeyToSecp256k1Keypair, shortAddress, shortString, tickScore, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy, toBuffer, toCoinAmount, toDecimalsAmount, transClmmpoolDataWithoutTicks, utf8to16, withLiquiditySlippage };
|
package/dist/index.js
CHANGED
|
@@ -1818,10 +1818,10 @@ var import_bn10 = __toESM(require("bn.js"));
|
|
|
1818
1818
|
// src/math/almmWeightToAmounts.ts
|
|
1819
1819
|
var import_bn9 = __toESM(require("bn.js"));
|
|
1820
1820
|
var import_decimal6 = __toESM(require("decimal.js"));
|
|
1821
|
-
var
|
|
1821
|
+
var import_calc_almm = require("@magmaprotocol/calc_almm");
|
|
1822
1822
|
function getPriceOfBinByBinId(binId, binStep) {
|
|
1823
1823
|
const twoDec = new import_decimal6.default(2);
|
|
1824
|
-
const price = new import_decimal6.default((0,
|
|
1824
|
+
const price = new import_decimal6.default((0, import_calc_almm.get_price_x128_from_real_id)(binId, binStep));
|
|
1825
1825
|
return price.div(twoDec.pow(128));
|
|
1826
1826
|
}
|
|
1827
1827
|
function autoFillYByWeight(activeId, binStep, amountX, amountXInActiveBin, amountYInActiveBin, distributions) {
|
|
@@ -2757,17 +2757,20 @@ var SplitSwap = class {
|
|
|
2757
2757
|
|
|
2758
2758
|
// src/math/bin.ts
|
|
2759
2759
|
var import_decimal9 = __toESM(require("decimal.js"));
|
|
2760
|
-
var
|
|
2760
|
+
var import_calc_almm2 = require("@magmaprotocol/calc_almm");
|
|
2761
2761
|
var BinMath = class {
|
|
2762
2762
|
static getPriceOfBinByBinId(binId, binStep, decimalsA, decimalsB) {
|
|
2763
2763
|
const twoDec = new import_decimal9.default(2);
|
|
2764
|
-
const price = new import_decimal9.default((0,
|
|
2764
|
+
const price = new import_decimal9.default((0, import_calc_almm2.get_price_x128_from_real_id)(binId, binStep));
|
|
2765
2765
|
return price.div(twoDec.pow(128)).mul(import_decimal9.default.pow(10, decimalsA - decimalsB));
|
|
2766
2766
|
}
|
|
2767
2767
|
static getBinIdFromPrice(price, binStep, decimalsA, decimalsB) {
|
|
2768
2768
|
const twoDec = new import_decimal9.default(2);
|
|
2769
2769
|
const tenDec = new import_decimal9.default(10);
|
|
2770
|
-
const realid = (0,
|
|
2770
|
+
const realid = (0, import_calc_almm2.get_real_id_from_price_x128)(
|
|
2771
|
+
new import_decimal9.default(price).mul(tenDec.pow(decimalsB - decimalsA)).mul(twoDec.pow(128)).toDecimalPlaces(0).toString(),
|
|
2772
|
+
binStep
|
|
2773
|
+
);
|
|
2771
2774
|
return realid;
|
|
2772
2775
|
}
|
|
2773
2776
|
};
|
|
@@ -5398,6 +5401,7 @@ var PoolModule = class {
|
|
|
5398
5401
|
}
|
|
5399
5402
|
return dataPage;
|
|
5400
5403
|
}
|
|
5404
|
+
// TODO: 实现这个方法为almm
|
|
5401
5405
|
/**
|
|
5402
5406
|
* Gets a list of pools.
|
|
5403
5407
|
* @param {string[]} assignPools An array of pool IDs to get.
|
|
@@ -10635,7 +10639,7 @@ var GaugeModule = class {
|
|
|
10635
10639
|
|
|
10636
10640
|
// src/modules/almm.ts
|
|
10637
10641
|
var import_transactions12 = require("@mysten/sui/transactions");
|
|
10638
|
-
var
|
|
10642
|
+
var import_calc_almm3 = require("@magmaprotocol/calc_almm");
|
|
10639
10643
|
var import_decimal13 = __toESM(require("decimal.js"));
|
|
10640
10644
|
var import_bn22 = __toESM(require("bn.js"));
|
|
10641
10645
|
var AlmmModule = class {
|
|
@@ -10647,6 +10651,37 @@ var AlmmModule = class {
|
|
|
10647
10651
|
get sdk() {
|
|
10648
10652
|
return this._sdk;
|
|
10649
10653
|
}
|
|
10654
|
+
async getPools(paginationArgs = "all", forceRefresh = false) {
|
|
10655
|
+
const { package_id } = this._sdk.sdkOptions.almm_pool;
|
|
10656
|
+
const allPools = [];
|
|
10657
|
+
const cacheKey = `${package_id}_getInitCreatePairEvent`;
|
|
10658
|
+
const cacheData = this.getCache(cacheKey, forceRefresh);
|
|
10659
|
+
if (cacheData !== void 0) {
|
|
10660
|
+
allPools.push(...cacheData);
|
|
10661
|
+
}
|
|
10662
|
+
if (allPools.length === 0) {
|
|
10663
|
+
try {
|
|
10664
|
+
const moveEventType = `${package_id}::almm_pair::EventCreatePair`;
|
|
10665
|
+
const objects = await this._sdk.fullClient.queryEventsByPage({ MoveEventType: moveEventType }, paginationArgs);
|
|
10666
|
+
const dataPage = {
|
|
10667
|
+
data: [],
|
|
10668
|
+
hasNextPage: false
|
|
10669
|
+
};
|
|
10670
|
+
dataPage.hasNextPage = objects.hasNextPage;
|
|
10671
|
+
dataPage.nextCursor = objects.nextCursor;
|
|
10672
|
+
objects.data.forEach((object) => {
|
|
10673
|
+
const fields = object.parsedJson;
|
|
10674
|
+
if (fields) {
|
|
10675
|
+
allPools.push(fields);
|
|
10676
|
+
}
|
|
10677
|
+
});
|
|
10678
|
+
this.updateCache(cacheKey, allPools, cacheTime24h);
|
|
10679
|
+
} catch (error) {
|
|
10680
|
+
console.log("getCreatePairEvents", error);
|
|
10681
|
+
}
|
|
10682
|
+
}
|
|
10683
|
+
return allPools;
|
|
10684
|
+
}
|
|
10650
10685
|
async getPoolInfo(pools) {
|
|
10651
10686
|
const cachePoolList = [];
|
|
10652
10687
|
pools = pools.filter((poolID) => {
|
|
@@ -10684,11 +10719,12 @@ var AlmmModule = class {
|
|
|
10684
10719
|
base_factor: fields.params.fields.base_factor,
|
|
10685
10720
|
base_fee: fields.params.fields.base_factor * fields.bin_step / 1e9,
|
|
10686
10721
|
active_index: fields.params.fields.active_index,
|
|
10687
|
-
real_bin_id: (0,
|
|
10722
|
+
real_bin_id: (0, import_calc_almm3.get_real_id)(fields.params.fields.active_index),
|
|
10688
10723
|
coinAmountA: fields.reserve_x,
|
|
10689
10724
|
coinAmountB: fields.reserve_y,
|
|
10690
10725
|
liquidity: fields.liquidity,
|
|
10691
|
-
rewarder_infos: rewarders
|
|
10726
|
+
rewarder_infos: rewarders,
|
|
10727
|
+
params: fields.params.fields
|
|
10692
10728
|
};
|
|
10693
10729
|
poolList.push(poolInfo);
|
|
10694
10730
|
this.updateCache(`${fields.id.id}_getPoolObject`, poolInfo, cacheTime24h);
|
|
@@ -10726,7 +10762,8 @@ var AlmmModule = class {
|
|
|
10726
10762
|
index_reference: 0,
|
|
10727
10763
|
time_of_last_update: 0,
|
|
10728
10764
|
oracle_index: 0,
|
|
10729
|
-
active_index: 0
|
|
10765
|
+
active_index: 0,
|
|
10766
|
+
protocol_variable_share: 0
|
|
10730
10767
|
};
|
|
10731
10768
|
simulateRes.events?.forEach((item) => {
|
|
10732
10769
|
console.log(extractStructTagFromType(item.type).name);
|
|
@@ -10738,7 +10775,7 @@ var AlmmModule = class {
|
|
|
10738
10775
|
}
|
|
10739
10776
|
// NOTE: x, y should be sorted
|
|
10740
10777
|
async createPairPayload(params) {
|
|
10741
|
-
const storage_id = (0,
|
|
10778
|
+
const storage_id = (0, import_calc_almm3.get_storage_id_from_real_id)(
|
|
10742
10779
|
BinMath.getBinIdFromPrice(params.priceTokenBPerTokenA, params.bin_step, params.coinADecimal, params.coinBDecimal)
|
|
10743
10780
|
);
|
|
10744
10781
|
const tx = new import_transactions12.Transaction();
|
|
@@ -10752,7 +10789,8 @@ var AlmmModule = class {
|
|
|
10752
10789
|
tx.object(global_config_id),
|
|
10753
10790
|
tx.pure.u64(params.base_fee),
|
|
10754
10791
|
tx.pure.u16(params.bin_step),
|
|
10755
|
-
tx.pure.u32(storage_id)
|
|
10792
|
+
tx.pure.u32(storage_id),
|
|
10793
|
+
tx.object(CLOCK_ADDRESS)
|
|
10756
10794
|
];
|
|
10757
10795
|
tx.moveCall({
|
|
10758
10796
|
target: `${integrate.published_at}::${AlmmScript}::create_pair`,
|
|
@@ -10781,11 +10819,11 @@ var AlmmModule = class {
|
|
|
10781
10819
|
const { almm_pool, integrate } = this.sdk.sdkOptions;
|
|
10782
10820
|
const almmConfig = getPackagerConfigs(almm_pool);
|
|
10783
10821
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
10784
|
-
const price = (0,
|
|
10822
|
+
const price = (0, import_calc_almm3.get_price_x128_from_real_id)(params.active_bin, params.bin_step);
|
|
10785
10823
|
const min_price = new import_decimal13.default(price).mul(lower_slippage);
|
|
10786
10824
|
const max_price = new import_decimal13.default(price).mul(upper_slippage);
|
|
10787
|
-
const active_min = (0,
|
|
10788
|
-
const active_max = (0,
|
|
10825
|
+
const active_min = (0, import_calc_almm3.get_storage_id_from_real_id)((0, import_calc_almm3.get_real_id_from_price_x128)(min_price.toDecimalPlaces(0).toString(), params.bin_step));
|
|
10826
|
+
const active_max = (0, import_calc_almm3.get_storage_id_from_real_id)((0, import_calc_almm3.get_real_id_from_price_x128)(max_price.toDecimalPlaces(0).toString(), params.bin_step));
|
|
10789
10827
|
const allCoins = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
|
|
10790
10828
|
let amount_min = 0;
|
|
10791
10829
|
let amount_max = 0;
|
|
@@ -10821,8 +10859,8 @@ var AlmmModule = class {
|
|
|
10821
10859
|
tx.pure.bool(params.fixCoinB),
|
|
10822
10860
|
tx.pure.u64(params.amountBTotal),
|
|
10823
10861
|
tx.pure.u8(params.strategy),
|
|
10824
|
-
tx.pure.u32((0,
|
|
10825
|
-
tx.pure.u32((0,
|
|
10862
|
+
tx.pure.u32((0, import_calc_almm3.get_storage_id_from_real_id)(params.min_bin)),
|
|
10863
|
+
tx.pure.u32((0, import_calc_almm3.get_storage_id_from_real_id)(params.max_bin)),
|
|
10826
10864
|
tx.pure.u32(active_min),
|
|
10827
10865
|
tx.pure.u32(active_max),
|
|
10828
10866
|
tx.pure.u64(amount_min),
|
|
@@ -10908,11 +10946,11 @@ var AlmmModule = class {
|
|
|
10908
10946
|
tx.setSender(this.sdk.senderAddress);
|
|
10909
10947
|
const { almm_pool, integrate } = this.sdk.sdkOptions;
|
|
10910
10948
|
const almmConfig = getPackagerConfigs(almm_pool);
|
|
10911
|
-
const price = (0,
|
|
10949
|
+
const price = (0, import_calc_almm3.get_price_x128_from_real_id)(params.active_bin, params.bin_step);
|
|
10912
10950
|
const min_price = new import_decimal13.default(price).mul(lower_slippage);
|
|
10913
10951
|
const max_price = new import_decimal13.default(price).mul(upper_slippage);
|
|
10914
|
-
const active_min = (0,
|
|
10915
|
-
const active_max = (0,
|
|
10952
|
+
const active_min = (0, import_calc_almm3.get_storage_id_from_real_id)((0, import_calc_almm3.get_real_id_from_price_x128)(min_price.toDecimalPlaces(0).toString(), params.bin_step));
|
|
10953
|
+
const active_max = (0, import_calc_almm3.get_storage_id_from_real_id)((0, import_calc_almm3.get_real_id_from_price_x128)(max_price.toDecimalPlaces(0).toString(), params.bin_step));
|
|
10916
10954
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
10917
10955
|
const allCoins = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
|
|
10918
10956
|
let amount_min = 0;
|
|
@@ -10971,11 +11009,11 @@ var AlmmModule = class {
|
|
|
10971
11009
|
tx.setSender(this.sdk.senderAddress);
|
|
10972
11010
|
const { almm_pool, integrate } = this.sdk.sdkOptions;
|
|
10973
11011
|
const almmConfig = getPackagerConfigs(almm_pool);
|
|
10974
|
-
const price = (0,
|
|
11012
|
+
const price = (0, import_calc_almm3.get_price_x128_from_real_id)(params.active_bin, params.bin_step);
|
|
10975
11013
|
const min_price = new import_decimal13.default(price).mul(lower_slippage);
|
|
10976
11014
|
const max_price = new import_decimal13.default(price).mul(upper_slippage);
|
|
10977
|
-
const active_min = (0,
|
|
10978
|
-
const active_max = (0,
|
|
11015
|
+
const active_min = (0, import_calc_almm3.get_storage_id_from_real_id)((0, import_calc_almm3.get_real_id_from_price_x128)(min_price.toDecimalPlaces(0).toString(), params.bin_step));
|
|
11016
|
+
const active_max = (0, import_calc_almm3.get_storage_id_from_real_id)((0, import_calc_almm3.get_real_id_from_price_x128)(max_price.toDecimalPlaces(0).toString(), params.bin_step));
|
|
10979
11017
|
const typeArguments = [params.coinTypeA, params.coinTypeB, ...params.rewards_token];
|
|
10980
11018
|
const allCoins = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
|
|
10981
11019
|
let amount_min = 0;
|
|
@@ -11030,13 +11068,20 @@ var AlmmModule = class {
|
|
|
11030
11068
|
async burnPosition(params) {
|
|
11031
11069
|
const tx = new import_transactions12.Transaction();
|
|
11032
11070
|
tx.setSender(this.sdk.senderAddress);
|
|
11033
|
-
const { integrate, clmm_pool } = this.sdk.sdkOptions;
|
|
11071
|
+
const { integrate, clmm_pool, almm_pool } = this.sdk.sdkOptions;
|
|
11034
11072
|
const clmmConfigs = getPackagerConfigs(clmm_pool);
|
|
11073
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
11035
11074
|
const typeArguments = [params.coin_a, params.coin_b, ...params.rewards_token];
|
|
11036
|
-
let args = [tx.object(params.pool_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
|
|
11075
|
+
let args = [tx.object(almmConfig.factory), tx.object(params.pool_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
|
|
11037
11076
|
let target = `${integrate.published_at}::${AlmmScript}::burn_position`;
|
|
11038
11077
|
if (params.rewards_token.length > 0) {
|
|
11039
|
-
args = [
|
|
11078
|
+
args = [
|
|
11079
|
+
tx.object(almmConfig.factory),
|
|
11080
|
+
tx.object(params.pool_id),
|
|
11081
|
+
tx.object(clmmConfigs.global_vault_id),
|
|
11082
|
+
tx.object(params.position_id),
|
|
11083
|
+
tx.object(CLOCK_ADDRESS)
|
|
11084
|
+
];
|
|
11040
11085
|
target = `${integrate.published_at}::${AlmmScript}::burn_position_reward${params.rewards_token.length}`;
|
|
11041
11086
|
}
|
|
11042
11087
|
tx.moveCall({
|
|
@@ -11049,13 +11094,21 @@ var AlmmModule = class {
|
|
|
11049
11094
|
async shrinkPosition(params) {
|
|
11050
11095
|
const tx = new import_transactions12.Transaction();
|
|
11051
11096
|
tx.setSender(this.sdk.senderAddress);
|
|
11052
|
-
const { integrate, clmm_pool } = this.sdk.sdkOptions;
|
|
11097
|
+
const { integrate, clmm_pool, almm_pool } = this.sdk.sdkOptions;
|
|
11053
11098
|
const clmmConfigs = getPackagerConfigs(clmm_pool);
|
|
11099
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
11054
11100
|
const typeArguments = [params.coin_a, params.coin_b, ...params.rewards_token];
|
|
11055
|
-
let args = [
|
|
11101
|
+
let args = [
|
|
11102
|
+
tx.object(almmConfig.factory),
|
|
11103
|
+
tx.object(params.pool_id),
|
|
11104
|
+
tx.object(params.position_id),
|
|
11105
|
+
tx.pure.u64(params.delta_percentage),
|
|
11106
|
+
tx.object(CLOCK_ADDRESS)
|
|
11107
|
+
];
|
|
11056
11108
|
let target = `${integrate.published_at}::${AlmmScript}::shrink_position`;
|
|
11057
11109
|
if (params.rewards_token.length > 0) {
|
|
11058
11110
|
args = [
|
|
11111
|
+
tx.object(almmConfig.factory),
|
|
11059
11112
|
tx.object(params.pool_id),
|
|
11060
11113
|
tx.object(clmmConfigs.global_vault_id),
|
|
11061
11114
|
tx.object(params.position_id),
|
|
@@ -11092,10 +11145,12 @@ var AlmmModule = class {
|
|
|
11092
11145
|
async collectReward(params, transaction) {
|
|
11093
11146
|
const tx = transaction || new import_transactions12.Transaction();
|
|
11094
11147
|
tx.setSender(this.sdk.senderAddress);
|
|
11095
|
-
const { integrate, clmm_pool } = this.sdk.sdkOptions;
|
|
11148
|
+
const { integrate, clmm_pool, almm_pool } = this.sdk.sdkOptions;
|
|
11096
11149
|
const clmmConfigs = getPackagerConfigs(clmm_pool);
|
|
11150
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
11097
11151
|
const typeArguments = [params.coin_a, params.coin_b, ...params.rewards_token];
|
|
11098
11152
|
const args = [
|
|
11153
|
+
tx.object(almmConfig.factory),
|
|
11099
11154
|
tx.object(params.pool_id),
|
|
11100
11155
|
tx.object(clmmConfigs.global_vault_id),
|
|
11101
11156
|
tx.object(params.position_id),
|
|
@@ -11115,9 +11170,10 @@ var AlmmModule = class {
|
|
|
11115
11170
|
async collectFees(params, transaction) {
|
|
11116
11171
|
const tx = transaction || new import_transactions12.Transaction();
|
|
11117
11172
|
tx.setSender(this.sdk.senderAddress);
|
|
11118
|
-
const { integrate } = this.sdk.sdkOptions;
|
|
11173
|
+
const { integrate, almm_pool } = this.sdk.sdkOptions;
|
|
11174
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
11119
11175
|
const typeArguments = [params.coin_a, params.coin_b];
|
|
11120
|
-
const args = [tx.object(params.pool_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
|
|
11176
|
+
const args = [tx.object(almmConfig.factory), tx.object(params.pool_id), tx.object(params.position_id), tx.object(CLOCK_ADDRESS)];
|
|
11121
11177
|
const target = `${integrate.published_at}::${AlmmScript}::collect_fees`;
|
|
11122
11178
|
tx.moveCall({
|
|
11123
11179
|
target,
|
|
@@ -11140,14 +11196,14 @@ var AlmmModule = class {
|
|
|
11140
11196
|
const primaryCoinBInputs = TransactionUtil.buildCoinForAmount(tx, allCoins, BigInt(amountBTotal), params.coinTypeB, false, true);
|
|
11141
11197
|
const storageIds = [];
|
|
11142
11198
|
params.realIds.forEach((i) => {
|
|
11143
|
-
storageIds.push((0,
|
|
11199
|
+
storageIds.push((0, import_calc_almm3.get_storage_id_from_real_id)(i));
|
|
11144
11200
|
});
|
|
11145
11201
|
const args = [
|
|
11146
11202
|
tx.object(almmConfig.factory),
|
|
11147
11203
|
tx.object(global_config_id),
|
|
11148
11204
|
tx.pure.u64(params.baseFee),
|
|
11149
11205
|
tx.pure.u16(params.binStep),
|
|
11150
|
-
tx.pure.u32((0,
|
|
11206
|
+
tx.pure.u32((0, import_calc_almm3.get_storage_id_from_real_id)(params.activeId)),
|
|
11151
11207
|
primaryCoinAInputs.targetCoin,
|
|
11152
11208
|
primaryCoinBInputs.targetCoin,
|
|
11153
11209
|
tx.pure.vector("u32", storageIds),
|
|
@@ -11167,8 +11223,9 @@ var AlmmModule = class {
|
|
|
11167
11223
|
async swap(params) {
|
|
11168
11224
|
const tx = new import_transactions12.Transaction();
|
|
11169
11225
|
tx.setSender(this.sdk.senderAddress);
|
|
11170
|
-
const { clmm_pool, integrate } = this.sdk.sdkOptions;
|
|
11226
|
+
const { clmm_pool, almm_pool, integrate } = this.sdk.sdkOptions;
|
|
11171
11227
|
const { global_config_id } = getPackagerConfigs(clmm_pool);
|
|
11228
|
+
const almmConfig = getPackagerConfigs(almm_pool);
|
|
11172
11229
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
11173
11230
|
const allCoinAsset = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress);
|
|
11174
11231
|
const primaryCoinInputA = TransactionUtil.buildCoinForAmount(
|
|
@@ -11188,6 +11245,7 @@ var AlmmModule = class {
|
|
|
11188
11245
|
true
|
|
11189
11246
|
);
|
|
11190
11247
|
const args = [
|
|
11248
|
+
tx.object(almmConfig.factory),
|
|
11191
11249
|
tx.object(params.pair),
|
|
11192
11250
|
tx.object(global_config_id),
|
|
11193
11251
|
primaryCoinInputA.targetCoin,
|
|
@@ -11230,7 +11288,7 @@ var AlmmModule = class {
|
|
|
11230
11288
|
}
|
|
11231
11289
|
});
|
|
11232
11290
|
res.forEach((bin) => {
|
|
11233
|
-
bin.real_bin_id = (0,
|
|
11291
|
+
bin.real_bin_id = (0, import_calc_almm3.get_real_id)(Number(bin.storage_id));
|
|
11234
11292
|
});
|
|
11235
11293
|
return res.sort((a, b) => a.real_bin_id - b.real_bin_id);
|
|
11236
11294
|
}
|
|
@@ -11303,7 +11361,7 @@ var AlmmModule = class {
|
|
|
11303
11361
|
* @returns array of Position objects.
|
|
11304
11362
|
*/
|
|
11305
11363
|
async getUserPositionById(positionId, showDisplay = true) {
|
|
11306
|
-
|
|
11364
|
+
const allPosition = [];
|
|
11307
11365
|
const ownerRes = await this._sdk.fullClient.getObject({
|
|
11308
11366
|
id: positionId,
|
|
11309
11367
|
options: { showContent: true, showType: true, showDisplay, showOwner: true }
|
|
@@ -11324,6 +11382,7 @@ var AlmmModule = class {
|
|
|
11324
11382
|
* Gets a list of positions for the given account address.
|
|
11325
11383
|
* @param accountAddress The account address to get positions for.
|
|
11326
11384
|
* @param assignPoolIds An array of pool IDs to filter the positions by.
|
|
11385
|
+
* @param showDisplay When some testnet rpc nodes can't return object's display data, you can set this option to false, avoid returning errors. Default set true.
|
|
11327
11386
|
* @returns array of Position objects.
|
|
11328
11387
|
*/
|
|
11329
11388
|
async getUserPositions(accountAddress, assignPoolIds = [], showDisplay = true) {
|
|
@@ -11417,7 +11476,7 @@ var AlmmModule = class {
|
|
|
11417
11476
|
liquidity: item2.parsedJson.liquidity,
|
|
11418
11477
|
x_equivalent: item2.parsedJson.x_equivalent,
|
|
11419
11478
|
y_equivalent: item2.parsedJson.y_equivalent,
|
|
11420
|
-
bin_real_ids: item2.parsedJson.bin_ids.map((id) => (0,
|
|
11479
|
+
bin_real_ids: item2.parsedJson.bin_ids.map((id) => (0, import_calc_almm3.get_real_id)(id)),
|
|
11421
11480
|
bin_x_eq: item2.parsedJson.bin_x_eq,
|
|
11422
11481
|
bin_y_eq: item2.parsedJson.bin_y_eq,
|
|
11423
11482
|
bin_liquidity: item2.parsedJson.bin_liquidity
|
|
@@ -11484,7 +11543,7 @@ var AlmmModule = class {
|
|
|
11484
11543
|
pos_object_id: fields.id.id,
|
|
11485
11544
|
owner: ownerWarp.AddressOwner,
|
|
11486
11545
|
pool: fields.pair_id,
|
|
11487
|
-
bin_real_ids: fields.bin_ids.map((id) => (0,
|
|
11546
|
+
bin_real_ids: fields.bin_ids.map((id) => (0, import_calc_almm3.get_real_id)(id)),
|
|
11488
11547
|
type: ""
|
|
11489
11548
|
};
|
|
11490
11549
|
}
|
|
@@ -11556,7 +11615,7 @@ var AlmmModule = class {
|
|
|
11556
11615
|
liquidity: item.parsedJson.liquidity,
|
|
11557
11616
|
x_equivalent: item.parsedJson.x_equivalent,
|
|
11558
11617
|
y_equivalent: item.parsedJson.y_equivalent,
|
|
11559
|
-
bin_real_ids: item.parsedJson.bin_ids.map((id) => (0,
|
|
11618
|
+
bin_real_ids: item.parsedJson.bin_ids.map((id) => (0, import_calc_almm3.get_real_id)(id)),
|
|
11560
11619
|
bin_x_eq: item.parsedJson.bin_x_eq,
|
|
11561
11620
|
bin_y_eq: item.parsedJson.bin_y_eq,
|
|
11562
11621
|
bin_liquidity: item.parsedJson.bin_liquidity
|
|
@@ -12076,7 +12135,7 @@ var main_default = MagmaClmmSDK;
|
|
|
12076
12135
|
var SDKConfig = {
|
|
12077
12136
|
clmmConfig: {
|
|
12078
12137
|
pools_id: "0xfa145b9de10fe858be81edd1c6cdffcf27be9d016de02a1345eb1009a68ba8b2",
|
|
12079
|
-
// clmm and
|
|
12138
|
+
// clmm and almm both use this global_config
|
|
12080
12139
|
global_config_id: "0x4c4e1402401f72c7d8533d0ed8d5f8949da363c7a3319ccef261ffe153d32f8a",
|
|
12081
12140
|
global_vault_id: "0xa7e1102f222b6eb81ccc8a126e7feb2353342be9df6f6646a77c4519da29c071",
|
|
12082
12141
|
admin_cap_id: "0x89c1a321291d15ddae5a086c9abc533dff697fde3d89e0ca836c41af73e36a75"
|
|
@@ -12125,8 +12184,8 @@ var clmmMainnet = {
|
|
|
12125
12184
|
config: SDKConfig.clmmConfig
|
|
12126
12185
|
},
|
|
12127
12186
|
almm_pool: {
|
|
12128
|
-
package_id: "",
|
|
12129
|
-
published_at: "",
|
|
12187
|
+
package_id: "0x17ec44d20706af7f4ca563be7424bfa07c190f7f47bec157fa1eedaeec0bae3d",
|
|
12188
|
+
published_at: "0x17ec44d20706af7f4ca563be7424bfa07c190f7f47bec157fa1eedaeec0bae3d",
|
|
12130
12189
|
config: SDKConfig.almmConfig
|
|
12131
12190
|
},
|
|
12132
12191
|
distribution: {
|
|
@@ -12134,8 +12193,8 @@ var clmmMainnet = {
|
|
|
12134
12193
|
published_at: "0xee4a1f231dc45a303389998fe26c4e39278cf68b404b32e4f0b9769129b8267b"
|
|
12135
12194
|
},
|
|
12136
12195
|
integrate: {
|
|
12137
|
-
package_id: "
|
|
12138
|
-
published_at: "
|
|
12196
|
+
package_id: "0x7701ae515703598d6f2451f4bfec857d3cba994fd3e1968b11110d674e3126c4",
|
|
12197
|
+
published_at: "0x7701ae515703598d6f2451f4bfec857d3cba994fd3e1968b11110d674e3126c4"
|
|
12139
12198
|
},
|
|
12140
12199
|
deepbook: {
|
|
12141
12200
|
package_id: "0x000000000000000000000000000000000000000000000000000000000000dee9",
|