@orca-so/whirlpools-core 1.0.3 → 1.0.4

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.
@@ -1,113 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function _NUM_REWARDS(): number;
4
- export function _POSITION_BUNDLE_SIZE(): number;
5
- export function _TICK_ARRAY_SIZE(): number;
6
- export function _FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD(): number;
7
- export function _MIN_TICK_INDEX(): number;
8
- export function _MAX_TICK_INDEX(): number;
9
- /**
10
- * Get the first unoccupied position in a bundle
11
- *
12
- * # Arguments
13
- * * `bundle` - The bundle to check
14
- *
15
- * # Returns
16
- * * `u32` - The first unoccupied position (None if full)
17
- */
18
- export function firstUnoccupiedPositionInBundle(bitmap: Uint8Array): number | undefined;
19
- /**
20
- * Check whether a position bundle is full
21
- * A position bundle can contain 256 positions
22
- *
23
- * # Arguments
24
- * * `bundle` - The bundle to check
25
- *
26
- * # Returns
27
- * * `bool` - Whether the bundle is full
28
- */
29
- export function isPositionBundleFull(bitmap: Uint8Array): boolean;
30
- /**
31
- * Check whether a position bundle is empty
32
- *
33
- * # Arguments
34
- * * `bundle` - The bundle to check
35
- *
36
- * # Returns
37
- * * `bool` - Whether the bundle is empty
38
- */
39
- export function isPositionBundleEmpty(bitmap: Uint8Array): boolean;
40
- /**
41
- * Convert a price into a sqrt priceX64
42
- * IMPORTANT: floating point operations can reduce the precision of the result.
43
- * Make sure to do these operations last and not to use the result for further calculations.
44
- *
45
- * # Parameters
46
- * * `price` - The price to convert
47
- * * `decimals_a` - The number of decimals of the base token
48
- * * `decimals_b` - The number of decimals of the quote token
49
- *
50
- * # Returns
51
- * * `u128` - The sqrt priceX64
52
- */
53
- export function priceToSqrtPrice(price: number, decimals_a: number, decimals_b: number): bigint;
54
- /**
55
- * Convert a sqrt priceX64 into a tick index
56
- * IMPORTANT: floating point operations can reduce the precision of the result.
57
- * Make sure to do these operations last and not to use the result for further calculations.
58
- *
59
- * # Parameters
60
- * * `sqrt_price` - The sqrt priceX64 to convert
61
- * * `decimals_a` - The number of decimals of the base token
62
- * * `decimals_b` - The number of decimals of the quote token
63
- *
64
- * # Returns
65
- * * `f64` - The decimal price
66
- */
67
- export function sqrtPriceToPrice(sqrt_price: bigint, decimals_a: number, decimals_b: number): number;
68
- /**
69
- * Invert a price
70
- * IMPORTANT: floating point operations can reduce the precision of the result.
71
- * Make sure to do these operations last and not to use the result for further calculations.
72
- *
73
- * # Parameters
74
- * * `price` - The price to invert
75
- * * `decimals_a` - The number of decimals of the base token
76
- * * `decimals_b` - The number of decimals of the quote token
77
- *
78
- * # Returns
79
- * * `f64` - The inverted price
80
- */
81
- export function invertPrice(price: number, decimals_a: number, decimals_b: number): number;
82
- /**
83
- * Convert a tick index into a price
84
- * IMPORTANT: floating point operations can reduce the precision of the result.
85
- * Make sure to do these operations last and not to use the result for further calculations.
86
- *
87
- * # Parameters
88
- * * `tick_index` - The tick index to convert
89
- * * `decimals_a` - The number of decimals of the base token
90
- * * `decimals_b` - The number of decimals of the quote token
91
- *
92
- * # Returns
93
- * * `f64` - The decimal price
94
- */
95
- export function tickIndexToPrice(tick_index: number, decimals_a: number, decimals_b: number): number;
96
- /**
97
- * Convert a price into a tick index
98
- * IMPORTANT: floating point operations can reduce the precision of the result.
99
- * Make sure to do these operations last and not to use the result for further calculations.
100
- *
101
- * # Parameters
102
- * * `price` - The price to convert
103
- * * `decimals_a` - The number of decimals of the base token
104
- * * `decimals_b` - The number of decimals of the quote token
105
- *
106
- * # Returns
107
- * * `i32` - The tick index
108
- */
109
- export function priceToTickIndex(price: number, decimals_a: number, decimals_b: number): number;
110
- export function _FEE_RATE_DENOMINATOR(): number;
111
3
  /**
112
4
  * Get the first tick index in the tick array that contains the specified tick index.
113
5
  *
@@ -267,6 +159,114 @@ export function isFullRangeOnly(tick_spacing: number): boolean;
267
159
  * - A u32 integer representing the tick index in the tick array
268
160
  */
269
161
  export function getTickIndexInArray(tick_index: number, tick_array_start_index: number, tick_spacing: number): number;
162
+ export function _FEE_RATE_DENOMINATOR(): number;
163
+ export function _TICK_ARRAY_SIZE(): number;
164
+ export function _FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD(): number;
165
+ export function _MIN_TICK_INDEX(): number;
166
+ export function _MAX_TICK_INDEX(): number;
167
+ /**
168
+ * Get the first unoccupied position in a bundle
169
+ *
170
+ * # Arguments
171
+ * * `bundle` - The bundle to check
172
+ *
173
+ * # Returns
174
+ * * `u32` - The first unoccupied position (None if full)
175
+ */
176
+ export function firstUnoccupiedPositionInBundle(bitmap: Uint8Array): number | undefined;
177
+ /**
178
+ * Check whether a position bundle is full
179
+ * A position bundle can contain 256 positions
180
+ *
181
+ * # Arguments
182
+ * * `bundle` - The bundle to check
183
+ *
184
+ * # Returns
185
+ * * `bool` - Whether the bundle is full
186
+ */
187
+ export function isPositionBundleFull(bitmap: Uint8Array): boolean;
188
+ /**
189
+ * Check whether a position bundle is empty
190
+ *
191
+ * # Arguments
192
+ * * `bundle` - The bundle to check
193
+ *
194
+ * # Returns
195
+ * * `bool` - Whether the bundle is empty
196
+ */
197
+ export function isPositionBundleEmpty(bitmap: Uint8Array): boolean;
198
+ /**
199
+ * Convert a price into a sqrt priceX64
200
+ * IMPORTANT: floating point operations can reduce the precision of the result.
201
+ * Make sure to do these operations last and not to use the result for further calculations.
202
+ *
203
+ * # Parameters
204
+ * * `price` - The price to convert
205
+ * * `decimals_a` - The number of decimals of the base token
206
+ * * `decimals_b` - The number of decimals of the quote token
207
+ *
208
+ * # Returns
209
+ * * `u128` - The sqrt priceX64
210
+ */
211
+ export function priceToSqrtPrice(price: number, decimals_a: number, decimals_b: number): bigint;
212
+ /**
213
+ * Convert a sqrt priceX64 into a tick index
214
+ * IMPORTANT: floating point operations can reduce the precision of the result.
215
+ * Make sure to do these operations last and not to use the result for further calculations.
216
+ *
217
+ * # Parameters
218
+ * * `sqrt_price` - The sqrt priceX64 to convert
219
+ * * `decimals_a` - The number of decimals of the base token
220
+ * * `decimals_b` - The number of decimals of the quote token
221
+ *
222
+ * # Returns
223
+ * * `f64` - The decimal price
224
+ */
225
+ export function sqrtPriceToPrice(sqrt_price: bigint, decimals_a: number, decimals_b: number): number;
226
+ /**
227
+ * Invert a price
228
+ * IMPORTANT: floating point operations can reduce the precision of the result.
229
+ * Make sure to do these operations last and not to use the result for further calculations.
230
+ *
231
+ * # Parameters
232
+ * * `price` - The price to invert
233
+ * * `decimals_a` - The number of decimals of the base token
234
+ * * `decimals_b` - The number of decimals of the quote token
235
+ *
236
+ * # Returns
237
+ * * `f64` - The inverted price
238
+ */
239
+ export function invertPrice(price: number, decimals_a: number, decimals_b: number): number;
240
+ /**
241
+ * Convert a tick index into a price
242
+ * IMPORTANT: floating point operations can reduce the precision of the result.
243
+ * Make sure to do these operations last and not to use the result for further calculations.
244
+ *
245
+ * # Parameters
246
+ * * `tick_index` - The tick index to convert
247
+ * * `decimals_a` - The number of decimals of the base token
248
+ * * `decimals_b` - The number of decimals of the quote token
249
+ *
250
+ * # Returns
251
+ * * `f64` - The decimal price
252
+ */
253
+ export function tickIndexToPrice(tick_index: number, decimals_a: number, decimals_b: number): number;
254
+ /**
255
+ * Convert a price into a tick index
256
+ * IMPORTANT: floating point operations can reduce the precision of the result.
257
+ * Make sure to do these operations last and not to use the result for further calculations.
258
+ *
259
+ * # Parameters
260
+ * * `price` - The price to convert
261
+ * * `decimals_a` - The number of decimals of the base token
262
+ * * `decimals_b` - The number of decimals of the quote token
263
+ *
264
+ * # Returns
265
+ * * `i32` - The tick index
266
+ */
267
+ export function priceToTickIndex(price: number, decimals_a: number, decimals_b: number): number;
268
+ export function _NUM_REWARDS(): number;
269
+ export function _POSITION_BUNDLE_SIZE(): number;
270
270
  export function _TICK_ARRAY_NOT_EVENLY_SPACED(): string;
271
271
  export function _TICK_INDEX_OUT_OF_BOUNDS(): string;
272
272
  export function _INVALID_TICK_INDEX(): string;
@@ -610,6 +610,40 @@ export function increaseLiquidityQuoteB(token_amount_b: bigint, slippage_toleran
610
610
  * - `CollectRewardsQuote`: The rewards owed for the 3 reward tokens.
611
611
  */
612
612
  export function collectRewardsQuote(whirlpool: WhirlpoolFacade, position: PositionFacade, tick_lower: TickFacade, tick_upper: TickFacade, current_timestamp: bigint, transfer_fee_1?: TransferFee | null, transfer_fee_2?: TransferFee | null, transfer_fee_3?: TransferFee | null): CollectRewardsQuote;
613
+ export interface TransferFee {
614
+ feeBps: number;
615
+ maxFee: bigint;
616
+ }
617
+
618
+ export interface IncreaseLiquidityQuote {
619
+ liquidityDelta: bigint;
620
+ tokenEstA: bigint;
621
+ tokenEstB: bigint;
622
+ tokenMaxA: bigint;
623
+ tokenMaxB: bigint;
624
+ }
625
+
626
+ export interface DecreaseLiquidityQuote {
627
+ liquidityDelta: bigint;
628
+ tokenEstA: bigint;
629
+ tokenEstB: bigint;
630
+ tokenMinA: bigint;
631
+ tokenMinB: bigint;
632
+ }
633
+
634
+ export interface CollectFeesQuote {
635
+ feeOwedA: bigint;
636
+ feeOwedB: bigint;
637
+ }
638
+
639
+ export interface CollectRewardQuote {
640
+ rewardsOwed: bigint;
641
+ }
642
+
643
+ export interface CollectRewardsQuote {
644
+ rewards: CollectRewardQuote[];
645
+ }
646
+
613
647
  export interface TickArrayFacade {
614
648
  startTickIndex: number;
615
649
  ticks: TickFacade[];
@@ -661,40 +695,6 @@ export interface WhirlpoolFacade {
661
695
  rewardInfos: WhirlpoolRewardInfoFacade[];
662
696
  }
663
697
 
664
- export interface TransferFee {
665
- feeBps: number;
666
- maxFee: bigint;
667
- }
668
-
669
- export interface IncreaseLiquidityQuote {
670
- liquidityDelta: bigint;
671
- tokenEstA: bigint;
672
- tokenEstB: bigint;
673
- tokenMaxA: bigint;
674
- tokenMaxB: bigint;
675
- }
676
-
677
- export interface DecreaseLiquidityQuote {
678
- liquidityDelta: bigint;
679
- tokenEstA: bigint;
680
- tokenEstB: bigint;
681
- tokenMinA: bigint;
682
- tokenMinB: bigint;
683
- }
684
-
685
- export interface CollectFeesQuote {
686
- feeOwedA: bigint;
687
- feeOwedB: bigint;
688
- }
689
-
690
- export interface CollectRewardQuote {
691
- rewardsOwed: bigint;
692
- }
693
-
694
- export interface CollectRewardsQuote {
695
- rewards: CollectRewardQuote[];
696
- }
697
-
698
698
  export interface PositionRewardInfoFacade {
699
699
  growthInsideCheckpoint: bigint;
700
700
  amountOwed: bigint;
@@ -196,187 +196,6 @@ function getStringFromWasm0(ptr, len) {
196
196
  ptr = ptr >>> 0;
197
197
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
198
198
  }
199
-
200
- export function _NUM_REWARDS() {
201
- const ret = wasm._NUM_REWARDS();
202
- return ret >>> 0;
203
- }
204
-
205
- export function _POSITION_BUNDLE_SIZE() {
206
- const ret = wasm._POSITION_BUNDLE_SIZE();
207
- return ret >>> 0;
208
- }
209
-
210
- export function _TICK_ARRAY_SIZE() {
211
- const ret = wasm._TICK_ARRAY_SIZE();
212
- return ret >>> 0;
213
- }
214
-
215
- export function _FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD() {
216
- const ret = wasm._FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD();
217
- return ret;
218
- }
219
-
220
- export function _MIN_TICK_INDEX() {
221
- const ret = wasm._MIN_TICK_INDEX();
222
- return ret;
223
- }
224
-
225
- export function _MAX_TICK_INDEX() {
226
- const ret = wasm._MAX_TICK_INDEX();
227
- return ret;
228
- }
229
-
230
- function passArray8ToWasm0(arg, malloc) {
231
- const ptr = malloc(arg.length * 1, 1) >>> 0;
232
- getUint8ArrayMemory0().set(arg, ptr / 1);
233
- WASM_VECTOR_LEN = arg.length;
234
- return ptr;
235
- }
236
- /**
237
- * Get the first unoccupied position in a bundle
238
- *
239
- * # Arguments
240
- * * `bundle` - The bundle to check
241
- *
242
- * # Returns
243
- * * `u32` - The first unoccupied position (None if full)
244
- */
245
- export function firstUnoccupiedPositionInBundle(bitmap) {
246
- const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
247
- const len0 = WASM_VECTOR_LEN;
248
- const ret = wasm.firstUnoccupiedPositionInBundle(ptr0, len0);
249
- return ret === 0x100000001 ? undefined : ret;
250
- }
251
-
252
- /**
253
- * Check whether a position bundle is full
254
- * A position bundle can contain 256 positions
255
- *
256
- * # Arguments
257
- * * `bundle` - The bundle to check
258
- *
259
- * # Returns
260
- * * `bool` - Whether the bundle is full
261
- */
262
- export function isPositionBundleFull(bitmap) {
263
- const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
264
- const len0 = WASM_VECTOR_LEN;
265
- const ret = wasm.isPositionBundleFull(ptr0, len0);
266
- return ret !== 0;
267
- }
268
-
269
- /**
270
- * Check whether a position bundle is empty
271
- *
272
- * # Arguments
273
- * * `bundle` - The bundle to check
274
- *
275
- * # Returns
276
- * * `bool` - Whether the bundle is empty
277
- */
278
- export function isPositionBundleEmpty(bitmap) {
279
- const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
280
- const len0 = WASM_VECTOR_LEN;
281
- const ret = wasm.isPositionBundleEmpty(ptr0, len0);
282
- return ret !== 0;
283
- }
284
-
285
- /**
286
- * Convert a price into a sqrt priceX64
287
- * IMPORTANT: floating point operations can reduce the precision of the result.
288
- * Make sure to do these operations last and not to use the result for further calculations.
289
- *
290
- * # Parameters
291
- * * `price` - The price to convert
292
- * * `decimals_a` - The number of decimals of the base token
293
- * * `decimals_b` - The number of decimals of the quote token
294
- *
295
- * # Returns
296
- * * `u128` - The sqrt priceX64
297
- */
298
- export function priceToSqrtPrice(price, decimals_a, decimals_b) {
299
- const ret = wasm.priceToSqrtPrice(price, decimals_a, decimals_b);
300
- return takeObject(ret);
301
- }
302
-
303
- /**
304
- * Convert a sqrt priceX64 into a tick index
305
- * IMPORTANT: floating point operations can reduce the precision of the result.
306
- * Make sure to do these operations last and not to use the result for further calculations.
307
- *
308
- * # Parameters
309
- * * `sqrt_price` - The sqrt priceX64 to convert
310
- * * `decimals_a` - The number of decimals of the base token
311
- * * `decimals_b` - The number of decimals of the quote token
312
- *
313
- * # Returns
314
- * * `f64` - The decimal price
315
- */
316
- export function sqrtPriceToPrice(sqrt_price, decimals_a, decimals_b) {
317
- const ret = wasm.sqrtPriceToPrice(addHeapObject(sqrt_price), decimals_a, decimals_b);
318
- return ret;
319
- }
320
-
321
- /**
322
- * Invert a price
323
- * IMPORTANT: floating point operations can reduce the precision of the result.
324
- * Make sure to do these operations last and not to use the result for further calculations.
325
- *
326
- * # Parameters
327
- * * `price` - The price to invert
328
- * * `decimals_a` - The number of decimals of the base token
329
- * * `decimals_b` - The number of decimals of the quote token
330
- *
331
- * # Returns
332
- * * `f64` - The inverted price
333
- */
334
- export function invertPrice(price, decimals_a, decimals_b) {
335
- const ret = wasm.invertPrice(price, decimals_a, decimals_b);
336
- return ret;
337
- }
338
-
339
- /**
340
- * Convert a tick index into a price
341
- * IMPORTANT: floating point operations can reduce the precision of the result.
342
- * Make sure to do these operations last and not to use the result for further calculations.
343
- *
344
- * # Parameters
345
- * * `tick_index` - The tick index to convert
346
- * * `decimals_a` - The number of decimals of the base token
347
- * * `decimals_b` - The number of decimals of the quote token
348
- *
349
- * # Returns
350
- * * `f64` - The decimal price
351
- */
352
- export function tickIndexToPrice(tick_index, decimals_a, decimals_b) {
353
- const ret = wasm.tickIndexToPrice(tick_index, decimals_a, decimals_b);
354
- return ret;
355
- }
356
-
357
- /**
358
- * Convert a price into a tick index
359
- * IMPORTANT: floating point operations can reduce the precision of the result.
360
- * Make sure to do these operations last and not to use the result for further calculations.
361
- *
362
- * # Parameters
363
- * * `price` - The price to convert
364
- * * `decimals_a` - The number of decimals of the base token
365
- * * `decimals_b` - The number of decimals of the quote token
366
- *
367
- * # Returns
368
- * * `i32` - The tick index
369
- */
370
- export function priceToTickIndex(price, decimals_a, decimals_b) {
371
- const ret = wasm.priceToTickIndex(price, decimals_a, decimals_b);
372
- return ret;
373
- }
374
-
375
- export function _FEE_RATE_DENOMINATOR() {
376
- const ret = wasm._FEE_RATE_DENOMINATOR();
377
- return ret >>> 0;
378
- }
379
-
380
199
  /**
381
200
  * Get the first tick index in the tick array that contains the specified tick index.
382
201
  *
@@ -603,6 +422,186 @@ export function getTickIndexInArray(tick_index, tick_array_start_index, tick_spa
603
422
  }
604
423
  }
605
424
 
425
+ export function _FEE_RATE_DENOMINATOR() {
426
+ const ret = wasm._FEE_RATE_DENOMINATOR();
427
+ return ret >>> 0;
428
+ }
429
+
430
+ export function _TICK_ARRAY_SIZE() {
431
+ const ret = wasm._TICK_ARRAY_SIZE();
432
+ return ret >>> 0;
433
+ }
434
+
435
+ export function _FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD() {
436
+ const ret = wasm._FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD();
437
+ return ret;
438
+ }
439
+
440
+ export function _MIN_TICK_INDEX() {
441
+ const ret = wasm._MIN_TICK_INDEX();
442
+ return ret;
443
+ }
444
+
445
+ export function _MAX_TICK_INDEX() {
446
+ const ret = wasm._MAX_TICK_INDEX();
447
+ return ret;
448
+ }
449
+
450
+ function passArray8ToWasm0(arg, malloc) {
451
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
452
+ getUint8ArrayMemory0().set(arg, ptr / 1);
453
+ WASM_VECTOR_LEN = arg.length;
454
+ return ptr;
455
+ }
456
+ /**
457
+ * Get the first unoccupied position in a bundle
458
+ *
459
+ * # Arguments
460
+ * * `bundle` - The bundle to check
461
+ *
462
+ * # Returns
463
+ * * `u32` - The first unoccupied position (None if full)
464
+ */
465
+ export function firstUnoccupiedPositionInBundle(bitmap) {
466
+ const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
467
+ const len0 = WASM_VECTOR_LEN;
468
+ const ret = wasm.firstUnoccupiedPositionInBundle(ptr0, len0);
469
+ return ret === 0x100000001 ? undefined : ret;
470
+ }
471
+
472
+ /**
473
+ * Check whether a position bundle is full
474
+ * A position bundle can contain 256 positions
475
+ *
476
+ * # Arguments
477
+ * * `bundle` - The bundle to check
478
+ *
479
+ * # Returns
480
+ * * `bool` - Whether the bundle is full
481
+ */
482
+ export function isPositionBundleFull(bitmap) {
483
+ const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
484
+ const len0 = WASM_VECTOR_LEN;
485
+ const ret = wasm.isPositionBundleFull(ptr0, len0);
486
+ return ret !== 0;
487
+ }
488
+
489
+ /**
490
+ * Check whether a position bundle is empty
491
+ *
492
+ * # Arguments
493
+ * * `bundle` - The bundle to check
494
+ *
495
+ * # Returns
496
+ * * `bool` - Whether the bundle is empty
497
+ */
498
+ export function isPositionBundleEmpty(bitmap) {
499
+ const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
500
+ const len0 = WASM_VECTOR_LEN;
501
+ const ret = wasm.isPositionBundleEmpty(ptr0, len0);
502
+ return ret !== 0;
503
+ }
504
+
505
+ /**
506
+ * Convert a price into a sqrt priceX64
507
+ * IMPORTANT: floating point operations can reduce the precision of the result.
508
+ * Make sure to do these operations last and not to use the result for further calculations.
509
+ *
510
+ * # Parameters
511
+ * * `price` - The price to convert
512
+ * * `decimals_a` - The number of decimals of the base token
513
+ * * `decimals_b` - The number of decimals of the quote token
514
+ *
515
+ * # Returns
516
+ * * `u128` - The sqrt priceX64
517
+ */
518
+ export function priceToSqrtPrice(price, decimals_a, decimals_b) {
519
+ const ret = wasm.priceToSqrtPrice(price, decimals_a, decimals_b);
520
+ return takeObject(ret);
521
+ }
522
+
523
+ /**
524
+ * Convert a sqrt priceX64 into a tick index
525
+ * IMPORTANT: floating point operations can reduce the precision of the result.
526
+ * Make sure to do these operations last and not to use the result for further calculations.
527
+ *
528
+ * # Parameters
529
+ * * `sqrt_price` - The sqrt priceX64 to convert
530
+ * * `decimals_a` - The number of decimals of the base token
531
+ * * `decimals_b` - The number of decimals of the quote token
532
+ *
533
+ * # Returns
534
+ * * `f64` - The decimal price
535
+ */
536
+ export function sqrtPriceToPrice(sqrt_price, decimals_a, decimals_b) {
537
+ const ret = wasm.sqrtPriceToPrice(addHeapObject(sqrt_price), decimals_a, decimals_b);
538
+ return ret;
539
+ }
540
+
541
+ /**
542
+ * Invert a price
543
+ * IMPORTANT: floating point operations can reduce the precision of the result.
544
+ * Make sure to do these operations last and not to use the result for further calculations.
545
+ *
546
+ * # Parameters
547
+ * * `price` - The price to invert
548
+ * * `decimals_a` - The number of decimals of the base token
549
+ * * `decimals_b` - The number of decimals of the quote token
550
+ *
551
+ * # Returns
552
+ * * `f64` - The inverted price
553
+ */
554
+ export function invertPrice(price, decimals_a, decimals_b) {
555
+ const ret = wasm.invertPrice(price, decimals_a, decimals_b);
556
+ return ret;
557
+ }
558
+
559
+ /**
560
+ * Convert a tick index into a price
561
+ * IMPORTANT: floating point operations can reduce the precision of the result.
562
+ * Make sure to do these operations last and not to use the result for further calculations.
563
+ *
564
+ * # Parameters
565
+ * * `tick_index` - The tick index to convert
566
+ * * `decimals_a` - The number of decimals of the base token
567
+ * * `decimals_b` - The number of decimals of the quote token
568
+ *
569
+ * # Returns
570
+ * * `f64` - The decimal price
571
+ */
572
+ export function tickIndexToPrice(tick_index, decimals_a, decimals_b) {
573
+ const ret = wasm.tickIndexToPrice(tick_index, decimals_a, decimals_b);
574
+ return ret;
575
+ }
576
+
577
+ /**
578
+ * Convert a price into a tick index
579
+ * IMPORTANT: floating point operations can reduce the precision of the result.
580
+ * Make sure to do these operations last and not to use the result for further calculations.
581
+ *
582
+ * # Parameters
583
+ * * `price` - The price to convert
584
+ * * `decimals_a` - The number of decimals of the base token
585
+ * * `decimals_b` - The number of decimals of the quote token
586
+ *
587
+ * # Returns
588
+ * * `i32` - The tick index
589
+ */
590
+ export function priceToTickIndex(price, decimals_a, decimals_b) {
591
+ const ret = wasm.priceToTickIndex(price, decimals_a, decimals_b);
592
+ return ret;
593
+ }
594
+
595
+ export function _NUM_REWARDS() {
596
+ const ret = wasm._NUM_REWARDS();
597
+ return ret >>> 0;
598
+ }
599
+
600
+ export function _POSITION_BUNDLE_SIZE() {
601
+ const ret = wasm._POSITION_BUNDLE_SIZE();
602
+ return ret >>> 0;
603
+ }
604
+
606
605
  export function _TICK_ARRAY_NOT_EVENLY_SPACED() {
607
606
  try {
608
607
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -31,7 +31,7 @@ export const tryGetMaxAmountWithSlippageTolerance: (a: number, b: bigint, c: num
31
31
  export const tryGetMinAmountWithSlippageTolerance: (a: number, b: bigint, c: number) => void;
32
32
  export const tryApplySwapFee: (a: number, b: bigint, c: number) => void;
33
33
  export const tryReverseApplySwapFee: (a: number, b: bigint, c: number) => void;
34
- export const _FEE_RATE_DENOMINATOR: () => number;
34
+ export const _NUM_REWARDS: () => number;
35
35
  export const _TICK_ARRAY_NOT_EVENLY_SPACED: (a: number) => void;
36
36
  export const _TICK_INDEX_OUT_OF_BOUNDS: (a: number) => void;
37
37
  export const _INVALID_TICK_INDEX: (a: number) => void;
@@ -49,7 +49,7 @@ export const _TICK_INDEX_NOT_IN_ARRAY: (a: number) => void;
49
49
  export const isPositionInRange: (a: number, b: number, c: number) => number;
50
50
  export const positionStatus: (a: number, b: number, c: number) => number;
51
51
  export const positionRatio: (a: number, b: number, c: number) => number;
52
- export const _POSITION_BUNDLE_SIZE: () => number;
52
+ export const _FEE_RATE_DENOMINATOR: () => number;
53
53
  export const _TICK_ARRAY_SIZE: () => number;
54
54
  export const _FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD: () => number;
55
55
  export const _MIN_TICK_INDEX: () => number;
@@ -62,7 +62,7 @@ export const sqrtPriceToPrice: (a: number, b: number, c: number) => number;
62
62
  export const invertPrice: (a: number, b: number, c: number) => number;
63
63
  export const tickIndexToPrice: (a: number, b: number, c: number) => number;
64
64
  export const priceToTickIndex: (a: number, b: number, c: number) => number;
65
- export const _NUM_REWARDS: () => number;
65
+ export const _POSITION_BUNDLE_SIZE: () => number;
66
66
  export const swapQuoteByInputToken: (a: number, b: bigint, c: number, d: number, e: number, f: number, g: number, h: number) => void;
67
67
  export const swapQuoteByOutputToken: (a: number, b: bigint, c: number, d: number, e: number, f: number, g: number, h: number) => void;
68
68
  export const collectFeesQuote: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;