@cetusprotocol/sui-clmm-sdk 1.0.2 → 1.1.1
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.mts +140 -12
- package/dist/index.d.ts +140 -12
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/docs/get_reward.md +4 -4
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -168,6 +168,7 @@ declare function computeSwapStep(currentSqrtPrice: BN, targetSqrtPrice: BN, liqu
|
|
|
168
168
|
*/
|
|
169
169
|
declare function computeSwap(aToB: boolean, byAmountIn: boolean, amount: BN, poolData: ClmmpoolData, swapTicks: Array<TickData>): SwapResult;
|
|
170
170
|
|
|
171
|
+
declare const poolLiquiditySnapshotType = "position_liquidity_snapshot";
|
|
171
172
|
/**
|
|
172
173
|
* Enumerates the possible status values of a position within a liquidity mining module.
|
|
173
174
|
*/
|
|
@@ -233,11 +234,11 @@ type Position = {
|
|
|
233
234
|
* The address type of the second coin in the position.
|
|
234
235
|
*/
|
|
235
236
|
coin_type_b: SuiAddressType;
|
|
236
|
-
} & NFT$1 &
|
|
237
|
+
} & NFT$1 & PositionInfo;
|
|
237
238
|
/**
|
|
238
239
|
* Represents reward information associated with a liquidity mining position.
|
|
239
240
|
*/
|
|
240
|
-
type
|
|
241
|
+
type PositionInfo = {
|
|
241
242
|
/**
|
|
242
243
|
* The unique identifier of the position object.
|
|
243
244
|
*/
|
|
@@ -1038,6 +1039,29 @@ type SwapGasEstimateArg = {
|
|
|
1038
1039
|
swap_ticks: Array<TickData>;
|
|
1039
1040
|
current_pool: Pool;
|
|
1040
1041
|
};
|
|
1042
|
+
type GetPositionInfoListParams = {
|
|
1043
|
+
position_handle: string;
|
|
1044
|
+
position_ids: string[];
|
|
1045
|
+
};
|
|
1046
|
+
type PoolLiquiditySnapshot = {
|
|
1047
|
+
current_sqrt_price: string;
|
|
1048
|
+
remove_percent: string;
|
|
1049
|
+
snapshots: {
|
|
1050
|
+
id: string;
|
|
1051
|
+
size: string;
|
|
1052
|
+
};
|
|
1053
|
+
position_snapshots?: PositionSnapshot[];
|
|
1054
|
+
};
|
|
1055
|
+
type PositionSnapshot = {
|
|
1056
|
+
position_id: string;
|
|
1057
|
+
liquidity: string;
|
|
1058
|
+
tick_lower_index: number;
|
|
1059
|
+
tick_upper_index: number;
|
|
1060
|
+
fee_owned_a: string;
|
|
1061
|
+
fee_owned_b: string;
|
|
1062
|
+
value_cut: string;
|
|
1063
|
+
rewards: string[];
|
|
1064
|
+
};
|
|
1041
1065
|
|
|
1042
1066
|
/**
|
|
1043
1067
|
* Represents configurations specific to the Cetus protocol.
|
|
@@ -1320,6 +1344,55 @@ type SuiInputTypes = 'object' | SuiBasicTypes;
|
|
|
1320
1344
|
*/
|
|
1321
1345
|
declare const getDefaultSuiInputType: (value: any) => SuiInputTypes;
|
|
1322
1346
|
|
|
1347
|
+
type VestConfigs = {
|
|
1348
|
+
versioned_id: string;
|
|
1349
|
+
clmm_vest_id: string;
|
|
1350
|
+
cetus_coin_type: string;
|
|
1351
|
+
};
|
|
1352
|
+
type GlobalVestingPeriod = {
|
|
1353
|
+
period: number;
|
|
1354
|
+
release_time: string;
|
|
1355
|
+
redeemed_amount: string;
|
|
1356
|
+
percentage: string;
|
|
1357
|
+
};
|
|
1358
|
+
type ClmmVestInfo = {
|
|
1359
|
+
id: string;
|
|
1360
|
+
balance: string;
|
|
1361
|
+
global_vesting_periods: GlobalVestingPeriod[];
|
|
1362
|
+
total_value: string;
|
|
1363
|
+
total_cetus_amount: string;
|
|
1364
|
+
redeemed_amount: string;
|
|
1365
|
+
start_time: string;
|
|
1366
|
+
type: string;
|
|
1367
|
+
positions: {
|
|
1368
|
+
id: string;
|
|
1369
|
+
size: string;
|
|
1370
|
+
};
|
|
1371
|
+
};
|
|
1372
|
+
type PeriodDetail = {
|
|
1373
|
+
period: number;
|
|
1374
|
+
cetus_amount: string;
|
|
1375
|
+
is_redeemed: boolean;
|
|
1376
|
+
};
|
|
1377
|
+
type PositionVesting = {
|
|
1378
|
+
position_id: string;
|
|
1379
|
+
cetus_amount: string;
|
|
1380
|
+
redeemed_amount: string;
|
|
1381
|
+
is_paused: boolean;
|
|
1382
|
+
impaired_a: string;
|
|
1383
|
+
impaired_b: string;
|
|
1384
|
+
period_details: PeriodDetail[];
|
|
1385
|
+
} & CoinPairType;
|
|
1386
|
+
type RedeemOption = {
|
|
1387
|
+
clmm_pool_id: string;
|
|
1388
|
+
clmm_position_id: string;
|
|
1389
|
+
period: number;
|
|
1390
|
+
} & CoinPairType;
|
|
1391
|
+
type GetPositionVestOption = {
|
|
1392
|
+
clmm_pool_id: string;
|
|
1393
|
+
clmm_position_ids: string[];
|
|
1394
|
+
} & CoinPairType;
|
|
1395
|
+
|
|
1323
1396
|
type BigNumber = Decimal.Value | number | string;
|
|
1324
1397
|
|
|
1325
1398
|
/**
|
|
@@ -1439,6 +1512,13 @@ declare class PoolModule implements IModule<CetusClmmSDK> {
|
|
|
1439
1512
|
* @returns {Promise<Pool[]>} An array of Pool objects.
|
|
1440
1513
|
*/
|
|
1441
1514
|
getPoolsWithPage(pagination_args?: PaginationArgs, force_refresh?: boolean): Promise<DataPage<Pool>>;
|
|
1515
|
+
/**
|
|
1516
|
+
* Get the liquidity snapshot of a pool.
|
|
1517
|
+
* @param pool_id The ID of the pool.
|
|
1518
|
+
* @returns The liquidity snapshot of the pool.
|
|
1519
|
+
*/
|
|
1520
|
+
getPoolLiquiditySnapshot(pool_id: string, show_details?: boolean): Promise<PoolLiquiditySnapshot>;
|
|
1521
|
+
getPositionSnapshot(snapshot_handle: string, pos_ids: string[]): Promise<PositionSnapshot[]>;
|
|
1442
1522
|
/**
|
|
1443
1523
|
* Gets a list of pools.
|
|
1444
1524
|
* @param {string[]} assign_pools An array of pool ID to get.
|
|
@@ -1512,7 +1592,7 @@ declare class PoolModule implements IModule<CetusClmmSDK> {
|
|
|
1512
1592
|
* @param {FetchParams} params The parameters for the fetch.
|
|
1513
1593
|
* @returns {Promise<PositionReward[]>} A promise that resolves to an array of position rewards.
|
|
1514
1594
|
*/
|
|
1515
|
-
|
|
1595
|
+
fetchPoolPositionInfoList(params: FetchParams): Promise<PositionInfo[]>;
|
|
1516
1596
|
/**
|
|
1517
1597
|
* Fetches ticks from the fullnode using the RPC API.
|
|
1518
1598
|
* @param {string} tick_handle The handle for the tick. Get tick handle from `sdk.Pool.getPool()`
|
|
@@ -1626,19 +1706,20 @@ declare class PositionModule implements IModule<CetusClmmSDK> {
|
|
|
1626
1706
|
*/
|
|
1627
1707
|
getSimplePositionList(position_ids: SuiObjectIdType[], show_display?: boolean): Promise<Position[]>;
|
|
1628
1708
|
/**
|
|
1629
|
-
* Updates the
|
|
1709
|
+
* Updates the position info
|
|
1630
1710
|
* @param {string} position_handle Position handle
|
|
1631
1711
|
* @param {Position} position Position object
|
|
1632
1712
|
* @returns {Promise<Position>} A promise that resolves to an array of Position objects.
|
|
1633
1713
|
*/
|
|
1634
|
-
|
|
1714
|
+
updatePositionInfo(position_handle: string, position: Position): Promise<Position>;
|
|
1635
1715
|
/**
|
|
1636
|
-
* Gets the position
|
|
1716
|
+
* Gets the position info for the given position handle and position object ID.
|
|
1637
1717
|
* @param {string} position_handle The handle of the position.
|
|
1638
1718
|
* @param {string} position_id The ID of the position object.
|
|
1639
|
-
* @returns {Promise<
|
|
1719
|
+
* @returns {Promise<PositionInfo>} PositionInfo object.
|
|
1640
1720
|
*/
|
|
1641
|
-
|
|
1721
|
+
getPositionInfo(position_handle: string, position_id: string): Promise<PositionInfo>;
|
|
1722
|
+
getPositionInfoList(options: GetPositionInfoListParams[]): Promise<PositionInfo[]>;
|
|
1642
1723
|
buildFetchPosFee(params: FetchPosFeeParams, tx: Transaction): void;
|
|
1643
1724
|
parsedPosFeeData(simulate_res: DevInspectResults): Record<string, {
|
|
1644
1725
|
position_id: string;
|
|
@@ -1888,6 +1969,30 @@ declare class SwapModule implements IModule<CetusClmmSDK> {
|
|
|
1888
1969
|
}>;
|
|
1889
1970
|
}
|
|
1890
1971
|
|
|
1972
|
+
declare class VestModule implements IModule<CetusClmmSDK> {
|
|
1973
|
+
protected _sdk: CetusClmmSDK;
|
|
1974
|
+
constructor(sdk: CetusClmmSDK);
|
|
1975
|
+
get sdk(): CetusClmmSDK;
|
|
1976
|
+
/**
|
|
1977
|
+
* Get the clmm vest info list
|
|
1978
|
+
* @returns {Promise<ClmmVestInfo[]>} The clmm vest info list
|
|
1979
|
+
*/
|
|
1980
|
+
getClmmVestInfoList(): Promise<ClmmVestInfo[]>;
|
|
1981
|
+
/**
|
|
1982
|
+
* Get the clmm vest info
|
|
1983
|
+
* @param vest_id - The vest id
|
|
1984
|
+
* @returns {Promise<ClmmVestInfo>} The clmm vest info
|
|
1985
|
+
*/
|
|
1986
|
+
getClmmVestInfo(force_refresh?: boolean): Promise<ClmmVestInfo>;
|
|
1987
|
+
getPositionVesting(options: GetPositionVestOption[]): Promise<PositionVesting[]>;
|
|
1988
|
+
/**
|
|
1989
|
+
* Build the redeem payload
|
|
1990
|
+
* @param options - The redeem options
|
|
1991
|
+
* @returns {Transaction} The redeem payload
|
|
1992
|
+
*/
|
|
1993
|
+
buildRedeemPayload(options: RedeemOption[], tx?: Transaction): Transaction;
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1891
1996
|
/**
|
|
1892
1997
|
* Represents options and configurations for an SDK.
|
|
1893
1998
|
*/
|
|
@@ -1908,6 +2013,7 @@ interface SdkOptions extends BaseSdkOptions {
|
|
|
1908
2013
|
* The URL for the swap count
|
|
1909
2014
|
*/
|
|
1910
2015
|
stats_pools_url?: string;
|
|
2016
|
+
clmm_vest?: Package<VestConfigs>;
|
|
1911
2017
|
}
|
|
1912
2018
|
/**
|
|
1913
2019
|
* The entry class of CetusClmmSDK, which is almost responsible for all interactions with CLMM.
|
|
@@ -1933,6 +2039,10 @@ declare class CetusClmmSDK extends SdkWrapper<SdkOptions> {
|
|
|
1933
2039
|
* Provide interact with clmm pool and coin and launchpad pool config
|
|
1934
2040
|
*/
|
|
1935
2041
|
protected _config: ConfigModule;
|
|
2042
|
+
/**
|
|
2043
|
+
* Provide interact with clmm claim
|
|
2044
|
+
*/
|
|
2045
|
+
protected _vest: VestModule;
|
|
1936
2046
|
constructor(options: SdkOptions);
|
|
1937
2047
|
/**
|
|
1938
2048
|
* Getter for the Pool property.
|
|
@@ -1959,6 +2069,11 @@ declare class CetusClmmSDK extends SdkWrapper<SdkOptions> {
|
|
|
1959
2069
|
* @returns {SwapModule} The Swap property value.
|
|
1960
2070
|
*/
|
|
1961
2071
|
get Swap(): SwapModule;
|
|
2072
|
+
/**
|
|
2073
|
+
* Getter for the Vest property.
|
|
2074
|
+
* @returns {VestModule} The Vest property value.
|
|
2075
|
+
*/
|
|
2076
|
+
get Vest(): VestModule;
|
|
1962
2077
|
static createSDK(options: BaseSdkOptions): CetusClmmSDK;
|
|
1963
2078
|
/**
|
|
1964
2079
|
* Create a custom SDK instance with the given options
|
|
@@ -1984,7 +2099,7 @@ declare function buildPosition(object: SuiObjectResponse): Position;
|
|
|
1984
2099
|
* @param {any} fields - The response containing information about the reward.
|
|
1985
2100
|
* @returns {PositionReward} - The built PositionReward object.
|
|
1986
2101
|
*/
|
|
1987
|
-
declare function
|
|
2102
|
+
declare function buildPositionInfo(fields: any): PositionInfo;
|
|
1988
2103
|
/**
|
|
1989
2104
|
* Builds a TickData object based on a response containing information about tick data.
|
|
1990
2105
|
* It must check if the response contains the required fields.
|
|
@@ -2170,6 +2285,14 @@ declare function getLowerSqrtPriceFromCoinB(amount: BN, liquidity: BN, sqrt_pric
|
|
|
2170
2285
|
*/
|
|
2171
2286
|
declare function getUpperSqrtPriceFromCoinB(amount: BN, liquidity: BN, sqrt_price_x64: BN): BN;
|
|
2172
2287
|
|
|
2288
|
+
declare const BPS = 10000;
|
|
2289
|
+
declare class VestUtils {
|
|
2290
|
+
static parseClmmVestInfo(res: SuiObjectResponse): ClmmVestInfo;
|
|
2291
|
+
static parsePositionVesting(fields: any): PositionVesting;
|
|
2292
|
+
static parsePoolLiquiditySnapshot(res: SuiObjectResponse): PoolLiquiditySnapshot;
|
|
2293
|
+
static parsePositionSnapshot(res: SuiObjectResponse): PositionSnapshot;
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2173
2296
|
declare function estPoolAPR(pre_block_reward: BN, reward_price: BN, total_trading_fee: BN, total_liquidity_value: BN): BN;
|
|
2174
2297
|
type estPosAPRResult = {
|
|
2175
2298
|
fee_apr: Decimal;
|
|
@@ -2199,7 +2322,8 @@ declare enum PositionErrorCode {
|
|
|
2199
2322
|
InvalidTickEvent = "InvalidTickEvent",
|
|
2200
2323
|
InvalidPositionObject = "InvalidPositionObject",
|
|
2201
2324
|
InvalidPositionRewardObject = "InvalidPositionRewardObject",
|
|
2202
|
-
InvalidParams = "InvalidParams"
|
|
2325
|
+
InvalidParams = "InvalidParams",
|
|
2326
|
+
FetchError = "FetchError"
|
|
2203
2327
|
}
|
|
2204
2328
|
declare enum PoolErrorCode {
|
|
2205
2329
|
InvalidCoinTypeSequence = "InvalidCoinTypeSequence",
|
|
@@ -2212,6 +2336,10 @@ declare enum PoolErrorCode {
|
|
|
2212
2336
|
StatsPoolsUrlNotSet = "StatsPoolsUrlNotSet",
|
|
2213
2337
|
FetchError = "FetchError"
|
|
2214
2338
|
}
|
|
2339
|
+
declare enum VestErrorCode {
|
|
2340
|
+
ClmmVestNotSet = "ClmmVestNotSet",
|
|
2341
|
+
ClmmVestFetchError = "ClmmVestFetchError"
|
|
2342
|
+
}
|
|
2215
2343
|
declare enum PartnerErrorCode {
|
|
2216
2344
|
NotFoundPartnerObject = "NotFoundPartnerObject",
|
|
2217
2345
|
InvalidPartnerRefFeeFields = "InvalidPartnerRefFeeFields"
|
|
@@ -2240,7 +2368,7 @@ declare enum RouterErrorCode {
|
|
|
2240
2368
|
declare enum TypesErrorCode {
|
|
2241
2369
|
InvalidType = "InvalidType"
|
|
2242
2370
|
}
|
|
2243
|
-
type ClmmErrorCode = SwapErrorCode | PoolErrorCode | PositionErrorCode | PartnerErrorCode | ConfigErrorCode | UtilsErrorCode | RouterErrorCode | TypesErrorCode;
|
|
2371
|
+
type ClmmErrorCode = SwapErrorCode | PoolErrorCode | PositionErrorCode | PartnerErrorCode | ConfigErrorCode | UtilsErrorCode | RouterErrorCode | TypesErrorCode | VestErrorCode;
|
|
2244
2372
|
declare class ClmmError extends BaseError {
|
|
2245
2373
|
constructor(message: string, errorCode?: ClmmErrorCode, details?: Record<string, any>);
|
|
2246
2374
|
static isVaultsErrorCode(e: any, code: ClmmErrorCode): boolean;
|
|
@@ -2248,4 +2376,4 @@ declare class ClmmError extends BaseError {
|
|
|
2248
2376
|
declare const handleError: (code: ClmmErrorCode, error: Error, details?: Record<string, any>) => never;
|
|
2249
2377
|
declare const handleMessageError: (code: ClmmErrorCode, message: string, details?: Record<string, any>) => never;
|
|
2250
2378
|
|
|
2251
|
-
export { AMM_SWAP_MODULE, type AddLiquidityCommonParams, type AddLiquidityFixTokenParams, type AddLiquidityParams, type AddLiquidityWithPriceRangeParams, type AdjustResult, type BasePath, type BigNumber, type Bits, type CalculateAddLiquidityFixCoinWithPriceParams, type CalculateAddLiquidityResult, type CalculateAddLiquidityWithPriceParams, type CalculateCreatePoolResult, type CalculateCreatePoolWithPriceParams, type CalculateRatesParams, type CalculateRatesResult, CetusClmmSDK, type CetusConfigs, type ClmmConfig, ClmmError, type ClmmErrorCode, ClmmExpectSwapModule, ClmmFetcherModule, ClmmIntegratePoolModule, ClmmIntegratePoolV2Module, ClmmIntegratePoolV3Module, ClmmIntegrateRouterModule, ClmmIntegrateRouterWithPartnerModule, ClmmIntegrateUtilsModule, ClmmPartnerModule, type ClmmPoolConfig, ClmmPositionStatus, type ClmmpoolData, type ClosePositionParams, type CoinConfig, type CollectFeeParams, type CollectFeesQuote, type CollectRewarderParams, ConfigErrorCode, ConfigModule, type CreatePartnerEvent, type CreatePoolAddLiquidityParams, type CreatePoolAddLiquidityWithPriceParams, type CreatePoolAndAddLiquidityRowResult, type CreatePoolCustomRangeParams, type CreatePoolParams, type CustomRangeParams, DeepbookClobV2Module, DeepbookCustodianV2Module, DeepbookEndpointsV2Module, type FetchParams, type FetchPosFeeParams, type FetchPosRewardParams, type FullRangeParams, type LaunchpadPoolConfig, type NFT, type OpenPositionParams, type OpenPositionWithPriceParams, POOL_STRUCT, PartnerErrorCode, type Pool, PoolErrorCode, type PoolImmutables, PoolModule, type PoolTransactionInfo, type PosRewarderResult, type Position, PositionErrorCode, PositionModule, type
|
|
2379
|
+
export { AMM_SWAP_MODULE, type AddLiquidityCommonParams, type AddLiquidityFixTokenParams, type AddLiquidityParams, type AddLiquidityWithPriceRangeParams, type AdjustResult, BPS, type BasePath, type BigNumber, type Bits, type CalculateAddLiquidityFixCoinWithPriceParams, type CalculateAddLiquidityResult, type CalculateAddLiquidityWithPriceParams, type CalculateCreatePoolResult, type CalculateCreatePoolWithPriceParams, type CalculateRatesParams, type CalculateRatesResult, CetusClmmSDK, type CetusConfigs, type ClmmConfig, ClmmError, type ClmmErrorCode, ClmmExpectSwapModule, ClmmFetcherModule, ClmmIntegratePoolModule, ClmmIntegratePoolV2Module, ClmmIntegratePoolV3Module, ClmmIntegrateRouterModule, ClmmIntegrateRouterWithPartnerModule, ClmmIntegrateUtilsModule, ClmmPartnerModule, type ClmmPoolConfig, ClmmPositionStatus, type ClmmVestInfo, type ClmmpoolData, type ClosePositionParams, type CoinConfig, type CollectFeeParams, type CollectFeesQuote, type CollectRewarderParams, ConfigErrorCode, ConfigModule, type CreatePartnerEvent, type CreatePoolAddLiquidityParams, type CreatePoolAddLiquidityWithPriceParams, type CreatePoolAndAddLiquidityRowResult, type CreatePoolCustomRangeParams, type CreatePoolParams, type CustomRangeParams, DeepbookClobV2Module, DeepbookCustodianV2Module, DeepbookEndpointsV2Module, type FetchParams, type FetchPosFeeParams, type FetchPosRewardParams, type FullRangeParams, type GetPositionInfoListParams, type GetPositionVestOption, type GlobalVestingPeriod, type LaunchpadPoolConfig, type NFT, type OpenPositionParams, type OpenPositionWithPriceParams, POOL_STRUCT, PartnerErrorCode, type PeriodDetail, type Pool, PoolErrorCode, type PoolImmutables, type PoolLiquiditySnapshot, PoolModule, type PoolTransactionInfo, type PosRewarderResult, type Position, PositionErrorCode, type PositionInfo, PositionModule, type PositionSnapshot, type PositionTransactionInfo, PositionUtils, type PositionVesting, type PreSwapLpChangeParams, type PreSwapParams, type PreSwapWithMultiPoolParams, type RedeemOption, type RemoveLiquidityParams, type Rewarder, type RewarderAmountOwned, RewarderModule, RouterErrorCode, type SdkOptions, type SplitPath, type SuiBasicTypes, type SuiInputTypes, type SuiStructTag, type SuiTxArg, SwapErrorCode, type SwapGasEstimateArg, SwapModule, type SwapParams, type SwapResult, type SwapStepResult, SwapUtils, type Tick, type TickData, type TransPreSwapWithMultiPoolParams, TypesErrorCode, UtilsErrorCode, type VestConfigs, VestErrorCode, VestModule, VestUtils, buildClmmPositionName, buildPool, buildPoolTransactionInfo, buildPosition, buildPositionInfo, buildPositionTransactionInfo, buildTickData, buildTickDataByEvent, buildTransferCoin, buildTransferCoinToSender, clmmMainnet, clmmTestnet, computeSwap, computeSwapStep, CetusClmmSDK as default, estPoolAPR, type estPosAPRResult, estPositionAPRWithDeltaMethod, estPositionAPRWithMultiMethod, findAdjustCoin, getDefaultSuiInputType, getLowerSqrtPriceFromCoinA, getLowerSqrtPriceFromCoinB, getUpperSqrtPriceFromCoinA, getUpperSqrtPriceFromCoinB, handleError, handleMessageError, newBits, poolFilterEvenTypes, poolLiquiditySnapshotType, transClmmpoolDataWithoutTicks };
|
package/dist/index.d.ts
CHANGED
|
@@ -168,6 +168,7 @@ declare function computeSwapStep(currentSqrtPrice: BN, targetSqrtPrice: BN, liqu
|
|
|
168
168
|
*/
|
|
169
169
|
declare function computeSwap(aToB: boolean, byAmountIn: boolean, amount: BN, poolData: ClmmpoolData, swapTicks: Array<TickData>): SwapResult;
|
|
170
170
|
|
|
171
|
+
declare const poolLiquiditySnapshotType = "position_liquidity_snapshot";
|
|
171
172
|
/**
|
|
172
173
|
* Enumerates the possible status values of a position within a liquidity mining module.
|
|
173
174
|
*/
|
|
@@ -233,11 +234,11 @@ type Position = {
|
|
|
233
234
|
* The address type of the second coin in the position.
|
|
234
235
|
*/
|
|
235
236
|
coin_type_b: SuiAddressType;
|
|
236
|
-
} & NFT$1 &
|
|
237
|
+
} & NFT$1 & PositionInfo;
|
|
237
238
|
/**
|
|
238
239
|
* Represents reward information associated with a liquidity mining position.
|
|
239
240
|
*/
|
|
240
|
-
type
|
|
241
|
+
type PositionInfo = {
|
|
241
242
|
/**
|
|
242
243
|
* The unique identifier of the position object.
|
|
243
244
|
*/
|
|
@@ -1038,6 +1039,29 @@ type SwapGasEstimateArg = {
|
|
|
1038
1039
|
swap_ticks: Array<TickData>;
|
|
1039
1040
|
current_pool: Pool;
|
|
1040
1041
|
};
|
|
1042
|
+
type GetPositionInfoListParams = {
|
|
1043
|
+
position_handle: string;
|
|
1044
|
+
position_ids: string[];
|
|
1045
|
+
};
|
|
1046
|
+
type PoolLiquiditySnapshot = {
|
|
1047
|
+
current_sqrt_price: string;
|
|
1048
|
+
remove_percent: string;
|
|
1049
|
+
snapshots: {
|
|
1050
|
+
id: string;
|
|
1051
|
+
size: string;
|
|
1052
|
+
};
|
|
1053
|
+
position_snapshots?: PositionSnapshot[];
|
|
1054
|
+
};
|
|
1055
|
+
type PositionSnapshot = {
|
|
1056
|
+
position_id: string;
|
|
1057
|
+
liquidity: string;
|
|
1058
|
+
tick_lower_index: number;
|
|
1059
|
+
tick_upper_index: number;
|
|
1060
|
+
fee_owned_a: string;
|
|
1061
|
+
fee_owned_b: string;
|
|
1062
|
+
value_cut: string;
|
|
1063
|
+
rewards: string[];
|
|
1064
|
+
};
|
|
1041
1065
|
|
|
1042
1066
|
/**
|
|
1043
1067
|
* Represents configurations specific to the Cetus protocol.
|
|
@@ -1320,6 +1344,55 @@ type SuiInputTypes = 'object' | SuiBasicTypes;
|
|
|
1320
1344
|
*/
|
|
1321
1345
|
declare const getDefaultSuiInputType: (value: any) => SuiInputTypes;
|
|
1322
1346
|
|
|
1347
|
+
type VestConfigs = {
|
|
1348
|
+
versioned_id: string;
|
|
1349
|
+
clmm_vest_id: string;
|
|
1350
|
+
cetus_coin_type: string;
|
|
1351
|
+
};
|
|
1352
|
+
type GlobalVestingPeriod = {
|
|
1353
|
+
period: number;
|
|
1354
|
+
release_time: string;
|
|
1355
|
+
redeemed_amount: string;
|
|
1356
|
+
percentage: string;
|
|
1357
|
+
};
|
|
1358
|
+
type ClmmVestInfo = {
|
|
1359
|
+
id: string;
|
|
1360
|
+
balance: string;
|
|
1361
|
+
global_vesting_periods: GlobalVestingPeriod[];
|
|
1362
|
+
total_value: string;
|
|
1363
|
+
total_cetus_amount: string;
|
|
1364
|
+
redeemed_amount: string;
|
|
1365
|
+
start_time: string;
|
|
1366
|
+
type: string;
|
|
1367
|
+
positions: {
|
|
1368
|
+
id: string;
|
|
1369
|
+
size: string;
|
|
1370
|
+
};
|
|
1371
|
+
};
|
|
1372
|
+
type PeriodDetail = {
|
|
1373
|
+
period: number;
|
|
1374
|
+
cetus_amount: string;
|
|
1375
|
+
is_redeemed: boolean;
|
|
1376
|
+
};
|
|
1377
|
+
type PositionVesting = {
|
|
1378
|
+
position_id: string;
|
|
1379
|
+
cetus_amount: string;
|
|
1380
|
+
redeemed_amount: string;
|
|
1381
|
+
is_paused: boolean;
|
|
1382
|
+
impaired_a: string;
|
|
1383
|
+
impaired_b: string;
|
|
1384
|
+
period_details: PeriodDetail[];
|
|
1385
|
+
} & CoinPairType;
|
|
1386
|
+
type RedeemOption = {
|
|
1387
|
+
clmm_pool_id: string;
|
|
1388
|
+
clmm_position_id: string;
|
|
1389
|
+
period: number;
|
|
1390
|
+
} & CoinPairType;
|
|
1391
|
+
type GetPositionVestOption = {
|
|
1392
|
+
clmm_pool_id: string;
|
|
1393
|
+
clmm_position_ids: string[];
|
|
1394
|
+
} & CoinPairType;
|
|
1395
|
+
|
|
1323
1396
|
type BigNumber = Decimal.Value | number | string;
|
|
1324
1397
|
|
|
1325
1398
|
/**
|
|
@@ -1439,6 +1512,13 @@ declare class PoolModule implements IModule<CetusClmmSDK> {
|
|
|
1439
1512
|
* @returns {Promise<Pool[]>} An array of Pool objects.
|
|
1440
1513
|
*/
|
|
1441
1514
|
getPoolsWithPage(pagination_args?: PaginationArgs, force_refresh?: boolean): Promise<DataPage<Pool>>;
|
|
1515
|
+
/**
|
|
1516
|
+
* Get the liquidity snapshot of a pool.
|
|
1517
|
+
* @param pool_id The ID of the pool.
|
|
1518
|
+
* @returns The liquidity snapshot of the pool.
|
|
1519
|
+
*/
|
|
1520
|
+
getPoolLiquiditySnapshot(pool_id: string, show_details?: boolean): Promise<PoolLiquiditySnapshot>;
|
|
1521
|
+
getPositionSnapshot(snapshot_handle: string, pos_ids: string[]): Promise<PositionSnapshot[]>;
|
|
1442
1522
|
/**
|
|
1443
1523
|
* Gets a list of pools.
|
|
1444
1524
|
* @param {string[]} assign_pools An array of pool ID to get.
|
|
@@ -1512,7 +1592,7 @@ declare class PoolModule implements IModule<CetusClmmSDK> {
|
|
|
1512
1592
|
* @param {FetchParams} params The parameters for the fetch.
|
|
1513
1593
|
* @returns {Promise<PositionReward[]>} A promise that resolves to an array of position rewards.
|
|
1514
1594
|
*/
|
|
1515
|
-
|
|
1595
|
+
fetchPoolPositionInfoList(params: FetchParams): Promise<PositionInfo[]>;
|
|
1516
1596
|
/**
|
|
1517
1597
|
* Fetches ticks from the fullnode using the RPC API.
|
|
1518
1598
|
* @param {string} tick_handle The handle for the tick. Get tick handle from `sdk.Pool.getPool()`
|
|
@@ -1626,19 +1706,20 @@ declare class PositionModule implements IModule<CetusClmmSDK> {
|
|
|
1626
1706
|
*/
|
|
1627
1707
|
getSimplePositionList(position_ids: SuiObjectIdType[], show_display?: boolean): Promise<Position[]>;
|
|
1628
1708
|
/**
|
|
1629
|
-
* Updates the
|
|
1709
|
+
* Updates the position info
|
|
1630
1710
|
* @param {string} position_handle Position handle
|
|
1631
1711
|
* @param {Position} position Position object
|
|
1632
1712
|
* @returns {Promise<Position>} A promise that resolves to an array of Position objects.
|
|
1633
1713
|
*/
|
|
1634
|
-
|
|
1714
|
+
updatePositionInfo(position_handle: string, position: Position): Promise<Position>;
|
|
1635
1715
|
/**
|
|
1636
|
-
* Gets the position
|
|
1716
|
+
* Gets the position info for the given position handle and position object ID.
|
|
1637
1717
|
* @param {string} position_handle The handle of the position.
|
|
1638
1718
|
* @param {string} position_id The ID of the position object.
|
|
1639
|
-
* @returns {Promise<
|
|
1719
|
+
* @returns {Promise<PositionInfo>} PositionInfo object.
|
|
1640
1720
|
*/
|
|
1641
|
-
|
|
1721
|
+
getPositionInfo(position_handle: string, position_id: string): Promise<PositionInfo>;
|
|
1722
|
+
getPositionInfoList(options: GetPositionInfoListParams[]): Promise<PositionInfo[]>;
|
|
1642
1723
|
buildFetchPosFee(params: FetchPosFeeParams, tx: Transaction): void;
|
|
1643
1724
|
parsedPosFeeData(simulate_res: DevInspectResults): Record<string, {
|
|
1644
1725
|
position_id: string;
|
|
@@ -1888,6 +1969,30 @@ declare class SwapModule implements IModule<CetusClmmSDK> {
|
|
|
1888
1969
|
}>;
|
|
1889
1970
|
}
|
|
1890
1971
|
|
|
1972
|
+
declare class VestModule implements IModule<CetusClmmSDK> {
|
|
1973
|
+
protected _sdk: CetusClmmSDK;
|
|
1974
|
+
constructor(sdk: CetusClmmSDK);
|
|
1975
|
+
get sdk(): CetusClmmSDK;
|
|
1976
|
+
/**
|
|
1977
|
+
* Get the clmm vest info list
|
|
1978
|
+
* @returns {Promise<ClmmVestInfo[]>} The clmm vest info list
|
|
1979
|
+
*/
|
|
1980
|
+
getClmmVestInfoList(): Promise<ClmmVestInfo[]>;
|
|
1981
|
+
/**
|
|
1982
|
+
* Get the clmm vest info
|
|
1983
|
+
* @param vest_id - The vest id
|
|
1984
|
+
* @returns {Promise<ClmmVestInfo>} The clmm vest info
|
|
1985
|
+
*/
|
|
1986
|
+
getClmmVestInfo(force_refresh?: boolean): Promise<ClmmVestInfo>;
|
|
1987
|
+
getPositionVesting(options: GetPositionVestOption[]): Promise<PositionVesting[]>;
|
|
1988
|
+
/**
|
|
1989
|
+
* Build the redeem payload
|
|
1990
|
+
* @param options - The redeem options
|
|
1991
|
+
* @returns {Transaction} The redeem payload
|
|
1992
|
+
*/
|
|
1993
|
+
buildRedeemPayload(options: RedeemOption[], tx?: Transaction): Transaction;
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1891
1996
|
/**
|
|
1892
1997
|
* Represents options and configurations for an SDK.
|
|
1893
1998
|
*/
|
|
@@ -1908,6 +2013,7 @@ interface SdkOptions extends BaseSdkOptions {
|
|
|
1908
2013
|
* The URL for the swap count
|
|
1909
2014
|
*/
|
|
1910
2015
|
stats_pools_url?: string;
|
|
2016
|
+
clmm_vest?: Package<VestConfigs>;
|
|
1911
2017
|
}
|
|
1912
2018
|
/**
|
|
1913
2019
|
* The entry class of CetusClmmSDK, which is almost responsible for all interactions with CLMM.
|
|
@@ -1933,6 +2039,10 @@ declare class CetusClmmSDK extends SdkWrapper<SdkOptions> {
|
|
|
1933
2039
|
* Provide interact with clmm pool and coin and launchpad pool config
|
|
1934
2040
|
*/
|
|
1935
2041
|
protected _config: ConfigModule;
|
|
2042
|
+
/**
|
|
2043
|
+
* Provide interact with clmm claim
|
|
2044
|
+
*/
|
|
2045
|
+
protected _vest: VestModule;
|
|
1936
2046
|
constructor(options: SdkOptions);
|
|
1937
2047
|
/**
|
|
1938
2048
|
* Getter for the Pool property.
|
|
@@ -1959,6 +2069,11 @@ declare class CetusClmmSDK extends SdkWrapper<SdkOptions> {
|
|
|
1959
2069
|
* @returns {SwapModule} The Swap property value.
|
|
1960
2070
|
*/
|
|
1961
2071
|
get Swap(): SwapModule;
|
|
2072
|
+
/**
|
|
2073
|
+
* Getter for the Vest property.
|
|
2074
|
+
* @returns {VestModule} The Vest property value.
|
|
2075
|
+
*/
|
|
2076
|
+
get Vest(): VestModule;
|
|
1962
2077
|
static createSDK(options: BaseSdkOptions): CetusClmmSDK;
|
|
1963
2078
|
/**
|
|
1964
2079
|
* Create a custom SDK instance with the given options
|
|
@@ -1984,7 +2099,7 @@ declare function buildPosition(object: SuiObjectResponse): Position;
|
|
|
1984
2099
|
* @param {any} fields - The response containing information about the reward.
|
|
1985
2100
|
* @returns {PositionReward} - The built PositionReward object.
|
|
1986
2101
|
*/
|
|
1987
|
-
declare function
|
|
2102
|
+
declare function buildPositionInfo(fields: any): PositionInfo;
|
|
1988
2103
|
/**
|
|
1989
2104
|
* Builds a TickData object based on a response containing information about tick data.
|
|
1990
2105
|
* It must check if the response contains the required fields.
|
|
@@ -2170,6 +2285,14 @@ declare function getLowerSqrtPriceFromCoinB(amount: BN, liquidity: BN, sqrt_pric
|
|
|
2170
2285
|
*/
|
|
2171
2286
|
declare function getUpperSqrtPriceFromCoinB(amount: BN, liquidity: BN, sqrt_price_x64: BN): BN;
|
|
2172
2287
|
|
|
2288
|
+
declare const BPS = 10000;
|
|
2289
|
+
declare class VestUtils {
|
|
2290
|
+
static parseClmmVestInfo(res: SuiObjectResponse): ClmmVestInfo;
|
|
2291
|
+
static parsePositionVesting(fields: any): PositionVesting;
|
|
2292
|
+
static parsePoolLiquiditySnapshot(res: SuiObjectResponse): PoolLiquiditySnapshot;
|
|
2293
|
+
static parsePositionSnapshot(res: SuiObjectResponse): PositionSnapshot;
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2173
2296
|
declare function estPoolAPR(pre_block_reward: BN, reward_price: BN, total_trading_fee: BN, total_liquidity_value: BN): BN;
|
|
2174
2297
|
type estPosAPRResult = {
|
|
2175
2298
|
fee_apr: Decimal;
|
|
@@ -2199,7 +2322,8 @@ declare enum PositionErrorCode {
|
|
|
2199
2322
|
InvalidTickEvent = "InvalidTickEvent",
|
|
2200
2323
|
InvalidPositionObject = "InvalidPositionObject",
|
|
2201
2324
|
InvalidPositionRewardObject = "InvalidPositionRewardObject",
|
|
2202
|
-
InvalidParams = "InvalidParams"
|
|
2325
|
+
InvalidParams = "InvalidParams",
|
|
2326
|
+
FetchError = "FetchError"
|
|
2203
2327
|
}
|
|
2204
2328
|
declare enum PoolErrorCode {
|
|
2205
2329
|
InvalidCoinTypeSequence = "InvalidCoinTypeSequence",
|
|
@@ -2212,6 +2336,10 @@ declare enum PoolErrorCode {
|
|
|
2212
2336
|
StatsPoolsUrlNotSet = "StatsPoolsUrlNotSet",
|
|
2213
2337
|
FetchError = "FetchError"
|
|
2214
2338
|
}
|
|
2339
|
+
declare enum VestErrorCode {
|
|
2340
|
+
ClmmVestNotSet = "ClmmVestNotSet",
|
|
2341
|
+
ClmmVestFetchError = "ClmmVestFetchError"
|
|
2342
|
+
}
|
|
2215
2343
|
declare enum PartnerErrorCode {
|
|
2216
2344
|
NotFoundPartnerObject = "NotFoundPartnerObject",
|
|
2217
2345
|
InvalidPartnerRefFeeFields = "InvalidPartnerRefFeeFields"
|
|
@@ -2240,7 +2368,7 @@ declare enum RouterErrorCode {
|
|
|
2240
2368
|
declare enum TypesErrorCode {
|
|
2241
2369
|
InvalidType = "InvalidType"
|
|
2242
2370
|
}
|
|
2243
|
-
type ClmmErrorCode = SwapErrorCode | PoolErrorCode | PositionErrorCode | PartnerErrorCode | ConfigErrorCode | UtilsErrorCode | RouterErrorCode | TypesErrorCode;
|
|
2371
|
+
type ClmmErrorCode = SwapErrorCode | PoolErrorCode | PositionErrorCode | PartnerErrorCode | ConfigErrorCode | UtilsErrorCode | RouterErrorCode | TypesErrorCode | VestErrorCode;
|
|
2244
2372
|
declare class ClmmError extends BaseError {
|
|
2245
2373
|
constructor(message: string, errorCode?: ClmmErrorCode, details?: Record<string, any>);
|
|
2246
2374
|
static isVaultsErrorCode(e: any, code: ClmmErrorCode): boolean;
|
|
@@ -2248,4 +2376,4 @@ declare class ClmmError extends BaseError {
|
|
|
2248
2376
|
declare const handleError: (code: ClmmErrorCode, error: Error, details?: Record<string, any>) => never;
|
|
2249
2377
|
declare const handleMessageError: (code: ClmmErrorCode, message: string, details?: Record<string, any>) => never;
|
|
2250
2378
|
|
|
2251
|
-
export { AMM_SWAP_MODULE, type AddLiquidityCommonParams, type AddLiquidityFixTokenParams, type AddLiquidityParams, type AddLiquidityWithPriceRangeParams, type AdjustResult, type BasePath, type BigNumber, type Bits, type CalculateAddLiquidityFixCoinWithPriceParams, type CalculateAddLiquidityResult, type CalculateAddLiquidityWithPriceParams, type CalculateCreatePoolResult, type CalculateCreatePoolWithPriceParams, type CalculateRatesParams, type CalculateRatesResult, CetusClmmSDK, type CetusConfigs, type ClmmConfig, ClmmError, type ClmmErrorCode, ClmmExpectSwapModule, ClmmFetcherModule, ClmmIntegratePoolModule, ClmmIntegratePoolV2Module, ClmmIntegratePoolV3Module, ClmmIntegrateRouterModule, ClmmIntegrateRouterWithPartnerModule, ClmmIntegrateUtilsModule, ClmmPartnerModule, type ClmmPoolConfig, ClmmPositionStatus, type ClmmpoolData, type ClosePositionParams, type CoinConfig, type CollectFeeParams, type CollectFeesQuote, type CollectRewarderParams, ConfigErrorCode, ConfigModule, type CreatePartnerEvent, type CreatePoolAddLiquidityParams, type CreatePoolAddLiquidityWithPriceParams, type CreatePoolAndAddLiquidityRowResult, type CreatePoolCustomRangeParams, type CreatePoolParams, type CustomRangeParams, DeepbookClobV2Module, DeepbookCustodianV2Module, DeepbookEndpointsV2Module, type FetchParams, type FetchPosFeeParams, type FetchPosRewardParams, type FullRangeParams, type LaunchpadPoolConfig, type NFT, type OpenPositionParams, type OpenPositionWithPriceParams, POOL_STRUCT, PartnerErrorCode, type Pool, PoolErrorCode, type PoolImmutables, PoolModule, type PoolTransactionInfo, type PosRewarderResult, type Position, PositionErrorCode, PositionModule, type
|
|
2379
|
+
export { AMM_SWAP_MODULE, type AddLiquidityCommonParams, type AddLiquidityFixTokenParams, type AddLiquidityParams, type AddLiquidityWithPriceRangeParams, type AdjustResult, BPS, type BasePath, type BigNumber, type Bits, type CalculateAddLiquidityFixCoinWithPriceParams, type CalculateAddLiquidityResult, type CalculateAddLiquidityWithPriceParams, type CalculateCreatePoolResult, type CalculateCreatePoolWithPriceParams, type CalculateRatesParams, type CalculateRatesResult, CetusClmmSDK, type CetusConfigs, type ClmmConfig, ClmmError, type ClmmErrorCode, ClmmExpectSwapModule, ClmmFetcherModule, ClmmIntegratePoolModule, ClmmIntegratePoolV2Module, ClmmIntegratePoolV3Module, ClmmIntegrateRouterModule, ClmmIntegrateRouterWithPartnerModule, ClmmIntegrateUtilsModule, ClmmPartnerModule, type ClmmPoolConfig, ClmmPositionStatus, type ClmmVestInfo, type ClmmpoolData, type ClosePositionParams, type CoinConfig, type CollectFeeParams, type CollectFeesQuote, type CollectRewarderParams, ConfigErrorCode, ConfigModule, type CreatePartnerEvent, type CreatePoolAddLiquidityParams, type CreatePoolAddLiquidityWithPriceParams, type CreatePoolAndAddLiquidityRowResult, type CreatePoolCustomRangeParams, type CreatePoolParams, type CustomRangeParams, DeepbookClobV2Module, DeepbookCustodianV2Module, DeepbookEndpointsV2Module, type FetchParams, type FetchPosFeeParams, type FetchPosRewardParams, type FullRangeParams, type GetPositionInfoListParams, type GetPositionVestOption, type GlobalVestingPeriod, type LaunchpadPoolConfig, type NFT, type OpenPositionParams, type OpenPositionWithPriceParams, POOL_STRUCT, PartnerErrorCode, type PeriodDetail, type Pool, PoolErrorCode, type PoolImmutables, type PoolLiquiditySnapshot, PoolModule, type PoolTransactionInfo, type PosRewarderResult, type Position, PositionErrorCode, type PositionInfo, PositionModule, type PositionSnapshot, type PositionTransactionInfo, PositionUtils, type PositionVesting, type PreSwapLpChangeParams, type PreSwapParams, type PreSwapWithMultiPoolParams, type RedeemOption, type RemoveLiquidityParams, type Rewarder, type RewarderAmountOwned, RewarderModule, RouterErrorCode, type SdkOptions, type SplitPath, type SuiBasicTypes, type SuiInputTypes, type SuiStructTag, type SuiTxArg, SwapErrorCode, type SwapGasEstimateArg, SwapModule, type SwapParams, type SwapResult, type SwapStepResult, SwapUtils, type Tick, type TickData, type TransPreSwapWithMultiPoolParams, TypesErrorCode, UtilsErrorCode, type VestConfigs, VestErrorCode, VestModule, VestUtils, buildClmmPositionName, buildPool, buildPoolTransactionInfo, buildPosition, buildPositionInfo, buildPositionTransactionInfo, buildTickData, buildTickDataByEvent, buildTransferCoin, buildTransferCoinToSender, clmmMainnet, clmmTestnet, computeSwap, computeSwapStep, CetusClmmSDK as default, estPoolAPR, type estPosAPRResult, estPositionAPRWithDeltaMethod, estPositionAPRWithMultiMethod, findAdjustCoin, getDefaultSuiInputType, getLowerSqrtPriceFromCoinA, getLowerSqrtPriceFromCoinB, getUpperSqrtPriceFromCoinA, getUpperSqrtPriceFromCoinB, handleError, handleMessageError, newBits, poolFilterEvenTypes, poolLiquiditySnapshotType, transClmmpoolDataWithoutTicks };
|