@cetusprotocol/dlmm-sdk 0.0.5 → 0.0.6

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.
Files changed (42) hide show
  1. package/README.md +376 -51
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +1 -1
  5. package/dist/index.mjs.map +1 -1
  6. package/package.json +1 -1
  7. package/.turbo/turbo-build.log +0 -10485
  8. package/src/config/index.ts +0 -2
  9. package/src/config/mainnet.ts +0 -25
  10. package/src/config/testnet.ts +0 -30
  11. package/src/errors/errors.ts +0 -40
  12. package/src/index.ts +0 -8
  13. package/src/modules/configModule.ts +0 -184
  14. package/src/modules/index.ts +0 -1
  15. package/src/modules/partnerModule.ts +0 -302
  16. package/src/modules/poolModule.ts +0 -625
  17. package/src/modules/positionModule.ts +0 -901
  18. package/src/modules/rewardModule.ts +0 -174
  19. package/src/modules/swapModule.ts +0 -129
  20. package/src/sdk.ts +0 -88
  21. package/src/types/constants.ts +0 -23
  22. package/src/types/dlmm.ts +0 -466
  23. package/src/types/index.ts +0 -2
  24. package/src/utils/binUtils.ts +0 -552
  25. package/src/utils/feeUtils.ts +0 -92
  26. package/src/utils/index.ts +0 -5
  27. package/src/utils/parseData.ts +0 -556
  28. package/src/utils/strategyUtils.ts +0 -202
  29. package/src/utils/weightUtils.ts +0 -684
  30. package/tests/add_liquidity_bidask.test.ts +0 -192
  31. package/tests/add_liquidity_curve.test.ts +0 -244
  32. package/tests/add_liquidity_spot.test.ts +0 -314
  33. package/tests/bin.test.ts +0 -95
  34. package/tests/config.test.ts +0 -73
  35. package/tests/partner.test.ts +0 -74
  36. package/tests/pool.test.ts +0 -184
  37. package/tests/position.test.ts +0 -76
  38. package/tests/remove_liquidity.test.ts +0 -137
  39. package/tests/swap.test.ts +0 -96
  40. package/tests/tsconfig.json +0 -26
  41. package/tsconfig.json +0 -5
  42. package/tsup.config.ts +0 -9
@@ -1,314 +0,0 @@
1
- // buildTestAccount
2
- import type { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'
3
- import { buildTestAccount } from '@cetusprotocol/test-utils'
4
- import { CetusDlmmSDK } from '../src/sdk'
5
- import {
6
- AddLiquidityOption,
7
- CalculateAddLiquidityAutoFillOption,
8
- CalculateAddLiquidityOption,
9
- DlmmPool,
10
- OpenAndAddLiquidityOption,
11
- OpenAndAddLiquidityWithPriceOption,
12
- StrategyType,
13
- } from '../src/types/dlmm'
14
- import { printTransaction, toDecimalsAmount } from '@cetusprotocol/common-sdk'
15
- import { BinUtils } from '../src/utils/binUtils'
16
-
17
- const pool_id = '0x2ebd6828bc7a952f6e3a884800f70c3ad658964fa9a103bea953835d73873e68'
18
- const position_id = '0xf5139870fbc926d1ca1afdc536b4ab457a9c2a696440d10955572f04b95d9e29'
19
-
20
- describe('dlmm add liquidity spot', () => {
21
- const sdk = CetusDlmmSDK.createSDK({ env: 'mainnet' })
22
- let send_key_pair: Ed25519Keypair
23
- let account: string
24
- let pool: DlmmPool
25
-
26
- beforeEach(async () => {
27
- send_key_pair = buildTestAccount()
28
- account = send_key_pair.getPublicKey().toSuiAddress()
29
- sdk.setSenderAddress(account)
30
- })
31
-
32
- test('0 spot both amounts open and add liquidity with price', async () => {
33
- pool = await sdk.Pool.getPool(pool_id)
34
- console.log('🚀 ~ beforeEach ~ pool:', pool)
35
- const { active_id, bin_step } = pool
36
- const amount_a = '1000000'
37
- const amount_b = '1200000'
38
-
39
- const lower_price = '0.99'
40
- const upper_price = '1.01'
41
- const price = BinUtils.getPriceFromBinId(active_id, bin_step, 6, 6)
42
-
43
- const lower_bin_id = BinUtils.getBinIdFromPrice(lower_price, bin_step, true, 6, 6)
44
- const upper_bin_id = BinUtils.getBinIdFromPrice(upper_price, bin_step, true, 6, 6)
45
-
46
- console.log('🚀 ~ test ~ lower_bin_id:', lower_bin_id)
47
- console.log('🚀 ~ test ~ upper_bin_id:', upper_bin_id)
48
-
49
- const amounts_in_active_bin = await sdk.Position.getActiveBinIfInRange(
50
- pool.bin_manager.bin_manager_handle,
51
- lower_bin_id,
52
- upper_bin_id,
53
- active_id,
54
- bin_step
55
- )
56
-
57
- const calculateOption: CalculateAddLiquidityOption = {
58
- pool_id,
59
- amount_a,
60
- amount_b,
61
- active_id,
62
- bin_step,
63
- lower_bin_id,
64
- upper_bin_id,
65
- active_bin_of_pool: amounts_in_active_bin,
66
- strategy_type: StrategyType.Spot,
67
- }
68
- const bin_infos = await sdk.Position.calculateAddLiquidityInfo(calculateOption)
69
- // console.log('🚀 ~ test ~ bin_infos:', bin_infos)
70
-
71
- const addOption: OpenAndAddLiquidityWithPriceOption = {
72
- pool_id,
73
- bin_infos: bin_infos,
74
- coin_type_a: pool.coin_type_a,
75
- coin_type_b: pool.coin_type_b,
76
- price_base_coin: 'coin_a',
77
- price: price.toString(),
78
- lower_price,
79
- upper_price,
80
- bin_step,
81
- active_bin_of_pool: amounts_in_active_bin,
82
- strategy_type: StrategyType.Spot,
83
- decimals_a: 6,
84
- decimals_b: 6,
85
- max_price_slippage: 0.01,
86
- active_id,
87
- }
88
- const tx = await sdk.Position.addLiquidityWithPricePayload(addOption)
89
-
90
- printTransaction(tx)
91
-
92
- const res = await sdk.FullClient.executeTx(send_key_pair, tx, true)
93
- console.log('🚀 ~ test ~ res:', res)
94
- })
95
-
96
- test('1 spot both amounts open and add liquidity', async () => {
97
- pool = await sdk.Pool.getPool(pool_id)
98
- console.log('🚀 ~ beforeEach ~ pool:', pool)
99
- const { active_id, bin_step } = pool
100
- const amount_a = '10000000'
101
- const amount_b = '20000000'
102
- const lower_bin_id = active_id - 10
103
- const upper_bin_id = active_id + 10
104
-
105
- const amounts_in_active_bin = await sdk.Position.getActiveBinIfInRange(
106
- pool.bin_manager.bin_manager_handle,
107
- lower_bin_id,
108
- upper_bin_id,
109
- active_id,
110
- bin_step
111
- )
112
-
113
- const calculateOption: CalculateAddLiquidityOption = {
114
- pool_id,
115
- amount_a,
116
- amount_b,
117
- active_id,
118
- bin_step,
119
- lower_bin_id,
120
- upper_bin_id,
121
- active_bin_of_pool: amounts_in_active_bin,
122
- strategy_type: StrategyType.Spot,
123
- }
124
- const bin_infos = await sdk.Position.calculateAddLiquidityInfo(calculateOption)
125
- console.log('🚀 ~ test ~ bin_infos:', bin_infos)
126
-
127
- const addOption: OpenAndAddLiquidityOption = {
128
- pool_id,
129
- bin_infos: bin_infos,
130
- coin_type_a: pool.coin_type_a,
131
- coin_type_b: pool.coin_type_b,
132
- lower_bin_id,
133
- upper_bin_id,
134
- active_id,
135
- strategy_type: StrategyType.Spot,
136
- use_bin_infos: false,
137
- max_price_slippage: 0.01,
138
- bin_step,
139
- }
140
- const tx = sdk.Position.addLiquidityPayload(addOption)
141
- tx.setGasBudget(10000000000)
142
- // printTransaction(tx)
143
-
144
- const res = await sdk.FullClient.executeTx(send_key_pair, tx, false)
145
- console.log('🚀 ~ test ~ res:', res)
146
- })
147
-
148
- test('2 spot strategy both amounts add liquidity', async () => {
149
- pool = await sdk.Pool.getPool(pool_id)
150
- const { active_id, bin_step, bin_manager, coin_type_a, coin_type_b } = pool
151
- console.log('🚀 ~ pool:', pool)
152
-
153
- const position = await sdk.Position.getPosition(position_id)
154
- const { lower_bin_id, upper_bin_id } = position
155
- console.log('🚀 ~ position:', position)
156
-
157
- const amounts_in_active_bin = await sdk.Position.getActiveBinIfInRange(
158
- bin_manager.bin_manager_handle,
159
- lower_bin_id,
160
- upper_bin_id,
161
- active_id,
162
- bin_step
163
- )
164
-
165
- const amount_a = '1000000'
166
- const amount_b = '0'
167
-
168
- const calculateOption: CalculateAddLiquidityOption = {
169
- pool_id,
170
- amount_a,
171
- amount_b,
172
- active_id,
173
- bin_step,
174
- lower_bin_id,
175
- upper_bin_id,
176
- active_bin_of_pool: amounts_in_active_bin,
177
- strategy_type: StrategyType.Spot,
178
- }
179
- const bin_infos = await sdk.Position.calculateAddLiquidityInfo(calculateOption)
180
- console.log('🚀 ~ test ~ bin_infos:', bin_infos)
181
-
182
- const addOption: AddLiquidityOption = {
183
- pool_id,
184
- bin_infos: bin_infos,
185
- coin_type_a,
186
- coin_type_b,
187
- active_id,
188
- position_id,
189
- collect_fee: true,
190
- reward_coins: [],
191
- strategy_type: StrategyType.Spot,
192
- use_bin_infos: false,
193
- max_price_slippage: 0.01,
194
- bin_step,
195
- }
196
- const tx = sdk.Position.addLiquidityPayload(addOption)
197
-
198
- printTransaction(tx)
199
-
200
- const res = await sdk.FullClient.executeTx(send_key_pair, tx, false)
201
- console.log('🚀 ~ test ~ res:', res)
202
- })
203
-
204
- test('3 spot strategy fix coin a add liquidity', async () => {
205
- pool = await sdk.Pool.getPool(pool_id)
206
- const { active_id, bin_step, bin_manager, coin_type_a, coin_type_b } = pool
207
- console.log('🚀 ~ pool:', pool)
208
-
209
- const position = await sdk.Position.getPosition(position_id)
210
- const { lower_bin_id, upper_bin_id } = position
211
- console.log('🚀 ~ position:', position)
212
-
213
- // const lower_bin_id = active_id + 1
214
- // const upper_bin_id = active_id + 1
215
-
216
- const amounts_in_active_bin = await sdk.Position.getActiveBinIfInRange(
217
- bin_manager.bin_manager_handle,
218
- lower_bin_id,
219
- upper_bin_id,
220
- active_id,
221
- bin_step
222
- )
223
-
224
- const coin_amount = toDecimalsAmount(1, 9)
225
-
226
- const calculateOption: CalculateAddLiquidityAutoFillOption = {
227
- pool_id,
228
- coin_amount,
229
- fix_amount_a: true,
230
- active_id,
231
- bin_step,
232
- lower_bin_id,
233
- upper_bin_id,
234
- active_bin_of_pool: amounts_in_active_bin,
235
- strategy_type: StrategyType.Spot,
236
- }
237
- const bin_infos = await sdk.Position.calculateAddLiquidityInfo(calculateOption)
238
- console.log('🚀 ~ test ~ bin_infos:', bin_infos)
239
-
240
- const addOption: AddLiquidityOption = {
241
- pool_id,
242
- bin_infos: bin_infos,
243
- coin_type_a,
244
- coin_type_b,
245
- active_id,
246
- position_id,
247
- collect_fee: false,
248
- reward_coins: [],
249
- use_bin_infos: false,
250
- strategy_type: StrategyType.Spot,
251
- max_price_slippage: 0.01,
252
- bin_step,
253
- }
254
- const tx = sdk.Position.addLiquidityPayload(addOption)
255
- tx.setGasBudget(10000000000)
256
- printTransaction(tx)
257
-
258
- const res = await sdk.FullClient.executeTx(send_key_pair, tx, false)
259
- console.log('🚀 ~ test ~ res:', res)
260
- })
261
-
262
- test('4 spot strategy fix coin a open add liquidity', async () => {
263
- pool = await sdk.Pool.getPool(pool_id)
264
- const { active_id, bin_step, bin_manager, coin_type_a, coin_type_b } = pool
265
- console.log('🚀 ~ pool:', pool)
266
-
267
- const lower_bin_id = active_id
268
- const upper_bin_id = active_id
269
-
270
- const amounts_in_active_bin = await sdk.Position.getActiveBinIfInRange(
271
- bin_manager.bin_manager_handle,
272
- lower_bin_id,
273
- upper_bin_id,
274
- active_id,
275
- bin_step
276
- )
277
-
278
- const coin_amount = toDecimalsAmount(1, 6)
279
-
280
- const calculateOption: CalculateAddLiquidityAutoFillOption = {
281
- pool_id,
282
- coin_amount,
283
- fix_amount_a: true,
284
- active_id,
285
- bin_step,
286
- lower_bin_id,
287
- upper_bin_id,
288
- active_bin_of_pool: amounts_in_active_bin,
289
- strategy_type: StrategyType.Spot,
290
- }
291
- const bin_infos = await sdk.Position.calculateAddLiquidityInfo(calculateOption)
292
- console.log('🚀 ~ test ~ bin_infos:', bin_infos)
293
-
294
- const addOption: OpenAndAddLiquidityOption = {
295
- pool_id,
296
- bin_infos: bin_infos,
297
- coin_type_a,
298
- coin_type_b,
299
- active_id,
300
- use_bin_infos: false,
301
- strategy_type: StrategyType.Spot,
302
- max_price_slippage: 0.01,
303
- bin_step,
304
- lower_bin_id,
305
- upper_bin_id,
306
- }
307
- const tx = sdk.Position.addLiquidityPayload(addOption)
308
- tx.setGasBudget(10000000000)
309
- printTransaction(tx)
310
-
311
- const res = await sdk.FullClient.executeTx(send_key_pair, tx, true)
312
- console.log('🚀 ~ test ~ res:', res)
313
- })
314
- })
package/tests/bin.test.ts DELETED
@@ -1,95 +0,0 @@
1
- // buildTestAccount
2
- import type { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'
3
- import { buildTestAccount } from '@cetusprotocol/test-utils'
4
- import { CetusDlmmSDK } from '../src/sdk'
5
- import { BinUtils } from '../src/utils/binUtils'
6
- import { Transaction } from '@mysten/sui/transactions'
7
- import { asUintN, d, printTransaction } from '@cetusprotocol/common-sdk'
8
- import { CalculateAddLiquidityOption, StrategyType } from '../src/types/dlmm'
9
- import { safeMulAmount } from '../src/utils'
10
-
11
- describe('dlmm bin', () => {
12
- const sdk = CetusDlmmSDK.createSDK({ env: 'mainnet' })
13
- let send_key_pair: Ed25519Keypair
14
- let account: string
15
-
16
- beforeEach(async () => {
17
- send_key_pair = buildTestAccount()
18
- account = send_key_pair.getPublicKey().toSuiAddress()
19
- sdk.setSenderAddress(account)
20
- })
21
-
22
- test('getBinIdFromPrice', async () => {
23
- const binId = BinUtils.getBinIdFromPrice(d(1).div('0.0013360404960738484928').toString(), 20, false, 9, 6)
24
- console.log('🚀 ~ test ~ binId:', binId)
25
- })
26
-
27
- test('getPriceFromBinId', async () => {
28
- const price = BinUtils.getPriceFromBinId(1113, 400, 6, 6)
29
- console.log('🚀 ~ test ~ price:', price)
30
- })
31
-
32
- test('getPricePerLamportFromQPrice', async () => {
33
- const q_price = BinUtils.getQPriceFromId(-4400, 100)
34
- console.log('🚀 ~ test ~ q_price:', q_price)
35
- const price_per_lamport = BinUtils.getPricePerLamportFromQPrice(q_price)
36
- console.log('🚀 ~ test ~ price_per_lamport:', price_per_lamport)
37
- })
38
-
39
- test('getPositionCount', async () => {
40
- const positionCount = BinUtils.getPositionCount(-750, 845)
41
- console.log('🚀 ~ test ~ positionCount:', positionCount)
42
- })
43
-
44
- test('getLiquidity', async () => {
45
- const liquidity = BinUtils.getLiquidity('0', '266666', '18431994054197767090')
46
- console.log('🚀 ~ test ~ liquidity:', liquidity)
47
- })
48
-
49
- test('getAmountAFromLiquidity', async () => {
50
- const amountA = BinUtils.getAmountAFromLiquidity('4101094304427826916657468', '18461505896777422276')
51
- console.log('🚀 ~ test ~ amountA:', amountA)
52
- })
53
-
54
- test('getAmountBFromLiquidity', async () => {
55
- const amountB = BinUtils.getAmountBFromLiquidity('4919119455159831291232256')
56
- console.log('🚀 ~ test ~ amountB:', amountB)
57
- })
58
-
59
- test('calculateAddLiquidityInfo', async () => {
60
- // const calculateOption: CalculateAddLiquidityOption = {
61
- // amount_a: '100000000',
62
- // amount_b: '100000000',
63
- // active_id: 0,
64
- // bin_step: 2,
65
- // lower_bin_id: 0,
66
- // upper_bin_id: 70,
67
- // amount_a_in_active_bin: '0',
68
- // amount_b_in_active_bin: '0',
69
- // strategy_type: StrategyType.Spot,
70
- // }
71
- // const bin_infos = sdk.Position.calculateAddLiquidityInfo(calculateOption)
72
- // console.log('🚀 ~ test ~ split_bin_infos:', bin_infos.bins.length)
73
- // const split_bin_infos = BinUtils.splitBinLiquidityInfo(bin_infos, 0, 70)
74
- // console.log('🚀 ~ test ~ split_bin_infos:', split_bin_infos.length)
75
-
76
- const calculateOption = {
77
- active_bin_of_pool: undefined,
78
- active_id: 2290,
79
- pool_id: '0x556d4a393ce033ba4ee77980b70b63ca7b824752583e51103c15e4038cc96e44',
80
- amount_a: '0',
81
- amount_b: '1000000000',
82
- bin_step: 25,
83
- lower_bin_id: 2273,
84
- strategy_type: 0,
85
- upper_bin_id: 2273
86
- }
87
-
88
- const bin_infos = await sdk.Position.calculateAddLiquidityInfo(calculateOption)
89
- console.log("🚀 ~ bin_infos:", JSON.stringify(bin_infos, null, 2))
90
- })
91
-
92
- test('findMinMaxBinId', async () => {
93
- console.log('bin step 10 : ', BinUtils.findMinMaxBinId(10))
94
- })
95
- })
@@ -1,73 +0,0 @@
1
- // buildTestAccount
2
- import type { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'
3
- import { buildTestAccount } from '@cetusprotocol/test-utils'
4
- import { CetusDlmmSDK } from '../src/sdk'
5
- import { parseCurrentRewardPeriodEmission, parseRewardPeriodEmission } from '../src/utils/parseData'
6
- import { Transaction } from '@mysten/sui/transactions'
7
- import { CoinAssist, printTransaction } from '@cetusprotocol/common-sdk'
8
- import { toB64, toBase64 } from '@mysten/sui/utils'
9
- import BN from 'bn.js'
10
-
11
- describe('config', () => {
12
- const sdk = CetusDlmmSDK.createSDK({ env: 'mainnet' })
13
- let send_key_pair: Ed25519Keypair
14
- let account: string
15
-
16
- beforeEach(async () => {
17
- send_key_pair = buildTestAccount()
18
- account = send_key_pair.getPublicKey().toSuiAddress()
19
- sdk.setSenderAddress(account)
20
- })
21
-
22
- test('getDlmmGlobalConfig', async () => {
23
- const res = await sdk.Config.getDlmmGlobalConfig()
24
- console.log('🚀 ~ test ~ res:', res)
25
- })
26
-
27
- test('build rawBytes', async () => {
28
- const tx = new Transaction()
29
-
30
- const zeroCoin = CoinAssist.buildCoinWithBalance(
31
- BigInt(100),
32
- '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC',
33
- tx
34
- )
35
- tx.transferObjects([zeroCoin], tx.pure.address(account))
36
- tx.setSender(account)
37
-
38
- printTransaction(tx)
39
- // build rawBytes
40
- const data = await tx.build({ client: sdk.FullClient })
41
- const rawBytes = toBase64(data)
42
- console.log('rawBytes: ', rawBytes)
43
- })
44
-
45
- test('getBinStepConfigList', async () => {
46
- const res = await sdk.Config.getBinStepConfigList('0xc00e4dbc372948b2b72ae5554c7296b39e107a92821baff08aa640aba0b07aed')
47
- console.log('🚀 ~ test ~ res:', res)
48
- })
49
-
50
- test('fetchDlmmSdkConfigs', async () => {
51
- const res = await sdk.Config.fetchDlmmSdkConfigs()
52
- console.log('🚀 ~ test ~ res:', res)
53
- })
54
-
55
- test('getPool', async () => {
56
- const pool = await sdk.Pool.getPool('0x8b131bccc1b4da0b463c19fa8cacdb71fc9f2ff632841769650886db2f0995f8')
57
- console.log('🚀 ~ test ~ pool:', JSON.stringify(pool, null, 2))
58
- })
59
-
60
- test('getRewardPeriodEmission', async () => {
61
- const currentTime = new Date().getTime() / 1000
62
- const res = await sdk.Reward.getRewardPeriodEmission(
63
- '0x59fbe11899d46c36b597b9899d86f62b880f0aa05727e25454a1158a52bf290d',
64
- '22080.13295225819507789012012891061154107319453032687306404113769',
65
- 1756354616
66
- )
67
- console.log('🚀 ~ test ~ res:', JSON.stringify(res, null, 2))
68
- const result = parseRewardPeriodEmission(res, currentTime, currentTime + 60 * 60 * 24 * 20, 60 * 60 * 24)
69
- console.log('🚀 ~ test ~ result:', JSON.stringify(result, null, 2))
70
- const currentEmission = parseCurrentRewardPeriodEmission(res)
71
- console.log('🚀 ~ test ~ currentEmission:', currentEmission)
72
- })
73
- })
@@ -1,74 +0,0 @@
1
- // buildTestAccount
2
- import type { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'
3
- import { buildTestAccount } from '@cetusprotocol/test-utils'
4
- import { CetusDlmmSDK } from '../src/sdk'
5
- import { BinUtils } from '../src/utils/binUtils'
6
- import { StrategyType } from '../src/types/dlmm'
7
- import { d, printTransaction } from '@cetusprotocol/common-sdk'
8
- import { Transaction } from '@mysten/sui/transactions'
9
-
10
- describe('partner', () => {
11
- const sdk = CetusDlmmSDK.createSDK({ env: 'testnet', full_rpc_url: 'https://rpc-testnet.suiscan.xyz' })
12
- let send_key_pair: Ed25519Keypair
13
- let account: string
14
-
15
- beforeEach(async () => {
16
- send_key_pair = buildTestAccount()
17
- account = send_key_pair.getPublicKey().toSuiAddress()
18
- sdk.setSenderAddress(account)
19
- })
20
-
21
- test('getPartnerList', async () => {
22
- const partnerList = await sdk.Partner.getPartnerList()
23
- console.log('🚀 ~ test ~ partnerList:', partnerList)
24
- })
25
-
26
- test('getPartner', async () => {
27
- const partner = await sdk.Partner.getPartner('0x9d171399393e3cbedffc24269eb606e735fb56fee17c15153eb5e2d5274a3677')
28
- console.log('🚀 ~ test ~ partner:', partner)
29
- })
30
-
31
- test('getPartnerCapId', async () => {
32
- const partnerCapId = await sdk.Partner.getPartnerCapId(account, '0x9d171399393e3cbedffc24269eb606e735fb56fee17c15153eb5e2d5274a3677')
33
- console.log('🚀 ~ test ~ partnerCapId:', partnerCapId)
34
- })
35
-
36
- test('getPartnerBalance', async () => {
37
- const partnerBalance = await sdk.Partner.getPartnerBalance('0x2f14a9ed1e9fb5b027b36d6b166de1f5fec2f26c444d64b22c26cd216b38c65b')
38
- console.log('🚀 ~ test ~ partnerBalance:', partnerBalance)
39
- })
40
-
41
- test('createPartnerPayload', async () => {
42
- const start_time = Number(d(Date.now()).div(1000).add(5000).toFixed(0))
43
- const tx = sdk.Partner.createPartnerPayload({
44
- name: 'test lb 2',
45
- ref_fee_rate: 0.01,
46
- start_time,
47
- end_time: start_time + 9 * 24 * 3600,
48
- recipient: account,
49
- })
50
- const res = await sdk.FullClient.executeTx(send_key_pair, tx, false)
51
- console.log('🚀 ~ test ~ res2:', res)
52
- })
53
-
54
- test('updateRefFeeRatePayload', async () => {
55
- const tx = await sdk.Partner.updateRefFeeRatePayload({
56
- partner_id: '0x9d171399393e3cbedffc24269eb606e735fb56fee17c15153eb5e2d5274a3677',
57
- ref_fee_rate: 0.02,
58
- })
59
- const res = await sdk.FullClient.executeTx(send_key_pair, tx, false)
60
- console.log('🚀 ~ test ~ res2:', res)
61
- })
62
-
63
- test('updateTimeRangePayload', async () => {
64
- const start_time = Number(d(Date.now()).div(1000).toFixed(0))
65
- const tx = await sdk.Partner.updateTimeRangePayload({
66
- partner_id: '0x9d171399393e3cbedffc24269eb606e735fb56fee17c15153eb5e2d5274a3677',
67
- start_time,
68
- end_time: start_time + 10 * 7 * 24 * 3600,
69
- })
70
-
71
- const res = await sdk.FullClient.executeTx(send_key_pair, tx, false)
72
- console.log('🚀 ~ test ~ res2:', res)
73
- })
74
- })