@cetusprotocol/burn-sdk 1.0.1 → 1.0.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cetusprotocol/burn-sdk",
3
- "version": "1.0.1",
4
- "description": "SDK for cetus dca",
3
+ "version": "1.0.3",
4
+ "description": "SDK for cetus burn",
5
5
  "typings": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -1,2 +0,0 @@
1
- export * from './mainnet'
2
- export * from './testnet'
@@ -1,18 +0,0 @@
1
- import { FullRpcUrlMainnet } from '@cetusprotocol/common-sdk'
2
- import type { SdkOptions } from '../sdk'
3
- import { CetusBurnSDK } from '../sdk'
4
- // mainnet
5
- export const burnMainnet: SdkOptions = {
6
- env: 'mainnet',
7
- full_rpc_url: FullRpcUrlMainnet,
8
- burn: {
9
- package_id: '0x12d73de9a6bc3cb658ec9dc0fe7de2662be1cea5c76c092fcc3606048cdbac27',
10
- published_at: '0xb977b00649d3ab8950bcbbafb01fcf32e2e7718eb3133eff2e48c0cef04b1495',
11
- config: {
12
- manager_id: '0x1d94aa32518d0cb00f9de6ed60d450c9a2090761f326752ffad06b2e9404f845',
13
- clmm_global_config: '0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f',
14
- clmm_global_vault_id: '0xce7bceef26d3ad1f6d9b6f13a953f053e6ed3ca77907516481ce99ae8e588f2b',
15
- burn_pool_handle: '0xc9aacf74bd7cc8da8820ae28ca4473b7e01c87be19bc35bf81c9c7311e1b299e',
16
- },
17
- },
18
- }
@@ -1,18 +0,0 @@
1
- import { FullRpcUrlTestnet } from '@cetusprotocol/common-sdk'
2
- import type { SdkOptions } from '../sdk'
3
- import { CetusBurnSDK } from '../sdk'
4
-
5
- export const burnTestnet: SdkOptions = {
6
- env: 'testnet',
7
- full_rpc_url: FullRpcUrlTestnet,
8
- burn: {
9
- package_id: '0x3b494006831b046481c8046910106e2dfbe0d1fa9bc01e41783fb3ff6534ed3a',
10
- published_at: '0xaf89f8215c5b07eaac8b77c7745ce62f94cb76ef4bcb854e283f644c519ef43e',
11
- config: {
12
- manager_id: '0xd04529ef15b7dad6699ee905daca0698858cab49724b2b2a1fc6b1ebc5e474ef',
13
- clmm_global_config: '0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e',
14
- clmm_global_vault_id: '0xf78d2ee3c312f298882cb680695e5e8c81b1d441a646caccc058006c2851ddea',
15
- burn_pool_handle: '0x20262dac8853ab8f63c98e0b17bfb1c758efc33d0092ac3c5f204dfb7ba81ac5',
16
- },
17
- },
18
- }
@@ -1,27 +0,0 @@
1
- import { BaseError } from '@cetusprotocol/common-sdk'
2
-
3
- export enum BurnErrorCode {
4
- InvalidPoolId = `InvalidPoolId`,
5
- InvalidPositionId = `InvalidPositionId`,
6
- InvalidAccountAddress = `InvalidAccountAddress`,
7
- BuildError = 'BuildError',
8
- FetchError = 'FetchError',
9
- }
10
-
11
- export class BurnError extends BaseError {
12
- constructor(message: string, error_code?: BurnErrorCode, details?: Record<string, any>) {
13
- super(message, error_code || 'UnknownError', details)
14
- }
15
-
16
- static isBurnErrorCode(e: any, code: BurnErrorCode): boolean {
17
- return this.isErrorCode<BurnError>(e, code)
18
- }
19
- }
20
-
21
- export const handleError = (code: BurnErrorCode, error: Error | string, details?: Record<string, any>) => {
22
- if (error instanceof Error) {
23
- throw new BurnError(error.message, code, details)
24
- } else {
25
- throw new BurnError(error, code, details)
26
- }
27
- }
package/src/index.ts DELETED
@@ -1,8 +0,0 @@
1
- import { CetusBurnSDK, SdkOptions } from './sdk'
2
-
3
- export * from './utils'
4
- export * from './types'
5
- export * from './modules'
6
- export * from './config'
7
- export { CetusBurnSDK, SdkOptions }
8
- export default CetusBurnSDK
@@ -1,365 +0,0 @@
1
- import type { TransactionObjectArgument } from '@mysten/sui/transactions'
2
- import { Transaction } from '@mysten/sui/transactions'
3
- import { CLOCK_ADDRESS, DETAILS_KEYS, getPackagerConfigs, IModule } from '@cetusprotocol/common-sdk'
4
- import { BurnErrorCode, handleError } from '../errors/errors'
5
- import type { CetusBurnSDK } from '../sdk'
6
- import type { BurnParams, CollectFeeParams, CollectRewardParams } from '../types/burn'
7
- import { BurnUtils } from '../utils'
8
-
9
- export class BurnModule implements IModule<CetusBurnSDK> {
10
- protected _sdk: CetusBurnSDK
11
-
12
- constructor(sdk: CetusBurnSDK) {
13
- this._sdk = sdk
14
- }
15
-
16
- get sdk() {
17
- return this._sdk
18
- }
19
-
20
- /**
21
- * @description Get the list of pools that have been burned.
22
- * @returns
23
- */
24
- async getBurnPoolList() {
25
- try {
26
- const { burn } = this._sdk.sdkOptions
27
- // TODO positionTableId is a constant, it can be written in the configuration later
28
- const { manager_id } = getPackagerConfigs(burn)
29
- const object: any = await this._sdk.FullClient.getObject({
30
- id: manager_id,
31
- options: {
32
- showType: true,
33
- showContent: true,
34
- },
35
- })
36
-
37
- const positionTableId = object?.data?.content?.fields?.position?.fields?.id?.id
38
-
39
- const positionTableData = await this._sdk.FullClient.getDynamicFieldsByPage(positionTableId)
40
-
41
- const burnPools = positionTableData?.data?.map((item: any) => {
42
- return item?.name?.value
43
- })
44
-
45
- return burnPools
46
- } catch (error) {
47
- console.log('getBurnPoolList ~ error:', error)
48
- handleError(BurnErrorCode.FetchError, error as Error, {
49
- [DETAILS_KEYS.METHOD_NAME]: 'getBurnPoolList',
50
- })
51
- }
52
- }
53
-
54
- /**
55
- * @description Get the position handle for a given pool.
56
- * @param pool_id - The pool ID.
57
- * @returns
58
- */
59
- private async getPositionHandle(pool_id: string) {
60
- const { burn } = this._sdk.sdkOptions
61
- const { burn_pool_handle } = getPackagerConfigs(burn)
62
- const cacheKey = `getPosHandle_${pool_id}`
63
- let posHandle = this._sdk.getCache<string>(cacheKey)
64
- if (posHandle) {
65
- return posHandle
66
- }
67
- try {
68
- const posHandleRes: any = await this._sdk.FullClient.getDynamicFieldObject({
69
- parentId: burn_pool_handle,
70
- name: {
71
- type: '0x2::object::ID',
72
- value: pool_id,
73
- },
74
- })
75
- posHandle = posHandleRes.data.content.fields.value.fields.id.id
76
-
77
- if (posHandle) {
78
- this._sdk.updateCache(cacheKey, posHandle)
79
- }
80
-
81
- return posHandle
82
- } catch (error) {
83
- handleError(BurnErrorCode.InvalidPoolId, error as Error, {
84
- [DETAILS_KEYS.METHOD_NAME]: 'getPositionHandle',
85
- [DETAILS_KEYS.REQUEST_PARAMS]: { pool_id },
86
- })
87
- }
88
- }
89
-
90
- /**
91
- * @description Get the list of burned positions for a given pool.
92
- * @param pool_id - The pool ID.
93
- * @returns
94
- */
95
- async getPoolBurnPositionList(pool_id: string) {
96
- try {
97
- const posHandle = await this.getPositionHandle(pool_id)
98
- if (posHandle === undefined) {
99
- handleError(BurnErrorCode.InvalidPoolId, `${pool_id} is a invalid pool id, please check it and try another valid pool id`, {
100
- [DETAILS_KEYS.METHOD_NAME]: 'getPositionHandle',
101
- [DETAILS_KEYS.REQUEST_PARAMS]: { pool_id },
102
- })
103
- }
104
-
105
- const positionTableData = await this._sdk.FullClient.getDynamicFieldsByPage(posHandle as string)
106
-
107
- const warpPosIds = positionTableData?.data?.map((item: any) => {
108
- return item.objectId
109
- })
110
-
111
- if (warpPosIds.length > 0) {
112
- const warpPosRes = await this._sdk.FullClient.batchGetObjects(warpPosIds, { showContent: true })
113
-
114
- const burnedPositionIds = warpPosRes.map((item: any) => {
115
- return item.data.content.fields.value.fields.burned_position_id
116
- })
117
-
118
- const burnedPositionsRes = await this._sdk.FullClient.batchGetObjects(burnedPositionIds, { showContent: true })
119
-
120
- const burnPositionList = burnedPositionsRes?.map((item: any) => {
121
- const info = BurnUtils.buildBurnPositionNFT(item?.data?.content?.fields)
122
- return info
123
- })
124
- return burnPositionList
125
- }
126
-
127
- return []
128
- } catch (error: any) {
129
- console.log('getPoolBurnPositionList ~ error:', error)
130
- handleError(BurnErrorCode.InvalidPoolId, `${pool_id} is a invalid pool id, please check it and try another valid pool id`, {
131
- [DETAILS_KEYS.METHOD_NAME]: 'getPoolBurnPositionList',
132
- [DETAILS_KEYS.REQUEST_PARAMS]: { pool_id },
133
- })
134
- }
135
- }
136
-
137
- /**
138
- * @description Get the list of burned positions for a given account.
139
- * @param account_address - The account address.
140
- * @returns
141
- */
142
- async getBurnPositionList(account_address: string) {
143
- const { package_id } = this._sdk.sdkOptions.burn
144
- try {
145
- const ownerRes = await this._sdk.FullClient.getOwnedObjectsByPage(account_address, {
146
- options: { showType: true, showContent: true, showOwner: true, showDisplay: true },
147
- filter: {
148
- MatchAny: [
149
- {
150
- StructType: `${package_id}::lp_burn::CetusLPBurnProof`,
151
- },
152
- ],
153
- },
154
- })
155
- const burnPositionList = ownerRes?.data?.map((item: any) => {
156
- const info = BurnUtils.buildBurnPositionNFT(item?.data?.content?.fields)
157
- return info
158
- })
159
- return burnPositionList
160
- } catch (error) {
161
- handleError(BurnErrorCode.InvalidAccountAddress, error as Error, {
162
- [DETAILS_KEYS.METHOD_NAME]: 'getBurnPositionList',
163
- [DETAILS_KEYS.REQUEST_PARAMS]: { account_address },
164
- })
165
- }
166
- }
167
-
168
- /**
169
- * @description Get the burned position information for a given position ID.
170
- * @param pos_id - The position ID.
171
- * @returns
172
- */
173
- async getBurnPosition(pos_id: string) {
174
- try {
175
- const object: any = await this._sdk.FullClient.getObject({ id: pos_id, options: { showContent: true, showType: true } })
176
-
177
- if (object?.data?.content?.fields) {
178
- const info = BurnUtils.buildBurnPositionNFT(object?.data?.content?.fields)
179
- return info
180
- }
181
-
182
- return null
183
- } catch (error) {
184
- handleError(BurnErrorCode.InvalidPositionId, error as Error, {
185
- [DETAILS_KEYS.METHOD_NAME]: 'getBurnPosition',
186
- [DETAILS_KEYS.REQUEST_PARAMS]: { pos_id },
187
- })
188
- }
189
- }
190
-
191
- /**
192
- * @description Create a burn payload for a given pool and position.
193
- * @param params - The burn parameters.
194
- * @param tx - The transaction object.
195
- * @returns
196
- */
197
- createBurnPayload(params: BurnParams, tx?: Transaction) {
198
- tx = tx || new Transaction()
199
-
200
- const positionArg = typeof params.pos_id === 'string' ? tx.object(params.pos_id) : params.pos_id
201
-
202
- const { burn } = this._sdk.sdkOptions
203
- const { manager_id } = getPackagerConfigs(burn)
204
- const target = `${burn.published_at}::lp_burn::burn`
205
- tx.moveCall({
206
- target,
207
- arguments: [tx.object(manager_id), tx.object(params.pool_id), positionArg],
208
- typeArguments: [params.coin_type_a, params.coin_type_b],
209
- })
210
-
211
- return tx
212
- }
213
-
214
- /**
215
- * When the position is burned, a CetusLPBurnProof will be returned. Compared to the burn_lp function,
216
- * this V2 version does not require the pool object as a parameter, making it more convenient to use.
217
- * The function will automatically verify the position's validity through the position object itself.
218
- * This design also allows users to create a pool, add liquidity, and burn the position all within one transaction.
219
- *
220
- * @param {string | TransactionObjectArgument} pos - The LP position to be burned,
221
- * either as an object argument or its ID (string).
222
- * @param {Transaction} [tx] - An optional `Transaction` object; if not provided, a new one is created.
223
- * @returns {CetusLPBurnProof} - The CetusLPBurnProof object ID .
224
- */
225
- createBurnLPV2Payload(pos: string | TransactionObjectArgument, tx?: Transaction): TransactionObjectArgument {
226
- tx = tx || new Transaction()
227
-
228
- const positionArg = typeof pos === 'string' ? tx.object(pos) : pos
229
-
230
- const { burn } = this._sdk.sdkOptions
231
- const { manager_id } = getPackagerConfigs(burn)
232
-
233
- const target = `${burn.published_at}::lp_burn::burn_lp_v2`
234
- const [cetusLPBurnProof] = tx.moveCall({
235
- target,
236
- arguments: [tx.object(manager_id), positionArg],
237
- typeArguments: [],
238
- })
239
-
240
- return cetusLPBurnProof
241
- }
242
-
243
- /**
244
- * @description Create a collect fee payload for a given pool and position.
245
- * @param params - The collect fee parameters.
246
- * @param tx - The transaction object.
247
- * @returns
248
- */
249
- createCollectFeePayload(params: CollectFeeParams, tx?: Transaction) {
250
- tx = tx || new Transaction()
251
-
252
- const { burn } = this._sdk.sdkOptions
253
- const { manager_id, clmm_global_config } = getPackagerConfigs(burn)
254
-
255
- const target = `${burn.published_at}::lp_burn::collect_fee`
256
-
257
- const coins = tx.moveCall({
258
- target,
259
- arguments: [tx.object(manager_id), tx.object(clmm_global_config), tx.object(params.pool_id), tx.object(params.pos_id)],
260
- typeArguments: [params.coin_type_a, params.coin_type_b],
261
- })
262
- tx.transferObjects(coins, tx.pure.address(params.account))
263
-
264
- return tx
265
- }
266
-
267
- /**
268
- * @description Create a collect reward payload for a given pool and position.
269
- * @param params - The collect reward parameters.
270
- * @param tx - The transaction object.
271
- * @returns
272
- */
273
- crateCollectRewardPayload(params: CollectRewardParams, tx?: Transaction) {
274
- tx = tx || new Transaction()
275
-
276
- const { burn } = this._sdk.sdkOptions
277
- const { manager_id, clmm_global_config, clmm_global_vault_id } = getPackagerConfigs(burn)
278
-
279
- const target = `${burn.published_at}::lp_burn::collect_reward`
280
-
281
- for (let i = 0; i < params.rewarder_coin_types?.length; i++) {
282
- const item = params.rewarder_coin_types?.[i]
283
- const coin = tx.moveCall({
284
- target,
285
- arguments: [
286
- tx.object(manager_id),
287
- tx.object(clmm_global_config),
288
- tx.object(params.pool_id),
289
- tx.object(params.pos_id),
290
- tx.object(clmm_global_vault_id),
291
- tx.object(CLOCK_ADDRESS),
292
- ],
293
- typeArguments: [params.coin_type_a, params.coin_type_b, item],
294
- })
295
-
296
- tx.transferObjects([coin], tx.pure.address(params.account))
297
- }
298
-
299
- return tx
300
- }
301
-
302
- /**
303
- * @description Create a collect fee payload for a given pool and position.
304
- * @param params - The collect fee parameters.
305
- * @param tx - The transaction object.
306
- * @returns
307
- */
308
- createCollectFeesPayload(params: CollectFeeParams[], tx?: Transaction) {
309
- tx = tx || new Transaction()
310
-
311
- const { burn } = this._sdk.sdkOptions
312
- const { manager_id, clmm_global_config } = getPackagerConfigs(burn)
313
-
314
- const target = `${burn.published_at}::lp_burn::collect_fee`
315
-
316
- for (let i = 0; i < params.length; i++) {
317
- const item = params[i]
318
- const coins = tx.moveCall({
319
- target,
320
- arguments: [tx.object(manager_id), tx.object(clmm_global_config), tx.object(item.pool_id), tx.object(item.pos_id)],
321
- typeArguments: [item.coin_type_a, item.coin_type_b],
322
- })
323
- tx.transferObjects(coins, tx.pure.address(item.account))
324
- }
325
-
326
- return tx
327
- }
328
-
329
- /**
330
- * @description Create a collect reward payload for a given pool and position.
331
- * @param params - The collect reward parameters.
332
- * @param tx - The transaction object.
333
- * @returns
334
- */
335
- crateCollectRewardsPayload(params: CollectRewardParams[], tx?: Transaction) {
336
- tx = tx || new Transaction()
337
-
338
- const { burn } = this._sdk.sdkOptions
339
- const { manager_id, clmm_global_config, clmm_global_vault_id } = getPackagerConfigs(burn)
340
-
341
- const target = `${burn.published_at}::lp_burn::collect_reward`
342
- for (let j = 0; j < params.length; j++) {
343
- const item = params[j]
344
- for (let i = 0; i < item.rewarder_coin_types?.length; i++) {
345
- const items = item.rewarder_coin_types?.[i]
346
- const coin = tx.moveCall({
347
- target,
348
- arguments: [
349
- tx.object(manager_id),
350
- tx.object(clmm_global_config),
351
- tx.object(item.pool_id),
352
- tx.object(item.pos_id),
353
- tx.object(clmm_global_vault_id),
354
- tx.object(CLOCK_ADDRESS),
355
- ],
356
- typeArguments: [item.coin_type_a, item.coin_type_b, items],
357
- })
358
-
359
- tx.transferObjects([coin], tx.pure.address(item.account))
360
- }
361
- }
362
-
363
- return tx
364
- }
365
- }
@@ -1 +0,0 @@
1
- export * from './burnModule'
package/src/sdk.ts DELETED
@@ -1,50 +0,0 @@
1
- import type { BaseSdkOptions, Package } from '@cetusprotocol/common-sdk'
2
- import { SdkWrapper } from '@cetusprotocol/common-sdk'
3
- import { burnMainnet, burnTestnet } from './config'
4
- import { BurnModule } from './modules/burnModule'
5
- import type { BurnConfigs } from './types/burn'
6
-
7
- /**
8
- * Represents options and configurations for an SDK.
9
- */
10
- export interface SdkOptions extends BaseSdkOptions {
11
- burn: Package<BurnConfigs>
12
- }
13
-
14
- /**
15
- * The entry class of CetusDcaSDK, which is almost responsible for all interactions with dca.
16
- */
17
- export class CetusBurnSDK extends SdkWrapper<SdkOptions> {
18
- protected _burn: BurnModule
19
-
20
- constructor(options: SdkOptions) {
21
- super(options)
22
-
23
- this._burn = new BurnModule(this)
24
- }
25
-
26
- get Burn(): BurnModule {
27
- return this._burn
28
- }
29
-
30
- /**
31
- * Static factory method to initialize the SDK
32
- * @param options SDK initialization options
33
- * @returns An instance of CetusBurnDK
34
- */
35
- static createSDK(options: BaseSdkOptions): CetusBurnSDK {
36
- const { env = 'mainnet' } = options
37
- return env === 'mainnet'
38
- ? CetusBurnSDK.createCustomSDK({ ...burnMainnet, ...options })
39
- : CetusBurnSDK.createCustomSDK({ ...burnTestnet, ...options })
40
- }
41
-
42
- /**
43
- * Create a custom SDK instance with the given options
44
- * @param options The options for the SDK
45
- * @returns An instance of CetusBurnSDK
46
- */
47
- static createCustomSDK<T extends BaseSdkOptions>(options: T & SdkOptions): CetusBurnSDK {
48
- return new CetusBurnSDK(options)
49
- }
50
- }
package/src/types/burn.ts DELETED
@@ -1,38 +0,0 @@
1
- import type { CoinPairType } from '@cetusprotocol/common-sdk'
2
- import type { TransactionObjectArgument } from '@mysten/sui/transactions'
3
-
4
- export type BurnConfigs = {
5
- manager_id: string
6
- clmm_global_config: string
7
- clmm_global_vault_id: string
8
- burn_pool_handle: string
9
- }
10
-
11
- export type BurnPositionNFT = {
12
- id: string
13
- url: string
14
- pool_id: string
15
- description: string
16
- name: string
17
- liquidity: string
18
- clmm_position_id: string
19
- clmm_pool_id: string
20
- tick_lower_index: number
21
- tick_upper_index: number
22
- index: number
23
- is_lp_burn: boolean
24
- } & CoinPairType
25
-
26
- type CommonParams = {
27
- pool_id: string
28
- pos_id: string | TransactionObjectArgument
29
- } & CoinPairType
30
-
31
- export type BurnParams = CommonParams
32
-
33
- export type CollectFeeParams = CommonParams & { account: string }
34
-
35
- export type CollectRewardParams = CommonParams & {
36
- rewarder_coin_types: string[]
37
- account: string
38
- }
@@ -1 +0,0 @@
1
- export * from './burn'
package/src/utils/burn.ts DELETED
@@ -1,26 +0,0 @@
1
- import { asIntN, extractStructTagFromType } from '@cetusprotocol/common-sdk'
2
- import { BurnPositionNFT } from '../types/burn'
3
-
4
- export class BurnUtils {
5
- static buildBurnPositionNFT(fields: any): BurnPositionNFT {
6
- const burnFields = fields.position.fields
7
- const name = `Cetus Burned LP | Pool${burnFields.name.split('Pool')?.[1]}`
8
- const burnPositionNft: BurnPositionNFT = {
9
- id: fields.id.id,
10
- url: burnFields.url,
11
- pool_id: burnFields.pool,
12
- coin_type_a: extractStructTagFromType(burnFields.coin_type_a.fields.name).full_address,
13
- coin_type_b: extractStructTagFromType(burnFields.coin_type_b.fields.name).full_address,
14
- description: burnFields.description,
15
- name,
16
- liquidity: burnFields.liquidity,
17
- clmm_position_id: burnFields.id.id,
18
- clmm_pool_id: burnFields.pool,
19
- tick_lower_index: asIntN(BigInt(burnFields.tick_lower_index.fields.bits)),
20
- tick_upper_index: asIntN(BigInt(burnFields.tick_upper_index.fields.bits)),
21
- index: burnFields.index,
22
- is_lp_burn: true,
23
- }
24
- return burnPositionNft
25
- }
26
- }
@@ -1 +0,0 @@
1
- export * from './burn'
@@ -1,90 +0,0 @@
1
- // buildTestAccount
2
- import type { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'
3
- import { buildTestAccount } from '@cetusprotocol/test-utils'
4
- import { CetusBurnSDK } from '../src/sdk'
5
-
6
- describe('burn', () => {
7
- const sdk = CetusBurnSDK.createSDK({ env: 'mainnet' })
8
- console.log('🚀 ~ describe ~ sdk:', sdk)
9
- let send_key_pair: Ed25519Keypair
10
- let account: string
11
-
12
- beforeEach(async () => {
13
- send_key_pair = buildTestAccount()
14
- account = send_key_pair.getPublicKey().toSuiAddress()
15
- sdk.setSenderAddress(account)
16
- })
17
-
18
- test('getBurnPoolList', async () => {
19
- const res = await sdk.Burn.getBurnPoolList()
20
- console.log('getBurnPoolList res:', res)
21
- })
22
-
23
- test('getPoolBurnPositionList', async () => {
24
- const res = await sdk.Burn.getPoolBurnPositionList('0xcf994611fd4c48e277ce3ffd4d4364c914af2c3cbb05f7bf6facd371de688630')
25
- console.log('getBurnPositionList res:', res)
26
- })
27
-
28
- test('getBurnPositionList', async () => {
29
- const res = await sdk.Burn.getBurnPositionList(account)
30
- console.log('getBurnPositionList res:', res)
31
- })
32
-
33
- test('getBurnPosition', async () => {
34
- const posId = '0x88678e4cd2681bf41b7f2afdd49c1583a1ca0ae8d6c8f5581bf1db1e021a1e48'
35
- const res = await sdk.Burn.getBurnPosition(posId)
36
- console.log('getBurnPosition res:', res)
37
- })
38
-
39
- test('burn lock', async () => {
40
- const poolId = '0xc41621d02d5ee00a7a993b912a8550df50524c9b2494339691e5896936ff269b'
41
- const posId = '0x4e1970683fc49de834478339724509a051764e7f34d55b4dc4d2a37b7034669c' // is burn success
42
- const coinTypeA = '26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC'
43
- const coinTypeB = '26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::cetus::CETUS'
44
- const txb = await sdk.Burn.createBurnPayload({
45
- pool_id: poolId,
46
- pos_id: posId,
47
- coin_type_a: coinTypeA,
48
- coin_type_b: coinTypeB,
49
- })
50
-
51
- const simulateRes = await sdk.FullClient.devInspectTransactionBlock({
52
- transactionBlock: txb,
53
- sender: account,
54
- })
55
- console.log('burn lock simulateRes:', simulateRes)
56
- })
57
-
58
- test('createBurnLPV2Payload', async () => {})
59
-
60
- test('claim', async () => {
61
- const poolId = '0xc41621d02d5ee00a7a993b912a8550df50524c9b2494339691e5896936ff269b'
62
- const posId = '0x2f10a5816747fd02218dd7a3a7d0417d287da55ccee5943eb5c94f5a6b552299' // is wrap pos id
63
- const coinTypeA = '26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC'
64
- const coinTypeB = '26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::cetus::CETUS'
65
-
66
- const rewarderCoinTypes = ['0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::cetus::CETUS']
67
- let txb = sdk.Burn.createCollectFeePayload({
68
- pool_id: poolId,
69
- pos_id: posId,
70
- coin_type_a: coinTypeA,
71
- coin_type_b: coinTypeB,
72
- account,
73
- })
74
-
75
- txb = sdk.Burn.crateCollectRewardPayload({
76
- pool_id: poolId,
77
- pos_id: posId,
78
- coin_type_a: coinTypeA,
79
- coin_type_b: coinTypeB,
80
- rewarder_coin_types: rewarderCoinTypes,
81
- account,
82
- })
83
-
84
- const simulateRes = await sdk.FullClient.devInspectTransactionBlock({
85
- transactionBlock: txb,
86
- sender: account,
87
- })
88
- console.log('claim simulateRes:', simulateRes)
89
- })
90
- })