@cetusprotocol/sui-clmm-sdk 1.1.2 → 1.2.0

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.
@@ -51,6 +51,35 @@ const position_id = '0xfbf94213d59d285f66bacdb3d667a4db00b491af35887022e9197bb24
51
51
  const res = await sdk.Position.getPositionById(position_id)
52
52
  ```
53
53
 
54
+
55
+ ## 3. Get detailed position information
56
+
57
+ Use `sdk.Position.getPositionInfoList()` method.
58
+
59
+ This method retrieves the actual liquidity of impaired positions after trimming. For normal positions, the liquidity value obtained from `getPositionInfoList` is consistent with the liquidity value obtained from `getPositionList`.
60
+
61
+ ### Function Parameters
62
+
63
+ - `position_info_list`: An array of objects containing `position_handle` and `position_ids`.
64
+
65
+ ### Example
66
+
67
+ ```typescript
68
+ const pos_id = '0x59c5d04778b40c333fd....'
69
+ const pos = await sdk.Position.getPositionById(pos_id, false)
70
+ const pool = await sdk.Pool.getPool(pos.pool)
71
+ const parentId = pool.position_manager.positions_handle
72
+ const res = await sdk.Position.getPositionInfoList([
73
+ {
74
+ position_handle: parentId,
75
+ position_ids: [pos_id],
76
+ },
77
+ ])
78
+ ```
79
+
80
+
81
+
82
+
54
83
  ## 4. Batch get position fees
55
84
 
56
85
  Use `sdk.Position.batchFetchPositionFees()` method.
package/docs/utils.md CHANGED
@@ -42,7 +42,7 @@ const price = TickMath.tickIndexToPrice(tick_index, decimals_a, decimals_b)
42
42
  ```typescript
43
43
  import { TickMath } from '@cetusprotocol/common-sdk'
44
44
  // decimalsA and decimalsB means the decimal of coinA and coinB
45
- const price = TickMath.priceToTickIndex(tick_index, decimals_a, decimals_b)
45
+ const index = TickMath.priceToTickIndex(price, decimals_a, decimals_b)
46
46
  ```
47
47
 
48
48
  ## 3.Tick index to sqrt price x64
package/docs/vest.md ADDED
@@ -0,0 +1,103 @@
1
+ # Vest Module Documentation
2
+
3
+ This document provides an overview of the Vest module functionality in the Cetus SDK, which handles vesting-related operations for CLMM (Concentrated Liquidity Market Maker) positions.
4
+
5
+ ## Core Concepts
6
+
7
+ ### Vesting Information
8
+ The vesting system allows users to lock their liquidity positions for a specified period, earning rewards in return. The module provides various methods to interact with and manage these vesting positions.
9
+
10
+ ## API Methods
11
+
12
+ ### 1. Get CLMM Vest Info List
13
+ Retrieves a list of all vesting information for CLMM positions.
14
+
15
+ ```typescript
16
+ import { CetusClmmSDK } from '@cetusprotocol/clmm-sdk'
17
+
18
+ const sdk = CetusClmmSDK.createSDK({ env: 'mainnet' })
19
+ const vestInfoList = await sdk.Vest.getClmmVestInfoList()
20
+ ```
21
+
22
+ ### 2. Get CLMM Vest Info
23
+ Retrieves specific vesting information for a CLMM position.
24
+
25
+ ```typescript
26
+ const vestInfo = await sdk.Vest.getClmmVestInfo()
27
+ ```
28
+
29
+ ### 3. Get Pool Liquidity Snapshot
30
+ Retrieves liquidity snapshot information for a specific pool and its positions.
31
+
32
+ ```typescript
33
+ const poolSnapshot = await sdk.Pool.getPoolLiquiditySnapshot(pool_id)
34
+ const { remove_percent, snapshots } = poolSnapshot
35
+
36
+ // Get position snapshot
37
+ const posSnap = await sdk.Pool.getPositionSnapshot(snapshots.id, position_ids)
38
+ ```
39
+
40
+ ### 4. Get Position Vesting
41
+ Retrieves vesting information for specific positions in a pool.
42
+
43
+ ```typescript
44
+ const vestingList = await sdk.Vest.getPositionVesting([
45
+ {
46
+ clmm_position_ids: ['position_id_1', 'position_id_2'],
47
+ clmm_pool_id: 'pool_id',
48
+ coin_type_a: 'coin_type_a',
49
+ coin_type_b: 'coin_type_b'
50
+ }
51
+ ])
52
+ ```
53
+
54
+ ### 5. Redeem Vesting Position
55
+ Redeems a vested position to claim rewards.
56
+
57
+ ```typescript
58
+ const tx = sdk.Vest.buildRedeemPayload([
59
+ {
60
+ clmm_pool_id: pool.id,
61
+ clmm_position_id: position_id,
62
+ period: 0,
63
+ coin_type_a: pool.coin_type_a,
64
+ coin_type_b: pool.coin_type_b
65
+ }
66
+ ])
67
+
68
+ // Execute the transaction
69
+ const transferTxn = await sdk.FullClient.executeTx(keyPair, tx, false)
70
+ ```
71
+
72
+ ## Parameters
73
+
74
+ ### Vesting Position Parameters
75
+ - `clmm_pool_id`: The ID of the CLMM pool
76
+ - `clmm_position_ids`: Array of position IDs to check vesting status
77
+ - `coin_type_a`: Type of the first token in the pool
78
+ - `coin_type_b`: Type of the second token in the pool
79
+ - `period`: The vesting period (0 for immediate redemption)
80
+
81
+ ### Snapshot Parameters
82
+ - `pool_id`: The ID of the pool to get snapshot for
83
+ - `position_ids`: Array of position IDs to get snapshot for
84
+ - `remove_percent`: Percentage of liquidity removed
85
+ - `snapshots`: Snapshot information containing position details
86
+
87
+ ## Notes
88
+
89
+ 1. **Vesting Period**
90
+ - Positions can be vested for different periods
91
+ - Rewards are typically proportional to the vesting period
92
+
93
+ 2. **Redemption**
94
+ - Positions can be redeemed after the vesting period
95
+ - Rewards are distributed upon redemption
96
+
97
+ 3. **Pool Snapshots**
98
+ - Snapshots track liquidity changes in pools
99
+ - Used to calculate rewards and vesting status
100
+
101
+ 4. **Position Management**
102
+ - Multiple positions can be managed simultaneously
103
+ - Each position can have different vesting parameters
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/sui-clmm-sdk",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "SDK for cetus clmm",
5
5
  "typings": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
@@ -31,7 +31,6 @@
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@cetusprotocol/common-sdk": "*",
34
- "@mysten/bcs": "^1.5.0",
35
- "@mysten/sui": "^1.24.0"
34
+ "@mysten/sui": "*"
36
35
  }
37
36
  }