@cetusprotocol/burn-sdk 1.0.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.
- package/.turbo/turbo-build.log +10682 -0
- package/README.md +275 -0
- package/dist/index.d.mts +154 -0
- package/dist/index.d.ts +154 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +36 -0
- package/src/config/index.ts +2 -0
- package/src/config/mainnet.ts +18 -0
- package/src/config/testnet.ts +18 -0
- package/src/errors/errors.ts +27 -0
- package/src/index.ts +8 -0
- package/src/modules/burnModule.ts +365 -0
- package/src/modules/index.ts +1 -0
- package/src/sdk.ts +50 -0
- package/src/types/burn.ts +38 -0
- package/src/types/index.ts +1 -0
- package/src/utils/burn.ts +26 -0
- package/src/utils/index.ts +1 -0
- package/tests/burn.test.ts +90 -0
- package/tests/tsconfig.json +26 -0
- package/tsconfig.json +5 -0
- package/tsup.config.ts +9 -0
package/README.md
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# @cetusprotocol/burn-sdk
|
|
2
|
+
|
|
3
|
+
The primary functionality of this project, referred to as "`LP Burn`," is designed for users who wish to permanently lock their liquidity positions. Once locked, the liquidity within these positions cannot be withdrawn; however, users can still claim any transaction fees and mining rewards generated from these positions. This locking mechanism is implemented by wrapping the original position, effectively sealing the liquidity while still allowing the accrual of rewards.
|
|
4
|
+
|
|
5
|
+
The `Burn SDK` is specifically tailored for projects that have established liquidity pools and wish to relinquish their liquidity rights. This feature enables these projects to demonstrate commitment to their community and ecosystem by permanently locking liquidity, thereby enhancing stability and fostering trust in the longevity of the liquidity pool.
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
## How to Use the Burn SDK ?
|
|
10
|
+
|
|
11
|
+
### Installation
|
|
12
|
+
|
|
13
|
+
To start using the `Burn SDK`, you first need to install it in your TypeScript project. You can add it using npm, yarn, or bun:
|
|
14
|
+
|
|
15
|
+
npm link: https://www.npmjs.com/package/@cetusprotocol/burn-sdk
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @cetusprotocol/burn-sdk
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Setup
|
|
22
|
+
|
|
23
|
+
Import the SDK into the TypeScript file where you intend to use it:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { CetusBurnSDK } from '@cetusprotocol/burn-sdk'
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Initializing the SDK
|
|
30
|
+
|
|
31
|
+
Initialize the SDK with the required configuration parameters. This typically includes setting up the network and API keys, if needed.
|
|
32
|
+
|
|
33
|
+
If you would like to use the mainnet network and the official Sui rpc url, you can do so as follows:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
const sdk = CetusBurnSDK.createSDK()
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
If you wish to set your own full node URL or network (You have the option to select either 'mainnet' or 'testnet' for the network), you can do so as follows:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
const env = 'mainnet'
|
|
43
|
+
const full_rpc_url = 'YOUR_FULL_NODE_URL'
|
|
44
|
+
const wallet = 'YOUR_WALLET_ADDRESS'
|
|
45
|
+
|
|
46
|
+
const sdk = CetusBurnSDK.createSDK({ env })
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
If you wish to set your own full node URL or SuiClient, you can do so as follows:
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
const sdk = CetusBurnSDK.createSDK({ env, sui_client })
|
|
53
|
+
// or
|
|
54
|
+
const sdk = CetusBurnSDK.createSDK({ env, full_rpc_url })
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
After linking your wallet, if you need use your wallet address to do something, you should set it by `sdk.setSenderAddress`.
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
const wallet = 'YOUR_WALLET_ADDRESS'
|
|
63
|
+
sdk.setSenderAddress(wallet)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 1. getBurnPoolList
|
|
67
|
+
|
|
68
|
+
This method retrieves a list of existing burn pools by calling `sdk.Burn.getBurnPoolList()`, then prints the result.
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
const pool_ids = await sdk.Burn.getBurnPoolList()
|
|
72
|
+
|
|
73
|
+
// result:
|
|
74
|
+
pool_ids: [
|
|
75
|
+
'0x2dea79f17e61f8d02ff02ed75510283...',
|
|
76
|
+
'0x6fd4915e6d8d3e2ba6d81787046eb94...',
|
|
77
|
+
'0xc41621d02d5ee00a7a993b912a8550d...',
|
|
78
|
+
'0xaccdd1c40fdd6abf168def70044a565...',
|
|
79
|
+
'0xc10e379b4658d455ee4b8656213c715...',
|
|
80
|
+
'0x1861771ab3b7f0f6a4252e1c60ed270...',
|
|
81
|
+
'0x1b9b4f2271bc69df97ddafcb3f64599...',
|
|
82
|
+
'0x473ab0306ff8952d473b10bb4c3516c...',
|
|
83
|
+
'0x3a61bd98686e4aa6213fb5b3b535645...',
|
|
84
|
+
]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 2. getPoolBurnPositionList
|
|
88
|
+
|
|
89
|
+
This method fetches a list of burn positions for a specified pool ID by calling the `sdk.Burn.getPoolBurnPositionList(pool_id)`, then prints the result.
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
const pool_id = '0x...'
|
|
93
|
+
const position_ids = await sdk.Burn.getPoolBurnPositionList(pool_id)
|
|
94
|
+
// result:
|
|
95
|
+
position_ids: [{
|
|
96
|
+
id: '0x88678e4cd2681bf41b7f2afdd49c15...',
|
|
97
|
+
url: 'https://bq7bkvdje7gvgmv66hrxdy7wx5h5ggtrrnmt66rdkkehb64rvz3q.arweave.net/DD4VVGknzVMyvvHj...',
|
|
98
|
+
pool_id: '0xc41621d02d5ee00a7a993b912a8550d...',
|
|
99
|
+
coin_type_a: '0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC',
|
|
100
|
+
coin_type_b: '0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::cetus::CETUS',
|
|
101
|
+
description: 'Cetus Liquidity Position',
|
|
102
|
+
name: 'Cetus Burned LP | Pool9-115',
|
|
103
|
+
liquidity: '19387676',
|
|
104
|
+
clmm_position_id: '0x092f07a470479f86927fe161a53074b...',
|
|
105
|
+
clmm_pool_id: '0xc41621d02d5ee00a7a993b912a8550d...',
|
|
106
|
+
tick_lower_index: -443580,
|
|
107
|
+
tick_upper_index: 443580,
|
|
108
|
+
index: '115',
|
|
109
|
+
is_lp_burn: true
|
|
110
|
+
},...]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 3. getBurnPositionList
|
|
114
|
+
|
|
115
|
+
This method fetches a list of burn positions for a specified account by calling the `sdk.Burn.getBurnPositionList(account_address)` method.
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
const account_address = '0x...'
|
|
119
|
+
const position_ids = await sdk.Burn.getBurnPositionList(account_address)
|
|
120
|
+
// result:
|
|
121
|
+
positionIds: ['0x1b9b4f2271bc69df97ddafcb3f645...']
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 4. getBurnPosition
|
|
125
|
+
|
|
126
|
+
This method obtains detailed information about a specific burn position by calling the `sdk.Burn.getBurnPosition(pos_id)` method, where pos_id is the specified burn position ID, and prints the result.
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
const pos_id = '0x...'
|
|
130
|
+
const position_info = await sdk.Burn.getBurnPosition(pos_id)
|
|
131
|
+
|
|
132
|
+
// result:
|
|
133
|
+
position_info: {
|
|
134
|
+
id: '0x88678e4cd2681bf41b7f2afdd49c15...',
|
|
135
|
+
url: 'https://bq7bkvdje7gvgmv66hrxdy7wx5h5ggtrrnmt66rdkkehb64rvz3q.arweave.net/DD4VVGknzVMyvvHj...',
|
|
136
|
+
pool_id: '0xc41621d02d5ee00a7a993b912a8550...',
|
|
137
|
+
coin_type_a: '0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC',
|
|
138
|
+
coin_type_b: '0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::cetus::CETUS',
|
|
139
|
+
description: 'Cetus Liquidity Position',
|
|
140
|
+
name: 'Cetus Burned LP | Pool9-115',
|
|
141
|
+
liquidity: '19387676',
|
|
142
|
+
clmm_position_id: '0x092f07a470479f86927fe161a5307...',
|
|
143
|
+
clmm_pool_id: '0xc41621d02d5ee00a7a993b912a8550...',
|
|
144
|
+
tick_lower_index: -443580,
|
|
145
|
+
tick_upper_index: 443580,
|
|
146
|
+
index: '115',
|
|
147
|
+
is_lp_burn: true
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 5. burn lock
|
|
152
|
+
|
|
153
|
+
This method creates a transaction builder for a burn lock transaction.
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
const pool_id = '0xc41621d02d5ee00a7a993b912a8550...'
|
|
157
|
+
const pos_id = '0x4e1970683fc49de834478339724509a05...' // is burn success
|
|
158
|
+
const coin_type_a = '26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC'
|
|
159
|
+
const coin_type_b = '26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::cetus::CETUS'
|
|
160
|
+
const txb = await sdk.Burn.createBurnPayload({
|
|
161
|
+
pool_id,
|
|
162
|
+
pos_id,
|
|
163
|
+
coin_type_a,
|
|
164
|
+
coin_type_b,
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
const simulate_res = await sdk.FullClient.devInspectTransactionBlock({
|
|
168
|
+
transactionBlock: txb,
|
|
169
|
+
sender: account,
|
|
170
|
+
})
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### 6. claim
|
|
174
|
+
|
|
175
|
+
This method creates a transaction builder for fee collection.
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
const pool_id = '0xc41621d02d5ee00a7a993b912a8550df...'
|
|
179
|
+
const pos_id = '0x2f10a5816747fd02218dd7a3a7d0417d28...' // is wrap pos id
|
|
180
|
+
const coin_type_a = '26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC'
|
|
181
|
+
const coin_type_b = '26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::cetus::CETUS'
|
|
182
|
+
|
|
183
|
+
const rewarder_coin_types = ['0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::cetus::CETUS']
|
|
184
|
+
let tx = sdk.Burn.createCollectFeePayload({
|
|
185
|
+
pool_id,
|
|
186
|
+
pos_id,
|
|
187
|
+
coin_type_a,
|
|
188
|
+
coin_type_b,
|
|
189
|
+
account,
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
tx = sdk.Burn.crateCollectRewardPayload({
|
|
193
|
+
pool_id,
|
|
194
|
+
pos_id,
|
|
195
|
+
coin_type_a,
|
|
196
|
+
coin_type_b,
|
|
197
|
+
rewarder_coin_types,
|
|
198
|
+
account,
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
const simulate_res = await sdk.FullClient.devInspectTransactionBlock({
|
|
202
|
+
transactionBlock: txb,
|
|
203
|
+
sender: account,
|
|
204
|
+
})
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### 7. batch claim
|
|
208
|
+
|
|
209
|
+
This method creates a transaction builder for batch fee collection.
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
const pool_id = '0xc41621d02d5ee00a7a993b912a855...'
|
|
213
|
+
const pos_id = '0x2f10a5816747fd02218dd7a3a7d0417d...' // is wrap pos id
|
|
214
|
+
const coin_type_a = '26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC'
|
|
215
|
+
const coin_type_b = '26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::cetus::CETUS'
|
|
216
|
+
|
|
217
|
+
const rewarder_coin_types = ['0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::cetus::CETUS']
|
|
218
|
+
let tx = sdk.Burn.createCollectFeesPayload([{
|
|
219
|
+
pool_id,
|
|
220
|
+
pos_id,
|
|
221
|
+
coin_type_a,
|
|
222
|
+
coin_type_b,
|
|
223
|
+
account,
|
|
224
|
+
}, ...])
|
|
225
|
+
|
|
226
|
+
tx = sdk.Burn.crateCollectRewardsPayload([{
|
|
227
|
+
pool_id,
|
|
228
|
+
pos_id,
|
|
229
|
+
coin_type_a,
|
|
230
|
+
coin_type_b,
|
|
231
|
+
rewarder_coin_types,
|
|
232
|
+
account,
|
|
233
|
+
}, ...])
|
|
234
|
+
|
|
235
|
+
const simulate_res = await sdk.FullClient.devInspectTransactionBlock({
|
|
236
|
+
transactionBlock: txb,
|
|
237
|
+
sender: account,
|
|
238
|
+
})
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### 8. burn LP position
|
|
242
|
+
|
|
243
|
+
When the position is burned, a CetusLPBurnProof will be returned. Compared to the `burn_lp` function, this V2 version does not require the pool object as a parameter, making it more convenient to use. The function will automatically verify the position's validity through the position object itself. This design also enables users to create a pool, add liquidity, and burn the position all within a single transaction.
|
|
244
|
+
|
|
245
|
+
```typescript
|
|
246
|
+
const pos_id = '0x4e1970683fc49de834478339724509...' // is burn success
|
|
247
|
+
const txb = await sdk.Burn.createBurnLPV2Payload(pos_id)
|
|
248
|
+
|
|
249
|
+
const simulate_res = await sdk.FullClient.devInspectTransactionBlock({
|
|
250
|
+
transactionBlock: txb,
|
|
251
|
+
sender: account,
|
|
252
|
+
})
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
# Contract Error Codes
|
|
256
|
+
|
|
257
|
+
the Cetus smart contract may return the following error codes:
|
|
258
|
+
|
|
259
|
+
| Module | Error Code | Description | Contract Methods |
|
|
260
|
+
| ------- | ---------- | -------------------------------------------------------------------------- | ---------------------------- |
|
|
261
|
+
| lp_burn | 1 | The version of the contract has been deprecated | The vast majority of methods |
|
|
262
|
+
| lp_burn | 2 | The current liquidity position does not fully cover the entire price range | burn_lp_v2 |
|
|
263
|
+
| lp_burn | 3 | The current liquidity position does not belong to this pool | burn_lp |
|
|
264
|
+
|
|
265
|
+
# More About Cetus
|
|
266
|
+
|
|
267
|
+
Use the following links to learn more about Cetus:
|
|
268
|
+
|
|
269
|
+
Learn more about working with Cetus in the [Cetus Documentation](https://cetus-1.gitbook.io/cetus-docs).
|
|
270
|
+
|
|
271
|
+
Join the Cetus community on [Cetus Discord](https://discord.com/channels/1009749448022315008/1009751382783447072).
|
|
272
|
+
|
|
273
|
+
## License
|
|
274
|
+
|
|
275
|
+
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { CoinPairType, IModule, SdkWrapper, BaseSdkOptions, Package } from '@cetusprotocol/common-sdk';
|
|
2
|
+
import { TransactionObjectArgument, Transaction } from '@mysten/sui/transactions';
|
|
3
|
+
|
|
4
|
+
type BurnConfigs = {
|
|
5
|
+
manager_id: string;
|
|
6
|
+
clmm_global_config: string;
|
|
7
|
+
clmm_global_vault_id: string;
|
|
8
|
+
burn_pool_handle: string;
|
|
9
|
+
};
|
|
10
|
+
type BurnPositionNFT = {
|
|
11
|
+
id: string;
|
|
12
|
+
url: string;
|
|
13
|
+
pool_id: string;
|
|
14
|
+
description: string;
|
|
15
|
+
name: string;
|
|
16
|
+
liquidity: string;
|
|
17
|
+
clmm_position_id: string;
|
|
18
|
+
clmm_pool_id: string;
|
|
19
|
+
tick_lower_index: number;
|
|
20
|
+
tick_upper_index: number;
|
|
21
|
+
index: number;
|
|
22
|
+
is_lp_burn: boolean;
|
|
23
|
+
} & CoinPairType;
|
|
24
|
+
type CommonParams = {
|
|
25
|
+
pool_id: string;
|
|
26
|
+
pos_id: string | TransactionObjectArgument;
|
|
27
|
+
} & CoinPairType;
|
|
28
|
+
type BurnParams = CommonParams;
|
|
29
|
+
type CollectFeeParams = CommonParams & {
|
|
30
|
+
account: string;
|
|
31
|
+
};
|
|
32
|
+
type CollectRewardParams = CommonParams & {
|
|
33
|
+
rewarder_coin_types: string[];
|
|
34
|
+
account: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
declare class BurnModule implements IModule<CetusBurnSDK> {
|
|
38
|
+
protected _sdk: CetusBurnSDK;
|
|
39
|
+
constructor(sdk: CetusBurnSDK);
|
|
40
|
+
get sdk(): CetusBurnSDK;
|
|
41
|
+
/**
|
|
42
|
+
* @description Get the list of pools that have been burned.
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
getBurnPoolList(): Promise<any[] | undefined>;
|
|
46
|
+
/**
|
|
47
|
+
* @description Get the position handle for a given pool.
|
|
48
|
+
* @param pool_id - The pool ID.
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
private getPositionHandle;
|
|
52
|
+
/**
|
|
53
|
+
* @description Get the list of burned positions for a given pool.
|
|
54
|
+
* @param pool_id - The pool ID.
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
getPoolBurnPositionList(pool_id: string): Promise<BurnPositionNFT[] | undefined>;
|
|
58
|
+
/**
|
|
59
|
+
* @description Get the list of burned positions for a given account.
|
|
60
|
+
* @param account_address - The account address.
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
getBurnPositionList(account_address: string): Promise<BurnPositionNFT[] | undefined>;
|
|
64
|
+
/**
|
|
65
|
+
* @description Get the burned position information for a given position ID.
|
|
66
|
+
* @param pos_id - The position ID.
|
|
67
|
+
* @returns
|
|
68
|
+
*/
|
|
69
|
+
getBurnPosition(pos_id: string): Promise<BurnPositionNFT | null | undefined>;
|
|
70
|
+
/**
|
|
71
|
+
* @description Create a burn payload for a given pool and position.
|
|
72
|
+
* @param params - The burn parameters.
|
|
73
|
+
* @param tx - The transaction object.
|
|
74
|
+
* @returns
|
|
75
|
+
*/
|
|
76
|
+
createBurnPayload(params: BurnParams, tx?: Transaction): Transaction;
|
|
77
|
+
/**
|
|
78
|
+
* When the position is burned, a CetusLPBurnProof will be returned. Compared to the burn_lp function,
|
|
79
|
+
* this V2 version does not require the pool object as a parameter, making it more convenient to use.
|
|
80
|
+
* The function will automatically verify the position's validity through the position object itself.
|
|
81
|
+
* This design also allows users to create a pool, add liquidity, and burn the position all within one transaction.
|
|
82
|
+
*
|
|
83
|
+
* @param {string | TransactionObjectArgument} pos - The LP position to be burned,
|
|
84
|
+
* either as an object argument or its ID (string).
|
|
85
|
+
* @param {Transaction} [tx] - An optional `Transaction` object; if not provided, a new one is created.
|
|
86
|
+
* @returns {CetusLPBurnProof} - The CetusLPBurnProof object ID .
|
|
87
|
+
*/
|
|
88
|
+
createBurnLPV2Payload(pos: string | TransactionObjectArgument, tx?: Transaction): TransactionObjectArgument;
|
|
89
|
+
/**
|
|
90
|
+
* @description Create a collect fee payload for a given pool and position.
|
|
91
|
+
* @param params - The collect fee parameters.
|
|
92
|
+
* @param tx - The transaction object.
|
|
93
|
+
* @returns
|
|
94
|
+
*/
|
|
95
|
+
createCollectFeePayload(params: CollectFeeParams, tx?: Transaction): Transaction;
|
|
96
|
+
/**
|
|
97
|
+
* @description Create a collect reward payload for a given pool and position.
|
|
98
|
+
* @param params - The collect reward parameters.
|
|
99
|
+
* @param tx - The transaction object.
|
|
100
|
+
* @returns
|
|
101
|
+
*/
|
|
102
|
+
crateCollectRewardPayload(params: CollectRewardParams, tx?: Transaction): Transaction;
|
|
103
|
+
/**
|
|
104
|
+
* @description Create a collect fee payload for a given pool and position.
|
|
105
|
+
* @param params - The collect fee parameters.
|
|
106
|
+
* @param tx - The transaction object.
|
|
107
|
+
* @returns
|
|
108
|
+
*/
|
|
109
|
+
createCollectFeesPayload(params: CollectFeeParams[], tx?: Transaction): Transaction;
|
|
110
|
+
/**
|
|
111
|
+
* @description Create a collect reward payload for a given pool and position.
|
|
112
|
+
* @param params - The collect reward parameters.
|
|
113
|
+
* @param tx - The transaction object.
|
|
114
|
+
* @returns
|
|
115
|
+
*/
|
|
116
|
+
crateCollectRewardsPayload(params: CollectRewardParams[], tx?: Transaction): Transaction;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Represents options and configurations for an SDK.
|
|
121
|
+
*/
|
|
122
|
+
interface SdkOptions extends BaseSdkOptions {
|
|
123
|
+
burn: Package<BurnConfigs>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The entry class of CetusDcaSDK, which is almost responsible for all interactions with dca.
|
|
127
|
+
*/
|
|
128
|
+
declare class CetusBurnSDK extends SdkWrapper<SdkOptions> {
|
|
129
|
+
protected _burn: BurnModule;
|
|
130
|
+
constructor(options: SdkOptions);
|
|
131
|
+
get Burn(): BurnModule;
|
|
132
|
+
/**
|
|
133
|
+
* Static factory method to initialize the SDK
|
|
134
|
+
* @param options SDK initialization options
|
|
135
|
+
* @returns An instance of CetusBurnDK
|
|
136
|
+
*/
|
|
137
|
+
static createSDK(options: BaseSdkOptions): CetusBurnSDK;
|
|
138
|
+
/**
|
|
139
|
+
* Create a custom SDK instance with the given options
|
|
140
|
+
* @param options The options for the SDK
|
|
141
|
+
* @returns An instance of CetusBurnSDK
|
|
142
|
+
*/
|
|
143
|
+
static createCustomSDK<T extends BaseSdkOptions>(options: T & SdkOptions): CetusBurnSDK;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
declare class BurnUtils {
|
|
147
|
+
static buildBurnPositionNFT(fields: any): BurnPositionNFT;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
declare const burnMainnet: SdkOptions;
|
|
151
|
+
|
|
152
|
+
declare const burnTestnet: SdkOptions;
|
|
153
|
+
|
|
154
|
+
export { type BurnConfigs, BurnModule, type BurnParams, type BurnPositionNFT, BurnUtils, CetusBurnSDK, type CollectFeeParams, type CollectRewardParams, type SdkOptions, burnMainnet, burnTestnet, CetusBurnSDK as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { CoinPairType, IModule, SdkWrapper, BaseSdkOptions, Package } from '@cetusprotocol/common-sdk';
|
|
2
|
+
import { TransactionObjectArgument, Transaction } from '@mysten/sui/transactions';
|
|
3
|
+
|
|
4
|
+
type BurnConfigs = {
|
|
5
|
+
manager_id: string;
|
|
6
|
+
clmm_global_config: string;
|
|
7
|
+
clmm_global_vault_id: string;
|
|
8
|
+
burn_pool_handle: string;
|
|
9
|
+
};
|
|
10
|
+
type BurnPositionNFT = {
|
|
11
|
+
id: string;
|
|
12
|
+
url: string;
|
|
13
|
+
pool_id: string;
|
|
14
|
+
description: string;
|
|
15
|
+
name: string;
|
|
16
|
+
liquidity: string;
|
|
17
|
+
clmm_position_id: string;
|
|
18
|
+
clmm_pool_id: string;
|
|
19
|
+
tick_lower_index: number;
|
|
20
|
+
tick_upper_index: number;
|
|
21
|
+
index: number;
|
|
22
|
+
is_lp_burn: boolean;
|
|
23
|
+
} & CoinPairType;
|
|
24
|
+
type CommonParams = {
|
|
25
|
+
pool_id: string;
|
|
26
|
+
pos_id: string | TransactionObjectArgument;
|
|
27
|
+
} & CoinPairType;
|
|
28
|
+
type BurnParams = CommonParams;
|
|
29
|
+
type CollectFeeParams = CommonParams & {
|
|
30
|
+
account: string;
|
|
31
|
+
};
|
|
32
|
+
type CollectRewardParams = CommonParams & {
|
|
33
|
+
rewarder_coin_types: string[];
|
|
34
|
+
account: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
declare class BurnModule implements IModule<CetusBurnSDK> {
|
|
38
|
+
protected _sdk: CetusBurnSDK;
|
|
39
|
+
constructor(sdk: CetusBurnSDK);
|
|
40
|
+
get sdk(): CetusBurnSDK;
|
|
41
|
+
/**
|
|
42
|
+
* @description Get the list of pools that have been burned.
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
getBurnPoolList(): Promise<any[] | undefined>;
|
|
46
|
+
/**
|
|
47
|
+
* @description Get the position handle for a given pool.
|
|
48
|
+
* @param pool_id - The pool ID.
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
private getPositionHandle;
|
|
52
|
+
/**
|
|
53
|
+
* @description Get the list of burned positions for a given pool.
|
|
54
|
+
* @param pool_id - The pool ID.
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
getPoolBurnPositionList(pool_id: string): Promise<BurnPositionNFT[] | undefined>;
|
|
58
|
+
/**
|
|
59
|
+
* @description Get the list of burned positions for a given account.
|
|
60
|
+
* @param account_address - The account address.
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
getBurnPositionList(account_address: string): Promise<BurnPositionNFT[] | undefined>;
|
|
64
|
+
/**
|
|
65
|
+
* @description Get the burned position information for a given position ID.
|
|
66
|
+
* @param pos_id - The position ID.
|
|
67
|
+
* @returns
|
|
68
|
+
*/
|
|
69
|
+
getBurnPosition(pos_id: string): Promise<BurnPositionNFT | null | undefined>;
|
|
70
|
+
/**
|
|
71
|
+
* @description Create a burn payload for a given pool and position.
|
|
72
|
+
* @param params - The burn parameters.
|
|
73
|
+
* @param tx - The transaction object.
|
|
74
|
+
* @returns
|
|
75
|
+
*/
|
|
76
|
+
createBurnPayload(params: BurnParams, tx?: Transaction): Transaction;
|
|
77
|
+
/**
|
|
78
|
+
* When the position is burned, a CetusLPBurnProof will be returned. Compared to the burn_lp function,
|
|
79
|
+
* this V2 version does not require the pool object as a parameter, making it more convenient to use.
|
|
80
|
+
* The function will automatically verify the position's validity through the position object itself.
|
|
81
|
+
* This design also allows users to create a pool, add liquidity, and burn the position all within one transaction.
|
|
82
|
+
*
|
|
83
|
+
* @param {string | TransactionObjectArgument} pos - The LP position to be burned,
|
|
84
|
+
* either as an object argument or its ID (string).
|
|
85
|
+
* @param {Transaction} [tx] - An optional `Transaction` object; if not provided, a new one is created.
|
|
86
|
+
* @returns {CetusLPBurnProof} - The CetusLPBurnProof object ID .
|
|
87
|
+
*/
|
|
88
|
+
createBurnLPV2Payload(pos: string | TransactionObjectArgument, tx?: Transaction): TransactionObjectArgument;
|
|
89
|
+
/**
|
|
90
|
+
* @description Create a collect fee payload for a given pool and position.
|
|
91
|
+
* @param params - The collect fee parameters.
|
|
92
|
+
* @param tx - The transaction object.
|
|
93
|
+
* @returns
|
|
94
|
+
*/
|
|
95
|
+
createCollectFeePayload(params: CollectFeeParams, tx?: Transaction): Transaction;
|
|
96
|
+
/**
|
|
97
|
+
* @description Create a collect reward payload for a given pool and position.
|
|
98
|
+
* @param params - The collect reward parameters.
|
|
99
|
+
* @param tx - The transaction object.
|
|
100
|
+
* @returns
|
|
101
|
+
*/
|
|
102
|
+
crateCollectRewardPayload(params: CollectRewardParams, tx?: Transaction): Transaction;
|
|
103
|
+
/**
|
|
104
|
+
* @description Create a collect fee payload for a given pool and position.
|
|
105
|
+
* @param params - The collect fee parameters.
|
|
106
|
+
* @param tx - The transaction object.
|
|
107
|
+
* @returns
|
|
108
|
+
*/
|
|
109
|
+
createCollectFeesPayload(params: CollectFeeParams[], tx?: Transaction): Transaction;
|
|
110
|
+
/**
|
|
111
|
+
* @description Create a collect reward payload for a given pool and position.
|
|
112
|
+
* @param params - The collect reward parameters.
|
|
113
|
+
* @param tx - The transaction object.
|
|
114
|
+
* @returns
|
|
115
|
+
*/
|
|
116
|
+
crateCollectRewardsPayload(params: CollectRewardParams[], tx?: Transaction): Transaction;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Represents options and configurations for an SDK.
|
|
121
|
+
*/
|
|
122
|
+
interface SdkOptions extends BaseSdkOptions {
|
|
123
|
+
burn: Package<BurnConfigs>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The entry class of CetusDcaSDK, which is almost responsible for all interactions with dca.
|
|
127
|
+
*/
|
|
128
|
+
declare class CetusBurnSDK extends SdkWrapper<SdkOptions> {
|
|
129
|
+
protected _burn: BurnModule;
|
|
130
|
+
constructor(options: SdkOptions);
|
|
131
|
+
get Burn(): BurnModule;
|
|
132
|
+
/**
|
|
133
|
+
* Static factory method to initialize the SDK
|
|
134
|
+
* @param options SDK initialization options
|
|
135
|
+
* @returns An instance of CetusBurnDK
|
|
136
|
+
*/
|
|
137
|
+
static createSDK(options: BaseSdkOptions): CetusBurnSDK;
|
|
138
|
+
/**
|
|
139
|
+
* Create a custom SDK instance with the given options
|
|
140
|
+
* @param options The options for the SDK
|
|
141
|
+
* @returns An instance of CetusBurnSDK
|
|
142
|
+
*/
|
|
143
|
+
static createCustomSDK<T extends BaseSdkOptions>(options: T & SdkOptions): CetusBurnSDK;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
declare class BurnUtils {
|
|
147
|
+
static buildBurnPositionNFT(fields: any): BurnPositionNFT;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
declare const burnMainnet: SdkOptions;
|
|
151
|
+
|
|
152
|
+
declare const burnTestnet: SdkOptions;
|
|
153
|
+
|
|
154
|
+
export { type BurnConfigs, BurnModule, type BurnParams, type BurnPositionNFT, BurnUtils, CetusBurnSDK, type CollectFeeParams, type CollectRewardParams, type SdkOptions, burnMainnet, burnTestnet, CetusBurnSDK as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var P=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var v=(a,t)=>{for(var e in t)P(a,e,{get:t[e],enumerable:!0})},I=(a,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of E(t))!A.call(a,n)&&n!==e&&P(a,n,{get:()=>t[n],enumerable:!(o=S(t,n))||o.enumerable});return a};var D=a=>I(P({},"__esModule",{value:!0}),a);var R={};v(R,{BurnModule:()=>m,BurnUtils:()=>b,CetusBurnSDK:()=>g,burnMainnet:()=>h,burnTestnet:()=>k,default:()=>F});module.exports=D(R);var T=require("@cetusprotocol/common-sdk");var w=require("@cetusprotocol/common-sdk"),h={env:"mainnet",full_rpc_url:w.FullRpcUrlMainnet,burn:{package_id:"0x12d73de9a6bc3cb658ec9dc0fe7de2662be1cea5c76c092fcc3606048cdbac27",published_at:"0xb977b00649d3ab8950bcbbafb01fcf32e2e7718eb3133eff2e48c0cef04b1495",config:{manager_id:"0x1d94aa32518d0cb00f9de6ed60d450c9a2090761f326752ffad06b2e9404f845",clmm_global_config:"0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f",clmm_global_vault_id:"0xce7bceef26d3ad1f6d9b6f13a953f053e6ed3ca77907516481ce99ae8e588f2b",burn_pool_handle:"0xc9aacf74bd7cc8da8820ae28ca4473b7e01c87be19bc35bf81c9c7311e1b299e"}}};var C=require("@cetusprotocol/common-sdk"),k={env:"testnet",full_rpc_url:C.FullRpcUrlTestnet,burn:{package_id:"0x3b494006831b046481c8046910106e2dfbe0d1fa9bc01e41783fb3ff6534ed3a",published_at:"0xaf89f8215c5b07eaac8b77c7745ce62f94cb76ef4bcb854e283f644c519ef43e",config:{manager_id:"0xd04529ef15b7dad6699ee905daca0698858cab49724b2b2a1fc6b1ebc5e474ef",clmm_global_config:"0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e",clmm_global_vault_id:"0xf78d2ee3c312f298882cb680695e5e8c81b1d441a646caccc058006c2851ddea",burn_pool_handle:"0x20262dac8853ab8f63c98e0b17bfb1c758efc33d0092ac3c5f204dfb7ba81ac5"}}};var p=require("@mysten/sui/transactions"),s=require("@cetusprotocol/common-sdk");var B=require("@cetusprotocol/common-sdk");var y=class extends B.BaseError{constructor(t,e,o){super(t,e||"UnknownError",o)}static isBurnErrorCode(t,e){return this.isErrorCode(t,e)}},u=(a,t,e)=>{throw t instanceof Error?new y(t.message,a,e):new y(t,a,e)};var f=require("@cetusprotocol/common-sdk"),b=class{static buildBurnPositionNFT(t){let e=t.position.fields,o=`Cetus Burned LP | Pool${e.name.split("Pool")?.[1]}`;return{id:t.id.id,url:e.url,pool_id:e.pool,coin_type_a:(0,f.extractStructTagFromType)(e.coin_type_a.fields.name).full_address,coin_type_b:(0,f.extractStructTagFromType)(e.coin_type_b.fields.name).full_address,description:e.description,name:o,liquidity:e.liquidity,clmm_position_id:e.id.id,clmm_pool_id:e.pool,tick_lower_index:(0,f.asIntN)(BigInt(e.tick_lower_index.fields.bits)),tick_upper_index:(0,f.asIntN)(BigInt(e.tick_upper_index.fields.bits)),index:e.index,is_lp_burn:!0}}};var m=class{constructor(t){this._sdk=t}get sdk(){return this._sdk}async getBurnPoolList(){try{let{burn:t}=this._sdk.sdkOptions,{manager_id:e}=(0,s.getPackagerConfigs)(t),n=(await this._sdk.FullClient.getObject({id:e,options:{showType:!0,showContent:!0}}))?.data?.content?.fields?.position?.fields?.id?.id;return(await this._sdk.FullClient.getDynamicFieldsByPage(n))?.data?.map(d=>d?.name?.value)}catch(t){console.log("getBurnPoolList ~ error:",t),u("FetchError",t,{[s.DETAILS_KEYS.METHOD_NAME]:"getBurnPoolList"})}}async getPositionHandle(t){let{burn:e}=this._sdk.sdkOptions,{burn_pool_handle:o}=(0,s.getPackagerConfigs)(e),n=`getPosHandle_${t}`,r=this._sdk.getCache(n);if(r)return r;try{return r=(await this._sdk.FullClient.getDynamicFieldObject({parentId:o,name:{type:"0x2::object::ID",value:t}})).data.content.fields.value.fields.id.id,r&&this._sdk.updateCache(n,r),r}catch(i){u("InvalidPoolId",i,{[s.DETAILS_KEYS.METHOD_NAME]:"getPositionHandle",[s.DETAILS_KEYS.REQUEST_PARAMS]:{pool_id:t}})}}async getPoolBurnPositionList(t){try{let e=await this.getPositionHandle(t);e===void 0&&u("InvalidPoolId",`${t} is a invalid pool id, please check it and try another valid pool id`,{[s.DETAILS_KEYS.METHOD_NAME]:"getPositionHandle",[s.DETAILS_KEYS.REQUEST_PARAMS]:{pool_id:t}});let n=(await this._sdk.FullClient.getDynamicFieldsByPage(e))?.data?.map(r=>r.objectId);if(n.length>0){let i=(await this._sdk.FullClient.batchGetObjects(n,{showContent:!0})).map(c=>c.data.content.fields.value.fields.burned_position_id);return(await this._sdk.FullClient.batchGetObjects(i,{showContent:!0}))?.map(c=>b.buildBurnPositionNFT(c?.data?.content?.fields))}return[]}catch(e){console.log("getPoolBurnPositionList ~ error:",e),u("InvalidPoolId",`${t} is a invalid pool id, please check it and try another valid pool id`,{[s.DETAILS_KEYS.METHOD_NAME]:"getPoolBurnPositionList",[s.DETAILS_KEYS.REQUEST_PARAMS]:{pool_id:t}})}}async getBurnPositionList(t){let{package_id:e}=this._sdk.sdkOptions.burn;try{return(await this._sdk.FullClient.getOwnedObjectsByPage(t,{options:{showType:!0,showContent:!0,showOwner:!0,showDisplay:!0},filter:{MatchAny:[{StructType:`${e}::lp_burn::CetusLPBurnProof`}]}}))?.data?.map(r=>b.buildBurnPositionNFT(r?.data?.content?.fields))}catch(o){u("InvalidAccountAddress",o,{[s.DETAILS_KEYS.METHOD_NAME]:"getBurnPositionList",[s.DETAILS_KEYS.REQUEST_PARAMS]:{account_address:t}})}}async getBurnPosition(t){try{let e=await this._sdk.FullClient.getObject({id:t,options:{showContent:!0,showType:!0}});return e?.data?.content?.fields?b.buildBurnPositionNFT(e?.data?.content?.fields):null}catch(e){u("InvalidPositionId",e,{[s.DETAILS_KEYS.METHOD_NAME]:"getBurnPosition",[s.DETAILS_KEYS.REQUEST_PARAMS]:{pos_id:t}})}}createBurnPayload(t,e){e=e||new p.Transaction;let o=typeof t.pos_id=="string"?e.object(t.pos_id):t.pos_id,{burn:n}=this._sdk.sdkOptions,{manager_id:r}=(0,s.getPackagerConfigs)(n),i=`${n.published_at}::lp_burn::burn`;return e.moveCall({target:i,arguments:[e.object(r),e.object(t.pool_id),o],typeArguments:[t.coin_type_a,t.coin_type_b]}),e}createBurnLPV2Payload(t,e){e=e||new p.Transaction;let o=typeof t=="string"?e.object(t):t,{burn:n}=this._sdk.sdkOptions,{manager_id:r}=(0,s.getPackagerConfigs)(n),i=`${n.published_at}::lp_burn::burn_lp_v2`,[d]=e.moveCall({target:i,arguments:[e.object(r),o],typeArguments:[]});return d}createCollectFeePayload(t,e){e=e||new p.Transaction;let{burn:o}=this._sdk.sdkOptions,{manager_id:n,clmm_global_config:r}=(0,s.getPackagerConfigs)(o),i=`${o.published_at}::lp_burn::collect_fee`,d=e.moveCall({target:i,arguments:[e.object(n),e.object(r),e.object(t.pool_id),e.object(t.pos_id)],typeArguments:[t.coin_type_a,t.coin_type_b]});return e.transferObjects(d,e.pure.address(t.account)),e}crateCollectRewardPayload(t,e){e=e||new p.Transaction;let{burn:o}=this._sdk.sdkOptions,{manager_id:n,clmm_global_config:r,clmm_global_vault_id:i}=(0,s.getPackagerConfigs)(o),d=`${o.published_at}::lp_burn::collect_reward`;for(let l=0;l<t.rewarder_coin_types?.length;l++){let c=t.rewarder_coin_types?.[l],_=e.moveCall({target:d,arguments:[e.object(n),e.object(r),e.object(t.pool_id),e.object(t.pos_id),e.object(i),e.object(s.CLOCK_ADDRESS)],typeArguments:[t.coin_type_a,t.coin_type_b,c]});e.transferObjects([_],e.pure.address(t.account))}return e}createCollectFeesPayload(t,e){e=e||new p.Transaction;let{burn:o}=this._sdk.sdkOptions,{manager_id:n,clmm_global_config:r}=(0,s.getPackagerConfigs)(o),i=`${o.published_at}::lp_burn::collect_fee`;for(let d=0;d<t.length;d++){let l=t[d],c=e.moveCall({target:i,arguments:[e.object(n),e.object(r),e.object(l.pool_id),e.object(l.pos_id)],typeArguments:[l.coin_type_a,l.coin_type_b]});e.transferObjects(c,e.pure.address(l.account))}return e}crateCollectRewardsPayload(t,e){e=e||new p.Transaction;let{burn:o}=this._sdk.sdkOptions,{manager_id:n,clmm_global_config:r,clmm_global_vault_id:i}=(0,s.getPackagerConfigs)(o),d=`${o.published_at}::lp_burn::collect_reward`;for(let l=0;l<t.length;l++){let c=t[l];for(let _=0;_<c.rewarder_coin_types?.length;_++){let j=c.rewarder_coin_types?.[_],O=e.moveCall({target:d,arguments:[e.object(n),e.object(r),e.object(c.pool_id),e.object(c.pos_id),e.object(i),e.object(s.CLOCK_ADDRESS)],typeArguments:[c.coin_type_a,c.coin_type_b,j]});e.transferObjects([O],e.pure.address(c.account))}}return e}};var g=class a extends T.SdkWrapper{constructor(t){super(t),this._burn=new m(this)}get Burn(){return this._burn}static createSDK(t){let{env:e="mainnet"}=t;return e==="mainnet"?a.createCustomSDK({...h,...t}):a.createCustomSDK({...k,...t})}static createCustomSDK(t){return new a(t)}};var F=g;0&&(module.exports={BurnModule,BurnUtils,CetusBurnSDK,burnMainnet,burnTestnet});
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/sdk.ts","../src/config/mainnet.ts","../src/config/testnet.ts","../src/modules/burnModule.ts","../src/errors/errors.ts","../src/utils/burn.ts"],"sourcesContent":["import { CetusBurnSDK, SdkOptions } from './sdk'\n\nexport * from './utils'\nexport * from './types'\nexport * from './modules'\nexport * from './config'\nexport { CetusBurnSDK, SdkOptions }\nexport default CetusBurnSDK\n","import type { BaseSdkOptions, Package } from '@cetusprotocol/common-sdk'\nimport { SdkWrapper } from '@cetusprotocol/common-sdk'\nimport { burnMainnet, burnTestnet } from './config'\nimport { BurnModule } from './modules/burnModule'\nimport type { BurnConfigs } from './types/burn'\n\n/**\n * Represents options and configurations for an SDK.\n */\nexport interface SdkOptions extends BaseSdkOptions {\n burn: Package<BurnConfigs>\n}\n\n/**\n * The entry class of CetusDcaSDK, which is almost responsible for all interactions with dca.\n */\nexport class CetusBurnSDK extends SdkWrapper<SdkOptions> {\n protected _burn: BurnModule\n\n constructor(options: SdkOptions) {\n super(options)\n\n this._burn = new BurnModule(this)\n }\n\n get Burn(): BurnModule {\n return this._burn\n }\n\n /**\n * Static factory method to initialize the SDK\n * @param options SDK initialization options\n * @returns An instance of CetusBurnDK\n */\n static createSDK(options: BaseSdkOptions): CetusBurnSDK {\n const { env = 'mainnet' } = options\n return env === 'mainnet'\n ? CetusBurnSDK.createCustomSDK({ ...burnMainnet, ...options })\n : CetusBurnSDK.createCustomSDK({ ...burnTestnet, ...options })\n }\n\n /**\n * Create a custom SDK instance with the given options\n * @param options The options for the SDK\n * @returns An instance of CetusBurnSDK\n */\n static createCustomSDK<T extends BaseSdkOptions>(options: T & SdkOptions): CetusBurnSDK {\n return new CetusBurnSDK(options)\n }\n}\n","import { FullRpcUrlMainnet } from '@cetusprotocol/common-sdk'\nimport type { SdkOptions } from '../sdk'\nimport { CetusBurnSDK } from '../sdk'\n// mainnet\nexport const burnMainnet: SdkOptions = {\n env: 'mainnet',\n full_rpc_url: FullRpcUrlMainnet,\n burn: {\n package_id: '0x12d73de9a6bc3cb658ec9dc0fe7de2662be1cea5c76c092fcc3606048cdbac27',\n published_at: '0xb977b00649d3ab8950bcbbafb01fcf32e2e7718eb3133eff2e48c0cef04b1495',\n config: {\n manager_id: '0x1d94aa32518d0cb00f9de6ed60d450c9a2090761f326752ffad06b2e9404f845',\n clmm_global_config: '0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f',\n clmm_global_vault_id: '0xce7bceef26d3ad1f6d9b6f13a953f053e6ed3ca77907516481ce99ae8e588f2b',\n burn_pool_handle: '0xc9aacf74bd7cc8da8820ae28ca4473b7e01c87be19bc35bf81c9c7311e1b299e',\n },\n },\n}\n","import { FullRpcUrlTestnet } from '@cetusprotocol/common-sdk'\nimport type { SdkOptions } from '../sdk'\nimport { CetusBurnSDK } from '../sdk'\n\nexport const burnTestnet: SdkOptions = {\n env: 'testnet',\n full_rpc_url: FullRpcUrlTestnet,\n burn: {\n package_id: '0x3b494006831b046481c8046910106e2dfbe0d1fa9bc01e41783fb3ff6534ed3a',\n published_at: '0xaf89f8215c5b07eaac8b77c7745ce62f94cb76ef4bcb854e283f644c519ef43e',\n config: {\n manager_id: '0xd04529ef15b7dad6699ee905daca0698858cab49724b2b2a1fc6b1ebc5e474ef',\n clmm_global_config: '0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e',\n clmm_global_vault_id: '0xf78d2ee3c312f298882cb680695e5e8c81b1d441a646caccc058006c2851ddea',\n burn_pool_handle: '0x20262dac8853ab8f63c98e0b17bfb1c758efc33d0092ac3c5f204dfb7ba81ac5',\n },\n },\n}\n","import type { TransactionObjectArgument } from '@mysten/sui/transactions'\nimport { Transaction } from '@mysten/sui/transactions'\nimport { CLOCK_ADDRESS, DETAILS_KEYS, getPackagerConfigs, IModule } from '@cetusprotocol/common-sdk'\nimport { BurnErrorCode, handleError } from '../errors/errors'\nimport type { CetusBurnSDK } from '../sdk'\nimport type { BurnParams, CollectFeeParams, CollectRewardParams } from '../types/burn'\nimport { BurnUtils } from '../utils'\n\nexport class BurnModule implements IModule<CetusBurnSDK> {\n protected _sdk: CetusBurnSDK\n\n constructor(sdk: CetusBurnSDK) {\n this._sdk = sdk\n }\n\n get sdk() {\n return this._sdk\n }\n\n /**\n * @description Get the list of pools that have been burned.\n * @returns\n */\n async getBurnPoolList() {\n try {\n const { burn } = this._sdk.sdkOptions\n // TODO positionTableId is a constant, it can be written in the configuration later\n const { manager_id } = getPackagerConfigs(burn)\n const object: any = await this._sdk.FullClient.getObject({\n id: manager_id,\n options: {\n showType: true,\n showContent: true,\n },\n })\n\n const positionTableId = object?.data?.content?.fields?.position?.fields?.id?.id\n\n const positionTableData = await this._sdk.FullClient.getDynamicFieldsByPage(positionTableId)\n\n const burnPools = positionTableData?.data?.map((item: any) => {\n return item?.name?.value\n })\n\n return burnPools\n } catch (error) {\n console.log('getBurnPoolList ~ error:', error)\n handleError(BurnErrorCode.FetchError, error as Error, {\n [DETAILS_KEYS.METHOD_NAME]: 'getBurnPoolList',\n })\n }\n }\n\n /**\n * @description Get the position handle for a given pool.\n * @param pool_id - The pool ID.\n * @returns\n */\n private async getPositionHandle(pool_id: string) {\n const { burn } = this._sdk.sdkOptions\n const { burn_pool_handle } = getPackagerConfigs(burn)\n const cacheKey = `getPosHandle_${pool_id}`\n let posHandle = this._sdk.getCache<string>(cacheKey)\n if (posHandle) {\n return posHandle\n }\n try {\n const posHandleRes: any = await this._sdk.FullClient.getDynamicFieldObject({\n parentId: burn_pool_handle,\n name: {\n type: '0x2::object::ID',\n value: pool_id,\n },\n })\n posHandle = posHandleRes.data.content.fields.value.fields.id.id\n\n if (posHandle) {\n this._sdk.updateCache(cacheKey, posHandle)\n }\n\n return posHandle\n } catch (error) {\n handleError(BurnErrorCode.InvalidPoolId, error as Error, {\n [DETAILS_KEYS.METHOD_NAME]: 'getPositionHandle',\n [DETAILS_KEYS.REQUEST_PARAMS]: { pool_id },\n })\n }\n }\n\n /**\n * @description Get the list of burned positions for a given pool.\n * @param pool_id - The pool ID.\n * @returns\n */\n async getPoolBurnPositionList(pool_id: string) {\n try {\n const posHandle = await this.getPositionHandle(pool_id)\n if (posHandle === undefined) {\n handleError(BurnErrorCode.InvalidPoolId, `${pool_id} is a invalid pool id, please check it and try another valid pool id`, {\n [DETAILS_KEYS.METHOD_NAME]: 'getPositionHandle',\n [DETAILS_KEYS.REQUEST_PARAMS]: { pool_id },\n })\n }\n\n const positionTableData = await this._sdk.FullClient.getDynamicFieldsByPage(posHandle as string)\n\n const warpPosIds = positionTableData?.data?.map((item: any) => {\n return item.objectId\n })\n\n if (warpPosIds.length > 0) {\n const warpPosRes = await this._sdk.FullClient.batchGetObjects(warpPosIds, { showContent: true })\n\n const burnedPositionIds = warpPosRes.map((item: any) => {\n return item.data.content.fields.value.fields.burned_position_id\n })\n\n const burnedPositionsRes = await this._sdk.FullClient.batchGetObjects(burnedPositionIds, { showContent: true })\n\n const burnPositionList = burnedPositionsRes?.map((item: any) => {\n const info = BurnUtils.buildBurnPositionNFT(item?.data?.content?.fields)\n return info\n })\n return burnPositionList\n }\n\n return []\n } catch (error: any) {\n console.log('getPoolBurnPositionList ~ error:', error)\n handleError(BurnErrorCode.InvalidPoolId, `${pool_id} is a invalid pool id, please check it and try another valid pool id`, {\n [DETAILS_KEYS.METHOD_NAME]: 'getPoolBurnPositionList',\n [DETAILS_KEYS.REQUEST_PARAMS]: { pool_id },\n })\n }\n }\n\n /**\n * @description Get the list of burned positions for a given account.\n * @param account_address - The account address.\n * @returns\n */\n async getBurnPositionList(account_address: string) {\n const { package_id } = this._sdk.sdkOptions.burn\n try {\n const ownerRes = await this._sdk.FullClient.getOwnedObjectsByPage(account_address, {\n options: { showType: true, showContent: true, showOwner: true, showDisplay: true },\n filter: {\n MatchAny: [\n {\n StructType: `${package_id}::lp_burn::CetusLPBurnProof`,\n },\n ],\n },\n })\n const burnPositionList = ownerRes?.data?.map((item: any) => {\n const info = BurnUtils.buildBurnPositionNFT(item?.data?.content?.fields)\n return info\n })\n return burnPositionList\n } catch (error) {\n handleError(BurnErrorCode.InvalidAccountAddress, error as Error, {\n [DETAILS_KEYS.METHOD_NAME]: 'getBurnPositionList',\n [DETAILS_KEYS.REQUEST_PARAMS]: { account_address },\n })\n }\n }\n\n /**\n * @description Get the burned position information for a given position ID.\n * @param pos_id - The position ID.\n * @returns\n */\n async getBurnPosition(pos_id: string) {\n try {\n const object: any = await this._sdk.FullClient.getObject({ id: pos_id, options: { showContent: true, showType: true } })\n\n if (object?.data?.content?.fields) {\n const info = BurnUtils.buildBurnPositionNFT(object?.data?.content?.fields)\n return info\n }\n\n return null\n } catch (error) {\n handleError(BurnErrorCode.InvalidPositionId, error as Error, {\n [DETAILS_KEYS.METHOD_NAME]: 'getBurnPosition',\n [DETAILS_KEYS.REQUEST_PARAMS]: { pos_id },\n })\n }\n }\n\n /**\n * @description Create a burn payload for a given pool and position.\n * @param params - The burn parameters.\n * @param tx - The transaction object.\n * @returns\n */\n createBurnPayload(params: BurnParams, tx?: Transaction) {\n tx = tx || new Transaction()\n\n const positionArg = typeof params.pos_id === 'string' ? tx.object(params.pos_id) : params.pos_id\n\n const { burn } = this._sdk.sdkOptions\n const { manager_id } = getPackagerConfigs(burn)\n const target = `${burn.published_at}::lp_burn::burn`\n tx.moveCall({\n target,\n arguments: [tx.object(manager_id), tx.object(params.pool_id), positionArg],\n typeArguments: [params.coin_type_a, params.coin_type_b],\n })\n\n return tx\n }\n\n /**\n * When the position is burned, a CetusLPBurnProof will be returned. Compared to the burn_lp function,\n * this V2 version does not require the pool object as a parameter, making it more convenient to use.\n * The function will automatically verify the position's validity through the position object itself.\n * This design also allows users to create a pool, add liquidity, and burn the position all within one transaction.\n *\n * @param {string | TransactionObjectArgument} pos - The LP position to be burned,\n * either as an object argument or its ID (string).\n * @param {Transaction} [tx] - An optional `Transaction` object; if not provided, a new one is created.\n * @returns {CetusLPBurnProof} - The CetusLPBurnProof object ID .\n */\n createBurnLPV2Payload(pos: string | TransactionObjectArgument, tx?: Transaction): TransactionObjectArgument {\n tx = tx || new Transaction()\n\n const positionArg = typeof pos === 'string' ? tx.object(pos) : pos\n\n const { burn } = this._sdk.sdkOptions\n const { manager_id } = getPackagerConfigs(burn)\n\n const target = `${burn.published_at}::lp_burn::burn_lp_v2`\n const [cetusLPBurnProof] = tx.moveCall({\n target,\n arguments: [tx.object(manager_id), positionArg],\n typeArguments: [],\n })\n\n return cetusLPBurnProof\n }\n\n /**\n * @description Create a collect fee payload for a given pool and position.\n * @param params - The collect fee parameters.\n * @param tx - The transaction object.\n * @returns\n */\n createCollectFeePayload(params: CollectFeeParams, tx?: Transaction) {\n tx = tx || new Transaction()\n\n const { burn } = this._sdk.sdkOptions\n const { manager_id, clmm_global_config } = getPackagerConfigs(burn)\n\n const target = `${burn.published_at}::lp_burn::collect_fee`\n\n const coins = tx.moveCall({\n target,\n arguments: [tx.object(manager_id), tx.object(clmm_global_config), tx.object(params.pool_id), tx.object(params.pos_id)],\n typeArguments: [params.coin_type_a, params.coin_type_b],\n })\n tx.transferObjects(coins, tx.pure.address(params.account))\n\n return tx\n }\n\n /**\n * @description Create a collect reward payload for a given pool and position.\n * @param params - The collect reward parameters.\n * @param tx - The transaction object.\n * @returns\n */\n crateCollectRewardPayload(params: CollectRewardParams, tx?: Transaction) {\n tx = tx || new Transaction()\n\n const { burn } = this._sdk.sdkOptions\n const { manager_id, clmm_global_config, clmm_global_vault_id } = getPackagerConfigs(burn)\n\n const target = `${burn.published_at}::lp_burn::collect_reward`\n\n for (let i = 0; i < params.rewarder_coin_types?.length; i++) {\n const item = params.rewarder_coin_types?.[i]\n const coin = tx.moveCall({\n target,\n arguments: [\n tx.object(manager_id),\n tx.object(clmm_global_config),\n tx.object(params.pool_id),\n tx.object(params.pos_id),\n tx.object(clmm_global_vault_id),\n tx.object(CLOCK_ADDRESS),\n ],\n typeArguments: [params.coin_type_a, params.coin_type_b, item],\n })\n\n tx.transferObjects([coin], tx.pure.address(params.account))\n }\n\n return tx\n }\n\n /**\n * @description Create a collect fee payload for a given pool and position.\n * @param params - The collect fee parameters.\n * @param tx - The transaction object.\n * @returns\n */\n createCollectFeesPayload(params: CollectFeeParams[], tx?: Transaction) {\n tx = tx || new Transaction()\n\n const { burn } = this._sdk.sdkOptions\n const { manager_id, clmm_global_config } = getPackagerConfigs(burn)\n\n const target = `${burn.published_at}::lp_burn::collect_fee`\n\n for (let i = 0; i < params.length; i++) {\n const item = params[i]\n const coins = tx.moveCall({\n target,\n arguments: [tx.object(manager_id), tx.object(clmm_global_config), tx.object(item.pool_id), tx.object(item.pos_id)],\n typeArguments: [item.coin_type_a, item.coin_type_b],\n })\n tx.transferObjects(coins, tx.pure.address(item.account))\n }\n\n return tx\n }\n\n /**\n * @description Create a collect reward payload for a given pool and position.\n * @param params - The collect reward parameters.\n * @param tx - The transaction object.\n * @returns\n */\n crateCollectRewardsPayload(params: CollectRewardParams[], tx?: Transaction) {\n tx = tx || new Transaction()\n\n const { burn } = this._sdk.sdkOptions\n const { manager_id, clmm_global_config, clmm_global_vault_id } = getPackagerConfigs(burn)\n\n const target = `${burn.published_at}::lp_burn::collect_reward`\n for (let j = 0; j < params.length; j++) {\n const item = params[j]\n for (let i = 0; i < item.rewarder_coin_types?.length; i++) {\n const items = item.rewarder_coin_types?.[i]\n const coin = tx.moveCall({\n target,\n arguments: [\n tx.object(manager_id),\n tx.object(clmm_global_config),\n tx.object(item.pool_id),\n tx.object(item.pos_id),\n tx.object(clmm_global_vault_id),\n tx.object(CLOCK_ADDRESS),\n ],\n typeArguments: [item.coin_type_a, item.coin_type_b, items],\n })\n\n tx.transferObjects([coin], tx.pure.address(item.account))\n }\n }\n\n return tx\n }\n}\n","import { BaseError } from '@cetusprotocol/common-sdk'\n\nexport enum BurnErrorCode {\n InvalidPoolId = `InvalidPoolId`,\n InvalidPositionId = `InvalidPositionId`,\n InvalidAccountAddress = `InvalidAccountAddress`,\n BuildError = 'BuildError',\n FetchError = 'FetchError',\n}\n\nexport class BurnError extends BaseError {\n constructor(message: string, error_code?: BurnErrorCode, details?: Record<string, any>) {\n super(message, error_code || 'UnknownError', details)\n }\n\n static isBurnErrorCode(e: any, code: BurnErrorCode): boolean {\n return this.isErrorCode<BurnError>(e, code)\n }\n}\n\nexport const handleError = (code: BurnErrorCode, error: Error | string, details?: Record<string, any>) => {\n if (error instanceof Error) {\n throw new BurnError(error.message, code, details)\n } else {\n throw new BurnError(error, code, details)\n }\n}\n","import { asIntN, extractStructTagFromType } from '@cetusprotocol/common-sdk'\nimport { BurnPositionNFT } from '../types/burn'\n\nexport class BurnUtils {\n static buildBurnPositionNFT(fields: any): BurnPositionNFT {\n const burnFields = fields.position.fields\n const name = `Cetus Burned LP | Pool${burnFields.name.split('Pool')?.[1]}`\n const burnPositionNft: BurnPositionNFT = {\n id: fields.id.id,\n url: burnFields.url,\n pool_id: burnFields.pool,\n coin_type_a: extractStructTagFromType(burnFields.coin_type_a.fields.name).full_address,\n coin_type_b: extractStructTagFromType(burnFields.coin_type_b.fields.name).full_address,\n description: burnFields.description,\n name,\n liquidity: burnFields.liquidity,\n clmm_position_id: burnFields.id.id,\n clmm_pool_id: burnFields.pool,\n tick_lower_index: asIntN(BigInt(burnFields.tick_lower_index.fields.bits)),\n tick_upper_index: asIntN(BigInt(burnFields.tick_upper_index.fields.bits)),\n index: burnFields.index,\n is_lp_burn: true,\n }\n return burnPositionNft\n }\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,cAAAC,EAAA,iBAAAC,EAAA,gBAAAC,EAAA,gBAAAC,EAAA,YAAAC,IAAA,eAAAC,EAAAR,GCCA,IAAAS,EAA2B,qCCD3B,IAAAC,EAAkC,qCAIrBC,EAA0B,CACrC,IAAK,UACL,aAAc,oBACd,KAAM,CACJ,WAAY,qEACZ,aAAc,qEACd,OAAQ,CACN,WAAY,qEACZ,mBAAoB,qEACpB,qBAAsB,qEACtB,iBAAkB,oEACpB,CACF,CACF,ECjBA,IAAAC,EAAkC,qCAIrBC,EAA0B,CACrC,IAAK,UACL,aAAc,oBACd,KAAM,CACJ,WAAY,qEACZ,aAAc,qEACd,OAAQ,CACN,WAAY,qEACZ,mBAAoB,qEACpB,qBAAsB,qEACtB,iBAAkB,oEACpB,CACF,CACF,EChBA,IAAAC,EAA4B,oCAC5BC,EAAyE,qCCFzE,IAAAC,EAA0B,qCAUnB,IAAMC,EAAN,cAAwB,WAAU,CACvC,YAAYC,EAAiBC,EAA4BC,EAA+B,CACtF,MAAMF,EAASC,GAAc,eAAgBC,CAAO,CACtD,CAEA,OAAO,gBAAgBC,EAAQC,EAA8B,CAC3D,OAAO,KAAK,YAAuBD,EAAGC,CAAI,CAC5C,CACF,EAEaC,EAAc,CAACD,EAAqBE,EAAuBJ,IAAkC,CACxG,MAAII,aAAiB,MACb,IAAIP,EAAUO,EAAM,QAASF,EAAMF,CAAO,EAE1C,IAAIH,EAAUO,EAAOF,EAAMF,CAAO,CAE5C,EC1BA,IAAAK,EAAiD,qCAGpCC,EAAN,KAAgB,CACrB,OAAO,qBAAqBC,EAA8B,CACxD,IAAMC,EAAa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,EAAa,gBAAgB,CAAE,GAAGI,EAAa,GAAGH,CAAQ,CAAC,EAC3DD,EAAa,gBAAgB,CAAE,GAAGK,EAAa,GAAGJ,CAAQ,CAAC,CACjE,CAOA,OAAO,gBAA0CA,EAAuC,CACtF,OAAO,IAAID,EAAaC,CAAO,CACjC,CACF,ED1CA,IAAOK,EAAQC","names":["index_exports","__export","BurnModule","BurnUtils","CetusBurnSDK","burnMainnet","burnTestnet","index_default","__toCommonJS","import_common_sdk","import_common_sdk","burnMainnet","import_common_sdk","burnTestnet","import_transactions","import_common_sdk","import_common_sdk","BurnError","message","error_code","details","e","code","handleError","error","import_common_sdk","BurnUtils","fields","burnFields","name","BurnModule","sdk","burn","manager_id","positionTableId","item","error","handleError","pool_id","burn_pool_handle","cacheKey","posHandle","warpPosIds","burnedPositionIds","BurnUtils","account_address","package_id","pos_id","object","params","tx","positionArg","target","pos","cetusLPBurnProof","clmm_global_config","coins","clmm_global_vault_id","i","coin","j","items","CetusBurnSDK","_CetusBurnSDK","options","BurnModule","env","burnMainnet","burnTestnet","index_default","CetusBurnSDK"]}
|