@ferra-labs/damm 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.
@@ -0,0 +1,4520 @@
1
+ import { SuiTransactionBlockResponse, SuiMoveObject, SuiClient, SuiEventFilter, TransactionFilter, SuiObjectResponseQuery, SuiObjectDataOptions, SuiObjectResponse, DevInspectResults, CoinBalance, SuiObjectData, SuiObjectRef, OwnedObjectRef, ObjectOwner, DisplayFieldsResponse, SuiParsedData } from '@mysten/sui/client';
2
+ import { TransactionArgument, Transaction, TransactionObjectArgument, TransactionResult } from '@mysten/sui/transactions';
3
+ import BN from 'bn.js';
4
+ import { Graph } from '@syntsugar/cc-graph';
5
+ import Decimal, { Decimal as Decimal$1 } from 'decimal.js';
6
+ import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
7
+ import { Secp256k1Keypair } from '@mysten/sui/keypairs/secp256k1';
8
+
9
+ /**
10
+ * Represents a SUI address, which is a string.
11
+ */
12
+ type SuiAddressType = string;
13
+ /**
14
+ * Represents a SUI object identifier, which is a string.
15
+ */
16
+ type SuiObjectIdType = string;
17
+ /**
18
+ * The address representing the clock in the system.
19
+ */
20
+ declare const CLOCK_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000006";
21
+ /**
22
+ * Constants for different modules in the DAMM (Cryptocurrency Liquidity Mining Module).
23
+ */
24
+ declare const DammPartnerModule = "partner";
25
+ declare const DammIntegratePoolModule = "pool_script";
26
+ declare const DammIntegrateRouterModule = "router";
27
+ declare const DammIntegrateRouterWithPartnerModule = "router_with_partner";
28
+ declare const DammFetcherModule = "fetcher_script";
29
+ declare const DammExpectSwapModule = "expect_swap";
30
+ declare const DammIntegrateUtilsModule = "utils";
31
+ /**
32
+ * The address for CoinInfo module.
33
+ */
34
+ declare const CoinInfoAddress = "0x1::coin::CoinInfo";
35
+ /**
36
+ * The address for CoinStore module.
37
+ */
38
+ declare const CoinStoreAddress = "0x1::coin::CoinStore";
39
+ /**
40
+ * Represents a SUI resource, which can be of any type.
41
+ */
42
+ type SuiResource = any;
43
+ /**
44
+ * Represents a paginated data page with optional cursor and limit.
45
+ */
46
+ type DataPage<T> = {
47
+ data: T[];
48
+ nextCursor?: any;
49
+ hasNextPage: boolean;
50
+ };
51
+ /**
52
+ * Represents query parameters for pagination.
53
+ */
54
+ type PageQuery = {
55
+ cursor?: any;
56
+ limit?: number | null;
57
+ };
58
+ /**
59
+ * Represents arguments for pagination, with options for fetching all data or using PageQuery.
60
+ */
61
+ type PaginationArgs = 'all' | PageQuery;
62
+ /**
63
+ * Represents a Non-Fungible Token (NFT) with associated metadata.
64
+ */
65
+ type NFT = {
66
+ /**
67
+ * The address or identifier of the creator of the NFT.
68
+ */
69
+ creator: string;
70
+ /**
71
+ * A description providing additional information about the NFT.
72
+ */
73
+ description: string;
74
+ /**
75
+ * The URL to the image representing the NFT visually.
76
+ */
77
+ image_url: string;
78
+ /**
79
+ * A link associated with the NFT, providing more details or interactions.
80
+ */
81
+ link: string;
82
+ /**
83
+ * The name or title of the NFT.
84
+ */
85
+ name: string;
86
+ /**
87
+ * The URL to the project or collection associated with the NFT.
88
+ */
89
+ project_url: string;
90
+ };
91
+ /**
92
+ * Represents a SUI struct tag.
93
+ */
94
+ type SuiStructTag = {
95
+ /**
96
+ * The full address of the struct.
97
+ */
98
+ full_address: string;
99
+ /**
100
+ * The source address of the struct.
101
+ */
102
+ source_address: string;
103
+ /**
104
+ * The address of the struct.
105
+ */
106
+ address: SuiAddressType;
107
+ /**
108
+ * The module to which the struct belongs.
109
+ */
110
+ module: string;
111
+ /**
112
+ * The name of the struct.
113
+ */
114
+ name: string;
115
+ /**
116
+ * An array of type arguments (SUI addresses) for the struct.
117
+ */
118
+ type_arguments: SuiAddressType[];
119
+ };
120
+ /**
121
+ * Represents basic SUI data types.
122
+ */
123
+ type SuiBasicTypes = 'address' | 'bool' | 'u8' | 'u16' | 'u32' | 'u64' | 'u128' | 'u256';
124
+ /**
125
+ * Represents a SUI transaction argument, which can be of various types.
126
+ */
127
+ type SuiTxArg = TransactionArgument | string | number | bigint | boolean;
128
+ /**
129
+ * Represents input types for SUI data.
130
+ */
131
+ type SuiInputTypes = 'object' | SuiBasicTypes;
132
+ /**
133
+ * Gets the default SUI input type based on the provided value.
134
+ * @param value - The value to determine the default input type for.
135
+ * @returns The default SUI input type.
136
+ * @throws Error if the type of the value is unknown.
137
+ */
138
+ declare const getDefaultSuiInputType: (value: any) => SuiInputTypes;
139
+
140
+ /**
141
+ * Enumerates the possible status values of a position within a liquidity mining module.
142
+ */
143
+ declare enum DammPositionStatus {
144
+ /**
145
+ * The position has been deleted or removed.
146
+ */
147
+ 'Deleted' = "Deleted",
148
+ /**
149
+ * The position exists and is active.
150
+ */
151
+ 'Exists' = "Exists",
152
+ /**
153
+ * The position does not exist or is not active.
154
+ */
155
+ 'NotExists' = "NotExists"
156
+ }
157
+ /**
158
+ * Represents a package containing specific configuration or data.
159
+ * @template T - The type of configuration or data contained in the package.
160
+ */
161
+ type Package<T = undefined> = {
162
+ /**
163
+ * The unique identifier of the package.
164
+ */
165
+ package_id: string;
166
+ /**
167
+ * the package was published.
168
+ */
169
+ published_at: string;
170
+ /**
171
+ * The version number of the package (optional).
172
+ */
173
+ version?: number;
174
+ /**
175
+ * The configuration or data contained in the package (optional).
176
+ */
177
+ config?: T;
178
+ };
179
+ /**
180
+ * The Ferra dammpool's position NFT.
181
+ */
182
+ type Position = {
183
+ /**
184
+ * The unique identifier of the position object.
185
+ */
186
+ pos_object_id: SuiObjectIdType;
187
+ /**
188
+ * The owner of the position.
189
+ */
190
+ owner: SuiObjectIdType;
191
+ /**
192
+ * The liquidity pool associated with the position.
193
+ */
194
+ pool: SuiObjectIdType;
195
+ /**
196
+ * The type of position represented by an address.
197
+ */
198
+ type: SuiAddressType;
199
+ /**
200
+ * The index of the position.
201
+ */
202
+ index: number;
203
+ /**
204
+ * The amount of liquidity held by the position.
205
+ */
206
+ liquidity: string;
207
+ /**
208
+ * The lower tick index of the position range.
209
+ */
210
+ tick_lower_index: number;
211
+ /**
212
+ * The upper tick index of the position range.
213
+ */
214
+ tick_upper_index: number;
215
+ /**
216
+ * The status of the position within the liquidity mining module.
217
+ */
218
+ position_status: DammPositionStatus;
219
+ lock_until: string;
220
+ /**
221
+ * The address type of the first coin in the position.
222
+ */
223
+ coin_type_a: SuiAddressType;
224
+ /**
225
+ * The address type of the second coin in the position.
226
+ */
227
+ coin_type_b: SuiAddressType;
228
+ } & NFT & PositionReward;
229
+ /**
230
+ * Represents reward information associated with a liquidity mining position.
231
+ */
232
+ type PositionReward = {
233
+ /**
234
+ * The unique identifier of the position object.
235
+ */
236
+ pos_object_id: SuiObjectIdType;
237
+ /**
238
+ * The amount of liquidity held by the position.
239
+ */
240
+ liquidity: string;
241
+ /**
242
+ * The lower tick index of the position range.
243
+ */
244
+ tick_lower_index: number;
245
+ /**
246
+ * The upper tick index of the position range.
247
+ */
248
+ tick_upper_index: number;
249
+ /**
250
+ * The accumulated fee growth inside the first coin of the position.
251
+ */
252
+ fee_growth_inside_a: string;
253
+ /**
254
+ * The accumulated fee owed in the first coin of the position.
255
+ */
256
+ fee_owed_a: string;
257
+ /**
258
+ * The accumulated fee growth inside the second coin of the position.
259
+ */
260
+ fee_growth_inside_b: string;
261
+ /**
262
+ * The accumulated fee owed in the second coin of the position.
263
+ */
264
+ fee_owed_b: string;
265
+ /**
266
+ * The amount of reward owed in the first reward category.
267
+ */
268
+ reward_amount_owed_0: string;
269
+ /**
270
+ * The amount of reward owed in the second reward category.
271
+ */
272
+ reward_amount_owed_1: string;
273
+ /**
274
+ * The amount of reward owed in the third reward category.
275
+ */
276
+ reward_amount_owed_2: string;
277
+ /**
278
+ * The accumulated reward growth inside the first reward category.
279
+ */
280
+ reward_growth_inside_0: string;
281
+ /**
282
+ * The accumulated reward growth inside the second reward category.
283
+ */
284
+ reward_growth_inside_1: string;
285
+ /**
286
+ * The accumulated reward growth inside the third reward category.
287
+ */
288
+ reward_growth_inside_2: string;
289
+ };
290
+ /**
291
+ * Represents a pair of coins used in a financial context.
292
+ */
293
+ type CoinPairType = {
294
+ /**
295
+ * The address type of the coin a in the pair.
296
+ */
297
+ coinTypeA: SuiAddressType;
298
+ /**
299
+ * The address type of the coin b in the pair.
300
+ */
301
+ coinTypeB: SuiAddressType;
302
+ };
303
+ /**
304
+ * Represents immutable properties of a liquidity pool.
305
+ */
306
+ type PoolImmutables = {
307
+ /**
308
+ * The address of the liquidity pool.
309
+ */
310
+ poolAddress: string;
311
+ /**
312
+ * The tick spacing value used in the pool.
313
+ */
314
+ tickSpacing: string;
315
+ } & CoinPairType;
316
+ /**
317
+ * "Pool" is the core module of Damm protocol, which defines the trading pairs of "dammpool".
318
+ */
319
+ type Pool = {
320
+ /**
321
+ * Represents the type or category of a liquidity pool.
322
+ */
323
+ poolType: string;
324
+ /**
325
+ * The amount of coin a.
326
+ */
327
+ coinAmountA: bigint;
328
+ /**
329
+ * The amount of coin b.
330
+ */
331
+ coinAmountB: bigint;
332
+ /**
333
+ * The current sqrt price
334
+ */
335
+ isQuoteY: boolean;
336
+ /**
337
+ * The current sqrt price
338
+ */
339
+ currentSqrtPrice: bigint;
340
+ collectFeeMode: number;
341
+ currentTickIndex: number;
342
+ parameters: {
343
+ currentSqrtPrice: bigint;
344
+ currentTickIndex: number;
345
+ tickLowerIndex: number;
346
+ tickUpperIndex: number;
347
+ activationTimestamp: bigint;
348
+ cliffFeeNumerator: bigint;
349
+ decayPeriod: bigint;
350
+ enabledDynamicFee: boolean;
351
+ isQuoteY: boolean;
352
+ enabledFeeScheduler: boolean;
353
+ feeRate: number;
354
+ feeSchedulerMode: bigint;
355
+ feeSchedulerReductionFactor: bigint;
356
+ filterPeriod: bigint;
357
+ idReference: number;
358
+ maxVolatilityAccumulator: number;
359
+ numberOfPeriod: number;
360
+ periodFrequency: number;
361
+ reductionFactor: number;
362
+ tickSpacing: number;
363
+ timeOfLastUpdate: number;
364
+ variableFeeControl: number;
365
+ volatilityAccumulator: number;
366
+ volatilityReference: number;
367
+ };
368
+ /**
369
+ * The global fee growth of coin a as Q64.64
370
+ */
371
+ feeGrowthGlobalB: number;
372
+ /**
373
+ * The global fee growth of coin b as Q64.64
374
+ */
375
+ feeGrowthGlobalA: number;
376
+ /**
377
+ * The amounts of coin a owend to protocol
378
+ */
379
+ feeProtocolCoinA: number;
380
+ /**
381
+ * The amounts of coin b owend to protocol
382
+ */
383
+ feeProtocolCoinB: number;
384
+ /**
385
+ * The numerator of fee rate, the denominator is 1_000_000.
386
+ */
387
+ feeRate: number;
388
+ /**
389
+ * is the pool pause
390
+ */
391
+ isPause: boolean;
392
+ /**
393
+ * The liquidity of current tick index
394
+ */
395
+ liquidity: number;
396
+ /**
397
+ * The pool index
398
+ */
399
+ index: number;
400
+ /**
401
+ * The positions manager
402
+ */
403
+ positionManager: {
404
+ positionsHandle: string;
405
+ size: number;
406
+ };
407
+ /**
408
+ * The rewarder manager
409
+ */
410
+ rewarderInfos: Array<Rewarder>;
411
+ rewarderLastUpdatedTime: string;
412
+ /**
413
+ * The tick manager handle
414
+ */
415
+ ticksHandle: string;
416
+ /**
417
+ * The url for pool and position
418
+ */
419
+ uri: string;
420
+ /**
421
+ * The name for pool
422
+ */
423
+ name: string;
424
+ } & PoolImmutables;
425
+ type Rewarder = {
426
+ /**
427
+ * The coin address where rewards will be distributed.
428
+ */
429
+ coinAddress: string;
430
+ /**
431
+ * The rate of emissions in coins per second.
432
+ */
433
+ emissions_per_second: number;
434
+ /**
435
+ * The global growth factor influencing reward emissions.
436
+ */
437
+ growth_global: number;
438
+ /**
439
+ * The total emissions in coins that occur every day.
440
+ */
441
+ emissionsEveryDay: number;
442
+ };
443
+ /**
444
+ * Configuration settings for the Cryptocurrency Liquidity Mining Module (DAMM).
445
+ */
446
+ type DammConfig = {
447
+ /**
448
+ * Identifier of the pools for liquidity mining.
449
+ */
450
+ pools_id: SuiObjectIdType;
451
+ /**
452
+ * Identifier of the global configuration for the module.
453
+ */
454
+ global_config_id: SuiObjectIdType;
455
+ /**
456
+ * Identifier of the global vault for the module.
457
+ */
458
+ global_rewarder_vault_id: SuiObjectIdType;
459
+ /**
460
+ * Optional identifier of partners for the liquidity mining module.
461
+ */
462
+ partners_id?: SuiObjectIdType;
463
+ };
464
+ /**
465
+ * Represents an event to create a liquidity mining partner.
466
+ */
467
+ type CreatePartnerEvent = {
468
+ /**
469
+ * The name of the liquidity mining partner.
470
+ */
471
+ name: string;
472
+ /**
473
+ * The recipient's address for the partner.
474
+ */
475
+ recipient: SuiAddressType;
476
+ /**
477
+ * Identifier of the partner.
478
+ */
479
+ partner_id: SuiObjectIdType;
480
+ /**
481
+ * Identifier of the partner's capacity.
482
+ */
483
+ partner_cap_id: SuiObjectIdType;
484
+ /**
485
+ * The fee rate associated with the partner.
486
+ */
487
+ fee_rate: string;
488
+ /**
489
+ * The starting epoch of the partnership.
490
+ */
491
+ start_epoch: string;
492
+ /**
493
+ * The ending epoch of the partnership.
494
+ */
495
+ end_epoch: string;
496
+ };
497
+ /**
498
+ * Represents a coin asset with address, object ID, and balance information.
499
+ */
500
+ type CoinAsset = {
501
+ /**
502
+ * The address type of the coin asset.
503
+ */
504
+ coinAddress: SuiAddressType;
505
+ /**
506
+ * The object identifier of the coin asset.
507
+ */
508
+ coinObjectId: SuiObjectIdType;
509
+ /**
510
+ * The balance amount of the coin asset.
511
+ */
512
+ balance: bigint;
513
+ };
514
+ /**
515
+ * Represents a faucet coin configuration.
516
+ */
517
+ type FaucetCoin = {
518
+ /**
519
+ * The name or identifier of the transaction module.
520
+ */
521
+ transactionModule: string;
522
+ /**
523
+ * The supply ID or object identifier of the faucet coin.
524
+ */
525
+ suplyID: SuiObjectIdType;
526
+ /**
527
+ * The number of decimal places used for the faucet coin.
528
+ */
529
+ decimals: number;
530
+ };
531
+ /**
532
+ * Represents parameters for creating a liquidity pool.
533
+ */
534
+ type CreatePoolParams = {
535
+ /**
536
+ * The tick spacing value used for the pool.
537
+ */
538
+ tick_spacing: number;
539
+ /**
540
+ * The initial square root price value for the pool.
541
+ */
542
+ initialize_sqrt_price: string;
543
+ /**
544
+ * The Uniform Resource Identifier (URI) associated with the pool.
545
+ */
546
+ uri: string;
547
+ } & CoinPairType;
548
+ /**
549
+ * Represents parameters for adding liquidity to a created liquidity pool.
550
+ * Extends the CreatePoolParams type.
551
+ */
552
+ type CreatePoolAddLiquidityParams = CreatePoolParams & {
553
+ /**
554
+ * The amount of the first coin to be added as liquidity.
555
+ * Can be a number or a string.
556
+ */
557
+ amount_a: number | string;
558
+ /**
559
+ * The amount of the second coin to be added as liquidity.
560
+ * Can be a number or a string.
561
+ */
562
+ amount_b: number | string;
563
+ /**
564
+ * Indicates whether the amount of the first coin is fixed.
565
+ */
566
+ fix_amount_a: boolean;
567
+ /**
568
+ * The lower tick index for liquidity provision.
569
+ */
570
+ tick_lower?: number;
571
+ /**
572
+ * The upper tick index for liquidity provision.
573
+ */
574
+ tick_upper?: number;
575
+ lock_until?: number;
576
+ collect_fee_mode: number;
577
+ is_quote_y: boolean;
578
+ fee_scheduler_mode: number;
579
+ enable_fee_scheduler: boolean;
580
+ enable_dynamic_fee: boolean;
581
+ activation_timestamp: number;
582
+ metadata_a?: SuiObjectIdType;
583
+ metadata_b?: SuiObjectIdType;
584
+ /**
585
+ * The allowed slippage percentage for the liquidity provision.
586
+ */
587
+ slippage: number;
588
+ };
589
+ type FetchParams = {
590
+ pool_id: SuiObjectIdType;
591
+ } & CoinPairType;
592
+ type CommonParams = {
593
+ /**
594
+ * The object id about which pool you want to operation.
595
+ */
596
+ pool_id: SuiObjectIdType;
597
+ /**
598
+ * The object id about position.
599
+ */
600
+ pos_id: SuiObjectIdType;
601
+ };
602
+ type AddLiquidityFixTokenParams = {
603
+ /**
604
+ * If fixed amount A, you must set amount_a, amount_b will be auto calculated by DammPoolUtil.estLiquidityAndcoinAmountFromOneAmounts().
605
+ */
606
+ amount_a: number | string;
607
+ /**
608
+ * If fixed amount B, you must set amount_b, amount_a will be auto calculated by DammPoolUtil.estLiquidityAndcoinAmountFromOneAmounts().
609
+ */
610
+ amount_b: number | string;
611
+ /**
612
+ * Price slippage point.
613
+ */
614
+ slippage: number;
615
+ /**
616
+ * true means fixed coinA amount, false means fixed coinB amount
617
+ */
618
+ fix_amount_a: boolean;
619
+ /**
620
+ * control whether or not to create a new position or add liquidity on existed position.
621
+ */
622
+ is_open: boolean;
623
+ lock_until?: number;
624
+ } & AddLiquidityCommonParams;
625
+ type AddLiquidityParams = {
626
+ /**
627
+ * The actual change in liquidity that has been added.
628
+ */
629
+ delta_liquidity: string;
630
+ /**
631
+ * The max limit about used coin a amount
632
+ */
633
+ max_amount_a: number | string;
634
+ /**
635
+ * The max limit about used coin b amount.
636
+ */
637
+ max_amount_b: number | string;
638
+ lock_until?: number;
639
+ } & AddLiquidityCommonParams;
640
+ type AddLiquidityCommonParams = {
641
+ /**
642
+ * Represents the index of the lower tick boundary.
643
+ */
644
+ tick_lower: string | number;
645
+ /**
646
+ * Represents the index of the upper tick boundary.
647
+ */
648
+ tick_upper: string | number;
649
+ /**
650
+ * If you already has one position, you can select collect fees while adding liquidity.
651
+ */
652
+ collect_fee: boolean;
653
+ /**
654
+ * If these not empty, it will collect rewarder in this position, if you already open the position.
655
+ */
656
+ rewarder_coin_types: SuiAddressType[];
657
+ } & CoinPairType & CommonParams;
658
+ /**
659
+ * Parameters for opening a position within a liquidity pool.
660
+ * Extends the CoinPairType type.
661
+ */
662
+ type OpenPositionParams = CoinPairType & {
663
+ /**
664
+ * The lower tick index for the position.
665
+ */
666
+ tick_lower: string;
667
+ /**
668
+ * The upper tick index for the position.
669
+ */
670
+ tick_upper: string;
671
+ /**
672
+ * The object identifier of the liquidity pool.
673
+ */
674
+ pool_id: SuiObjectIdType;
675
+ lock_until?: number;
676
+ };
677
+ /**
678
+ * Parameters for removing liquidity from a pool.
679
+ * Extends the CoinPairType and CommonParams types.
680
+ */
681
+ type RemoveLiquidityParams = CoinPairType & CommonParams & {
682
+ /**
683
+ * The change in liquidity amount to be removed.
684
+ */
685
+ delta_liquidity: string;
686
+ /**
687
+ * The minimum amount of the first coin to be received.
688
+ */
689
+ min_amount_a: string;
690
+ /**
691
+ * The minimum amount of the second coin to be received.
692
+ */
693
+ min_amount_b: string;
694
+ /**
695
+ * Indicates whether to collect fees during the removal.
696
+ */
697
+ collect_fee: boolean;
698
+ /**
699
+ * Coin types associated with rewarder contracts.
700
+ */
701
+ rewarder_coin_types: string[];
702
+ };
703
+ /**
704
+ * Parameters for closing a position within a liquidity pool.
705
+ * Extends the CoinPairType, CommonParams, and CommonParams types.
706
+ */
707
+ type ClosePositionParams = CoinPairType & CommonParams & {
708
+ /**
709
+ * Coin types associated with rewarder contracts.
710
+ */
711
+ rewarder_coin_types: SuiAddressType[];
712
+ /**
713
+ * The minimum amount of the first coin to be received.
714
+ */
715
+ min_amount_a: string;
716
+ /**
717
+ * The minimum amount of the second coin to be received.
718
+ */
719
+ min_amount_b: string;
720
+ /**
721
+ * Indicates whether to collect fees during the closing.
722
+ */
723
+ collect_fee: boolean;
724
+ } & CoinPairType & CommonParams;
725
+ /**
726
+ * Represents parameters for collecting fees.
727
+ */
728
+ type CollectFeeParams = CommonParams & CoinPairType;
729
+ /**
730
+ * Represents parameters for creating a test transfer transaction payload.
731
+ */
732
+ type createTestTransferTxPayloadParams = {
733
+ /**
734
+ * The recipient account address.
735
+ */
736
+ account: string;
737
+ /**
738
+ * The value to transfer.
739
+ */
740
+ value: number;
741
+ };
742
+ /**
743
+ * Represents parameters for calculating rates in a swap.
744
+ */
745
+ type CalculateRatesParams = {
746
+ /**
747
+ * The number of decimal places for token A.
748
+ */
749
+ decimalsA: number;
750
+ /**
751
+ * The number of decimal places for token B.
752
+ */
753
+ decimalsB: number;
754
+ /**
755
+ * Specifies if the swap is from token A to token B.
756
+ */
757
+ a2b: boolean;
758
+ /**
759
+ * Specifies if the swap amount is specified in token A.
760
+ */
761
+ byAmountIn: boolean;
762
+ /**
763
+ * The amount to swap.
764
+ */
765
+ amount: BN;
766
+ /**
767
+ * An array of tick data for swap ticks.
768
+ */
769
+ swapTicks: Array<TickData>;
770
+ /**
771
+ * The current pool information.
772
+ */
773
+ currentPool: Pool;
774
+ };
775
+ /**
776
+ * Represents the result of calculating rates in a swap.
777
+ */
778
+ type CalculateRatesResult = {
779
+ /**
780
+ * The estimated amount in token A.
781
+ */
782
+ estimatedAmountIn: BN;
783
+ /**
784
+ * The estimated amount in token B.
785
+ */
786
+ estimatedAmountOut: BN;
787
+ /**
788
+ * The estimated ending square root price.
789
+ */
790
+ estimatedEndSqrtPrice: BN;
791
+ /**
792
+ * The estimated fee amount.
793
+ */
794
+ estimatedFeeAmount: BN;
795
+ /**
796
+ * Indicates if the estimated amount exceeds the limit.
797
+ */
798
+ isExceed: boolean;
799
+ /**
800
+ * The extra compute limit.
801
+ */
802
+ extraComputeLimit: number;
803
+ /**
804
+ * Specifies if the swap is from token A to token B.
805
+ */
806
+ aToB: boolean;
807
+ /**
808
+ * Specifies if the swap amount is specified in token A.
809
+ */
810
+ byAmountIn: boolean;
811
+ /**
812
+ * The amount to swap.
813
+ */
814
+ amount: BN;
815
+ /**
816
+ * The price impact percentage.
817
+ */
818
+ priceImpactPct: number;
819
+ };
820
+ /**
821
+ * Represents parameters for a swap operation.
822
+ */
823
+ type SwapParams = {
824
+ /**
825
+ * The identifier of the pool.
826
+ */
827
+ pool_id: SuiObjectIdType;
828
+ /**
829
+ * Specifies if the swap is from token A to token B.
830
+ */
831
+ a2b: boolean;
832
+ /**
833
+ * Specifies if the swap amount is specified in token A.
834
+ */
835
+ by_amount_in: boolean;
836
+ /**
837
+ * The swap amount.
838
+ */
839
+ amount: string;
840
+ /**
841
+ * The amount limit for the swap.
842
+ */
843
+ amount_limit: string;
844
+ /**
845
+ * The optional swap partner.
846
+ */
847
+ swap_partner?: string;
848
+ } & CoinPairType;
849
+ /**
850
+ * Represents parameters for a pre-swap operation.
851
+ */
852
+ type PreSwapParams = {
853
+ /**
854
+ * The pool information for the pre-swap.
855
+ */
856
+ pool: Pool;
857
+ /**
858
+ * The current square root price.
859
+ */
860
+ currentSqrtPrice: number;
861
+ /**
862
+ * The number of decimal places for token A.
863
+ */
864
+ decimalsA: number;
865
+ /**
866
+ * The number of decimal places for token B.
867
+ */
868
+ decimalsB: number;
869
+ /**
870
+ * Specifies if the swap is from token A to token B.
871
+ */
872
+ a2b: boolean;
873
+ /**
874
+ * Specifies if the swap amount is specified in token A.
875
+ */
876
+ byAmountIn: boolean;
877
+ /**
878
+ * The swap amount.
879
+ */
880
+ amount: string;
881
+ } & CoinPairType;
882
+ /**
883
+ * Represents parameters for a pre-swap operation with multiple pools.
884
+ */
885
+ type PreSwapWithMultiPoolParams = {
886
+ /**
887
+ * An array of pool addresses for the pre-swap.
888
+ */
889
+ poolAddresses: string[];
890
+ /**
891
+ * Specifies if the swap is from token A to token B.
892
+ */
893
+ a2b: boolean;
894
+ /**
895
+ * Specifies if the swap amount is specified in token A.
896
+ */
897
+ byAmountIn: boolean;
898
+ /**
899
+ * The swap amount.
900
+ */
901
+ amount: string;
902
+ } & CoinPairType;
903
+ /**
904
+ * If changes in liquidity are required before the swap, then this parameter should be passed.
905
+ */
906
+ type PreSwapLpChangeParams = {
907
+ /**
908
+ * Unique identifier for the liquidity pool involved in the transaction.
909
+ */
910
+ pool_id: string;
911
+ /**
912
+ * Lower bound of the liquidity range. In AMM models, like Uniswap V3, liquidity is provided within specific price ranges. This represents the lower limit of that range.
913
+ */
914
+ tick_lower: number;
915
+ /**
916
+ * Upper bound of the liquidity range, corresponding to the lower bound. This defines the upper limit of the range where liquidity is provided.
917
+ */
918
+ tick_upper: number;
919
+ /**
920
+ * The change in liquidity, which can be a large number and is thus represented as a string. It can be positive or negative, indicating an increase or decrease in liquidity.
921
+ */
922
+ delta_liquidity: number;
923
+ /**
924
+ * A boolean value indicating whether the 'delta_liquidity' represents an increase (true) or decrease (false) in liquidity.
925
+ */
926
+ is_increase: boolean;
927
+ };
928
+ /**
929
+ * Represents parameters for a transitional pre-swap operation with multiple pools.
930
+ */
931
+ type TransPreSwapWithMultiPoolParams = {
932
+ /**
933
+ * The address of the pool for the transitional pre-swap.
934
+ */
935
+ poolAddress: string;
936
+ /**
937
+ * Specifies if the swap is from token A to token B.
938
+ */
939
+ a2b: boolean;
940
+ /**
941
+ * Specifies if the swap amount is specified in token A.
942
+ */
943
+ byAmountIn: boolean;
944
+ /**
945
+ * The swap amount.
946
+ */
947
+ amount: string;
948
+ } & CoinPairType;
949
+ /**
950
+ * Represents parameters for collecting rewarder fees.
951
+ */
952
+ type CollectRewarderParams = {
953
+ /**
954
+ * The identifier of the pool.
955
+ */
956
+ pool_id: SuiObjectIdType;
957
+ /**
958
+ * The identifier of the position.
959
+ */
960
+ pos_id: SuiObjectIdType;
961
+ /**
962
+ * Specifies if the fee should be collected.
963
+ */
964
+ collect_fee: boolean;
965
+ /**
966
+ * An array of rewarder coin types.
967
+ */
968
+ rewarder_coin_types: SuiAddressType[];
969
+ } & CoinPairType;
970
+ type RemoveLiquidityAndClaimRewardsParams = {
971
+ /**
972
+ * The identifier of the pool.
973
+ */
974
+ pool_id: SuiObjectIdType;
975
+ /**
976
+ * The minimum amount of the first coin to be received.
977
+ */
978
+ min_amount_a: bigint;
979
+ /**
980
+ * The minimum amount of the second coin to be received.
981
+ */
982
+ min_amount_b: bigint;
983
+ /**
984
+ * The actual change in liquidity that has been added.
985
+ */
986
+ delta_liquidity: string;
987
+ /**
988
+ * The identifier of the position.
989
+ */
990
+ pos_id: SuiObjectIdType;
991
+ } & CoinPairType;
992
+ /**
993
+ * Represents the amount owed by a rewarder.
994
+ */
995
+ type RewarderAmountOwed = {
996
+ /**
997
+ * The amount owed.
998
+ */
999
+ amount_owed: BN;
1000
+ /**
1001
+ * The address of the coin.
1002
+ */
1003
+ coin_address: string;
1004
+ };
1005
+ /**
1006
+ * Utility function to retrieve packager configurations from a package object.
1007
+ * @param {Package<T>} packageObj - The package object containing configurations.
1008
+ * @throws {Error} Throws an error if the package does not have a valid config.
1009
+ * @returns {T} The retrieved configuration.
1010
+ */
1011
+ declare function getPackagerConfigs<T>(packageObj: Package<T>): T;
1012
+ type PositionTransactionInfo = {
1013
+ index: string;
1014
+ txDigest: string;
1015
+ packageId: string;
1016
+ transactionModule: string;
1017
+ sender: string;
1018
+ type: string;
1019
+ timestampMs: string;
1020
+ parsedJson: any;
1021
+ };
1022
+ type PoolTransactionInfo = {
1023
+ index: string;
1024
+ tx: string;
1025
+ sender: string;
1026
+ type: string;
1027
+ block_time: string;
1028
+ parsedJson: any;
1029
+ };
1030
+ declare const poolFilterEvenTypes: string[];
1031
+
1032
+ /**
1033
+ * Represents tick data for a liquidity pool.
1034
+ */
1035
+ type TickData = {
1036
+ /**
1037
+ * The object identifier of the tick data.
1038
+ */
1039
+ objectId: string;
1040
+ /**
1041
+ * The index of the tick.
1042
+ */
1043
+ index: number;
1044
+ /**
1045
+ * The square root price value for the tick.
1046
+ */
1047
+ sqrtPrice: BN;
1048
+ /**
1049
+ * The net liquidity value for the tick.
1050
+ */
1051
+ liquidityNet: BN;
1052
+ /**
1053
+ * The gross liquidity value for the tick.
1054
+ */
1055
+ liquidityGross: BN;
1056
+ /**
1057
+ * The fee growth outside coin A for the tick.
1058
+ */
1059
+ feeGrowthOutsideA: BN;
1060
+ /**
1061
+ * The fee growth outside coin B for the tick.
1062
+ */
1063
+ feeGrowthOutsideB: BN;
1064
+ /**
1065
+ * An array of rewarders' growth outside values for the tick.
1066
+ */
1067
+ rewardersGrowthOutside: BN[];
1068
+ };
1069
+ /**
1070
+ * Represents a tick for a liquidity pool.
1071
+ */
1072
+ type Tick = {
1073
+ /**
1074
+ * The index of the tick.
1075
+ */
1076
+ index: Bits;
1077
+ /**
1078
+ * The square root price value for the tick (string representation).
1079
+ */
1080
+ sqrt_price: string;
1081
+ /**
1082
+ * The net liquidity value for the tick (Bits format).
1083
+ */
1084
+ liquidity_net: Bits;
1085
+ /**
1086
+ * The gross liquidity value for the tick (string representation).
1087
+ */
1088
+ liquidity_gross: string;
1089
+ /**
1090
+ * The fee growth outside coin A for the tick (string representation).
1091
+ */
1092
+ fee_growth_outside_a: string;
1093
+ /**
1094
+ * The fee growth outside coin B for the tick (string representation).
1095
+ */
1096
+ fee_growth_outside_b: string;
1097
+ /**
1098
+ * An array of rewarders' growth outside values for the tick (array of string representations).
1099
+ */
1100
+ rewarders_growth_outside: string[3];
1101
+ };
1102
+ /**
1103
+ * Represents bits information.
1104
+ */
1105
+ type Bits = {
1106
+ bits: string;
1107
+ };
1108
+ /**
1109
+ * Represents data for a liquidity mining pool.
1110
+ */
1111
+ type DammpoolData = {
1112
+ coinA: string;
1113
+ coinB: string;
1114
+ currentSqrtPrice: BN;
1115
+ currentTickIndex: number;
1116
+ feeGrowthGlobalA: BN;
1117
+ feeGrowthGlobalB: BN;
1118
+ feeProtocolCoinA: BN;
1119
+ feeProtocolCoinB: BN;
1120
+ feeRate: BN;
1121
+ liquidity: BN;
1122
+ tickIndexes: number[];
1123
+ tickSpacing: number;
1124
+ ticks: Array<TickData>;
1125
+ collection_name: string;
1126
+ };
1127
+ /**
1128
+ * Transforms a Pool object into DammpoolData format.
1129
+ * @param {Pool} pool - The liquidity pool object to transform.
1130
+ * @returns {DammpoolData} The transformed DammpoolData object.
1131
+ */
1132
+ declare function transDammpoolDataWithoutTicks(pool: Pool): DammpoolData;
1133
+ /**
1134
+ * Creates a Bits object from an index.
1135
+ * @param {number | string} index - The index value.
1136
+ * @returns {Bits} The created Bits object.
1137
+ */
1138
+ declare function newBits(index: number | string): Bits;
1139
+
1140
+ /**
1141
+ * The maximum tick index supported by the dammpool program.
1142
+ * @category Constants
1143
+ */
1144
+ declare const MAX_TICK_INDEX = 443636;
1145
+ /**
1146
+ * The minimum tick index supported by the dammpool program.
1147
+ * @category Constants
1148
+ */
1149
+ declare const MIN_TICK_INDEX = -443636;
1150
+ /**
1151
+ * The maximum sqrt-price supported by the dammpool program.
1152
+ * @category Constants
1153
+ */
1154
+ declare const MAX_SQRT_PRICE = "79226673515401279992447579055";
1155
+ /**
1156
+ * The number of initialized ticks that a tick-array account can hold.
1157
+ * @category Constants
1158
+ */
1159
+ declare const TICK_ARRAY_SIZE = 64;
1160
+ /**
1161
+ * The minimum sqrt-price supported by the dammpool program.
1162
+ * @category Constants
1163
+ */
1164
+ declare const MIN_SQRT_PRICE = "4295048016";
1165
+ /**
1166
+ * The denominator which the fee rate is divided on.
1167
+ * @category Constants
1168
+ */
1169
+ declare const FEE_RATE_DENOMINATOR: BN;
1170
+
1171
+ /**
1172
+ * Represents configuration for tokens.
1173
+ */
1174
+ type TokenConfig = {
1175
+ /**
1176
+ * The object identifier of the coin registry.
1177
+ */
1178
+ coin_registry_id: SuiObjectIdType;
1179
+ /**
1180
+ * The object identifier of the coin list owner.
1181
+ */
1182
+ coin_list_owner: SuiObjectIdType;
1183
+ /**
1184
+ * The object identifier of the pool registry.
1185
+ */
1186
+ pool_registry_id: SuiObjectIdType;
1187
+ /**
1188
+ * The object identifier of the pool list owner.
1189
+ */
1190
+ pool_list_owner: SuiObjectIdType;
1191
+ };
1192
+ /**
1193
+ * Represents information about a token.
1194
+ */
1195
+ type TokenInfo = {
1196
+ /**
1197
+ * The name of the token.
1198
+ */
1199
+ name: string;
1200
+ /**
1201
+ * The symbol of the token.
1202
+ */
1203
+ symbol: string;
1204
+ /**
1205
+ * The official symbol of the token.
1206
+ */
1207
+ official_symbol: string;
1208
+ /**
1209
+ * The Coingecko ID of the token.
1210
+ */
1211
+ coingecko_id: string;
1212
+ /**
1213
+ * The number of decimal places for the token.
1214
+ */
1215
+ decimals: number;
1216
+ /**
1217
+ * The project URL for the token.
1218
+ */
1219
+ project_url: string;
1220
+ /**
1221
+ * The URL to the logo image of the token.
1222
+ */
1223
+ logo_url: string;
1224
+ /**
1225
+ * The address of the token.
1226
+ */
1227
+ address: string;
1228
+ } & Record<string, any>;
1229
+ /**
1230
+ * Represents information about a liquidity pool.
1231
+ */
1232
+ type PoolInfo = {
1233
+ /**
1234
+ * The symbol of the pool.
1235
+ */
1236
+ symbol: string;
1237
+ /**
1238
+ * The name of the pool.
1239
+ */
1240
+ name: string;
1241
+ /**
1242
+ * The number of decimal places for the pool.
1243
+ */
1244
+ decimals: number;
1245
+ /**
1246
+ * The fee for the pool.
1247
+ */
1248
+ fee: string;
1249
+ /**
1250
+ * The tick spacing for the pool.
1251
+ */
1252
+ tick_spacing: number;
1253
+ /**
1254
+ * The type of the pool.
1255
+ */
1256
+ type: string;
1257
+ /**
1258
+ * The address of the pool.
1259
+ */
1260
+ address: string;
1261
+ /**
1262
+ * The address of coin A for the pool.
1263
+ */
1264
+ coin_a_address: string;
1265
+ /**
1266
+ * The address of coin B for the pool.
1267
+ */
1268
+ coin_b_address: string;
1269
+ /**
1270
+ * The project URL for the pool.
1271
+ */
1272
+ project_url: string;
1273
+ /**
1274
+ * The sort order for the pool.
1275
+ */
1276
+ sort: number;
1277
+ /**
1278
+ * Indicates if the rewarder is displayed for the pool.
1279
+ */
1280
+ is_display_rewarder: boolean;
1281
+ /**
1282
+ * Indicates if rewarder 1 is displayed for the pool.
1283
+ */
1284
+ rewarder_display1: boolean;
1285
+ /**
1286
+ * Indicates if rewarder 2 is displayed for the pool.
1287
+ */
1288
+ rewarder_display2: boolean;
1289
+ /**
1290
+ * Indicates if rewarder 3 is displayed for the pool.
1291
+ */
1292
+ rewarder_display3: boolean;
1293
+ /**
1294
+ * Indicates if the pool is stable.
1295
+ */
1296
+ is_stable: boolean;
1297
+ } & Record<string, any>;
1298
+ /**
1299
+ * Represents an event related to token configuration.
1300
+ */
1301
+ type TokenConfigEvent = {
1302
+ /**
1303
+ * The object identifier of the coin registry.
1304
+ */
1305
+ coin_registry_id: SuiObjectIdType;
1306
+ /**
1307
+ * The object identifier of the coin list owner.
1308
+ */
1309
+ coin_list_owner: SuiObjectIdType;
1310
+ /**
1311
+ * The object identifier of the pool registry.
1312
+ */
1313
+ pool_registry_id: SuiObjectIdType;
1314
+ /**
1315
+ * The object identifier of the pool list owner.
1316
+ */
1317
+ pool_list_owner: SuiObjectIdType;
1318
+ };
1319
+
1320
+ /**
1321
+ * Represents input data for adding liquidity to a pool.
1322
+ */
1323
+ type LiquidityInput = {
1324
+ /**
1325
+ * The amount of coin A.
1326
+ */
1327
+ coinAmountA: BN;
1328
+ /**
1329
+ * The amount of coin B.
1330
+ */
1331
+ coinAmountB: BN;
1332
+ /**
1333
+ * The maximum amount of token A.
1334
+ */
1335
+ tokenMaxA: BN;
1336
+ /**
1337
+ * The maximum amount of token B.
1338
+ */
1339
+ tokenMaxB: BN;
1340
+ /**
1341
+ * The liquidity amount.
1342
+ */
1343
+ liquidityAmount: BN;
1344
+ fix_amount_a: boolean;
1345
+ };
1346
+ /**
1347
+ * Represents the direction of a swap.
1348
+ */
1349
+ declare enum SwapDirection {
1350
+ /**
1351
+ * Swap from coin A to coin B.
1352
+ */
1353
+ A2B = "a2b",
1354
+ /**
1355
+ * Swap from coin B to coin A.
1356
+ */
1357
+ B2A = "b2a"
1358
+ }
1359
+
1360
+ type BigNumber = Decimal.Value | number | string;
1361
+
1362
+ interface IModule {
1363
+ readonly sdk: FerraDammSDK;
1364
+ }
1365
+
1366
+ type CreatePoolAndAddLiquidityRowResult = {
1367
+ position: TransactionObjectArgument;
1368
+ coinAObject: TransactionObjectArgument;
1369
+ coinBObject: TransactionObjectArgument;
1370
+ transaction: Transaction;
1371
+ coinAType: string;
1372
+ coinBType: string;
1373
+ };
1374
+ type FeeTier = {
1375
+ tick_spacing: number;
1376
+ dynamic_fee: {
1377
+ decay_period: number;
1378
+ filter_period: number;
1379
+ max_volatility_accumulator: number;
1380
+ reduction_factor: number;
1381
+ variable_fee_control: number;
1382
+ };
1383
+ fee_rate: number;
1384
+ fee_scheduler: {
1385
+ exponential: {
1386
+ cliff_fee_numerator: string;
1387
+ number_of_period: number;
1388
+ period_frequency: string;
1389
+ reduction_factor: string;
1390
+ };
1391
+ linear: {
1392
+ cliff_fee_numerator: string;
1393
+ number_of_period: number;
1394
+ period_frequency: string;
1395
+ reduction_factor: string;
1396
+ };
1397
+ };
1398
+ };
1399
+ /**
1400
+ * Pool module for comprehensive DAMM pool management
1401
+ * Handles pool creation, data retrieval, liquidity operations, and tick management
1402
+ * Includes caching mechanisms for optimal performance
1403
+ *
1404
+ * @example
1405
+ * // Get pool information
1406
+ * const pool = await sdk.Pool.getPool('0x_pool_address');
1407
+ * console.log(`Liquidity: ${pool.liquidity}`);
1408
+ * console.log(`Current tick: ${pool.currentTickIndex}`);
1409
+ * console.log(`Fee rate: ${pool.feeRate / 10000000}%`);
1410
+ *
1411
+ * @example
1412
+ * // Fetch all ticks for a pool
1413
+ * const ticks = await sdk.Pool.fetchTicksByRpc('0x_pool_address');
1414
+ * console.log(`Found ${ticks.length} initialized ticks`);
1415
+ *
1416
+ * @example
1417
+ * // Create a new pool with initial liquidity
1418
+ * const createPoolTx = await sdk.Pool.createPoolTransactionPayload({
1419
+ * coinTypeA: "0x2::sui::SUI",
1420
+ * coinTypeB: "0x5d4b...::coin::COIN",
1421
+ * tick_spacing: 60,
1422
+ * initialize_sqrt_price: "79228162514264337593543950336", // 1:1 price
1423
+ * uri: "https://example.com/pool-metadata.json",
1424
+ * amount_a: 1000000000, // 1 SUI
1425
+ * amount_b: 1000000, // 1 COIN
1426
+ * fix_amount_a: true,
1427
+ * tick_lower: -120,
1428
+ * tick_upper: 120,
1429
+ * slippage: 0.05
1430
+ * });
1431
+ */
1432
+ declare class PoolModule implements IModule {
1433
+ protected _sdk: FerraDammSDK;
1434
+ private readonly _cache;
1435
+ constructor(sdk: FerraDammSDK);
1436
+ get sdk(): FerraDammSDK;
1437
+ /**
1438
+ * Retrieves available base fee tiers and their parameters
1439
+ * Returns all supported fee configurations including dynamic fee settings
1440
+ * @returns Array of fee tier configurations with tick spacing and fee parameters
1441
+ * @throws {DammpoolsError} If config fetch fails
1442
+ * @example
1443
+ * const feeTiers = await sdk.Pool.getBaseFeesAvailable();
1444
+ * feeTiers.forEach(tier => {
1445
+ * console.log(`Tick spacing: ${tier.tick_spacing}`);
1446
+ * console.log(`Fee rate: ${tier.fee_rate / 10000000}%`);
1447
+ * console.log(`Dynamic fee enabled: ${tier.dynamic_fee !== null}`);
1448
+ * });
1449
+ */
1450
+ getBaseFeesAvailable(): Promise<FeeTier[]>;
1451
+ /**
1452
+ * Gets all positions for a specific pool
1453
+ * Fetches position data from the pool's position manager
1454
+ * @param positionHandle - Position manager handle ID from pool object
1455
+ * @param paginationArgs - Pagination configuration or 'all' to fetch everything
1456
+ * @returns Paginated list of positions
1457
+ * @throws {DammpoolsError} If position handle is invalid
1458
+ * @example
1459
+ * const pool = await sdk.Pool.getPool(poolId);
1460
+ * const positions = await sdk.Pool.getPositionList(
1461
+ * pool.positionManager.positionsHandle,
1462
+ * { cursor: null, limit: 50 }
1463
+ * );
1464
+ * console.log(`Found ${positions.data.length} positions`);
1465
+ */
1466
+ getPositionList(positionHandle: string, paginationArgs?: PaginationArgs): Promise<DataPage<Position>>;
1467
+ /**
1468
+ * Fetches pool immutable data (type, addresses, spacing) for multiple pools
1469
+ * Immutables don't change after pool creation - safe to cache long-term
1470
+ * @param assignPoolIDs - Specific pool IDs to fetch (empty = all pools)
1471
+ * @param offset - Starting index for pagination
1472
+ * @param limit - Maximum number of pools to return
1473
+ * @param forceRefresh - Bypass cache and fetch fresh data
1474
+ * @returns Array of pool immutable data
1475
+ * @example
1476
+ * // Get all pools
1477
+ * const allPools = await sdk.Pool.getPoolImmutables();
1478
+ *
1479
+ * // Get specific pools
1480
+ * const specificPools = await sdk.Pool.getPoolImmutables([
1481
+ * '0x_pool1',
1482
+ * '0x_pool2'
1483
+ * ]);
1484
+ *
1485
+ * specificPools.forEach(pool => {
1486
+ * console.log(`${pool.name}: ${pool.coin_type_a} / ${pool.coin_type_b}`);
1487
+ * });
1488
+ */
1489
+ getPoolImmutables(assignPoolIDs?: string[], offset?: number, limit?: number, forceRefresh?: boolean): Promise<PoolImmutables[]>;
1490
+ /**
1491
+ * Fetches complete pool state including current liquidity, price, and fees
1492
+ * This is the main method for getting up-to-date pool data
1493
+ * @param assignPools - Specific pool IDs to fetch (empty = all pools)
1494
+ * @param offset - Starting index for pagination
1495
+ * @param limit - Maximum number of pools to return
1496
+ * @returns Array of complete pool objects
1497
+ * @example
1498
+ * const pools = await sdk.Pool.getPools(['0x_pool_id']);
1499
+ * const pool = pools[0];
1500
+ *
1501
+ * console.log(`Current sqrt price: ${pool.currentSqrtPrice}`);
1502
+ * console.log(`Current tick: ${pool.currentTickIndex}`);
1503
+ * console.log(`Total liquidity: ${pool.liquidity}`);
1504
+ * console.log(`Coin A amount: ${pool.coinAmountA}`);
1505
+ * console.log(`Coin B amount: ${pool.coinAmountB}`);
1506
+ * console.log(`Fee rate: ${pool.feeRate / 10000000}%`);
1507
+ */
1508
+ getPools(assignPools?: string[], offset?: number, limit?: number): Promise<Pool[]>;
1509
+ /**
1510
+ * Retrieves pool immutable data with advanced pagination support
1511
+ * @param paginationArgs - Pagination parameters ('all' or specific cursor/limit)
1512
+ * @param forceRefresh - Force cache refresh if true
1513
+ * @returns Paginated pool immutable data with navigation metadata
1514
+ */
1515
+ getPoolImmutablesWithPage(paginationArgs?: PaginationArgs, forceRefresh?: boolean): Promise<DataPage<PoolImmutables>>;
1516
+ /**
1517
+ * Retrieves complete pool data with advanced pagination support
1518
+ * @param assignPools - Specific pool IDs to retrieve (empty array for all pools)
1519
+ * @param paginationArgs - Pagination parameters ('all' or specific cursor/limit)
1520
+ * @param forceRefresh - Force cache refresh if true
1521
+ * @returns Array of complete pool objects with current state
1522
+ */
1523
+ getPoolsWithPage(assignPools?: string[], paginationArgs?: PaginationArgs, forceRefresh?: boolean): Promise<Pool[]>;
1524
+ /**
1525
+ * Gets a single pool's complete state by ID
1526
+ * Preferred method for fetching individual pool data - includes caching
1527
+ * @param poolID - Pool object ID (0x-prefixed address)
1528
+ * @param forceRefresh - Skip cache and fetch fresh data (default: true)
1529
+ * @returns Complete pool object with current state
1530
+ * @throws {DammpoolsError} If pool doesn't exist or fetch fails (PoolErrorCode.InvalidPoolObject)
1531
+ * @example
1532
+ * const pool = await sdk.Pool.getPool('0x_pool_address');
1533
+ *
1534
+ * // Check if pool is paused
1535
+ * if (pool.isPause) {
1536
+ * console.log('Pool is currently paused');
1537
+ * }
1538
+ *
1539
+ * // Calculate current price from sqrt price
1540
+ * const sqrtPrice = new BN(pool.currentSqrtPrice);
1541
+ * const price = TickMath.sqrtPriceX64ToPrice(sqrtPrice, 9, 6);
1542
+ * console.log(`Current price: ${price.toString()} COIN per SUI`);
1543
+ */
1544
+ getPool(poolID: string, forceRefresh?: boolean): Promise<Pool>;
1545
+ /**
1546
+ * Creates a transaction to instantiate a new pool with initial liquidity
1547
+ * Automatically sorts coins and validates parameters
1548
+ * @param params - Pool creation parameters including coins, fee tier, and initial position
1549
+ * @returns Transaction ready for signing and execution
1550
+ * @throws {DammpoolsError} If coin types are invalid or amounts insufficient
1551
+ * @example
1552
+ * const tx = await sdk.Pool.createPoolTransactionPayload({
1553
+ * coinTypeA: "0x2::sui::SUI",
1554
+ * coinTypeB: "0x5d4b...::coin::COIN",
1555
+ * tick_spacing: 60, // Standard 0.3% fee tier
1556
+ * initialize_sqrt_price: "79228162514264337593543950336", // 1:1 price
1557
+ * uri: "https://ferra.xyz/pool-metadata.json",
1558
+ * amount_a: 10_000_000_000, // 10 SUI
1559
+ * amount_b: 10_000_000, // 10 COIN
1560
+ * fix_amount_a: true,
1561
+ * tick_lower: -600, // Wide range
1562
+ * tick_upper: 600,
1563
+ * slippage: 0.05
1564
+ * });
1565
+ *
1566
+ * const result = await sdk.fullClient.signAndExecuteTransaction({
1567
+ * transaction: tx,
1568
+ * signer: keypair
1569
+ * });
1570
+ *
1571
+ * // Extract pool ID from events
1572
+ * const poolCreatedEvent = result.events?.find(
1573
+ * e => e.type.includes('::PoolCreatedEvent')
1574
+ * );
1575
+ * const poolId = poolCreatedEvent?.parsedJson?.pool_id;
1576
+ */
1577
+ creatPoolTransactionPayload(params: CreatePoolAddLiquidityParams): Promise<Transaction>;
1578
+ /**
1579
+ * Creates a pool with initial liquidity position
1580
+ * Automatically sorts coin types according to protocol requirements
1581
+ * @param params - Pool creation and liquidity parameters
1582
+ * @returns Transaction object for pool creation and liquidity addition
1583
+ */
1584
+ createPoolTransactionPayload(params: CreatePoolAddLiquidityParams): Promise<Transaction>;
1585
+ /**
1586
+ * Gets DAMM global configuration including registry IDs and settings
1587
+ * Configuration is cached for performance
1588
+ * @param forceRefresh - Bypass cache and fetch fresh config
1589
+ * @returns Global DAMM configuration object
1590
+ * @example
1591
+ * const config = await sdk.Pool.getDammConfigs();
1592
+ * console.log(`Global config ID: ${config.global_config_id}`);
1593
+ * console.log(`Pools registry: ${config.pools_id}`);
1594
+ * console.log(`Rewarder vault: ${config.global_rewarder_vault_id}`);
1595
+ */
1596
+ getDammConfigs(forceRefresh?: boolean): Promise<DammConfig>;
1597
+ /**
1598
+ * Retrieves full transaction details including events and effects
1599
+ * Used for analyzing pool-related transactions
1600
+ * @param digest - Transaction digest to query
1601
+ * @param forceRefresh - Force cache refresh if true
1602
+ * @returns Complete transaction block response or null
1603
+ */
1604
+ getSuiTransactionResponse(digest: string, forceRefresh?: boolean): Promise<SuiTransactionBlockResponse | null>;
1605
+ /**
1606
+ * Gets transaction history for a specific pool
1607
+ * Returns swaps, adds/removes liquidity, fee collections
1608
+ * @param pool_id - Pool object ID
1609
+ * @param limit - Maximum transactions to return (default: 100)
1610
+ * @param offset - Starting offset for pagination
1611
+ * @returns Array of pool transaction info
1612
+ * @example
1613
+ * const txList = await sdk.Pool.getPoolTransactionList({
1614
+ * pool_id: poolId,
1615
+ * limit: 50,
1616
+ * offset: 0
1617
+ * });
1618
+ *
1619
+ * txList.forEach(tx => {
1620
+ * const type = tx.type.split('::').pop();
1621
+ * console.log(`${type}: ${tx.tx}`);
1622
+ * });
1623
+ */
1624
+ getPoolTransactionList({ poolId, paginationArgs, order, fullRpcUrl, }: {
1625
+ poolId: string;
1626
+ fullRpcUrl?: string;
1627
+ paginationArgs: PageQuery;
1628
+ order?: 'ascending' | 'descending' | null | undefined;
1629
+ }): Promise<DataPage<PoolTransactionInfo>>;
1630
+ /**
1631
+ * Internal method for creating pool with initial liquidity
1632
+ * Uses integrate contract to handle pool creation and liquidity in single transaction
1633
+ * @param params - Pool creation and liquidity parameters
1634
+ * @returns Transaction object
1635
+ */
1636
+ private createPoolAndAddLiquidity;
1637
+ /**
1638
+ * Fetches all initialized ticks for a pool from on-chain events
1639
+ * More comprehensive but slower than fetchTicksByRpc
1640
+ * Use this when you need complete tick history including deleted ticks
1641
+ * @param params - Fetch parameters with pool ID
1642
+ * @returns Array of all tick data from pool history
1643
+ * @example
1644
+ * const ticks = await sdk.Pool.fetchTicks({ pool_id: poolId });
1645
+ * console.log(`Total ticks: ${ticks.length}`);
1646
+ *
1647
+ * // Find ticks in specific range
1648
+ * const ticksInRange = ticks.filter(
1649
+ * t => t.index >= -120 && t.index <= 120
1650
+ * );
1651
+ */
1652
+ fetchTicks(params: FetchParams): Promise<TickData[]>;
1653
+ /**
1654
+ * Internal method to fetch tick data using simulated transaction
1655
+ * Uses devInspectTransactionBlock for gas-free tick data retrieval
1656
+ * @param params - Tick fetch parameters including start indices and limit
1657
+ * @returns Array of tick data
1658
+ */
1659
+ private getTicks;
1660
+ /**
1661
+ * Fetches position rewards from events for multiple positions
1662
+ * Useful for displaying historical reward claims
1663
+ * @param params - Fetch parameters with pool ID
1664
+ * @returns Array of position reward data
1665
+ * @example
1666
+ * const rewards = await sdk.Pool.fetchPositionRewardList({
1667
+ * pool_id: poolId
1668
+ * });
1669
+ *
1670
+ * rewards.forEach(reward => {
1671
+ * console.log(`Position: ${reward.pos_object_id}`);
1672
+ * console.log(`Reward 0: ${reward.reward_amount_owed_0}`);
1673
+ * console.log(`Reward 1: ${reward.reward_amount_owed_1}`);
1674
+ * console.log(`Reward 2: ${reward.reward_amount_owed_2}`);
1675
+ * });
1676
+ */
1677
+ fetchPositionRewardList(params: FetchParams): Promise<PositionReward[]>;
1678
+ /**
1679
+ * Fetches current tick state directly from pool's tick manager (RPC)
1680
+ * Faster than event-based fetch, returns only currently active ticks
1681
+ * Recommended for most use cases
1682
+ * @param tickHandle - Tick manager handle ID from pool object
1683
+ * @returns Array of currently active tick data
1684
+ * @example
1685
+ * const pool = await sdk.Pool.getPool(poolId);
1686
+ * const ticks = await sdk.Pool.fetchTicksByRpc(pool.ticksHandle);
1687
+ *
1688
+ * // Sort ticks by index for swap simulation
1689
+ * ticks.sort((a, b) => a.index - b.index);
1690
+ *
1691
+ * // Find nearest tick below current
1692
+ * const nearestBelow = ticks
1693
+ * .filter(t => t.index < pool.currentTickIndex)
1694
+ * .sort((a, b) => b.index - a.index)[0];
1695
+ */
1696
+ fetchTicksByRpc(tickHandle: string): Promise<TickData[]>;
1697
+ /**
1698
+ * Internal method to fetch tick objects by their IDs
1699
+ * @param tickObjectId - Array of tick object IDs
1700
+ * @returns Array of tick data
1701
+ */
1702
+ private getTicksByRpc;
1703
+ /**
1704
+ * Gets tick data for a specific tick index
1705
+ * Returns null if tick is not initialized
1706
+ * @param tickHandle - Tick manager handle ID
1707
+ * @param tickIndex - Specific tick index to fetch
1708
+ * @returns Tick data or throws if tick doesn't exist
1709
+ * @throws {DammpoolsError} If tick is not initialized
1710
+ * @example
1711
+ * const pool = await sdk.Pool.getPool(poolId);
1712
+ *
1713
+ * try {
1714
+ * const tick = await sdk.Pool.getTickDataByIndex(
1715
+ * pool.ticksHandle,
1716
+ * -120
1717
+ * );
1718
+ * console.log(`Liquidity at tick -120: ${tick.liquidityGross.toString()}`);
1719
+ * } catch (error) {
1720
+ * console.log('Tick -120 is not initialized');
1721
+ * }
1722
+ */
1723
+ getTickDataByIndex(tickHandle: string, tickIndex: number): Promise<TickData>;
1724
+ /**
1725
+ * Retrieves tick data by its object ID
1726
+ * Direct object fetch for known tick IDs
1727
+ * @param tickId - Tick object ID
1728
+ * @returns Tick data or null if not found
1729
+ */
1730
+ getTickDataByObjectId(tickId: string): Promise<TickData | null>;
1731
+ /**
1732
+ * Retrieves referral fee balances for a partner
1733
+ * @param partner - Partner object ID
1734
+ * @param showDisplay - Include display metadata
1735
+ * @returns Array of coin assets with balances
1736
+ */
1737
+ getPartnerRefFeeAmount(partner: string, showDisplay?: boolean): Promise<CoinAsset[]>;
1738
+ /**
1739
+ * Claims partner referral fees accumulated for a partner
1740
+ * Requires partner capability NFT
1741
+ * @param partnerCap - Partner capability object ID
1742
+ * @param partner - Partner address
1743
+ * @param coinType - Type of coin to claim fees in
1744
+ * @returns Transaction for claiming partner fees
1745
+ * @throws {DammpoolsError} If partner not found or invalid (PartnerErrorCode.NotFoundPartnerObject)
1746
+ * @example
1747
+ * const tx = await sdk.Pool.claimPartnerRefFeePayload(
1748
+ * '0x_partner_cap_id',
1749
+ * '0x_partner_address',
1750
+ * '0x2::sui::SUI'
1751
+ * );
1752
+ *
1753
+ * const result = await sdk.fullClient.signAndExecuteTransaction({
1754
+ * transaction: tx,
1755
+ * signer: partnerKeypair
1756
+ * });
1757
+ */
1758
+ claimPartnerRefFeePayload(partnerCap: string, partner: string, coinType: string): Promise<Transaction>;
1759
+ /**
1760
+ * Updates cached data with expiration time
1761
+ * @param key - Cache key
1762
+ * @param data - Data to cache
1763
+ * @param time - Cache duration in minutes (default: 5)
1764
+ */
1765
+ updateCache(key: string, data: SuiResource, time?: number): void;
1766
+ /**
1767
+ * Retrieves cached data if valid
1768
+ * @param key - Cache key
1769
+ * @param forceRefresh - Bypass cache if true
1770
+ * @returns Cached data or undefined if expired/not found
1771
+ */
1772
+ getCache<T>(key: string, forceRefresh?: boolean): T | undefined;
1773
+ }
1774
+
1775
+ declare function estPoolAPR(preBlockReward: BN, rewardPrice: BN, totalTradingFee: BN, totalLiquidityValue: BN): BN;
1776
+ type estPosAPRResult = {
1777
+ feeAPR: Decimal;
1778
+ posRewarder0APR: Decimal;
1779
+ posRewarder1APR: Decimal;
1780
+ posRewarder2APR: Decimal;
1781
+ };
1782
+ declare function estPositionAPRWithDeltaMethod(currentTickIndex: number, lowerTickIndex: number, upperTickIndex: number, currentSqrtPriceX64: BN, poolLiquidity: BN, decimalsA: number, decimalsB: number, decimalsRewarder0: number, decimalsRewarder1: number, decimalsRewarder2: number, feeRate: number, amountAStr: string, amountBStr: string, poolAmountA: BN, poolAmountB: BN, swapVolumeStr: string, poolRewarders0Str: string, poolRewarders1Str: string, poolRewarders2Str: string, coinAPriceStr: string, coinBPriceStr: string, rewarder0PriceStr: string, rewarder1PriceStr: string, rewarder2PriceStr: string): estPosAPRResult;
1783
+ declare function estPositionAPRWithMultiMethod(lowerUserPrice: number, upperUserPrice: number, lowerHistPrice: number, upperHistPrice: number): Decimal;
1784
+
1785
+ type SwapStepResult = {
1786
+ amountIn: BN;
1787
+ amountOut: BN;
1788
+ nextSqrtPrice: BN;
1789
+ feeAmount: BN;
1790
+ };
1791
+ type SwapResult = {
1792
+ amountIn: BN;
1793
+ amountOut: BN;
1794
+ feeAmount: BN;
1795
+ startSqrtPrice: BN;
1796
+ nextSqrtPrice: BN;
1797
+ isExceed: boolean;
1798
+ stepResults: Array<{
1799
+ currentSqrtPrice: BN;
1800
+ targetSqrtPrice: BN;
1801
+ currentLiquidity: BN;
1802
+ amountIn: BN;
1803
+ amountOut: BN;
1804
+ feeAmount: BN;
1805
+ remainderAmount: BN;
1806
+ }>;
1807
+ };
1808
+ type CoinAmounts = {
1809
+ coinA: BN;
1810
+ coinB: BN;
1811
+ };
1812
+ declare function toCoinAmount(a: number, b: number): CoinAmounts;
1813
+ /**
1814
+ * Get the amount A delta about two prices, for give amount of liquidity.
1815
+ * `delta_a = (liquidity * delta_sqrt_price) / sqrt_price_upper * sqrt_price_lower)`
1816
+ *
1817
+ * @param sqrtPrice0 - A sqrt price
1818
+ * @param sqrtPrice1 - Another sqrt price
1819
+ * @param liquidity - The amount of usable liquidity
1820
+ * @param roundUp - Whether to round the amount up or down
1821
+ * @returns
1822
+ */
1823
+ declare function getDeltaA(sqrtPrice0: BN, sqrtPrice1: BN, liquidity: BN, roundUp: boolean): BN;
1824
+ /**
1825
+ * Get the amount B delta about two prices, for give amount of liquidity.
1826
+ * `delta_a = (liquidity * delta_sqrt_price) / sqrt_price_upper * sqrt_price_lower)`
1827
+ *
1828
+ * @param sqrtPrice0 - A sqrt price
1829
+ * @param sqrtPrice1 - Another sqrt price
1830
+ * @param liquidity - The amount of usable liquidity
1831
+ * @param roundUp - Whether to round the amount up or down
1832
+ * @returns
1833
+ */
1834
+ declare function getDeltaB(sqrtPrice0: BN, sqrtPrice1: BN, liquidity: BN, roundUp: boolean): BN;
1835
+ /**
1836
+ * Get the next sqrt price from give a delta of token_a.
1837
+ * `new_sqrt_price = (sqrt_price * liquidity) / (liquidity +/- amount * sqrt_price)`
1838
+ *
1839
+ * @param sqrtPrice - The start sqrt price
1840
+ * @param liquidity - The amount of usable liquidity
1841
+ * @param amount - The amount of token_a
1842
+ * @param byAmountIn - Weather to fixed input
1843
+ */
1844
+ declare function getNextSqrtPriceAUp(sqrtPrice: BN, liquidity: BN, amount: BN, byAmountIn: boolean): BN;
1845
+ /**
1846
+ * Get the next sqrt price from give a delta of token_b.
1847
+ * `new_sqrt_price = (sqrt_price +(delta_b / liquidity)`
1848
+ *
1849
+ * @param sqrtPrice - The start sqrt price
1850
+ * @param liquidity - The amount of usable liquidity
1851
+ * @param amount - The amount of token_a
1852
+ * @param byAmountIn - Weather to fixed input
1853
+ */
1854
+ declare function getNextSqrtPriceBDown(sqrtPrice: BN, liquidity: BN, amount: BN, byAmountIn: boolean): BN;
1855
+ /**
1856
+ * Get next sqrt price from input parameter.
1857
+ *
1858
+ * @param sqrtPrice
1859
+ * @param liquidity
1860
+ * @param amount
1861
+ * @param aToB
1862
+ * @returns
1863
+ */
1864
+ declare function getNextSqrtPriceFromInput(sqrtPrice: BN, liquidity: BN, amount: BN, aToB: boolean): BN;
1865
+ /**
1866
+ * Get the next sqrt price from output parameters.
1867
+ *
1868
+ * @param sqrtPrice
1869
+ * @param liquidity
1870
+ * @param amount
1871
+ * @param a2b
1872
+ * @returns
1873
+ */
1874
+ declare function getNextSqrtPriceFromOutput(sqrtPrice: BN, liquidity: BN, amount: BN, a2b: boolean): BN;
1875
+ /**
1876
+ * Get the amount of delta_a or delta_b from input parameters, and round up result.
1877
+ *
1878
+ * @param currentSqrtPrice
1879
+ * @param targetSqrtPrice
1880
+ * @param liquidity
1881
+ * @param a2b
1882
+ * @returns
1883
+ */
1884
+ declare function getDeltaUpFromInput(currentSqrtPrice: BN, targetSqrtPrice: BN, liquidity: BN, a2b: boolean): BN;
1885
+ /**
1886
+ * Get the amount of delta_a or delta_b from output parameters, and round down result.
1887
+ *
1888
+ * @param currentSqrtPrice
1889
+ * @param targetSqrtPrice
1890
+ * @param liquidity
1891
+ * @param a2b
1892
+ * @returns
1893
+ */
1894
+ declare function getDeltaDownFromOutput(currentSqrtPrice: BN, targetSqrtPrice: BN, liquidity: BN, a2b: boolean): BN;
1895
+ /**
1896
+ * Simulate per step of swap on every tick.
1897
+ *
1898
+ * @param currentSqrtPrice
1899
+ * @param targetSqrtPrice
1900
+ * @param liquidity
1901
+ * @param amount
1902
+ * @param feeRate
1903
+ * @param byAmountIn
1904
+ * @returns
1905
+ */
1906
+ declare function computeSwapStep(currentSqrtPrice: BN, targetSqrtPrice: BN, liquidity: BN, amount: BN, feeRate: BN, byAmountIn: boolean): SwapStepResult;
1907
+ /**
1908
+ * Simulate swap by imput lots of ticks.
1909
+ * @param aToB
1910
+ * @param byAmountIn
1911
+ * @param amount
1912
+ * @param poolData
1913
+ * @param swapTicks
1914
+ * @returns
1915
+ */
1916
+ declare function computeSwap(poolData: DammpoolData, a2b: boolean, byAmountIn: boolean, amount: BN, swapTicks: Array<TickData>): SwapResult;
1917
+ /**
1918
+ * Estimate liquidity for coin A
1919
+ * @param sqrtPriceX - coin A sqrtprice
1920
+ * @param sqrtPriceY - coin B sqrtprice
1921
+ * @param coinAmount - token amount
1922
+ * @return
1923
+ */
1924
+ declare function estimateLiquidityForCoinA(sqrtPriceX: BN, sqrtPriceY: BN, coinAmount: BN): BN;
1925
+ /**
1926
+ * Estimate liquidity for coin B
1927
+ * @param sqrtPriceX - coin A sqrtprice
1928
+ * @param sqrtPriceY - coin B sqrtprice
1929
+ * @param coinAmount - token amount
1930
+ * @return
1931
+ */
1932
+ declare function estimateLiquidityForCoinB(sqrtPriceX: BN, sqrtPriceY: BN, coinAmount: BN): BN;
1933
+ declare class DammPoolUtil {
1934
+ /**
1935
+ * Update fee rate.
1936
+ * @param damm - dammpool data
1937
+ * @param feeAmount - fee Amount
1938
+ * @param refRate - ref rate
1939
+ * @param protocolFeeRate - protocol fee rate
1940
+ * @param iscoinA - is token A
1941
+ * @returns percentage
1942
+ */
1943
+ static updateFeeRate(damm: DammpoolData, feeAmount: BN, refRate: number, protocolFeeRate: number, iscoinA: boolean): {
1944
+ refFee: BN;
1945
+ damm: DammpoolData;
1946
+ };
1947
+ /**
1948
+ * Get token amount fron liquidity.
1949
+ * @param liquidity - liquidity
1950
+ * @param curSqrtPrice - Pool current sqrt price
1951
+ * @param lowerSqrtPrice - position lower sqrt price
1952
+ * @param upperSqrtPrice - position upper sqrt price
1953
+ * @param roundUp - is round up
1954
+ * @returns
1955
+ */
1956
+ static getCoinAmountFromLiquidity(liquidity: BN, curSqrtPrice: BN, lowerSqrtPrice: BN, upperSqrtPrice: BN, roundUp: boolean): CoinAmounts;
1957
+ /**
1958
+ * Estimate liquidity and token amount from one amounts
1959
+ * @param lowerTick - lower tick
1960
+ * @param upperTick - upper tick
1961
+ * @param coinAmount - token amount
1962
+ * @param iscoinA - is token A
1963
+ * @param roundUp - is round up
1964
+ * @param isIncrease - is increase
1965
+ * @param slippage - slippage percentage
1966
+ * @param curSqrtPrice - current sqrt price.
1967
+ * @return IncreaseLiquidityInput
1968
+ */
1969
+ static estLiquidityAndcoinAmountFromOneAmounts(lowerTick: number, upperTick: number, coinAmount: BN, iscoinA: boolean, roundUp: boolean, slippage: number, curSqrtPrice: BN): LiquidityInput;
1970
+ /**
1971
+ * Estimate liquidity from token amounts
1972
+ * @param curSqrtPrice - current sqrt price.
1973
+ * @param lowerTick - lower tick
1974
+ * @param upperTick - upper tick
1975
+ * @param tokenAmount - token amount
1976
+ * @return
1977
+ */
1978
+ static estimateLiquidityFromcoinAmounts(curSqrtPrice: BN, lowerTick: number, upperTick: number, tokenAmount: CoinAmounts): BN;
1979
+ /**
1980
+ * Estimate coin amounts from total amount
1981
+ * @param lowerTick
1982
+ * @param upperTick
1983
+ * @param decimalsA
1984
+ * @param decimalsB
1985
+ * @param curSqrtPrice
1986
+ * @param totalAmount
1987
+ * @param tokenPriceA
1988
+ * @param tokenPriceB
1989
+ * @returns
1990
+ */
1991
+ static estCoinAmountsFromTotalAmount(lowerTick: number, upperTick: number, curSqrtPrice: BN, totalAmount: string, tokenPriceA: string, tokenPriceB: string): {
1992
+ amountA: Decimal;
1993
+ amountB: Decimal;
1994
+ };
1995
+ static calculateDepositRatioFixTokenA(lowerTick: number, upperTick: number, curSqrtPrice: BN): {
1996
+ ratioA: Decimal;
1997
+ ratioB: Decimal;
1998
+ };
1999
+ }
2000
+
2001
+ declare const DEFAULT_GAS_BUDGET_FOR_SPLIT = 1000;
2002
+ declare const DEFAULT_GAS_BUDGET_FOR_MERGE = 500;
2003
+ declare const DEFAULT_GAS_BUDGET_FOR_TRANSFER = 100;
2004
+ declare const DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI = 100;
2005
+ declare const DEFAULT_GAS_BUDGET_FOR_STAKE = 1000;
2006
+ declare const GAS_TYPE_ARG = "0x2::sui::SUI";
2007
+ declare const GAS_TYPE_ARG_LONG = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
2008
+ declare const GAS_SYMBOL = "SUI";
2009
+ declare const DEFAULT_NFT_TRANSFER_GAS_FEE = 450;
2010
+ declare const SUI_SYSTEM_STATE_OBJECT_ID = "0x0000000000000000000000000000000000000005";
2011
+ /**
2012
+ * This class provides helper methods for working with coins.
2013
+ */
2014
+ declare class CoinAssist {
2015
+ /**
2016
+ * Get the coin type argument from a SuiMoveObject.
2017
+ *
2018
+ * @param obj The SuiMoveObject to get the coin type argument from.
2019
+ * @returns The coin type argument, or null if it is not found.
2020
+ */
2021
+ static getCoinTypeArg(obj: SuiMoveObject): string;
2022
+ /**
2023
+ * Get whether a SuiMoveObject is a SUI coin.
2024
+ *
2025
+ * @param obj The SuiMoveObject to check.
2026
+ * @returns Whether the SuiMoveObject is a SUI coin.
2027
+ */
2028
+ static isSUI(obj: SuiMoveObject): boolean;
2029
+ /**
2030
+ * Get the coin symbol from a coin type argument.
2031
+ *
2032
+ * @param coinTypeArg The coin type argument to get the symbol from.
2033
+ * @returns The coin symbol.
2034
+ */
2035
+ static getCoinSymbol(coinTypeArg: string): string;
2036
+ /**
2037
+ * Get the balance of a SuiMoveObject.
2038
+ *
2039
+ * @param obj The SuiMoveObject to get the balance from.
2040
+ * @returns The balance of the SuiMoveObject.
2041
+ */
2042
+ static getBalance(obj: SuiMoveObject): bigint;
2043
+ /**
2044
+ * Get the total balance of a list of CoinAsset objects for a given coin address.
2045
+ *
2046
+ * @param objs The list of CoinAsset objects to get the total balance for.
2047
+ * @param coinAddress The coin address to get the total balance for.
2048
+ * @returns The total balance of the CoinAsset objects for the given coin address.
2049
+ */
2050
+ static totalBalance(objs: CoinAsset[], coinAddress: SuiAddressType): bigint;
2051
+ /**
2052
+ * Get the ID of a SuiMoveObject.
2053
+ *
2054
+ * @param obj The SuiMoveObject to get the ID from.
2055
+ * @returns The ID of the SuiMoveObject.
2056
+ */
2057
+ static getID(obj: SuiMoveObject): string;
2058
+ /**
2059
+ * Get the coin type from a coin type argument.
2060
+ *
2061
+ * @param coinTypeArg The coin type argument to get the coin type from.
2062
+ * @returns The coin type.
2063
+ */
2064
+ static getCoinTypeFromArg(coinTypeArg: string): string;
2065
+ /**
2066
+ * Get the FaucetCoin objects from a SuiTransactionBlockResponse.
2067
+ *
2068
+ * @param suiTransactionResponse The SuiTransactionBlockResponse to get the FaucetCoin objects from.
2069
+ * @returns The FaucetCoin objects.
2070
+ */
2071
+ static getFaucetCoins(suiTransactionResponse: SuiTransactionBlockResponse): FaucetCoin[];
2072
+ /**
2073
+ * Get the CoinAsset objects for a given coin type.
2074
+ *
2075
+ * @param coinType The coin type to get the CoinAsset objects for.
2076
+ * @param allSuiObjects The list of all SuiMoveObjects.
2077
+ * @returns The CoinAsset objects for the given coin type.
2078
+ */
2079
+ static getCoinAssets(coinType: string, allSuiObjects: CoinAsset[]): CoinAsset[];
2080
+ /**
2081
+ * Get whether a coin address is a SUI coin.
2082
+ *
2083
+ * @param coinAddress The coin address to check.
2084
+ * @returns Whether the coin address is a SUI coin.
2085
+ */
2086
+ static isSuiCoin(coinAddress: SuiAddressType): boolean;
2087
+ /**
2088
+ * Select the CoinAsset objects from a list of CoinAsset objects that have a balance greater than or equal to a given amount.
2089
+ *
2090
+ * @param coins The list of CoinAsset objects to select from.
2091
+ * @param amount The amount to select CoinAsset objects with a balance greater than or equal to.
2092
+ * @param exclude A list of CoinAsset objects to exclude from the selection.
2093
+ * @returns The CoinAsset objects that have a balance greater than or equal to the given amount.
2094
+ */
2095
+ static selectCoinObjectIdGreaterThanOrEqual(coins: CoinAsset[], amount: bigint, exclude?: string[]): {
2096
+ objectArray: string[];
2097
+ remainCoins: CoinAsset[];
2098
+ amountArray: string[];
2099
+ };
2100
+ /**
2101
+ * Select the CoinAsset objects from a list of CoinAsset objects that have a balance greater than or equal to a given amount.
2102
+ *
2103
+ * @param coins The list of CoinAsset objects to select from.
2104
+ * @param amount The amount to select CoinAsset objects with a balance greater than or equal to.
2105
+ * @param exclude A list of CoinAsset objects to exclude from the selection.
2106
+ * @returns The CoinAsset objects that have a balance greater than or equal to the given amount.
2107
+ */
2108
+ static selectCoinAssetGreaterThanOrEqual(coins: CoinAsset[], amount: bigint, exclude?: string[]): {
2109
+ selectedCoins: CoinAsset[];
2110
+ remainingCoins: CoinAsset[];
2111
+ };
2112
+ /**
2113
+ * Sort the CoinAsset objects by their balance.
2114
+ *
2115
+ * @param coins The CoinAsset objects to sort.
2116
+ * @returns The sorted CoinAsset objects.
2117
+ */
2118
+ static sortByBalance(coins: CoinAsset[]): CoinAsset[];
2119
+ static sortByBalanceDes(coins: CoinAsset[]): CoinAsset[];
2120
+ /**
2121
+ * Calculate the total balance of a list of CoinAsset objects.
2122
+ *
2123
+ * @param coins The list of CoinAsset objects to calculate the total balance for.
2124
+ * @returns The total balance of the CoinAsset objects.
2125
+ */
2126
+ static calculateTotalBalance(coins: CoinAsset[]): bigint;
2127
+ }
2128
+
2129
+ /**
2130
+ * @category CollectFeesQuoteParam
2131
+ */
2132
+ type CollectFeesQuoteParam = {
2133
+ dammpool: Pool;
2134
+ position: Position;
2135
+ tickLower: TickData;
2136
+ tickUpper: TickData;
2137
+ };
2138
+ /**
2139
+ * @category CollectFeesQuote
2140
+ */
2141
+ type CollectFeesQuote = {
2142
+ position_id: string;
2143
+ feeOwedA: BN;
2144
+ feeOwedB: BN;
2145
+ };
2146
+ /**
2147
+ * Get a fee quote on the outstanding fees owed to a position.
2148
+ *
2149
+ * @category CollectFeesQuoteParam
2150
+ * @param param A collection of fetched Dammpool accounts to faciliate the quote.
2151
+ * @returns A quote object containing the fees owed for each token in the pool.
2152
+ */
2153
+ declare function collectFeesQuote(param: CollectFeesQuoteParam): CollectFeesQuote;
2154
+
2155
+ /**
2156
+ * Percentage - the util set for percentage struct.
2157
+ */
2158
+ declare class Percentage {
2159
+ readonly numerator: BN;
2160
+ readonly denominator: BN;
2161
+ constructor(numerator: BN, denominator: BN);
2162
+ /**
2163
+ * Get the percentage of a number.
2164
+ *
2165
+ * @param number
2166
+ * @returns
2167
+ */
2168
+ static fromDecimal(number: Decimal$1): Percentage;
2169
+ /**
2170
+ * Get the percentage of a fraction.
2171
+ *
2172
+ * @param numerator
2173
+ * @param denominator
2174
+ * @returns
2175
+ */
2176
+ static fromFraction(numerator: BN | number, denominator: BN | number): Percentage;
2177
+ }
2178
+
2179
+ declare enum AmountSpecified {
2180
+ Input = "Specified input amount",
2181
+ Output = "Specified output amount"
2182
+ }
2183
+ declare enum PositionStatus {
2184
+ BelowRange = 0,
2185
+ InRange = 1,
2186
+ AboveRange = 2
2187
+ }
2188
+ /**
2189
+ * This class provides utility methods for working with positions.
2190
+ */
2191
+ declare class PositionUtil {
2192
+ /**
2193
+ * Get the position status for the given tick indices.
2194
+ *
2195
+ * @param currentTickIndex The current tick index.
2196
+ * @param lowerTickIndex The lower tick index.
2197
+ * @param upperTickIndex The upper tick index.
2198
+ * @returns The position status.
2199
+ */
2200
+ static getPositionStatus(currentTickIndex: number, lowerTickIndex: number, upperTickIndex: number): PositionStatus;
2201
+ }
2202
+ /**
2203
+ * Get token A from liquidity.
2204
+ * @param liquidity - liquidity.
2205
+ * @param sqrtPrice0X64 - Current sqrt price of coin 0.
2206
+ * @param sqrtPrice1X64 - Current sqrt price of coin 1.
2207
+ * @param roundUp - If round up.
2208
+ *
2209
+ * @returns
2210
+ */
2211
+ declare function getCoinAFromLiquidity(liquidity: BN, sqrtPrice0X64: BN, sqrtPrice1X64: BN, roundUp: boolean): BN;
2212
+ /**
2213
+ * Get token B from liquidity.
2214
+ * @param liquidity - liqudity.
2215
+ * @param sqrtPrice0X64 - Current sqrt price of token 0.
2216
+ * @param sqrtPrice1X64 - Current sqrt price of token 1.
2217
+ * @param roundUp - If round up.
2218
+ *
2219
+ * @returns
2220
+ */
2221
+ declare function getCoinBFromLiquidity(liquidity: BN, sqrtPrice0X64: BN, sqrtPrice1X64: BN, roundUp: boolean): BN;
2222
+ /**
2223
+ * Get liquidity from token A.
2224
+ *
2225
+ * @param amount - The amount of token A.
2226
+ * @param sqrtPriceLowerX64 - The lower sqrt price.
2227
+ * @param sqrtPriceUpperX64 - The upper sqrt price.
2228
+ * @param roundUp - If round up.
2229
+ * @returns liquidity.
2230
+ */
2231
+ declare function getLiquidityFromCoinA(amount: BN, sqrtPriceLowerX64: BN, sqrtPriceUpperX64: BN, roundUp: boolean): BN;
2232
+ /**
2233
+ * Get liquidity from token B.
2234
+ * @param amount - The amount of token B.
2235
+ * @param sqrtPriceLowerX64 - The lower sqrt price.
2236
+ * @param sqrtPriceUpperX64 - The upper sqrt price.
2237
+ * @param roundUp - If round up.
2238
+ *
2239
+ * @returns liquidity.
2240
+ */
2241
+ declare function getLiquidityFromCoinB(amount: BN, sqrtPriceLowerX64: BN, sqrtPriceUpperX64: BN, roundUp: boolean): BN;
2242
+ /**
2243
+ * Get amount of fixed delta.
2244
+ * @param currentSqrtPriceX64 - Current sqrt price.
2245
+ * @param targetSqrtPriceX64 - Target sqrt price.
2246
+ * @param liquidity - liqudity.
2247
+ * @param amountSpecified - The amount specified in the swap.
2248
+ * @param swapDirection - The swap direction.
2249
+ *
2250
+ * @returns
2251
+ */
2252
+ declare function getAmountFixedDelta(currentSqrtPriceX64: BN, targetSqrtPriceX64: BN, liquidity: BN, amountSpecified: AmountSpecified, swapDirection: SwapDirection): BN;
2253
+ /**
2254
+ * Get amount of unfixed delta.
2255
+ * @param currentSqrtPriceX64 - Current sqrt price.
2256
+ * @param targetSqrtPriceX64 - Target sqrt price.
2257
+ * @param liquidity - liqudity.
2258
+ * @param amountSpecified - The amount specified in the swap.
2259
+ * @param swapDirection - The swap direction.
2260
+ *
2261
+ * @returns
2262
+ */
2263
+ declare function getAmountUnfixedDelta(currentSqrtPriceX64: BN, targetSqrtPriceX64: BN, liquidity: BN, amountSpecified: AmountSpecified, swapDirection: SwapDirection): BN;
2264
+ declare function adjustForSlippage(n: BN, { numerator, denominator }: Percentage, adjustUp: boolean): BN;
2265
+ declare function adjustForCoinSlippage(tokenAmount: CoinAmounts, slippage: Percentage, adjustUp: boolean): {
2266
+ tokenMaxA: BN;
2267
+ tokenMaxB: BN;
2268
+ };
2269
+
2270
+ declare class SwapUtils {
2271
+ /**
2272
+ * Get the default sqrt price limit for a swap.
2273
+ *
2274
+ * @param a2b - true if the swap is A to B, false if the swap is B to A.
2275
+ * @returns The default sqrt price limit for the swap.
2276
+ */
2277
+ static getDefaultSqrtPriceLimit(a2b: boolean): BN;
2278
+ /**
2279
+ * Get the default values for the otherAmountThreshold in a swap.
2280
+ *
2281
+ * @param amountSpecifiedIsInput - The direction of a swap
2282
+ * @returns The default values for the otherAmountThreshold parameter in a swap.
2283
+ */
2284
+ static getDefaultOtherAmountThreshold(amountSpecifiedIsInput: boolean): BN;
2285
+ }
2286
+ /**
2287
+ * Get lower sqrt price from token A.
2288
+ *
2289
+ * @param amount - The amount of tokens the user wanted to swap from.
2290
+ * @param liquidity - The liquidity of the pool.
2291
+ * @param sqrtPriceX64 - The sqrt price of the pool.
2292
+ * @returns LowesqrtPriceX64
2293
+ */
2294
+ declare function getLowerSqrtPriceFromCoinA(amount: BN, liquidity: BN, sqrtPriceX64: BN): BN;
2295
+ /**
2296
+ * Get upper sqrt price from token A.
2297
+ *
2298
+ * @param amount - The amount of tokens the user wanted to swap from.
2299
+ * @param liquidity - The liquidity of the pool.
2300
+ * @param sqrtPriceX64 - The sqrt price of the pool.
2301
+ * @returns LowesqrtPriceX64
2302
+ */
2303
+ declare function getUpperSqrtPriceFromCoinA(amount: BN, liquidity: BN, sqrtPriceX64: BN): BN;
2304
+ /**
2305
+ * Get lower sqrt price from coin B.
2306
+ *
2307
+ * @param amount - The amount of coins the user wanted to swap from.
2308
+ * @param liquidity - The liquidity of the pool.
2309
+ * @param sqrtPriceX64 - The sqrt price of the pool.
2310
+ * @returns LowesqrtPriceX64
2311
+ */
2312
+ declare function getLowerSqrtPriceFromCoinB(amount: BN, liquidity: BN, sqrtPriceX64: BN): BN;
2313
+ /**
2314
+ * Get upper sqrt price from coin B.
2315
+ *
2316
+ * @param amount - The amount of coins the user wanted to swap from.
2317
+ * @param liquidity - The liquidity of the pool.
2318
+ * @param sqrtPriceX64 - The sqrt price of the pool.
2319
+ * @returns LowesqrtPriceX64
2320
+ */
2321
+ declare function getUpperSqrtPriceFromCoinB(amount: BN, liquidity: BN, sqrtPriceX64: BN): BN;
2322
+
2323
+ declare class TickMath {
2324
+ static priceToSqrtPriceX64(price: Decimal, decimalsA: number, decimalsB: number): BN;
2325
+ static sqrtPriceX64ToPrice(sqrtPriceX64: BN, decimalsA: number, decimalsB: number): Decimal;
2326
+ static tickIndexToSqrtPriceX64(tickIndex: number): BN;
2327
+ static sqrtPriceX64ToTickIndex(sqrtPriceX64: BN): number;
2328
+ static tickIndexToPrice(tickIndex: number, decimalsA: number, decimalsB: number): Decimal;
2329
+ static priceToTickIndex(price: Decimal, decimalsA: number, decimalsB: number): number;
2330
+ static priceToInitializableTickIndex(price: Decimal, decimalsA: number, decimalsB: number, tickSpacing: number): number;
2331
+ static getInitializableTickIndex(tickIndex: number, tickSpacing: number): number;
2332
+ /**
2333
+ *
2334
+ * @param tickIndex
2335
+ * @param tickSpacing
2336
+ * @returns
2337
+ */
2338
+ static getNextInitializableTickIndex(tickIndex: number, tickSpacing: number): number;
2339
+ static getPrevInitializableTickIndex(tickIndex: number, tickSpacing: number): number;
2340
+ }
2341
+ declare function getTickDataFromUrlData(ticks: any): any[];
2342
+ declare function tickScore(tickIndex: number): Decimal;
2343
+
2344
+ declare const ZERO: BN;
2345
+ declare const ONE: BN;
2346
+ declare const TWO: BN;
2347
+ declare const U128: BN;
2348
+ declare const U64_MAX: BN;
2349
+ declare const U128_MAX: BN;
2350
+ /**
2351
+ * @category MathUtil
2352
+ */
2353
+ declare class MathUtil {
2354
+ static toX64_BN(num: BN): BN;
2355
+ static toX64_Decimal(num: Decimal): Decimal;
2356
+ static toX64(num: Decimal): BN;
2357
+ static fromX64(num: BN): Decimal;
2358
+ static fromX64_Decimal(num: Decimal): Decimal;
2359
+ static fromX64_BN(num: BN): BN;
2360
+ static shiftRightRoundUp(n: BN): BN;
2361
+ static divRoundUp(n0: BN, n1: BN): BN;
2362
+ static subUnderflowU128(n0: BN, n1: BN): BN;
2363
+ static checkUnsignedSub(n0: BN, n1: BN): BN;
2364
+ static checkMul(n0: BN, n1: BN, limit: number): BN;
2365
+ static checkMulDivFloor(n0: BN, n1: BN, denom: BN, limit: number): BN;
2366
+ static checkMulDivCeil(n0: BN, n1: BN, denom: BN, limit: number): BN;
2367
+ static checkMulDivRound(n0: BN, n1: BN, denom: BN, limit: number): BN;
2368
+ static checkMulShiftRight(n0: BN, n1: BN, shift: number, limit: number): BN;
2369
+ static checkMulShiftRight64RoundUpIf(n0: BN, n1: BN, limit: number, roundUp: boolean): BN;
2370
+ static checkMulShiftLeft(n0: BN, n1: BN, shift: number, limit: number): BN;
2371
+ static checkDivRoundUpIf(n0: BN, n1: BN, roundUp: boolean): BN;
2372
+ static isOverflow(n: BN, bit: number): boolean;
2373
+ static sign(v: BN): number;
2374
+ static is_neg(v: BN): boolean;
2375
+ static abs_u128(v: BN): BN;
2376
+ static u128_neg(v: BN): BN;
2377
+ static neg(v: BN): BN;
2378
+ static abs(v: BN): BN;
2379
+ static neg_from(v: BN): BN;
2380
+ }
2381
+
2382
+ declare enum SplitUnit {
2383
+ FIVE = 5,
2384
+ TEN = 10,
2385
+ TWENTY = 20,
2386
+ TWENTY_FIVE = 25,
2387
+ FIVETY = 50,
2388
+ HUNDRED = 100
2389
+ }
2390
+ declare function createSplitArray(minSplitUnit: SplitUnit): number[];
2391
+ declare function createSplitAmountArray(amount: BN, minSplitUnit: SplitUnit): BN[];
2392
+ type SplitSwapResult = {
2393
+ amountInArray: BN[];
2394
+ amountOutArray: BN[];
2395
+ feeAmountArray: BN[];
2396
+ nextSqrtPriceArray: BN[];
2397
+ isExceed: boolean[];
2398
+ };
2399
+ declare class SplitSwap {
2400
+ readonly minSplitUnit: number;
2401
+ amountArray: BN[];
2402
+ private byAmountIn;
2403
+ private a2b;
2404
+ private dammpool;
2405
+ private ticks;
2406
+ private splitSwapResult;
2407
+ constructor(amount: BN, unit: SplitUnit, dammpool: Pool, a2b: boolean, byAmountIn: boolean, tickData: TickData[]);
2408
+ createSplitSwapParams(amount: BN, unit: SplitUnit): void;
2409
+ computeSwap(): SplitSwapResult;
2410
+ }
2411
+
2412
+ type FetchPosRewardParams = {
2413
+ poolAddress: string;
2414
+ positionId: string;
2415
+ coinTypeA: string;
2416
+ coinTypeB: string;
2417
+ rewarderInfo: Rewarder[];
2418
+ };
2419
+ type FetchPosFeeParams = {
2420
+ poolAddress: string;
2421
+ positionId: string;
2422
+ coinTypeA: string;
2423
+ coinTypeB: string;
2424
+ };
2425
+ type PosRewarderResult = {
2426
+ poolAddress: string;
2427
+ positionId: string;
2428
+ rewarderAmountOwed: RewarderAmountOwed[];
2429
+ };
2430
+ /**
2431
+ * Rewarder module for managing pool incentive rewards
2432
+ * Handles reward calculations, claiming, and emissions tracking
2433
+ * Supports up to 3 simultaneous reward tokens per pool
2434
+ *
2435
+ * @example
2436
+ * // Check daily emissions for a pool
2437
+ * const emissions = await sdk.Rewarder.emissionsEveryDay(poolId);
2438
+ * console.log(`Rewarder 0: ${emissions[0]} tokens/day`);
2439
+ * console.log(`Rewarder 1: ${emissions[1]} tokens/day`);
2440
+ * console.log(`Rewarder 2: ${emissions[2]} tokens/day`);
2441
+ *
2442
+ * @example
2443
+ * // Fetch pending rewards for a position
2444
+ * const pool = await sdk.Pool.getPool(poolId);
2445
+ * const rewards = await sdk.Rewarder.fetchPositionRewarders(pool, positionId);
2446
+ *
2447
+ * rewards.forEach((reward, index) => {
2448
+ * const rewarderInfo = pool.rewarderInfos[index];
2449
+ * console.log(`Reward ${index} (${rewarderInfo.coinAddress}):`);
2450
+ * console.log(` Owed: ${reward.amount_owed}`);
2451
+ * });
2452
+ *
2453
+ * @example
2454
+ * // Claim all rewards from a position
2455
+ * const claimTx = await sdk.Rewarder.collectRewarderTransactionPayload({
2456
+ * pool_id: poolId,
2457
+ * pos_id: positionId,
2458
+ * rewarder_coin_types: [
2459
+ * pool.rewarderInfos[0].coinAddress,
2460
+ * pool.rewarderInfos[1].coinAddress,
2461
+ * pool.rewarderInfos[2].coinAddress
2462
+ * ],
2463
+ * coinTypeA: pool.coinTypeA,
2464
+ * coinTypeB: pool.coinTypeB
2465
+ * });
2466
+ */
2467
+ declare class RewarderModule implements IModule {
2468
+ protected _sdk: FerraDammSDK;
2469
+ private growthGlobal;
2470
+ constructor(sdk: FerraDammSDK);
2471
+ get sdk(): FerraDammSDK;
2472
+ /**
2473
+ * Calculates daily emission rates for all rewarders in a pool
2474
+ * Emissions are continuous, this converts to daily amounts
2475
+ * @param poolID - Pool object ID
2476
+ * @returns Array of daily emission amounts [rewarder0, rewarder1, rewarder2]
2477
+ * @example
2478
+ * const emissions = await sdk.Rewarder.emissionsEveryDay(poolId);
2479
+ * const pool = await sdk.Pool.getPool(poolId);
2480
+ *
2481
+ * pool.rewarderInfos.forEach((info, i) => {
2482
+ * const dailyEmission = emissions[i];
2483
+ * console.log(`${info.coinAddress}: ${dailyEmission} per day`);
2484
+ * });
2485
+ */
2486
+ emissionsEveryDay(poolID: string): Promise<any[]>;
2487
+ /**
2488
+ * Updates pool rewarder growth globals based on time elapsed
2489
+ * Internal method used for reward calculations
2490
+ * @param poolID - The pool object ID
2491
+ * @param currentTime - Current timestamp in milliseconds
2492
+ * @returns Updated pool object with new rewarder state
2493
+ */
2494
+ private updatePoolRewarder;
2495
+ /**
2496
+ * Batch fetches pending rewards for multiple positions
2497
+ * More efficient than calling fetchPositionRewarders multiple times
2498
+ * @param positionIDs - Array of position NFT IDs
2499
+ * @returns Map of position ID to array of reward amounts
2500
+ * @example
2501
+ * const rewardMap = await sdk.Rewarder.batchFetchPositionRewarders([
2502
+ * '0x_pos1',
2503
+ * '0x_pos2',
2504
+ * '0x_pos3'
2505
+ * ]);
2506
+ *
2507
+ * for (const [posId, rewards] of Object.entries(rewardMap)) {
2508
+ * console.log(`Position ${posId}:`);
2509
+ * rewards.forEach((reward, i) => {
2510
+ * console.log(` Reward ${i}: ${reward.amount_owed}`);
2511
+ * });
2512
+ * }
2513
+ */
2514
+ batchFetchPositionRewarders(positionIDs: string[]): Promise<Record<string, RewarderAmountOwed[]>>;
2515
+ /**
2516
+ * Fetches pending reward amounts for a specific position
2517
+ * Uses on-chain data for accurate calculations
2518
+ * @param pool - Pool object containing rewarder info
2519
+ * @param positionId - Position NFT ID
2520
+ * @returns Array of reward amounts owed
2521
+ * @example
2522
+ * const pool = await sdk.Pool.getPool(poolId);
2523
+ * const rewards = await sdk.Rewarder.fetchPositionRewarders(pool, positionId);
2524
+ *
2525
+ * // Display rewards with token info
2526
+ * for (let i = 0; i < rewards.length; i++) {
2527
+ * const rewarder = pool.rewarderInfos[i];
2528
+ * const reward = rewards[i];
2529
+ * console.log(`Rewarder ${i}:`);
2530
+ * console.log(` Token: ${rewarder.coinAddress}`);
2531
+ * console.log(` Owed: ${reward.amount_owed}`);
2532
+ * console.log(` Growth inside: ${reward.growth_inside}`);
2533
+ * }
2534
+ */
2535
+ fetchPositionRewarders(pool: Pool, positionId: string): Promise<RewarderAmountOwed[]>;
2536
+ /**
2537
+ * Fetches both fees and rewards for multiple positions
2538
+ * Convenience method that combines fee and reward queries
2539
+ * @param positionIDs - Array of position NFT IDs
2540
+ * @returns Map of position ID to fee quote
2541
+ * @example
2542
+ * const feeMap = await sdk.Rewarder.batchFetchPositionFees([
2543
+ * '0x_pos1',
2544
+ * '0x_pos2'
2545
+ * ]);
2546
+ *
2547
+ * for (const [posId, fees] of Object.entries(feeMap)) {
2548
+ * console.log(`Position ${posId}:`);
2549
+ * console.log(` Fee A: ${fees.feeOwedA.toString()}`);
2550
+ * console.log(` Fee B: ${fees.feeOwedB.toString()}`);
2551
+ * }
2552
+ */
2553
+ batchFetchPositionFees(positionIDs: string[]): Promise<Record<string, CollectFeesQuote>>;
2554
+ /**
2555
+ * Fetches pending fee amounts for multiple positions
2556
+ * Uses on-chain simulation for accurate results
2557
+ * @param params - Array of position and pool parameters
2558
+ * @returns Array of fee quotes
2559
+ * @example
2560
+ * const fees = await sdk.Rewarder.fetchPosFeeAmount([
2561
+ * {
2562
+ * pool_id: poolId1,
2563
+ * pos_id: posId1,
2564
+ * coinTypeA: "0x2::sui::SUI",
2565
+ * coinTypeB: "0x5d4b...::coin::COIN"
2566
+ * }
2567
+ * ]);
2568
+ *
2569
+ * fees.forEach(fee => {
2570
+ * console.log(`Fees for ${fee.position_id}:`);
2571
+ * console.log(` A: ${fee.feeOwedA.toString()}`);
2572
+ * console.log(` B: ${fee.feeOwedB.toString()}`);
2573
+ * });
2574
+ */
2575
+ fetchPosFeeAmount(params: FetchPosFeeParams[]): Promise<CollectFeesQuote[]>;
2576
+ /**
2577
+ * Fetches pending reward amounts for multiple positions
2578
+ * Uses on-chain simulation for accurate calculations
2579
+ * @param params - Array of position and pool parameters
2580
+ * @returns Array of reward amount quotes
2581
+ * @example
2582
+ * const pool = await sdk.Pool.getPool(poolId);
2583
+ *
2584
+ * const rewards = await sdk.Rewarder.fetchPosRewardersAmount([
2585
+ * {
2586
+ * pool_id: poolId,
2587
+ * pos_id: posId1,
2588
+ * coinTypeA: pool.coinTypeA,
2589
+ * coinTypeB: pool.coinTypeB,
2590
+ * rewarder_coin_types: pool.rewarderInfos.map(r => r.coinAddress)
2591
+ * }
2592
+ * ]);
2593
+ *
2594
+ * rewards.forEach(reward => {
2595
+ * console.log(`Position: ${reward.pos_object_id}`);
2596
+ * console.log(`Rewards: ${reward.rewarder_amounts}`);
2597
+ * });
2598
+ */
2599
+ fetchPosRewardersAmount(params: FetchPosRewardParams[]): Promise<PosRewarderResult[]>;
2600
+ /**
2601
+ * Fetches total accumulated rewards for an account in a specific pool
2602
+ * Aggregates rewards across all positions in the pool
2603
+ * @param account - Wallet address
2604
+ * @param poolObjectId - Pool object ID
2605
+ * @returns Total reward amounts by token
2606
+ * @example
2607
+ * const poolRewards = await sdk.Rewarder.fetchPoolRewardersAmount(
2608
+ * walletAddress,
2609
+ * poolId
2610
+ * );
2611
+ *
2612
+ * console.log('Total pool rewards for account:');
2613
+ * poolRewards.forEach((amount, index) => {
2614
+ * console.log(` Rewarder ${index}: ${amount}`);
2615
+ * });
2616
+ */
2617
+ fetchPoolRewardersAmount(account: string, poolObjectId: string): Promise<BN[]>;
2618
+ /**
2619
+ * Fetches tick data for all positions' upper and lower bounds
2620
+ * @param ticksHandle - Pool's tick collection handle
2621
+ * @param positions - Array of positions
2622
+ * @returns Array containing lower and upper tick data arrays
2623
+ */
2624
+ private getPoolLowerAndUpperTicks;
2625
+ /**
2626
+ * Creates a transaction to collect rewards from a position
2627
+ * Can optionally collect fees at the same time
2628
+ * @param params - Parameters including reward coin types
2629
+ * @param tx - Optional transaction to extend
2630
+ * @returns Transaction for collecting rewards
2631
+ * @example
2632
+ * const pool = await sdk.Pool.getPool(poolId);
2633
+ *
2634
+ * const claimTx = await sdk.Rewarder.collectRewarderTransactionPayload({
2635
+ * pool_id: poolId,
2636
+ * pos_id: positionId,
2637
+ * rewarder_coin_types: pool.rewarderInfos.map(r => r.coinAddress),
2638
+ * coinTypeA: pool.coinTypeA,
2639
+ * coinTypeB: pool.coinTypeB,
2640
+ * collect_fee: true // Also collect trading fees
2641
+ * });
2642
+ *
2643
+ * const result = await sdk.fullClient.signAndExecuteTransaction({
2644
+ * transaction: claimTx,
2645
+ * signer: keypair
2646
+ * });
2647
+ */
2648
+ collectRewarderTransactionPayload(params: CollectRewarderParams, tx?: Transaction): Promise<Transaction>;
2649
+ /**
2650
+ * Creates a transaction to batch collect rewards from multiple positions
2651
+ * More gas efficient than individual collection transactions
2652
+ * @param paramsList - Array of reward collection parameters
2653
+ * @param allCoinAsset - Available coin assets for the wallet
2654
+ * @returns Transaction for batch reward collection
2655
+ * @example
2656
+ * const pool = await sdk.Pool.getPool(poolId);
2657
+ * const coinAssets = await sdk.getOwnerCoinAssets(walletAddress);
2658
+ *
2659
+ * const batchTx = await sdk.Rewarder.batchCollectRewardePayload(
2660
+ * [
2661
+ * {
2662
+ * pool_id: poolId,
2663
+ * pos_id: posId1,
2664
+ * rewarder_coin_types: pool.rewarderInfos.map(r => r.coinAddress),
2665
+ * coinTypeA: pool.coinTypeA,
2666
+ * coinTypeB: pool.coinTypeB,
2667
+ * collect_fee: true
2668
+ * },
2669
+ * {
2670
+ * pool_id: poolId,
2671
+ * pos_id: posId2,
2672
+ * rewarder_coin_types: pool.rewarderInfos.map(r => r.coinAddress),
2673
+ * coinTypeA: pool.coinTypeA,
2674
+ * coinTypeB: pool.coinTypeB,
2675
+ * collect_fee: true
2676
+ * }
2677
+ * ],
2678
+ * coinAssets
2679
+ * );
2680
+ */
2681
+ batchCollectRewardePayload(params: CollectRewarderParams[], tx?: Transaction, inputCoinA?: TransactionObjectArgument, inputCoinB?: TransactionObjectArgument): Promise<Transaction>;
2682
+ /**
2683
+ * Creates collect reward move calls (internal method)
2684
+ * @param params - Collection parameters
2685
+ * @param tx - Transaction object
2686
+ * @param primaryCoinInputs - Array of coin objects for each rewarder
2687
+ * @returns Transaction object with collect reward calls
2688
+ */
2689
+ createCollectRewarderPaylod(params: CollectRewarderParams, tx: Transaction, primaryCoinInputs: TransactionArgument[]): Transaction;
2690
+ /**
2691
+ * Creates collect reward calls without sending coins to sender
2692
+ * Used when coins need to be used in subsequent operations
2693
+ * @param params - Collection parameters
2694
+ * @param tx - Transaction object
2695
+ * @param primaryCoinInputs - Array of coin objects for each rewarder
2696
+ * @returns Transaction object with collect reward calls
2697
+ */
2698
+ createCollectRewarderNoSendPaylod(params: CollectRewarderParams, tx: Transaction, primaryCoinInputs: TransactionArgument[]): Transaction;
2699
+ }
2700
+
2701
+ /**
2702
+ * Position module for managing liquidity positions in DAMM pools
2703
+ * Handles position creation, liquidity adjustments, fee collection, and rewards
2704
+ * Positions are represented as NFTs that can be transferred or locked
2705
+ *
2706
+ * @example
2707
+ * // Get all positions for a wallet
2708
+ * const positions = await sdk.Position.getPositionList(
2709
+ * '0x_wallet_address',
2710
+ * [] // All pools
2711
+ * );
2712
+ *
2713
+ * positions.forEach(pos => {
2714
+ * console.log(`Position ${pos.pos_object_id}`);
2715
+ * console.log(`Pool: ${pos.pool}`);
2716
+ * console.log(`Liquidity: ${pos.liquidity}`);
2717
+ * console.log(`Range: [${pos.tick_lower_index}, ${pos.tick_upper_index}]`);
2718
+ * });
2719
+ *
2720
+ * @example
2721
+ * // Add liquidity to existing position
2722
+ * const addLiqTx = await sdk.Position.createAddLiquidityPayload({
2723
+ * pool_id: poolId,
2724
+ * pos_id: positionId,
2725
+ * coinTypeA: "0x2::sui::SUI",
2726
+ * coinTypeB: "0x5d4b...::coin::COIN",
2727
+ * delta_liquidity: "1000000000",
2728
+ * max_amount_a: "1100000000", // 10% slippage
2729
+ * max_amount_b: "1100000"
2730
+ * });
2731
+ *
2732
+ * @example
2733
+ * // Collect fees from position
2734
+ * const pool = await sdk.Pool.getPool(poolId);
2735
+ * const collectTx = await sdk.Position.collectFeeTransactionPayload({
2736
+ * pool,
2737
+ * pos_id: positionId,
2738
+ * coinTypeA: pool.coinTypeA,
2739
+ * coinTypeB: pool.coinTypeB
2740
+ * });
2741
+ */
2742
+ declare class PositionModule implements IModule {
2743
+ protected _sdk: FerraDammSDK;
2744
+ private readonly _cache;
2745
+ constructor(sdk: FerraDammSDK);
2746
+ get sdk(): FerraDammSDK;
2747
+ /**
2748
+ * Constructs the full type address for Position objects
2749
+ * @returns Full type string in format: packageId::module::type
2750
+ */
2751
+ buildPositionType(): string;
2752
+ /**
2753
+ * Gets transaction history for specific positions
2754
+ * Returns liquidity changes, fee collections, reward claims
2755
+ * @param account - Wallet address that owns positions
2756
+ * @param positionIds - Array of position NFT IDs
2757
+ * @param limit - Max transactions to return (default: 100)
2758
+ * @param offset - Starting offset for pagination
2759
+ * @returns Array of position transaction info
2760
+ * @example
2761
+ * const txList = await sdk.Position.getPositionTransactionList({
2762
+ * account: walletAddress,
2763
+ * positionIds: [posId1, posId2],
2764
+ * limit: 50
2765
+ * });
2766
+ *
2767
+ * txList.forEach(tx => {
2768
+ * console.log(`${tx.type}: ${tx.txDigest}`);
2769
+ * console.log(` Timestamp: ${new Date(Number(tx.timestampMs))}`);
2770
+ * });
2771
+ */
2772
+ getPositionTransactionList({ posId, paginationArgs, order, fullRpcUrl, originPosId, }: {
2773
+ posId: string;
2774
+ originPosId?: string;
2775
+ fullRpcUrl?: string;
2776
+ paginationArgs?: PaginationArgs;
2777
+ order?: 'ascending' | 'descending' | null | undefined;
2778
+ }): Promise<DataPage<PositionTransactionInfo>>;
2779
+ /**
2780
+ * Gets all positions owned by a specific wallet address
2781
+ * Optionally filters by pool IDs
2782
+ * @param accountAddress - Wallet address to query positions for
2783
+ * @param assignPoolIds - Filter by specific pool IDs (empty = all pools)
2784
+ * @param showDisplay - Include NFT display metadata (default: true)
2785
+ * @returns Array of position objects owned by the account
2786
+ * @example
2787
+ * // Get all positions
2788
+ * const allPositions = await sdk.Position.getPositionList(
2789
+ * '0x_wallet_address'
2790
+ * );
2791
+ *
2792
+ * // Get positions for specific pools only
2793
+ * const filteredPositions = await sdk.Position.getPositionList(
2794
+ * '0x_wallet_address',
2795
+ * ['0x_pool1', '0x_pool2']
2796
+ * );
2797
+ *
2798
+ * // Check position status
2799
+ * filteredPositions.forEach(pos => {
2800
+ * const pool = await sdk.Pool.getPool(pos.pool);
2801
+ * const status = PositionUtil.getPositionStatus(
2802
+ * pool.currentTickIndex,
2803
+ * pos.tick_lower_index,
2804
+ * pos.tick_upper_index
2805
+ * );
2806
+ * console.log(`Position ${pos.pos_object_id}: ${status}`);
2807
+ * });
2808
+ */
2809
+ getPositionList(accountAddress: string, assignPoolIds?: string[], showDisplay?: boolean): Promise<Position[]>;
2810
+ /**
2811
+ * Retrieves position data using position handle (requires pool info)
2812
+ * Note: getPositionById is recommended for direct position retrieval
2813
+ * @param positionHandle - Position collection handle from pool
2814
+ * @param positionID - Position object ID
2815
+ * @param calculateRewarder - Calculate reward amounts (default: true)
2816
+ * @param showDisplay - Include display metadata (default: true)
2817
+ * @returns Complete position object with optional rewards
2818
+ */
2819
+ getPosition(positionHandle: string, positionID: string, calculateRewarder?: boolean, showDisplay?: boolean): Promise<Position>;
2820
+ /**
2821
+ * Gets complete position data by position ID
2822
+ * This is the recommended method - simpler than getPosition()
2823
+ * @param positionID - Position NFT object ID
2824
+ * @param calculateRewarder - Calculate pending rewards (default: true)
2825
+ * @param showDisplay - Include NFT metadata (default: true)
2826
+ * @returns Complete position object
2827
+ * @throws {DammpoolsError} If position doesn't exist
2828
+ * @example
2829
+ * const position = await sdk.Position.getPositionById(
2830
+ * '0x_position_id',
2831
+ * true // Calculate rewards
2832
+ * );
2833
+ *
2834
+ * console.log(`Liquidity: ${position.liquidity}`);
2835
+ * console.log(`Fee owed A: ${position.fee_owed_a}`);
2836
+ * console.log(`Fee owed B: ${position.fee_owed_b}`);
2837
+ * console.log(`Reward 0: ${position.reward_amount_owed_0}`);
2838
+ */
2839
+ getPositionById(positionID: string, calculateRewarder?: boolean, showDisplay?: boolean): Promise<Position>;
2840
+ /**
2841
+ * Gets basic position data without reward calculations
2842
+ * Faster than getPositionById when rewards not needed
2843
+ * @param positionID - Position NFT object ID
2844
+ * @param showDisplay - Include NFT metadata (default: true)
2845
+ * @returns Position object without reward amounts
2846
+ * @example
2847
+ * // Quick position check
2848
+ * const position = await sdk.Position.getSimplePosition(positionId);
2849
+ * console.log(`Range: [${position.tick_lower_index}, ${position.tick_upper_index}]`);
2850
+ * console.log(`In pool: ${position.pool}`);
2851
+ */
2852
+ getSimplePosition(positionID: string, showDisplay?: boolean): Promise<Position>;
2853
+ /**
2854
+ * Internal method to retrieve cached position data
2855
+ * @param positionID - Position object ID
2856
+ * @returns Cached position or undefined if not found/expired
2857
+ */
2858
+ private getSimplePositionByCache;
2859
+ /**
2860
+ * Batch fetches simple position data for multiple positions
2861
+ * More efficient than calling getSimplePosition multiple times
2862
+ * @param positionIDs - Array of position NFT IDs
2863
+ * @param showDisplay - Include NFT metadata (default: true)
2864
+ * @returns Array of position objects
2865
+ * @example
2866
+ * const positions = await sdk.Position.getSipmlePositionList([
2867
+ * '0x_pos1',
2868
+ * '0x_pos2',
2869
+ * '0x_pos3'
2870
+ * ]);
2871
+ *
2872
+ * // Quick overview
2873
+ * positions.forEach(pos => {
2874
+ * console.log(`${pos.pos_object_id}: ${pos.liquidity} liquidity`);
2875
+ * });
2876
+ */
2877
+ getSipmlePositionList(positionIDs: SuiObjectIdType[], showDisplay?: boolean): Promise<Position[]>;
2878
+ /**
2879
+ * Internal method to update position with reward information
2880
+ * @param positionHandle - Position collection handle
2881
+ * @param position - Position object to update
2882
+ * @returns Position object with reward data
2883
+ */
2884
+ private updatePositionRewarders;
2885
+ /**
2886
+ * Retrieves reward information for a specific position
2887
+ * @param positionHandle - Position collection handle
2888
+ * @param positionID - Position object ID
2889
+ * @returns Position reward data or undefined if not found
2890
+ */
2891
+ getPositionRewarders(positionHandle: string, positionID: string): Promise<PositionReward | undefined>;
2892
+ /**
2893
+ * Calculates pending fees for multiple positions
2894
+ * Uses on-chain simulation for accurate calculations
2895
+ * @param params - Array of position and pool parameters
2896
+ * @returns Array of fee quotes (amounts owed)
2897
+ * @example
2898
+ * const fees = await sdk.Position.fetchPosFeeAmount([
2899
+ * {
2900
+ * pool_id: poolId1,
2901
+ * pos_id: posId1,
2902
+ * coinTypeA: "0x2::sui::SUI",
2903
+ * coinTypeB: "0x5d4b...::coin::COIN"
2904
+ * },
2905
+ * {
2906
+ * pool_id: poolId2,
2907
+ * pos_id: posId2,
2908
+ * coinTypeA: "0x2::sui::SUI",
2909
+ * coinTypeB: "0x456::usdc::USDC"
2910
+ * }
2911
+ * ]);
2912
+ *
2913
+ * fees.forEach(fee => {
2914
+ * console.log(`Position: ${fee.position_id}`);
2915
+ * console.log(`Fee A: ${fee.feeOwedA.toString()}`);
2916
+ * console.log(`Fee B: ${fee.feeOwedB.toString()}`);
2917
+ * });
2918
+ */
2919
+ fetchPosFeeAmount(params: FetchPosFeeParams[]): Promise<CollectFeesQuote[]>;
2920
+ /**
2921
+ * Batch fetches pending fees for multiple positions by ID
2922
+ * Convenient wrapper around fetchPosFeeAmount
2923
+ * @param positionIDs - Array of position NFT IDs
2924
+ * @returns Map of position ID to fee quote
2925
+ * @example
2926
+ * const feeMap = await sdk.Position.batchFetchPositionFees([
2927
+ * '0x_pos1',
2928
+ * '0x_pos2'
2929
+ * ]);
2930
+ *
2931
+ * for (const [posId, fees] of Object.entries(feeMap)) {
2932
+ * console.log(`Position ${posId}:`);
2933
+ * console.log(` Fee A: ${fees.feeOwedA.toString()}`);
2934
+ * console.log(` Fee B: ${fees.feeOwedB.toString()}`);
2935
+ * }
2936
+ */
2937
+ batchFetchPositionFees(positionIDs: string[]): Promise<Record<string, CollectFeesQuote>>;
2938
+ /**
2939
+ * Creates a transaction to add liquidity with fixed token amounts
2940
+ * Useful when you want to specify exact amounts rather than liquidity delta
2941
+ * @param params - Parameters including amounts and slippage tolerance
2942
+ * @returns Transaction for adding liquidity
2943
+ * @example
2944
+ * const tx = await sdk.Position.createAddLiquidityFixTokenPayload({
2945
+ * coinTypeA: "0x2::sui::SUI",
2946
+ * coinTypeB: "0x5d4b...::coin::COIN",
2947
+ * pool_id: poolId,
2948
+ * pos_id: positionId,
2949
+ * amount_a: 1000000000, // 1 SUI
2950
+ * amount_b: 5000000, // 5 COIN
2951
+ * fix_amount_a: true, // Fix SUI, adjust COIN
2952
+ * slippage: 0.05, // 5% slippage
2953
+ * tick_lower: -120,
2954
+ * tick_upper: 120,
2955
+ * collect_fee: true // Auto-collect fees before adding
2956
+ * });
2957
+ */
2958
+ createAddLiquidityFixTokenPayload(params: AddLiquidityFixTokenParams, gasEstimateArg?: {
2959
+ slippage: number;
2960
+ curSqrtPrice: BN;
2961
+ }, tx?: Transaction, inputCoinA?: TransactionObjectArgument, inputCoinB?: TransactionObjectArgument): Promise<Transaction>;
2962
+ /**
2963
+ * Retrieves the balance of multiple coin types from a RewarderGlobalVault on the SUI network.
2964
+ *
2965
+ * This function queries the RewarderGlobalVault's dynamic fields (stored in a Bag)
2966
+ * to find the balance for each provided coin type. If a coin type is not found in the vault,
2967
+ * it returns 0n for that coin type.
2968
+ *
2969
+ * @param {SuiClient} client - The SUI client instance used to make RPC calls
2970
+ * @param {string} rewarderVaultId - The object ID of the RewarderGlobalVault on SUI blockchain
2971
+ * @param {string[]} coinTypes - Array of coin type identifiers to query balances for
2972
+ *
2973
+ * @returns {Promise<bigint[]>} Array of balances corresponding to each coin type.
2974
+ * Returns 0n if a coin type doesn't exist in the vault.
2975
+ * The order matches the input coinTypes array.
2976
+ *
2977
+ * @example
2978
+ * ```typescript
2979
+ * const client = new SuiClient({ url: "https://fullnode.mainnet.sui.io" });
2980
+ *
2981
+ * const balances = await getRewarderBalances(
2982
+ * client,
2983
+ * "0xd68c56a1610953b0a81c48ad26e463c6c51e50ddcc13e5e4121fe70ee75c1bf7",
2984
+ * [
2985
+ * "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
2986
+ * "0x2::sui::SUI",
2987
+ * ]
2988
+ * );
2989
+ *
2990
+ * console.log(balances); // [47463762n, 0n]
2991
+ * ```
2992
+ *
2993
+ * @throws {Error} Throws if the vault object is invalid or not a moveObject
2994
+ */
2995
+ getRewarderBalances<T extends Array<string>>(coinTypes: T): Promise<SizedArray<bigint, T['length']>>;
2996
+ /**
2997
+ * Creates a transaction to add liquidity with exact liquidity delta
2998
+ * Preferred method when you know the exact liquidity amount to add
2999
+ * @param params - Parameters including liquidity delta and amount limits
3000
+ * @returns Transaction for adding liquidity
3001
+ * @example
3002
+ * const tx = await sdk.Position.createAddLiquidityPayload({
3003
+ * pool_id: poolId,
3004
+ * pos_id: positionId,
3005
+ * coinTypeA: "0x2::sui::SUI",
3006
+ * coinTypeB: "0x5d4b...::coin::COIN",
3007
+ * delta_liquidity: "1000000000",
3008
+ * max_amount_a: "1100000000", // Max SUI to spend
3009
+ * max_amount_b: "1100000" // Max COIN to spend
3010
+ * });
3011
+ */
3012
+ createAddLiquidityPayload(params: AddLiquidityParams, tx?: Transaction, inputCoinA?: TransactionObjectArgument, inputCoinB?: TransactionObjectArgument): Promise<Transaction>;
3013
+ /**
3014
+ * Creates a transaction to remove liquidity from a position
3015
+ * @param params - Parameters including liquidity amount to remove and minimum outputs
3016
+ * @param tx - Optional existing transaction to extend
3017
+ * @returns Transaction for removing liquidity
3018
+ * @example
3019
+ * // Remove 50% of liquidity
3020
+ * const position = await sdk.Position.getPositionById(positionId);
3021
+ * const halfLiquidity = new BN(position.liquidity).divn(2);
3022
+ *
3023
+ * const tx = await sdk.Position.removeLiquidityTransactionPayload({
3024
+ * pool_id: poolId,
3025
+ * pos_id: positionId,
3026
+ * coinTypeA: "0x2::sui::SUI",
3027
+ * coinTypeB: "0x5d4b...::coin::COIN",
3028
+ * delta_liquidity: halfLiquidity.toString(),
3029
+ * min_amount_a: "900000000", // Minimum SUI to receive
3030
+ * min_amount_b: "4500000", // Minimum COIN to receive
3031
+ * collect_fee: true // Also collect pending fees
3032
+ * });
3033
+ */
3034
+ removeLiquidityTransactionPayload(params: RemoveLiquidityParams, tx?: Transaction): Promise<Transaction>;
3035
+ /**
3036
+ * Creates a transaction to close a position (remove all liquidity)
3037
+ * Position NFT is burned after closing
3038
+ * @param params - Parameters including slippage tolerance
3039
+ * @param tx - Optional existing transaction to extend
3040
+ * @returns Transaction for closing position
3041
+ * @example
3042
+ * const tx = await sdk.Position.closePositionTransactionPayload({
3043
+ * pool_id: poolId,
3044
+ * pos_id: positionId,
3045
+ * coinTypeA: "0x2::sui::SUI",
3046
+ * coinTypeB: "0x5d4b...::coin::COIN",
3047
+ * min_amount_a: "950000000", // Accept 5% slippage
3048
+ * min_amount_b: "4750000",
3049
+ * collect_fee: true,
3050
+ * rewarder_coin_types: [
3051
+ * "0x_reward_coin_1",
3052
+ * "0x_reward_coin_2",
3053
+ * "0x_reward_coin_3"
3054
+ * ]
3055
+ * });
3056
+ */
3057
+ closePositionTransactionPayload(params: ClosePositionParams, tx?: Transaction): Promise<Transaction>;
3058
+ /**
3059
+ * Creates transaction to open a new empty position
3060
+ * Position will have no liquidity until added separately
3061
+ * @param params - Position opening parameters
3062
+ * @param tx - Optional existing transaction to append to
3063
+ * @returns Transaction object for opening position
3064
+ */
3065
+ openPositionTransactionPayload(params: OpenPositionParams, tx?: Transaction): Transaction;
3066
+ /**
3067
+ * Locks a position until a specific timestamp
3068
+ * Locked positions cannot be closed or have liquidity removed
3069
+ * Useful for governance or vesting mechanisms
3070
+ * @param pool - Pool object
3071
+ * @param positionId - Position NFT ID
3072
+ * @param untilTimestamp - Unix timestamp (seconds) when lock expires
3073
+ * @param tx - Optional transaction to extend
3074
+ * @returns Transaction for locking position
3075
+ * @example
3076
+ * const pool = await sdk.Pool.getPool(poolId);
3077
+ * const oneWeekFromNow = Math.floor(Date.now() / 1000) + (7 * 24 * 60 * 60);
3078
+ *
3079
+ * const tx = await sdk.Position.lockPosition(
3080
+ * pool,
3081
+ * positionId,
3082
+ * oneWeekFromNow
3083
+ * );
3084
+ *
3085
+ * console.log(`Position locked until: ${new Date(oneWeekFromNow * 1000)}`);
3086
+ */
3087
+ lockPosition(pool: Pool, positionId: string, untilTimestamp: number, tx?: Transaction): Promise<Transaction>;
3088
+ /**
3089
+ * Gets lock status for a position by ID
3090
+ * @param positionId - Position NFT ID
3091
+ * @returns Tuple of [lockTimestamp, currentTimestamp, isLocked]
3092
+ * @example
3093
+ * const [lockTime, currentTime, isLocked] =
3094
+ * await sdk.Position.getLockPositionStatusById(positionId);
3095
+ *
3096
+ * if (isLocked) {
3097
+ * const unlockDate = new Date(lockTime * 1000);
3098
+ * console.log(`Locked until: ${unlockDate}`);
3099
+ * console.log(`Time remaining: ${lockTime - currentTime}s`);
3100
+ * } else {
3101
+ * console.log('Position is unlocked');
3102
+ * }
3103
+ */
3104
+ getLockPositionStatusById(positionId: string): Promise<[current_lock: number, current_timestamp: number, is_locked: boolean]>;
3105
+ getLockPositionStatus(position: Position): Promise<[current_lock: number, current_timestamp: number, is_locked: boolean]>;
3106
+ /**
3107
+ * Creates a transaction to collect accumulated fees from a position
3108
+ * Fees can be collected without affecting liquidity
3109
+ * @param params - Parameters including pool and position info
3110
+ * @param tx - Optional transaction to extend
3111
+ * @returns Transaction for collecting fees
3112
+ * @example
3113
+ * const pool = await sdk.Pool.getPool(poolId);
3114
+ *
3115
+ * const collectTx = await sdk.Position.collectFeeTransactionPayload({
3116
+ * pool,
3117
+ * pos_id: positionId,
3118
+ * coinTypeA: pool.coinTypeA,
3119
+ * coinTypeB: pool.coinTypeB,
3120
+ * collect_fee: true
3121
+ * });
3122
+ *
3123
+ * const result = await sdk.fullClient.signAndExecuteTransaction({
3124
+ * transaction: collectTx,
3125
+ * signer: keypair
3126
+ * });
3127
+ *
3128
+ * // Check collected amounts from events
3129
+ * const collectEvent = result.events?.find(
3130
+ * e => e.type.includes('CollectFeeEvent')
3131
+ * );
3132
+ * console.log(`Collected A: ${collectEvent?.parsedJson?.amount_a}`);
3133
+ * console.log(`Collected B: ${collectEvent?.parsedJson?.amount_b}`);
3134
+ */
3135
+ collectFeeTransactionPayload(params: CollectFeeParams, tx?: Transaction, inputCoinA?: TransactionObjectArgument, inputCoinB?: TransactionObjectArgument): Promise<Transaction>;
3136
+ /**
3137
+ * Internal method to create collect fee move call
3138
+ * @param params - Fee collection parameters
3139
+ * @param tx - Transaction object
3140
+ * @param primaryCoinAInput - Coin A object
3141
+ * @param primaryCoinBInput - Coin B object
3142
+ * @returns Transaction object with collect fee call
3143
+ */
3144
+ createCollectFeePaylod(params: CollectFeeParams, tx: Transaction, primaryCoinAInput: TransactionObjectArgument, primaryCoinBInput: TransactionObjectArgument): Transaction;
3145
+ /**
3146
+ * Creates collect fee call without sending coins to sender
3147
+ * Used when coins need to be used in subsequent operations
3148
+ * @param params - Fee collection parameters
3149
+ * @param tx - Transaction object
3150
+ * @param primaryCoinAInput - Coin A object
3151
+ * @param primaryCoinBInput - Coin B object
3152
+ * @returns Transaction object with collect fee call
3153
+ */
3154
+ createCollectFeeNoSendPaylod(params: CollectFeeParams, tx: Transaction, primaryCoinAInput: TransactionObjectArgument, primaryCoinBInput: TransactionObjectArgument): Transaction;
3155
+ /**
3156
+ * Calculates pending fees for a position using local computation
3157
+ * Faster than on-chain simulation but less accurate
3158
+ * @param params - Pool and position parameters
3159
+ * @returns Fee quote with amounts owed
3160
+ * @example
3161
+ * const pool = await sdk.Pool.getPool(poolId);
3162
+ * const position = await sdk.Position.getPositionById(positionId);
3163
+ * const ticks = await sdk.Pool.fetchTicksByRpc(pool.ticksHandle);
3164
+ *
3165
+ * const tickLower = ticks.find(t => t.index === position.tick_lower_index);
3166
+ * const tickUpper = ticks.find(t => t.index === position.tick_upper_index);
3167
+ *
3168
+ * const fees = await sdk.Position.calculateFee({
3169
+ * pool,
3170
+ * position,
3171
+ * tickLower,
3172
+ * tickUpper
3173
+ * });
3174
+ *
3175
+ * console.log(`Pending fee A: ${fees.feeOwedA.toString()}`);
3176
+ * console.log(`Pending fee B: ${fees.feeOwedB.toString()}`);
3177
+ */
3178
+ calculateFee(params: CollectFeeParams): Promise<{
3179
+ feeOwedA: any;
3180
+ feeOwedB: any;
3181
+ }>;
3182
+ /**
3183
+ * Updates cached data with expiration time
3184
+ * @param key - Cache key
3185
+ * @param data - Data to cache
3186
+ * @param time - Cache duration in minutes (default: 5)
3187
+ */
3188
+ private updateCache;
3189
+ /**
3190
+ * Retrieves cached data if valid
3191
+ * @param key - Cache key
3192
+ * @param forceRefresh - Bypass cache if true
3193
+ * @returns Cached data or undefined if expired/not found
3194
+ */
3195
+ private getCache;
3196
+ }
3197
+ type SizedArray<T, S extends number, Arr extends T[] = []> = Arr['length'] extends S ? Arr : SizedArray<T, S, [...Arr, T]>;
3198
+
3199
+ interface CoinNode {
3200
+ address: string;
3201
+ decimals: number;
3202
+ }
3203
+ interface CoinProvider {
3204
+ coins: CoinNode[];
3205
+ }
3206
+ interface PathLink {
3207
+ base: string;
3208
+ quote: string;
3209
+ addressMap: Map<number, string>;
3210
+ }
3211
+ interface PathProvider {
3212
+ paths: PathLink[];
3213
+ }
3214
+ type OnePath = {
3215
+ amountIn: BN;
3216
+ amountOut: BN;
3217
+ poolAddress: string[];
3218
+ a2b: boolean[];
3219
+ rawAmountLimit: BN[];
3220
+ isExceed: boolean;
3221
+ coinType: string[];
3222
+ };
3223
+ type BasePath = {
3224
+ direction: boolean;
3225
+ label: string;
3226
+ poolAddress: string;
3227
+ fromCoin: string;
3228
+ toCoin: string;
3229
+ feeRate: number;
3230
+ outputAmount: number;
3231
+ inputAmount: number;
3232
+ currentSqrtPrice: BN;
3233
+ fromDecimal: number;
3234
+ toDecimal: number;
3235
+ currentPrice: Decimal;
3236
+ };
3237
+ type SplitPath = {
3238
+ percent: number;
3239
+ inputAmount: number;
3240
+ outputAmount: number;
3241
+ pathIndex: number;
3242
+ lastQuoteOutput: number;
3243
+ basePaths: BasePath[];
3244
+ };
3245
+ type AddressAndDirection = {
3246
+ addressMap: Map<number, string>;
3247
+ direction: boolean;
3248
+ };
3249
+ type SwapWithRouterParams = {
3250
+ paths: OnePath[];
3251
+ partner: string;
3252
+ priceSlippagePoint: number;
3253
+ };
3254
+ type PreRouterSwapParams = {
3255
+ stepNums: number;
3256
+ poolAB: string;
3257
+ poolBC: string | undefined;
3258
+ a2b: boolean;
3259
+ b2c: boolean | undefined;
3260
+ byAmountIn: boolean;
3261
+ amount: BN;
3262
+ coinTypeA: SuiAddressType;
3263
+ coinTypeB: SuiAddressType;
3264
+ coinTypeC: SuiAddressType | undefined;
3265
+ };
3266
+ type PreSwapResult = {
3267
+ index: number;
3268
+ amountIn: BN;
3269
+ amountMedium: BN;
3270
+ amountOut: BN;
3271
+ targetSqrtPrice: BN[];
3272
+ currentSqrtPrice: BN[];
3273
+ isExceed: boolean;
3274
+ stepNum: number;
3275
+ };
3276
+ type BestInternalRouterResult = {
3277
+ amountIn: BN;
3278
+ amountOut: BN;
3279
+ paths: OnePath[];
3280
+ a2b: boolean;
3281
+ b2c: boolean | undefined;
3282
+ byAmountIn: boolean;
3283
+ isExceed: boolean;
3284
+ targetSqrtPrice: BN[];
3285
+ currentSqrtPrice: BN[];
3286
+ coinTypeA: SuiAddressType;
3287
+ coinTypeB: SuiAddressType;
3288
+ coinTypeC: SuiAddressType | undefined;
3289
+ createTxParams: SwapWithRouterParams | undefined;
3290
+ };
3291
+ type PoolWithTvl = {
3292
+ poolAddress: string;
3293
+ tvl: number;
3294
+ };
3295
+ /**
3296
+ * Router module for finding optimal multi-hop swap paths
3297
+ * Analyzes liquidity across pools to find best execution routes
3298
+ * Supports complex routing with intermediate tokens
3299
+ *
3300
+ * @example
3301
+ * // Find best route for SUI -> USDC swap
3302
+ * await sdk.Router.loadGraphData(); // Load pool graph first
3303
+ *
3304
+ * const route = await sdk.Router.getBestInternalRouter({
3305
+ * from: "0x2::sui::SUI",
3306
+ * target: "0x5d4b...::usdc::USDC",
3307
+ * amount: "1000000000", // 1 SUI
3308
+ * byAmountIn: true,
3309
+ * depth: 3 // Allow up to 3 hops
3310
+ * });
3311
+ *
3312
+ * if (route) {
3313
+ * console.log(`Best route: ${route.paths.map(p => p.coinType).join(' -> ')}`);
3314
+ * console.log(`Expected output: ${route.amountOut}`);
3315
+ * console.log(`Price impact: ${route.priceImpact}%`);
3316
+ * }
3317
+ *
3318
+ * @example
3319
+ * // Execute multi-hop swap
3320
+ * const swapTx = await sdk.Router.createSwapTransactionPayload({
3321
+ * paths: route.paths,
3322
+ * partner: null,
3323
+ * byAmountIn: true
3324
+ * });
3325
+ */
3326
+ declare class RouterModule implements IModule {
3327
+ readonly graph: Graph;
3328
+ readonly pathProviders: PathProvider[];
3329
+ private coinProviders;
3330
+ private _coinAddressMap;
3331
+ private poolAddressMap;
3332
+ private _isGraphLoaded;
3333
+ protected _sdk: FerraDammSDK;
3334
+ constructor(sdk: FerraDammSDK);
3335
+ get sdk(): FerraDammSDK;
3336
+ get isGraphLoaded(): boolean;
3337
+ /**
3338
+ * Retrieves pool address mapping with trading direction
3339
+ * @param baseCoin - Base coin identifier
3340
+ * @param quoteCoin - Quote coin identifier
3341
+ * @returns Address mapping with direction information, or undefined if not found
3342
+ */
3343
+ getPoolAddressMapAndDirection(baseCoin: string, quoteCoin: string): AddressAndDirection | undefined;
3344
+ /**
3345
+ * Populates the coin address mapping with available coins
3346
+ */
3347
+ private setCoinList;
3348
+ /**
3349
+ * Loads pool and coin graph data for routing
3350
+ * Must be called before using routing functions
3351
+ * Caches data for performance
3352
+ * @example
3353
+ * // Load graph once at app startup
3354
+ * await sdk.Router.loadGraphData();
3355
+ *
3356
+ * // Now you can use routing
3357
+ * const route = await sdk.Router.getBestInternalRouter({
3358
+ * from: "0x2::sui::SUI",
3359
+ * target: "0x5d4b...::usdc::USDC",
3360
+ * amount: "1000000000",
3361
+ * byAmountIn: true
3362
+ * });
3363
+ */
3364
+ loadGraph(coinData: CoinProvider, pathData: PathProvider): void;
3365
+ /**
3366
+ * Adds a new path provider to the routing graph
3367
+ * @param provider - Path provider containing trading paths
3368
+ * @returns Current RouterModule instance for chaining
3369
+ */
3370
+ private addPathProvider;
3371
+ /**
3372
+ * Registers a coin provider with the router
3373
+ * @param provider - Coin provider containing coin information
3374
+ * @returns Current RouterModule instance for chaining
3375
+ */
3376
+ private addCoinProvider;
3377
+ /**
3378
+ * Retrieves token information from the coin address mapping
3379
+ * @param coinType - Coin type identifier
3380
+ * @returns Coin node information or undefined if not found
3381
+ */
3382
+ tokenInfo(coinType: string): CoinNode | undefined;
3383
+ /**
3384
+ * Calculates the fee rate for a specific pool
3385
+ * @param fromCoin - Source coin type
3386
+ * @param toCoin - Target coin type
3387
+ * @param poolAddress - Pool address
3388
+ * @returns Fee rate percentage for the pool
3389
+ */
3390
+ getFeeRate(fromCoin: string, toCoin: string, poolAddress: string): number;
3391
+ /**
3392
+ * Finds the optimal swap route between two tokens
3393
+ * Analyzes all possible paths considering liquidity and fees
3394
+ * @param params - Routing parameters including tokens and amount
3395
+ * @returns Best route with expected output and path details, or null if no path found
3396
+ * @example
3397
+ * await sdk.Router.loadGraphData();
3398
+ *
3399
+ * const route = await sdk.Router.getBestInternalRouter({
3400
+ * from: "0x2::sui::SUI",
3401
+ * target: "0x5d4b...::usdc::USDC",
3402
+ * amount: "1000000000", // 1 SUI
3403
+ * byAmountIn: true,
3404
+ * depth: 3, // Max 3 hops
3405
+ * splitCount: 1 // Single path (no split routing)
3406
+ * });
3407
+ *
3408
+ * if (!route) {
3409
+ * console.log('No route found');
3410
+ * return;
3411
+ * }
3412
+ *
3413
+ * console.log('Route found:');
3414
+ * route.paths.forEach((path, i) => {
3415
+ * console.log(` Hop ${i + 1}: ${path.coinType}`);
3416
+ * console.log(` Pool: ${path.poolAddress}`);
3417
+ * console.log(` Direction: ${path.a2b ? 'A->B' : 'B->A'}`);
3418
+ * });
3419
+ * console.log(`Total output: ${route.amountOut}`);
3420
+ * console.log(`Price impact: ${route.priceImpact}%`);
3421
+ */
3422
+ getBestInternalRouter(fromCoin: string, toCoin: string, swapAmount: BN, isFixedInput: boolean, slippagePoint: number, partnerObjectId: string, multiPoolParams?: PreSwapWithMultiPoolParams): Promise<BestInternalRouterResult | undefined>;
3423
+ /**
3424
+ * Loads graph data from the remote API endpoint
3425
+ */
3426
+ loadGraphData(): Promise<void>;
3427
+ /**
3428
+ * Simulates multi-hop swaps across different parameter sets
3429
+ * Useful for comparing different amounts or paths
3430
+ * @param parameterSets - Array of routing parameters to test
3431
+ * @returns Array of best routes for each parameter set
3432
+ * @example
3433
+ * await sdk.Router.loadGraphData();
3434
+ *
3435
+ * const routes = await sdk.Router.preRouterSwapA2B2C([
3436
+ * {
3437
+ * from: "0x2::sui::SUI",
3438
+ * target: "0x5d4b...::usdc::USDC",
3439
+ * amount: "1000000000", // 1 SUI
3440
+ * byAmountIn: true
3441
+ * },
3442
+ * {
3443
+ * from: "0x2::sui::SUI",
3444
+ * target: "0x5d4b...::usdc::USDC",
3445
+ * amount: "10000000000", // 10 SUI
3446
+ * byAmountIn: true
3447
+ * }
3448
+ * ]);
3449
+ *
3450
+ * routes.forEach((route, i) => {
3451
+ * console.log(`Route ${i + 1}:`);
3452
+ * console.log(` Output: ${route?.amountOut ?? 'No route'}`);
3453
+ * });
3454
+ */
3455
+ preRouterSwapA2B2C(parameterSets: PreRouterSwapParams[]): Promise<PreSwapResult>;
3456
+ /**
3457
+ * Gets all pools with their Total Value Locked (TVL)
3458
+ * Useful for analytics and pool selection
3459
+ * @returns Array of pools with TVL data
3460
+ * @example
3461
+ * const poolsWithTvl = await sdk.Router.getPoolWithTVL();
3462
+ *
3463
+ * // Sort by TVL
3464
+ * poolsWithTvl.sort((a, b) => b.tvl - a.tvl);
3465
+ *
3466
+ * console.log('Top 10 pools by TVL:');
3467
+ * poolsWithTvl.slice(0, 10).forEach(pool => {
3468
+ * console.log(`${pool.name}: $${pool.tvl.toLocaleString()}`);
3469
+ * });
3470
+ */
3471
+ getPoolWithTVL(): Promise<PoolWithTvl[]>;
3472
+ }
3473
+
3474
+ /**
3475
+ * Swap module for executing token swaps in DAMM pools
3476
+ * Handles swap calculations, fee estimation, price impact analysis, and transaction creation
3477
+ * Supports both single-pool and multi-pool swap operations with gas optimization
3478
+ */
3479
+ declare class SwapModule implements IModule {
3480
+ protected _sdk: FerraDammSDK;
3481
+ constructor(sdk: FerraDammSDK);
3482
+ get sdk(): FerraDammSDK;
3483
+ /**
3484
+ * Performs pre-swap simulation across multiple pools to find optimal execution
3485
+ * @param swapParams - Parameters for multi-pool swap simulation
3486
+ * @returns Promise resolving to optimal swap data or null if no valid swap found
3487
+ */
3488
+ preSwapWithMultiPool(swapParams: PreSwapWithMultiPoolParams): Promise<{
3489
+ poolAddress: string;
3490
+ estimatedAmountIn: string;
3491
+ estimatedAmountOut: any;
3492
+ estimatedEndSqrtPrice: any;
3493
+ estimatedStartSqrtPrice: any;
3494
+ estimatedFeeAmount: any;
3495
+ isExceed: any;
3496
+ amount: string;
3497
+ aToB: boolean;
3498
+ byAmountIn: boolean;
3499
+ }>;
3500
+ /**
3501
+ * Performs pre-swap simulation for a single pool
3502
+ * @param swapParams - Parameters for single pool swap simulation
3503
+ * @returns Promise resolving to swap simulation data or null if simulation fails
3504
+ */
3505
+ preswap(swapParams: PreSwapParams): Promise<{
3506
+ poolAddress: string;
3507
+ currentSqrtPrice: number;
3508
+ estimatedAmountIn: any;
3509
+ estimatedAmountOut: any;
3510
+ estimatedEndSqrtPrice: any;
3511
+ estimatedFeeAmount: any;
3512
+ isExceed: any;
3513
+ amount: string;
3514
+ aToB: boolean;
3515
+ byAmountIn: boolean;
3516
+ }>;
3517
+ /**
3518
+ * Transforms raw swap simulation data into structured swap result
3519
+ * @param swapParams - Original swap parameters
3520
+ * @param simulationData - Raw simulation result data
3521
+ * @returns Structured swap data object
3522
+ */
3523
+ private transformSwapData;
3524
+ /**
3525
+ * Transforms multi-pool swap simulation data into structured result
3526
+ * @param swapParams - Original multi-pool swap parameters
3527
+ * @param responseData - Raw JSON response from simulation
3528
+ * @returns Structured multi-pool swap data object
3529
+ */
3530
+ private transformSwapWithMultiPoolData;
3531
+ /**
3532
+ * Calculates swap rates and impact metrics using local computation
3533
+ * @param calculationParams - Parameters for rate calculation including pool data and ticks
3534
+ * @returns Detailed calculation results including amounts, fees, and price impact
3535
+ */
3536
+ calculateRates(calculationParams: CalculateRatesParams): CalculateRatesResult;
3537
+ /**
3538
+ * Creates a transaction for multi-hop swap execution
3539
+ * Builds the complete swap path through multiple pools
3540
+ * @param params - Swap parameters including path and partner info
3541
+ * @returns Transaction ready for execution
3542
+ * @example
3543
+ * // First find the best route
3544
+ * const route = await sdk.Router.getBestInternalRouter({
3545
+ * from: "0x2::sui::SUI",
3546
+ * target: "0x5d4b...::usdc::USDC",
3547
+ * amount: "1000000000",
3548
+ * byAmountIn: true
3549
+ * });
3550
+ *
3551
+ * // Then create transaction
3552
+ * const tx = await sdk.Router.createSwapTransactionPayload({
3553
+ * paths: route.paths,
3554
+ * partner: null, // Or partner ID for fee sharing
3555
+ * byAmountIn: true
3556
+ * });
3557
+ *
3558
+ * const result = await sdk.fullClient.signAndExecuteTransaction({
3559
+ * transaction: tx,
3560
+ * signer: keypair
3561
+ * });
3562
+ */
3563
+ createSwapTransactionPayload(swapParams: SwapParams, gasEstimationConfig?: {
3564
+ byAmountIn: boolean;
3565
+ slippage: Percentage;
3566
+ decimalsA: number;
3567
+ decimalsB: number;
3568
+ swapTicks: Array<TickData>;
3569
+ currentPool: Pool;
3570
+ }): Promise<Transaction>;
3571
+ /**
3572
+ * Creates a swap transaction without automatic coin transfers (for advanced usage)
3573
+ * @param swapParams - Parameters for swap execution
3574
+ * @param gasEstimationConfig - Optional gas estimation configuration for SUI swaps
3575
+ * @returns Promise resolving to transaction and coin arguments for manual handling
3576
+ */
3577
+ createSwapTransactionWithoutTransferCoinsPayload(swapParams: SwapParams, gasEstimationConfig?: {
3578
+ byAmountIn: boolean;
3579
+ slippage: Percentage;
3580
+ decimalsA: number;
3581
+ decimalsB: number;
3582
+ swapTicks: Array<TickData>;
3583
+ currentPool: Pool;
3584
+ }): Promise<{
3585
+ tx: Transaction;
3586
+ coinABs: TransactionObjectArgument[];
3587
+ }>;
3588
+ }
3589
+
3590
+ /**
3591
+ * Represents a module for making RPC (Remote Procedure Call) requests.
3592
+ */
3593
+ declare class RpcModule extends SuiClient {
3594
+ /**
3595
+ * Get events for a given query criteria
3596
+ * @param query
3597
+ * @param paginationArgs
3598
+ * @returns
3599
+ */
3600
+ queryEventsByPage(query: SuiEventFilter, paginationArgs?: PaginationArgs): Promise<DataPage<any>>;
3601
+ queryTransactionBlocksByPage(filter?: TransactionFilter, paginationArgs?: PaginationArgs, order?: 'ascending' | 'descending' | null | undefined): Promise<DataPage<SuiTransactionBlockResponse>>;
3602
+ /**
3603
+ * Get all objects owned by an address
3604
+ * @param owner
3605
+ * @param query
3606
+ * @param paginationArgs
3607
+ * @returns
3608
+ */
3609
+ getOwnedObjectsByPage(owner: string, query: SuiObjectResponseQuery, paginationArgs?: PaginationArgs): Promise<DataPage<any>>;
3610
+ /**
3611
+ * Return the list of dynamic field objects owned by an object
3612
+ * @param parentId
3613
+ * @param paginationArgs
3614
+ * @returns
3615
+ */
3616
+ getDynamicFieldsByPage(parentId: SuiObjectIdType, paginationArgs?: PaginationArgs): Promise<DataPage<any>>;
3617
+ /**
3618
+ * Batch get details about a list of objects. If any of the object ids are duplicates the call will fail
3619
+ * @param ids
3620
+ * @param options
3621
+ * @param limit
3622
+ * @returns
3623
+ */
3624
+ batchGetObjects(ids: SuiObjectIdType[], options?: SuiObjectDataOptions, limit?: number): Promise<SuiObjectResponse[]>;
3625
+ /**
3626
+ * Calculates the gas cost of a transaction block.
3627
+ * @param {Transaction} tx - The transaction block to calculate gas for.
3628
+ * @returns {Promise<number>} - The estimated gas cost of the transaction block.
3629
+ * @throws {Error} - Throws an error if the sender is empty or devInspect fails.
3630
+ */
3631
+ calculationTxGas(tx: Transaction): Promise<number>;
3632
+ /**
3633
+ * Sends a transaction block after signing it with the provided keypair.
3634
+ *
3635
+ * @param {Ed25519Keypair | Secp256k1Keypair} keypair - The keypair used for signing the transaction.
3636
+ * @param {Transaction} tx - The transaction block to send.
3637
+ * @returns {Promise<SuiTransactionBlockResponse | undefined>} - The response of the sent transaction block.
3638
+ */
3639
+ sendTransaction(keypair: Ed25519Keypair | Secp256k1Keypair, tx: Transaction): Promise<SuiTransactionBlockResponse | undefined>;
3640
+ /**
3641
+ * Send a simulation transaction.
3642
+ * @param tx - The transaction block.
3643
+ * @param simulationAccount - The simulation account.
3644
+ * @param useDevInspect - A flag indicating whether to use DevInspect. Defaults to true.
3645
+ * @returns A promise that resolves to DevInspectResults or undefined.
3646
+ */
3647
+ sendSimulationTransaction(tx: Transaction, simulationAccount: string, useDevInspect?: boolean): Promise<DevInspectResults | undefined>;
3648
+ }
3649
+
3650
+ /**
3651
+ * Represents options and configurations for an SDK.
3652
+ */
3653
+ type SdkOptions = {
3654
+ /**
3655
+ * The full URL for interacting with the RPC (Remote Procedure Call) service.
3656
+ */
3657
+ fullRpcUrl: string;
3658
+ /**
3659
+ * Optional URL for the faucet service.
3660
+ */
3661
+ faucetURL?: string;
3662
+ /**
3663
+ * Configuration for the simulation account.
3664
+ */
3665
+ simulationAccount: {
3666
+ /**
3667
+ * The address of the simulation account.
3668
+ */
3669
+ address: string;
3670
+ };
3671
+ /**
3672
+ * Package containing faucet-related configurations.
3673
+ */
3674
+ faucet?: Package;
3675
+ /**
3676
+ * Package containing token-related configurations.
3677
+ */
3678
+ token?: Package<TokenConfig>;
3679
+ /**
3680
+ * Package containing Cryptocurrency Liquidity Mining Module (DAMM) pool configurations.
3681
+ */
3682
+ damm_pool: Package<DammConfig>;
3683
+ /**
3684
+ * Package containing integration-related configurations.
3685
+ */
3686
+ integrate: Package;
3687
+ /**
3688
+ * The URL for the swap count
3689
+ */
3690
+ swapCountUrl?: string;
3691
+ };
3692
+ /**
3693
+ * The entry class of FerraDammSDK, which is almost responsible for all interactions with DAMM.
3694
+ */
3695
+ declare class FerraDammSDK {
3696
+ private readonly _cache;
3697
+ /**
3698
+ * RPC provider on the SUI chain
3699
+ */
3700
+ protected _rpcModule: RpcModule;
3701
+ /**
3702
+ * Provide interact with damm pools with a pool router interface.
3703
+ */
3704
+ protected _pool: PoolModule;
3705
+ /**
3706
+ * Provide interact with damm position with a position router interface.
3707
+ */
3708
+ protected _position: PositionModule;
3709
+ /**
3710
+ * Provide interact with a pool swap router interface.
3711
+ */
3712
+ protected _swap: SwapModule;
3713
+ /**
3714
+ * Provide interact with a position rewarder interface.
3715
+ */
3716
+ protected _rewarder: RewarderModule;
3717
+ /**
3718
+ * Provide interact with a pool router interface.
3719
+ */
3720
+ protected _router: RouterModule;
3721
+ /**
3722
+ * Provide sdk options
3723
+ */
3724
+ protected _sdkOptions: SdkOptions;
3725
+ /**
3726
+ * After connecting the wallet, set the current wallet address to senderAddress.
3727
+ */
3728
+ protected _senderAddress: string;
3729
+ constructor(options: SdkOptions);
3730
+ /**
3731
+ * Getter for the sender address property.
3732
+ * @returns {SuiAddressType} The sender address.
3733
+ */
3734
+ get senderAddress(): SuiAddressType;
3735
+ /**
3736
+ * Setter for the sender address property.
3737
+ * @param {string} value - The new sender address value.
3738
+ */
3739
+ set senderAddress(value: string);
3740
+ /**
3741
+ * Getter for the Swap property.
3742
+ * @returns {SwapModule} The Swap property value.
3743
+ */
3744
+ get Swap(): SwapModule;
3745
+ /**
3746
+ * Getter for the fullClient property.
3747
+ * @returns {RpcModule} The fullClient property value.
3748
+ */
3749
+ get fullClient(): RpcModule;
3750
+ /**
3751
+ * Getter for the sdkOptions property.
3752
+ * @returns {SdkOptions} The sdkOptions property value.
3753
+ */
3754
+ get sdkOptions(): SdkOptions;
3755
+ /**
3756
+ * Getter for the Pool property.
3757
+ * @returns {PoolModule} The Pool property value.
3758
+ */
3759
+ get Pool(): PoolModule;
3760
+ /**
3761
+ * Getter for the Position property.
3762
+ * @returns {PositionModule} The Position property value.
3763
+ */
3764
+ get Position(): PositionModule;
3765
+ /**
3766
+ * Getter for the Rewarder property.
3767
+ * @returns {RewarderModule} The Rewarder property value.
3768
+ */
3769
+ get Rewarder(): RewarderModule;
3770
+ /**
3771
+ * Getter for the Router property.
3772
+ * @returns {RouterModule} The Router property value.
3773
+ */
3774
+ get Router(): RouterModule;
3775
+ /**
3776
+ * Gets all coin assets for the given owner and coin type.
3777
+ *
3778
+ * @param suiAddress The address of the owner.
3779
+ * @param coinType The type of the coin.
3780
+ * @returns an array of coin assets.
3781
+ */
3782
+ getOwnerCoinAssets(suiAddress: string, coinType?: string | null, forceRefresh?: boolean): Promise<CoinAsset[]>;
3783
+ /**
3784
+ * Gets all coin balances for the given owner and coin type.
3785
+ *
3786
+ * @param suiAddress The address of the owner.
3787
+ * @param coinType The type of the coin.
3788
+ * @returns an array of coin balances.
3789
+ */
3790
+ getOwnerCoinBalances(suiAddress: string, coinType?: string | null): Promise<CoinBalance[]>;
3791
+ /**
3792
+ * Updates the cache for the given key.
3793
+ *
3794
+ * @param key The key of the cache entry to update.
3795
+ * @param data The data to store in the cache.
3796
+ * @param time The time in minutes after which the cache entry should expire.
3797
+ */
3798
+ updateCache(key: string, data: SuiResource, time?: number): void;
3799
+ /**
3800
+ * Gets the cache entry for the given key.
3801
+ *
3802
+ * @param key The key of the cache entry to get.
3803
+ * @param forceRefresh Whether to force a refresh of the cache entry.
3804
+ * @returns The cache entry for the given key, or undefined if the cache entry does not exist or is expired.
3805
+ */
3806
+ getCache<T>(key: string, forceRefresh?: boolean): T | undefined;
3807
+ }
3808
+
3809
+ declare const cacheTime5min: number;
3810
+ declare const cacheTime24h: number;
3811
+ declare function getFutureTime(interval: number): number;
3812
+ /**
3813
+ * Defines the structure of a CachedContent object, used for caching resources in memory.
3814
+ */
3815
+ declare class CachedContent {
3816
+ overdueTime: number;
3817
+ value: SuiResource | null;
3818
+ constructor(value: SuiResource | null, overdueTime?: number);
3819
+ isValid(): boolean;
3820
+ }
3821
+
3822
+ /**
3823
+ * Converts an amount to a decimal value, based on the number of decimals specified.
3824
+ * @param {number | string} amount - The amount to convert to decimal.
3825
+ * @param {number | string} decimals - The number of decimals to use in the conversion.
3826
+ * @returns {number} - Returns the converted amount as a number.
3827
+ */
3828
+ declare function toDecimalsAmount(amount: number | string, decimals: number | string): number;
3829
+ /**
3830
+ * Converts a bigint to an unsigned integer of the specified number of bits.
3831
+ * @param {bigint} int - The bigint to convert.
3832
+ * @param {number} bits - The number of bits to use in the conversion. Defaults to 32 bits.
3833
+ * @returns {string} - Returns the converted unsigned integer as a string.
3834
+ */
3835
+ declare function asUintN(int: bigint, bits?: number): string;
3836
+ /**
3837
+ * Converts a bigint to a signed integer of the specified number of bits.
3838
+ * @param {bigint} int - The bigint to convert.
3839
+ * @param {number} bits - The number of bits to use in the conversion. Defaults to 32 bits.
3840
+ * @returns {number} - Returns the converted signed integer as a number.
3841
+ */
3842
+ declare function asIntN(int: bigint, bits?: number): bigint;
3843
+ /**
3844
+ * Converts an amount in decimals to its corresponding numerical value.
3845
+ * @param {number|string} amount - The amount to convert.
3846
+ * @param {number|string} decimals - The number of decimal places used in the amount.
3847
+ * @returns {number} - Returns the converted numerical value.
3848
+ */
3849
+ declare function fromDecimalsAmount(amount: number | string, decimals: number | string): number;
3850
+ /**
3851
+ * Converts a secret key in string or Uint8Array format to an Ed25519 key pair.
3852
+ * @param {string|Uint8Array} secretKey - The secret key to convert.
3853
+ * @param {string} ecode - The encoding of the secret key ('hex' or 'base64'). Defaults to 'hex'.
3854
+ * @returns {Ed25519Keypair} - Returns the Ed25519 key pair.
3855
+ */
3856
+ declare function secretKeyToEd25519Keypair(secretKey: string | Uint8Array, ecode?: 'hex' | 'base64'): Ed25519Keypair;
3857
+ /**
3858
+ * Converts a secret key in string or Uint8Array format to a Secp256k1 key pair.
3859
+ * @param {string|Uint8Array} secretKey - The secret key to convert.
3860
+ * @param {string} ecode - The encoding of the secret key ('hex' or 'base64'). Defaults to 'hex'.
3861
+ * @returns {Ed25519Keypair} - Returns the Secp256k1 key pair.
3862
+ */
3863
+ declare function secretKeyToSecp256k1Keypair(secretKey: string | Uint8Array, ecode?: 'hex' | 'base64'): Secp256k1Keypair;
3864
+ /**
3865
+ * Builds a Pool object based on a SuiObjectResponse.
3866
+ * @param {SuiObjectResponse} objects - The SuiObjectResponse containing information about the pool.
3867
+ * @returns {Pool} - The built Pool object.
3868
+ */
3869
+ declare function buildPool(objects: SuiObjectResponse): Pool;
3870
+ /**
3871
+ * Builds an NFT object based on a response containing information about the NFT.
3872
+ * @param {any} objects - The response containing information about the NFT.
3873
+ * @returns {NFT} - The built NFT object.
3874
+ */
3875
+ declare function buildNFT(objects: any): NFT;
3876
+ /** Builds a Position object based on a SuiObjectResponse.
3877
+ * @param {SuiObjectResponse} object - The SuiObjectResponse containing information about the position.
3878
+ * @returns {Position} - The built Position object.
3879
+ */
3880
+ declare function buildPosition(object: SuiObjectResponse): Position;
3881
+ /**
3882
+ * Builds a PositionReward object based on a response containing information about the reward.
3883
+ * @param {any} fields - The response containing information about the reward.
3884
+ * @returns {PositionReward} - The built PositionReward object.
3885
+ */
3886
+ declare function buildPositionReward(fields: any): PositionReward;
3887
+ /**
3888
+ * Builds a TickData object based on a response containing information about tick data.
3889
+ * It must check if the response contains the required fields.
3890
+ * @param {SuiObjectResponse} objects - The response containing information about tick data.
3891
+ * @returns {TickData} - The built TickData object.
3892
+ */
3893
+ declare function buildTickData(objects: SuiObjectResponse): TickData;
3894
+ /**
3895
+ * Builds a TickData object based on a given event's fields.
3896
+ * @param {any} fields - The fields of an event.
3897
+ * @returns {TickData} - The built TickData object.
3898
+ * @throws {Error} If any required field is missing.
3899
+ */
3900
+ declare function buildTickDataByEvent(fields: any): TickData;
3901
+ declare function buildDammPositionName(pool_index: number, position_index: number): string;
3902
+ declare function buildPositionTransactionInfo(data: SuiTransactionBlockResponse, txIndex: number, filterIds: string[]): PositionTransactionInfo[];
3903
+ declare function buildPoolTransactionInfo(data: SuiTransactionBlockResponse, txIndex: number, package_id: string, poolId: string): PoolTransactionInfo[];
3904
+
3905
+ declare function isSortedSymbols(symbolX: string, symbolY: string): boolean;
3906
+ declare function composeType(address: string, generics: SuiAddressType[]): SuiAddressType;
3907
+ declare function composeType(address: string, struct: string, generics?: SuiAddressType[]): SuiAddressType;
3908
+ declare function composeType(address: string, module: string, struct: string, generics?: SuiAddressType[]): SuiAddressType;
3909
+ declare function extractAddressFromType(type: string): string;
3910
+ declare function extractStructTagFromType(type: string): SuiStructTag;
3911
+ declare function normalizeCoinType(coinType: string): string;
3912
+ declare function fixSuiObjectId(value: string): string;
3913
+ /**
3914
+ * Fixes and normalizes a coin type by removing or keeping the prefix.
3915
+ *
3916
+ * @param {string} coinType - The coin type to be fixed.
3917
+ * @param {boolean} removePrefix - Whether to remove the prefix or not (default: true).
3918
+ * @returns {string} - The fixed and normalized coin type.
3919
+ */
3920
+ declare const fixCoinType: (coinType: string, removePrefix?: boolean) => string;
3921
+ /**
3922
+ * Recursively traverses the given data object and patches any string values that represent Sui object IDs.
3923
+ *
3924
+ * @param {any} data - The data object to be patched.
3925
+ */
3926
+ declare function patchFixSuiObjectId(data: any): void;
3927
+
3928
+ declare function addHexPrefix(hex: string): string;
3929
+ declare function removeHexPrefix(hex: string): string;
3930
+ declare function shortString(str: string, start?: number, end?: number): string;
3931
+ declare function shortAddress(address: string, start?: number, end?: number): string;
3932
+ declare function checkAddress(address: any, options?: {
3933
+ leadingZero: boolean;
3934
+ }): boolean;
3935
+ /**
3936
+ * Attempts to turn a value into a `Buffer`. As input it supports `Buffer`, `String`, `Number`, null/undefined, `BN` and other objects with a `toArray()` method.
3937
+ * @param v the value
3938
+ */
3939
+ declare function toBuffer(v: any): Buffer;
3940
+ declare function bufferToHex(buffer: Buffer): string;
3941
+ /**
3942
+ * '\x02\x00\x00\x00' to 2
3943
+ * @param binaryData
3944
+ */
3945
+ declare function hexToNumber(binaryData: string): number;
3946
+ declare function utf8to16(str: string): any;
3947
+ declare function hexToString(str: string): any;
3948
+
3949
+ declare function d(value?: Decimal.Value): Decimal.Instance;
3950
+ declare function decimalsMultiplier(decimals?: Decimal.Value): Decimal.Instance;
3951
+
3952
+ declare class TickUtil {
3953
+ /**
3954
+ * Get min tick index.
3955
+ * @param tick_spacing tick spacing
3956
+ * @retruns min tick index
3957
+ */
3958
+ static getMinIndex(tickSpacing: number): number;
3959
+ /**
3960
+ * Get max tick index.
3961
+ * @param tick_spacing - tick spacing
3962
+ * @retruns max tick index
3963
+ */
3964
+ static getMaxIndex(tickSpacing: number): number;
3965
+ }
3966
+ /**
3967
+ * Get nearest tick by current tick.
3968
+ *
3969
+ * @param tickIndex
3970
+ * @param tickSpacing
3971
+ * @returns
3972
+ */
3973
+ declare function getNearestTickByTick(tickIndex: number, tickSpacing: number): number;
3974
+ /**
3975
+ * Calculate reward amount in tick range.
3976
+ * @param {Pool}pool Pool object.
3977
+ * @param {TickData}tickLower Tick lower data.
3978
+ * @param {TickData}tickUpper Tick upper data.
3979
+ * @param {number}tickLowerIndex Tick lower index.
3980
+ * @param {number}tickUpperIndex Tick upper index.
3981
+ * @param {BN[]}growthGlobal
3982
+ * @returns
3983
+ */
3984
+ declare function getRewardInTickRange(pool: Pool, tickLower: TickData, tickUpper: TickData, tickLowerIndex: number, tickUpperIndex: number, growthGlobal: BN[]): BN[];
3985
+
3986
+ type AdjustResult = {
3987
+ isAdjustCoinA: boolean;
3988
+ isAdjustCoinB: boolean;
3989
+ };
3990
+ /**
3991
+ * Determines which coins in a pair are SUI tokens that need adjustment
3992
+ * @param coinPair - Pair of coin types to check
3993
+ * @returns Object indicating which coins are SUI and need adjustment
3994
+ */
3995
+ declare function findAdjustCoin(coinPair: CoinPairType): AdjustResult;
3996
+ type BuildCoinResult = {
3997
+ targetCoin: TransactionObjectArgument;
3998
+ remainCoins: CoinAsset[];
3999
+ isMintZeroCoin: boolean;
4000
+ tragetCoinAmount: string;
4001
+ originalSplitedCoin?: TransactionObjectArgument;
4002
+ };
4003
+ type CoinInputInterval = {
4004
+ amountSecond: bigint;
4005
+ amountFirst: bigint;
4006
+ };
4007
+ type TxCoin = {
4008
+ $kind: 'NestedResult';
4009
+ NestedResult: [number, number];
4010
+ } | ((tx: Transaction) => {
4011
+ $kind: 'NestedResult';
4012
+ NestedResult: [number, number];
4013
+ }) | ((tx: Transaction) => TransactionResult);
4014
+ /**
4015
+ * Utility function for debugging transaction structure
4016
+ * @param transaction - Transaction to inspect
4017
+ * @param enablePrint - Whether to print command details
4018
+ */
4019
+ declare function printTransaction(transaction: Transaction, enablePrint?: boolean): Promise<void>;
4020
+ /**
4021
+ * Transaction utility class for building DAMM-related transactions
4022
+ * Provides methods for liquidity operations, swaps, and coin management
4023
+ */
4024
+ declare class TransactionUtil {
4025
+ /**
4026
+ * Creates transaction parameters for collecting rewards and fees
4027
+ * @param sdk - SDK instance
4028
+ * @param transaction - Transaction to modify
4029
+ * @param rewarderParams - Parameters for reward collection
4030
+ * @param allCoinAssets - All available coin assets
4031
+ * @param coinAssetsA - Optional coin assets for token A
4032
+ * @param coinAssetsB - Optional coin assets for token B
4033
+ * @returns Modified transaction with reward collection logic
4034
+ */
4035
+ static createCollectRewarderAndFeeParams(sdk: FerraDammSDK, transaction: Transaction, rewarderParams: CollectRewarderParams, allCoinAssets: CoinAsset[], coinAssetsA?: CoinAsset[], coinAssetsB?: CoinAsset[]): Transaction;
4036
+ static createRemoveLiquidityPayload(params: RemoveLiquidityAndClaimRewardsParams, sdkOptions: SdkOptions, tx: Transaction): [coinA: TxCoin, coinB: TxCoin];
4037
+ static joinBalanceTx(currentBalance: TxCoin, targetBalance: TxCoin, coinType: string, transaction: Transaction): void;
4038
+ static joinCoinTx(currentCoin: TxCoin, targetCoin: TxCoin, coinType: string, transaction: Transaction): void;
4039
+ static balanceToCoinTx(balance: TxCoin, coinType: string, tx: Transaction): TransactionResult;
4040
+ /**
4041
+ * Adjusts transaction parameters to account for gas costs
4042
+ * @param sdk - SDK instance
4043
+ * @param availableCoins - Available coin assets
4044
+ * @param requiredAmount - Required amount for operation
4045
+ * @param transaction - Transaction to analyze
4046
+ * @returns Adjusted amount and optionally a new transaction
4047
+ */
4048
+ static adjustTransactionForGas(sdk: FerraDammSDK, availableCoins: CoinAsset[], requiredAmount: bigint, transaction: Transaction): Promise<{
4049
+ fixAmount: bigint;
4050
+ newTx?: Transaction;
4051
+ }>;
4052
+ /**
4053
+ * Builds add liquidity transaction with gas optimization for SUI tokens
4054
+ * @param sdk - SDK instance
4055
+ * @param allCoins - All available coin assets
4056
+ * @param liquidityParams - Parameters for adding liquidity
4057
+ * @param gasEstimationConfig - Gas estimation configuration
4058
+ * @param transaction - Optional existing transaction
4059
+ * @param inputCoinA - Optional pre-built coin A input
4060
+ * @param inputCoinB - Optional pre-built coin B input
4061
+ * @returns Transaction with gas-optimized liquidity addition
4062
+ */
4063
+ static buildAddLiquidityFixTokenForGas(sdk: FerraDammSDK, allCoins: CoinAsset[], liquidityParams: AddLiquidityFixTokenParams, gasEstimationConfig: {
4064
+ slippage: number;
4065
+ curSqrtPrice: BN;
4066
+ }, transaction?: Transaction, inputCoinA?: TransactionObjectArgument, inputCoinB?: TransactionObjectArgument): Promise<Transaction>;
4067
+ /**
4068
+ * Builds basic add liquidity transaction
4069
+ * @param sdk - SDK instance
4070
+ * @param allCoinAssets - All available coin assets
4071
+ * @param liquidityParams - Parameters for adding liquidity
4072
+ * @param transaction - Optional existing transaction
4073
+ * @param inputCoinA - Optional pre-built coin A input
4074
+ * @param inputCoinB - Optional pre-built coin B input
4075
+ * @returns Transaction for adding liquidity
4076
+ */
4077
+ static buildAddLiquidityFixToken(sdk: FerraDammSDK, allCoinAssets: CoinAsset[], liquidityParams: AddLiquidityFixTokenParams, transaction?: Transaction, inputCoinA?: TransactionObjectArgument, inputCoinB?: TransactionObjectArgument): Promise<Transaction>;
4078
+ /**
4079
+ * Builds coin input for add liquidity operations with slippage handling
4080
+ * @param transaction - Transaction to modify
4081
+ * @param needIntervalAmount - Whether amount needs interval calculation
4082
+ * @param amount - Amount to use
4083
+ * @param slippageRate - Slippage rate
4084
+ * @param coinType - Type of coin
4085
+ * @param allCoinAssets - Available coin assets
4086
+ * @param buildVector - Whether to build as vector
4087
+ * @param fixAmount - Whether to fix amount exactly
4088
+ * @returns Built coin result
4089
+ */
4090
+ static buildAddLiquidityFixTokenCoinInput(transaction: Transaction, needIntervalAmount: boolean, amount: number | string, slippageRate: number, coinType: string, allCoinAssets: CoinAsset[], buildVector?: boolean, fixAmount?: boolean): BuildCoinResult;
4091
+ /**
4092
+ * Adjusts liquidity parameters based on current pool state
4093
+ * @param liquidityParams - Original liquidity parameters
4094
+ * @param slippageRate - Slippage tolerance
4095
+ * @param currentSqrtPrice - Current pool sqrt price
4096
+ * @returns Adjusted liquidity parameters
4097
+ */
4098
+ static fixAddLiquidityFixTokenParams(liquidityParams: AddLiquidityFixTokenParams, slippageRate: number, currentSqrtPrice: BN): AddLiquidityFixTokenParams;
4099
+ /**
4100
+ * Builds the core arguments for add liquidity transaction
4101
+ * @param transaction - Transaction to modify
4102
+ * @param sdk - SDK instance
4103
+ * @param allCoinAssets - All available coin assets
4104
+ * @param liquidityParams - Liquidity parameters
4105
+ * @param coinAInputs - Coin A input result
4106
+ * @param coinBInputs - Coin B input result
4107
+ * @returns Transaction with liquidity arguments
4108
+ */
4109
+ private static buildAddLiquidityFixTokenArgs;
4110
+ /**
4111
+ * Builds swap transaction with gas optimization for SUI tokens
4112
+ * @param sdk - SDK instance
4113
+ * @param swapParams - Parameters for swap
4114
+ * @param allCoinAssets - All available coin assets
4115
+ * @param gasEstimationConfig - Gas estimation configuration
4116
+ * @returns Gas-optimized swap transaction
4117
+ */
4118
+ static buildSwapTransactionForGas(sdk: FerraDammSDK, swapParams: SwapParams, allCoinAssets: CoinAsset[], gasEstimationConfig: {
4119
+ byAmountIn: boolean;
4120
+ slippage: Percentage;
4121
+ decimalsA: number;
4122
+ decimalsB: number;
4123
+ swapTicks: Array<TickData>;
4124
+ currentPool: Pool;
4125
+ }): Promise<Transaction>;
4126
+ /**
4127
+ * Builds basic swap transaction
4128
+ * @param sdk - SDK instance
4129
+ * @param swapParams - Parameters for swap
4130
+ * @param allCoinAssets - All available coin assets
4131
+ * @returns Swap transaction
4132
+ */
4133
+ static buildSwapTransaction(sdk: FerraDammSDK, swapParams: SwapParams, allCoinAssets: CoinAsset[]): Transaction;
4134
+ /**
4135
+ * Builds the core arguments for swap transaction
4136
+ * @param transaction - Transaction to modify
4137
+ * @param swapParams - Swap parameters
4138
+ * @param sdkOptions - SDK configuration options
4139
+ * @param coinAInput - Coin A input result
4140
+ * @param coinBInput - Coin B input result
4141
+ * @returns Transaction with swap arguments
4142
+ */
4143
+ static buildSwapTransactionArgs(transaction: Transaction, swapParams: SwapParams, sdkOptions: SdkOptions, coinAInput: BuildCoinResult, coinBInput: BuildCoinResult): Transaction;
4144
+ /**
4145
+ * Builds swap transaction without automatic coin transfers, with gas optimization
4146
+ * @param sdk - SDK instance
4147
+ * @param swapParams - Parameters for swap
4148
+ * @param allCoinAssets - All available coin assets
4149
+ * @param gasEstimationConfig - Gas estimation configuration
4150
+ * @returns Object containing transaction and coin arguments for manual handling
4151
+ */
4152
+ static buildSwapTransactionWithoutTransferCoinsForGas(sdk: FerraDammSDK, swapParams: SwapParams, allCoinAssets: CoinAsset[], gasEstimationConfig: {
4153
+ byAmountIn: boolean;
4154
+ slippage: Percentage;
4155
+ decimalsA: number;
4156
+ decimalsB: number;
4157
+ swapTicks: Array<TickData>;
4158
+ currentPool: Pool;
4159
+ }): Promise<{
4160
+ tx: Transaction;
4161
+ coinABs: TransactionObjectArgument[];
4162
+ }>;
4163
+ /**
4164
+ * Builds swap transaction without automatic coin transfers
4165
+ * @param sdk - SDK instance
4166
+ * @param swapParams - Parameters for swap
4167
+ * @param allCoinAssets - All available coin assets
4168
+ * @returns Object containing transaction and coin arguments for manual handling
4169
+ */
4170
+ static buildSwapTransactionWithoutTransferCoins(sdk: FerraDammSDK, swapParams: SwapParams, allCoinAssets: CoinAsset[]): {
4171
+ tx: Transaction;
4172
+ coinABs: TransactionObjectArgument[];
4173
+ };
4174
+ /**
4175
+ * Builds swap transaction arguments without automatic transfers
4176
+ * @param sdk - SDK instance
4177
+ * @param transaction - Transaction to modify
4178
+ * @param swapParams - Swap parameters
4179
+ * @param sdkOptions - SDK configuration options
4180
+ * @param coinAInput - Coin A input result
4181
+ * @param coinBInput - Coin B input result
4182
+ * @returns Object containing transaction and resulting coin arguments
4183
+ */
4184
+ static buildSwapTransactionWithoutTransferCoinArgs(sdk: FerraDammSDK, transaction: Transaction, swapParams: SwapParams, sdkOptions: SdkOptions, coinAInput: BuildCoinResult, coinBInput: BuildCoinResult): {
4185
+ tx: Transaction;
4186
+ txRes: TransactionObjectArgument[];
4187
+ };
4188
+ /**
4189
+ * Fixes swap parameters by recalculating limits based on current pool state
4190
+ * @param sdk - SDK instance
4191
+ * @param swapParams - Original swap parameters
4192
+ * @param gasEstimationConfig - Gas estimation configuration
4193
+ * @returns Updated swap parameters with correct limits
4194
+ */
4195
+ static fixSwapParams(sdk: FerraDammSDK, swapParams: SwapParams, gasEstimationConfig: {
4196
+ byAmountIn: boolean;
4197
+ slippage: Percentage;
4198
+ decimalsA: number;
4199
+ decimalsB: number;
4200
+ swapTicks: Array<TickData>;
4201
+ currentPool: Pool;
4202
+ }): Promise<SwapParams>;
4203
+ /**
4204
+ * Asynchronously builds coin input for a specific amount
4205
+ * @param sdk - SDK instance
4206
+ * @param transaction - Transaction to modify
4207
+ * @param amount - Amount to build coin for
4208
+ * @param coinType - Type of coin
4209
+ * @param buildVector - Whether to build as vector
4210
+ * @param fixAmount - Whether to fix amount exactly
4211
+ * @returns Transaction object argument or undefined
4212
+ */
4213
+ static syncBuildCoinInputForAmount(sdk: FerraDammSDK, transaction: Transaction, amount: bigint, coinType: string, buildVector?: boolean, fixAmount?: boolean): Promise<TransactionObjectArgument | undefined>;
4214
+ /**
4215
+ * Builds coin input for a specific amount from available assets
4216
+ * @param transaction - Transaction to modify
4217
+ * @param availableCoins - Available coin assets
4218
+ * @param amount - Amount to build coin for
4219
+ * @param coinType - Type of coin
4220
+ * @param buildVector - Whether to build as vector
4221
+ * @param fixAmount - Whether to fix amount exactly
4222
+ * @returns Built coin result
4223
+ */
4224
+ static buildCoinForAmount(transaction: Transaction, availableCoins: CoinAsset[], amount: bigint, coinType: string, buildVector?: boolean, fixAmount?: boolean): BuildCoinResult;
4225
+ /**
4226
+ * Builds coin with specific balance using coinWithBalance utility
4227
+ * @param amount - Amount for the coin
4228
+ * @param coinType - Type of coin
4229
+ * @returns Transaction object argument for the coin
4230
+ */
4231
+ static buildCoinWithBalance(amount: bigint, coinType: string): TransactionObjectArgument;
4232
+ /**
4233
+ * Builds vector of coins for transaction use
4234
+ * @param transaction - Transaction to modify
4235
+ * @param availableCoins - All available coin assets
4236
+ * @param targetCoinAssets - Target coin assets to use
4237
+ * @param amount - Amount needed
4238
+ * @param coinType - Type of coin
4239
+ * @param fixAmount - Whether to fix amount exactly
4240
+ * @returns Built coin result as vector
4241
+ */
4242
+ private static buildVectorCoin;
4243
+ /**
4244
+ * Builds single coin for transaction use
4245
+ * @param transaction - Transaction to modify
4246
+ * @param targetCoinAssets - Target coin assets to use
4247
+ * @param amount - Amount needed
4248
+ * @param coinType - Type of coin
4249
+ * @param fixAmount - Whether to fix amount exactly
4250
+ * @returns Built coin result as single coin
4251
+ */
4252
+ private static buildOneCoin;
4253
+ /**
4254
+ * Builds split target coin by merging and splitting as needed
4255
+ * @param transaction - Transaction to modify
4256
+ * @param amount - Amount needed
4257
+ * @param targetCoinAssets - Coin assets to use
4258
+ * @param fixAmount - Whether to fix amount exactly
4259
+ * @returns Split coin result with metadata
4260
+ */
4261
+ private static buildSplitTargetCoin;
4262
+ /**
4263
+ * Generic coin building method that delegates to vector or single coin building
4264
+ * @param transaction - Transaction to modify
4265
+ * @param availableCoins - All available coin assets
4266
+ * @param targetCoinAssets - Target coin assets to use
4267
+ * @param amount - Amount needed
4268
+ * @param coinType - Type of coin
4269
+ * @param buildVector - Whether to build as vector
4270
+ * @param fixAmount - Whether to fix amount exactly
4271
+ * @returns Built coin result
4272
+ */
4273
+ private static buildCoin;
4274
+ /**
4275
+ * Builds zero-value coin for cases where no amount is needed
4276
+ * @param availableCoins - All available coin assets
4277
+ * @param transaction - Transaction to modify
4278
+ * @param coinType - Type of coin to mint
4279
+ * @param buildVector - Whether to build as vector
4280
+ * @returns Built zero coin result
4281
+ */
4282
+ private static buildZeroValueCoin;
4283
+ /**
4284
+ * Builds coin for amount with interval support (for slippage handling)
4285
+ * @param transaction - Transaction to modify
4286
+ * @param availableCoins - All available coin assets
4287
+ * @param amounts - Amount interval with first and second options
4288
+ * @param coinType - Type of coin
4289
+ * @param buildVector - Whether to build as vector
4290
+ * @param fixAmount - Whether to fix amount exactly
4291
+ * @returns Built coin result using interval logic
4292
+ */
4293
+ static buildCoinForAmountInterval(transaction: Transaction, availableCoins: CoinAsset[], amounts: CoinInputInterval, coinType: string, buildVector?: boolean, fixAmount?: boolean): BuildCoinResult;
4294
+ /**
4295
+ * Calls the Move function to mint a zero-value coin
4296
+ * @param transaction - Transaction to modify
4297
+ * @param coinType - Type of coin to mint
4298
+ * @returns Transaction object argument for zero coin
4299
+ */
4300
+ static callMintZeroValueCoin: (transaction: Transaction, coinType: string) => TransactionResult;
4301
+ /**
4302
+ * Builds router swap transaction for multi-path swapping
4303
+ * @param sdk - SDK instance
4304
+ * @param routerParams - Router swap parameters
4305
+ * @param isAmountIn - Whether amount is input (true) or output (false)
4306
+ * @param allCoinAssets - All available coin assets
4307
+ * @param recipient - Optional recipient address for transfers
4308
+ * @returns Router swap transaction
4309
+ */
4310
+ static buildRouterSwapTransaction(sdk: FerraDammSDK, routerParams: SwapWithRouterParams, isAmountIn: boolean, allCoinAssets: CoinAsset[], recipient?: string): Promise<Transaction>;
4311
+ /**
4312
+ * Builds the base path transaction for router swaps
4313
+ * @param sdk - SDK instance
4314
+ * @param routerParams - Router swap parameters
4315
+ * @param isAmountIn - Whether amount is input
4316
+ * @param allCoinAssets - All available coin assets
4317
+ * @param transaction - Transaction to modify
4318
+ * @param recipient - Optional recipient address
4319
+ * @returns Modified transaction with router swap logic
4320
+ */
4321
+ static buildRouterBasePathTx(sdk: FerraDammSDK, routerParams: SwapWithRouterParams, isAmountIn: boolean, allCoinAssets: CoinAsset[], transaction: Transaction, recipient?: string): Promise<Transaction>;
4322
+ /**
4323
+ * Builds router swap operations and returns resulting coins
4324
+ * @param sdk - SDK instance
4325
+ * @param routerParams - Router swap parameters
4326
+ * @param isAmountIn - Whether amount is input
4327
+ * @param sourceCoinResult - Source coin build result
4328
+ * @param targetCoinResult - Target coin build result
4329
+ * @param transaction - Transaction to modify
4330
+ * @returns Object with resulting coins and modified transaction
4331
+ */
4332
+ static buildRouterBasePathReturnCoins(sdk: FerraDammSDK, routerParams: SwapWithRouterParams, isAmountIn: boolean, sourceCoinResult: BuildCoinResult, targetCoinResult: BuildCoinResult, transaction: Transaction): Promise<{
4333
+ fromCoin: TransactionObjectArgument;
4334
+ toCoin: any;
4335
+ tx: Transaction;
4336
+ }>;
4337
+ /**
4338
+ * Validates that output coin meets minimum threshold requirements
4339
+ * @param sdk - SDK instance
4340
+ * @param isAmountIn - Whether amount is input
4341
+ * @param transaction - Transaction to modify
4342
+ * @param outputCoin - Coin to check
4343
+ * @param minimumAmount - Minimum required amount
4344
+ * @param coinType - Type of coin being checked
4345
+ */
4346
+ static checkCoinThreshold(sdk: FerraDammSDK, isAmountIn: boolean, transaction: Transaction, outputCoin: TransactionObjectArgument, minimumAmount: number, coinType: string): void;
4347
+ /**
4348
+ * Validates that output coin meets minimum threshold requirements
4349
+ * @param sdk - SDK instance
4350
+ * @param isAmountIn - Whether amount is input
4351
+ * @param transaction - Transaction to modify
4352
+ * @param outputCoin - Coin to check
4353
+ * @param minimumAmount - Minimum required amount
4354
+ * @param coinType - Type of coin being checked
4355
+ */
4356
+ static checkCoinThresholdInternal(coin: TransactionObjectArgument, minimumAmount: bigint, coinType: string, sdkOptions: SdkOptions, transaction: Transaction): void;
4357
+ /**
4358
+ * Builds DAMM base path transaction for individual swap steps
4359
+ * @param sdk - SDK instance
4360
+ * @param basePath - Base path configuration
4361
+ * @param transaction - Transaction to modify
4362
+ * @param isAmountIn - Whether amount is input
4363
+ * @param sourceCoin - Source coin argument
4364
+ * @param targetCoin - Target coin argument
4365
+ * @param isMiddleStep - Whether this is a middle step in multi-hop
4366
+ * @param partnerAddress - Partner address for fees
4367
+ * @returns Object with resulting coins and transaction
4368
+ */
4369
+ private static buildDammBasePathTx;
4370
+ /**
4371
+ * Builds coin type pairs for multi-hop routing
4372
+ * @param coinTypes - Array of coin types in the path
4373
+ * @param partitionQuantities - Quantities for each partition
4374
+ * @returns Array of coin type pairs for routing
4375
+ */
4376
+ static buildCoinTypePair(coinTypes: string[], partitionQuantities: number[]): string[][];
4377
+ /**
4378
+ * Transfers coin to sender using Move call
4379
+ * @param sdk - SDK instance
4380
+ * @param transaction - Transaction to modify
4381
+ * @param coinToTransfer - Coin to transfer
4382
+ * @param coinType - Type of coin
4383
+ */
4384
+ static buildTransferCoinToSender(sdk: FerraDammSDK, transaction: Transaction, coinToTransfer: TransactionObjectArgument, coinType: string): void;
4385
+ /**
4386
+ * Transfers coin to specified recipient or sender if no recipient provided
4387
+ * @param sdk - SDK instance
4388
+ * @param transaction - Transaction to modify
4389
+ * @param coinToTransfer - Coin to transfer
4390
+ * @param coinType - Type of coin
4391
+ * @param recipient - Optional recipient address
4392
+ */
4393
+ static buildTransferCoin(sdk: FerraDammSDK, transaction: Transaction, coinToTransfer: TransactionObjectArgument, coinType: string, recipient?: string): void;
4394
+ static buildLockPosition(args: {
4395
+ positionId: string;
4396
+ untilTimestamp: number;
4397
+ poolId: string;
4398
+ typeA: string;
4399
+ typeB: string;
4400
+ }, sdkOptions: SdkOptions, tx?: Transaction): readonly [Transaction];
4401
+ }
4402
+
4403
+ /**
4404
+ * Check if the address is a valid sui address.
4405
+ * @param {string}address
4406
+ * @returns
4407
+ */
4408
+ declare function checkValidSuiAddress(address: string): boolean;
4409
+ declare class TxBlock {
4410
+ txBlock: Transaction;
4411
+ constructor();
4412
+ /**
4413
+ * Transfer sui to many recipoents.
4414
+ * @param {string[]}recipients The recipient addresses.
4415
+ * @param {number[]}amounts The amounts of sui coins to be transferred.
4416
+ * @returns this
4417
+ */
4418
+ transferSuiToMany(recipients: string[], amounts: number[]): this;
4419
+ /**
4420
+ * Transfer sui to one recipient.
4421
+ * @param {string}recipient recipient cannot be empty or invalid sui address.
4422
+ * @param {number}amount
4423
+ * @returns this
4424
+ */
4425
+ transferSui(recipient: string, amount: number): this;
4426
+ /**
4427
+ * Transfer coin to many recipients.
4428
+ * @param {string}recipient recipient cannot be empty or invalid sui address.
4429
+ * @param {number}amount amount cannot be empty or invalid sui address.
4430
+ * @param {string[]}coinObjectIds object ids of coins to be transferred.
4431
+ * @returns this
4432
+ * @deprecated use transferAndDestoryZeroCoin instead
4433
+ */
4434
+ transferCoin(recipient: string, amount: number, coinObjectIds: string[]): this;
4435
+ }
4436
+
4437
+ declare function getSuiObjectData(resp: SuiObjectResponse): SuiObjectData | null | undefined;
4438
+ declare function getObjectDeletedResponse(resp: SuiObjectResponse): SuiObjectRef | undefined;
4439
+ declare function getObjectNotExistsResponse(resp: SuiObjectResponse): string | undefined;
4440
+ declare function getObjectReference(resp: SuiObjectResponse | OwnedObjectRef): SuiObjectRef | undefined;
4441
+ declare function getObjectId(data: SuiObjectResponse | SuiObjectRef | OwnedObjectRef): string;
4442
+ declare function getObjectVersion(data: SuiObjectResponse | SuiObjectRef | SuiObjectData): string | number | undefined;
4443
+ declare function isSuiObjectResponse(resp: SuiObjectResponse | SuiObjectData): resp is SuiObjectResponse;
4444
+ declare function getMovePackageContent(data: SuiObjectResponse): any | undefined;
4445
+ declare function getMoveObject(data: SuiObjectResponse | SuiObjectData): SuiMoveObject | undefined;
4446
+ declare function getMoveObjectType(resp: SuiObjectResponse): string | undefined;
4447
+ /**
4448
+ * Deriving the object type from the object response
4449
+ * @returns 'package' if the object is a package, move object type(e.g., 0x2::coin::Coin<0x2::sui::SUI>)
4450
+ * if the object is a move object
4451
+ */
4452
+ declare function getObjectType(resp: SuiObjectResponse | SuiObjectData): string | null | undefined;
4453
+ declare function getObjectPreviousTransactionDigest(resp: SuiObjectResponse): string | null | undefined;
4454
+ declare function getObjectOwner(resp: SuiObjectResponse): ObjectOwner | null | undefined;
4455
+ declare function getObjectDisplay(resp: SuiObjectResponse): DisplayFieldsResponse;
4456
+ /**
4457
+ * Get the fields of a sui object response or data. The dataType of the object must be moveObject.
4458
+ * @param {SuiObjectResponse | SuiObjectData}object The object to get the fields from.
4459
+ * @returns {any} The fields of the object.
4460
+ */
4461
+ declare function getObjectFields(object: SuiObjectResponse | SuiObjectData): any;
4462
+ interface SuiObjectDataWithContent extends SuiObjectData {
4463
+ content: SuiParsedData;
4464
+ }
4465
+ /**
4466
+ * Return hasPublicTransfer of a move object.
4467
+ * @param {SuiObjectResponse | SuiObjectData}data
4468
+ * @returns
4469
+ */
4470
+ declare function hasPublicTransfer(data: SuiObjectResponse | SuiObjectData): boolean;
4471
+
4472
+ declare const dammMainnet: SdkOptions;
4473
+ /**
4474
+ * Initialize the mainnet SDK
4475
+ * @param fullNodeUrl. If provided, it will be used as the full node URL.
4476
+ * @param simulationAccount. If provided, it will be used as the simulation account address.
4477
+ * when you use the `preswap` method or other methods that require payment assistance,
4478
+ * you must configure a simulation account with sufficient balance of input tokens.
4479
+ * If you connect the wallet, you can set the current wallet address to simulationAccount.
4480
+ * @returns
4481
+ */
4482
+ declare function initMainnetSDK(fullNodeUrl?: string, wallet?: string): FerraDammSDK;
4483
+
4484
+ declare const dammTestnet: SdkOptions;
4485
+ /**
4486
+ * Initialize the testnet SDK
4487
+ * @param fullNodeUrl. If provided, it will be used as the full node URL.
4488
+ * @param simulationAccount. If provided, it will be used as the simulation account address.
4489
+ * @returns
4490
+ */
4491
+ declare function initTestnetSDK(fullNodeUrl?: string, wallet?: string): FerraDammSDK;
4492
+
4493
+ declare const dammBeta: SdkOptions;
4494
+ /**
4495
+ * Initialize the beta SDK
4496
+ * @param fullNodeUrl. If provided, it will be used as the full node URL.
4497
+ * @param simulationAccount. If provided, it will be used as the simulation account address.
4498
+ * @returns
4499
+ */
4500
+ declare function initBetaSDK(fullNodeUrl?: string, wallet?: string): FerraDammSDK;
4501
+
4502
+ interface InitFerraSDKOptions {
4503
+ network: 'mainnet' | 'testnet' | 'beta';
4504
+ fullNodeUrl?: string;
4505
+ wallet?: string;
4506
+ }
4507
+ /**
4508
+ * Helper function to initialize the Ferra SDK
4509
+ * @param env - The environment to initialize the SDK in. One of 'mainnet' or 'testnet'.
4510
+ * @param fullNodeUrl - The full node URL to use.
4511
+ * @param wallet - The wallet address to use. If not provided,
4512
+ * If you use the `preswap` method or other methods that require payment assistance,
4513
+ * you must configure a wallet with sufficient balance of input tokens.
4514
+ * If you do not set a wallet, the SDK will throw an error.
4515
+ * @returns The initialized Ferra SDK.
4516
+ */
4517
+ declare function initFerraSDK(options: InitFerraSDKOptions): FerraDammSDK;
4518
+ declare function initFerraDammSDK(options: InitFerraSDKOptions): FerraDammSDK;
4519
+
4520
+ export { type AddLiquidityCommonParams, type AddLiquidityFixTokenParams, type AddLiquidityParams, type AddressAndDirection, type AdjustResult, AmountSpecified, type BasePath, type BestInternalRouterResult, type BigNumber, type Bits, type BuildCoinResult, CLOCK_ADDRESS, CachedContent, type CalculateRatesParams, type CalculateRatesResult, type ClosePositionParams, type CoinAmounts, type CoinAsset, CoinAssist, CoinInfoAddress, type CoinNode, type CoinPairType, type CoinProvider, CoinStoreAddress, type CollectFeeParams, type CollectFeesQuote, type CollectFeesQuoteParam, type CollectRewarderParams, type CreatePartnerEvent, type CreatePoolAddLiquidityParams, type CreatePoolAndAddLiquidityRowResult, type CreatePoolParams, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, type DammConfig, DammExpectSwapModule, DammFetcherModule, DammIntegratePoolModule, DammIntegrateRouterModule, DammIntegrateRouterWithPartnerModule, DammIntegrateUtilsModule, DammPartnerModule, DammPoolUtil, DammPositionStatus, type DammpoolData, type DataPage, FEE_RATE_DENOMINATOR, type FaucetCoin, type FeeTier, FerraDammSDK, type FetchParams, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, type LiquidityInput, MAX_SQRT_PRICE, MAX_TICK_INDEX, MIN_SQRT_PRICE, MIN_TICK_INDEX, MathUtil, type NFT, ONE, type OnePath, type OpenPositionParams, type Package, type PageQuery, type PaginationArgs, type PathLink, type PathProvider, Percentage, type Pool, type PoolImmutables, type PoolInfo, PoolModule, type PoolTransactionInfo, type Position, PositionModule, type PositionReward, PositionStatus, type PositionTransactionInfo, PositionUtil, type PreRouterSwapParams, type PreSwapLpChangeParams, type PreSwapParams, type PreSwapResult, type PreSwapWithMultiPoolParams, type RemoveLiquidityAndClaimRewardsParams, type RemoveLiquidityParams, type Rewarder, type RewarderAmountOwed, RouterModule, RpcModule, SUI_SYSTEM_STATE_OBJECT_ID, type SdkOptions, type SplitPath, SplitSwap, type SplitSwapResult, SplitUnit, type SuiAddressType, type SuiBasicTypes, type SuiInputTypes, type SuiObjectDataWithContent, type SuiObjectIdType, type SuiResource, type SuiStructTag, type SuiTxArg, SwapDirection, SwapModule, type SwapParams, type SwapResult, type SwapStepResult, SwapUtils, type SwapWithRouterParams, TICK_ARRAY_SIZE, TWO, type Tick, type TickData, TickMath, TickUtil, type TokenConfig, type TokenConfigEvent, type TokenInfo, type TransPreSwapWithMultiPoolParams, TransactionUtil, TxBlock, U128, U128_MAX, U64_MAX, ZERO, addHexPrefix, adjustForCoinSlippage, adjustForSlippage, asIntN, asUintN, bufferToHex, buildDammPositionName, buildNFT, buildPool, buildPoolTransactionInfo, buildPosition, buildPositionReward, buildPositionTransactionInfo, buildTickData, buildTickDataByEvent, cacheTime24h, cacheTime5min, checkAddress, checkValidSuiAddress, collectFeesQuote, composeType, computeSwap, computeSwapStep, createSplitAmountArray, createSplitArray, type createTestTransferTxPayloadParams, d, dammBeta, dammMainnet, dammTestnet, decimalsMultiplier, FerraDammSDK as default, estPoolAPR, type estPosAPRResult, estPositionAPRWithDeltaMethod, estPositionAPRWithMultiMethod, estimateLiquidityForCoinA, estimateLiquidityForCoinB, extractAddressFromType, extractStructTagFromType, findAdjustCoin, fixCoinType, fixSuiObjectId, fromDecimalsAmount, getAmountFixedDelta, getAmountUnfixedDelta, getCoinAFromLiquidity, getCoinBFromLiquidity, getDefaultSuiInputType, getDeltaA, getDeltaB, getDeltaDownFromOutput, getDeltaUpFromInput, getFutureTime, getLiquidityFromCoinA, getLiquidityFromCoinB, getLowerSqrtPriceFromCoinA, getLowerSqrtPriceFromCoinB, getMoveObject, getMoveObjectType, getMovePackageContent, getNearestTickByTick, getNextSqrtPriceAUp, getNextSqrtPriceBDown, getNextSqrtPriceFromInput, getNextSqrtPriceFromOutput, getObjectDeletedResponse, getObjectDisplay, getObjectFields, getObjectId, getObjectNotExistsResponse, getObjectOwner, getObjectPreviousTransactionDigest, getObjectReference, getObjectType, getObjectVersion, getPackagerConfigs, getRewardInTickRange, getSuiObjectData, getTickDataFromUrlData, getUpperSqrtPriceFromCoinA, getUpperSqrtPriceFromCoinB, hasPublicTransfer, hexToNumber, hexToString, initBetaSDK, initFerraDammSDK, initFerraSDK, initMainnetSDK, initTestnetSDK, isSortedSymbols, isSuiObjectResponse, newBits, normalizeCoinType, patchFixSuiObjectId, poolFilterEvenTypes, printTransaction, removeHexPrefix, secretKeyToEd25519Keypair, secretKeyToSecp256k1Keypair, shortAddress, shortString, tickScore, toBuffer, toCoinAmount, toDecimalsAmount, transDammpoolDataWithoutTicks, utf8to16 };