@crypticdot/defituna-core 3.4.6 → 3.4.7

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.
@@ -262,204 +262,6 @@ function passArray8ToWasm0(arg, malloc) {
262
262
  WASM_VECTOR_LEN = arg.length;
263
263
  return ptr;
264
264
  }
265
- /**
266
- * Get the first unoccupied position in a bundle
267
- *
268
- * # Arguments
269
- * * `bundle` - The bundle to check
270
- *
271
- * # Returns
272
- * * `u32` - The first unoccupied position (None if full)
273
- */
274
- export function firstUnoccupiedPositionInBundle(bitmap) {
275
- const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export);
276
- const len0 = WASM_VECTOR_LEN;
277
- const ret = wasm.firstUnoccupiedPositionInBundle(ptr0, len0);
278
- return ret === 0x100000001 ? undefined : ret;
279
- }
280
-
281
- /**
282
- * Check whether a position bundle is full
283
- * A position bundle can contain 256 positions
284
- *
285
- * # Arguments
286
- * * `bundle` - The bundle to check
287
- *
288
- * # Returns
289
- * * `bool` - Whether the bundle is full
290
- */
291
- export function isPositionBundleFull(bitmap) {
292
- const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export);
293
- const len0 = WASM_VECTOR_LEN;
294
- const ret = wasm.isPositionBundleFull(ptr0, len0);
295
- return ret !== 0;
296
- }
297
-
298
- /**
299
- * Check whether a position bundle is empty
300
- *
301
- * # Arguments
302
- * * `bundle` - The bundle to check
303
- *
304
- * # Returns
305
- * * `bool` - Whether the bundle is empty
306
- */
307
- export function isPositionBundleEmpty(bitmap) {
308
- const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export);
309
- const len0 = WASM_VECTOR_LEN;
310
- const ret = wasm.isPositionBundleEmpty(ptr0, len0);
311
- return ret !== 0;
312
- }
313
-
314
- /**
315
- * Check if a position is in range.
316
- * When a position is in range it is earning fees and rewards
317
- *
318
- * # Parameters
319
- * - `sqrt_price` - A u128 integer representing the sqrt price of the pool
320
- * - `tick_index_1` - A i32 integer representing the first tick index of the position
321
- * - `tick_index_2` - A i32 integer representing the second tick index of the position
322
- *
323
- * # Returns
324
- * - A boolean value indicating if the position is in range
325
- */
326
- export function isPositionInRange(current_sqrt_price, tick_index_1, tick_index_2) {
327
- const ret = wasm.isPositionInRange(current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2);
328
- return ret !== 0;
329
- }
330
-
331
- /**
332
- * Calculate the status of a position
333
- * The status can be one of three values:
334
- * - InRange: The position is in range
335
- * - BelowRange: The position is below the range
336
- * - AboveRange: The position is above the range
337
- *
338
- * # Parameters
339
- * - `sqrt_price` - A u128 integer representing the sqrt price of the pool
340
- * - `tick_index_1` - A i32 integer representing the first tick index of the position
341
- * - `tick_index_2` - A i32 integer representing the second tick index of the position
342
- *
343
- * # Returns
344
- * - A PositionStatus enum value indicating the status of the position
345
- */
346
- export function positionStatus(current_sqrt_price, tick_index_1, tick_index_2) {
347
- const ret = wasm.positionStatus(current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2);
348
- return takeObject(ret);
349
- }
350
-
351
- /**
352
- * Calculate the token_a / token_b ratio of a (ficticious) position
353
- *
354
- * # Parameters
355
- * - `sqrt_price` - A u128 integer representing the sqrt price of the pool
356
- * - `tick_index_1` - A i32 integer representing the first tick index of the position
357
- * - `tick_index_2` - A i32 integer representing the second tick index of the position
358
- *
359
- * # Returns
360
- * - A PositionRatio struct containing the ratio of token_a and token_b
361
- */
362
- export function positionRatioX64(current_sqrt_price, tick_index_1, tick_index_2) {
363
- const ret = wasm.positionRatioX64(current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2);
364
- return takeObject(ret);
365
- }
366
-
367
- /**
368
- * Convert a price into a sqrt priceX64
369
- * IMPORTANT: floating point operations can reduce the precision of the result.
370
- * Make sure to do these operations last and not to use the result for further calculations.
371
- *
372
- * # Parameters
373
- * * `price` - The price to convert
374
- * * `decimals_a` - The number of decimals of the base token
375
- * * `decimals_b` - The number of decimals of the quote token
376
- *
377
- * # Returns
378
- * * `u128` - The sqrt priceX64
379
- */
380
- export function priceToSqrtPrice(price, decimals_a, decimals_b) {
381
- try {
382
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
383
- wasm.priceToSqrtPrice(retptr, price, decimals_a, decimals_b);
384
- var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
385
- var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
386
- return (BigInt.asUintN(64, r0) | (BigInt.asUintN(64, r2) << BigInt(64)));
387
- } finally {
388
- wasm.__wbindgen_add_to_stack_pointer(16);
389
- }
390
- }
391
-
392
- /**
393
- * Convert a sqrt priceX64 into a tick index
394
- * IMPORTANT: floating point operations can reduce the precision of the result.
395
- * Make sure to do these operations last and not to use the result for further calculations.
396
- *
397
- * # Parameters
398
- * * `sqrt_price` - The sqrt priceX64 to convert
399
- * * `decimals_a` - The number of decimals of the base token
400
- * * `decimals_b` - The number of decimals of the quote token
401
- *
402
- * # Returns
403
- * * `f64` - The decimal price
404
- */
405
- export function sqrtPriceToPrice(sqrt_price, decimals_a, decimals_b) {
406
- const ret = wasm.sqrtPriceToPrice(sqrt_price, sqrt_price >> BigInt(64), decimals_a, decimals_b);
407
- return ret;
408
- }
409
-
410
- /**
411
- * Invert a price
412
- * IMPORTANT: floating point operations can reduce the precision of the result.
413
- * Make sure to do these operations last and not to use the result for further calculations.
414
- *
415
- * # Parameters
416
- * * `price` - The price to invert
417
- * * `decimals_a` - The number of decimals of the base token
418
- * * `decimals_b` - The number of decimals of the quote token
419
- *
420
- * # Returns
421
- * * `f64` - The inverted price
422
- */
423
- export function invertPrice(price, decimals_a, decimals_b) {
424
- const ret = wasm.invertPrice(price, decimals_a, decimals_b);
425
- return ret;
426
- }
427
-
428
- /**
429
- * Convert a tick index into a price
430
- * IMPORTANT: floating point operations can reduce the precision of the result.
431
- * Make sure to do these operations last and not to use the result for further calculations.
432
- *
433
- * # Parameters
434
- * * `tick_index` - The tick index to convert
435
- * * `decimals_a` - The number of decimals of the base token
436
- * * `decimals_b` - The number of decimals of the quote token
437
- *
438
- * # Returns
439
- * * `f64` - The decimal price
440
- */
441
- export function tickIndexToPrice(tick_index, decimals_a, decimals_b) {
442
- const ret = wasm.tickIndexToPrice(tick_index, decimals_a, decimals_b);
443
- return ret;
444
- }
445
-
446
- /**
447
- * Convert a price into a tick index
448
- * IMPORTANT: floating point operations can reduce the precision of the result.
449
- * Make sure to do these operations last and not to use the result for further calculations.
450
- *
451
- * # Parameters
452
- * * `price` - The price to convert
453
- * * `decimals_a` - The number of decimals of the base token
454
- * * `decimals_b` - The number of decimals of the quote token
455
- *
456
- * # Returns
457
- * * `i32` - The tick index
458
- */
459
- export function priceToTickIndex(price, decimals_a, decimals_b) {
460
- const ret = wasm.priceToTickIndex(price, decimals_a, decimals_b);
461
- return ret;
462
- }
463
265
 
464
266
  export function _POSITION_BUNDLE_SIZE() {
465
267
  const ret = wasm._POSITION_BUNDLE_SIZE();
@@ -704,47 +506,449 @@ export function orderTickIndexes(tick_index_1, tick_index_2) {
704
506
  * Check if a fusion_pool is a full-range only pool.
705
507
  *
706
508
  * # Parameters
707
- * - `tick_spacing` - A u16 integer representing the tick spacing
509
+ * - `tick_spacing` - A u16 integer representing the tick spacing
510
+ *
511
+ * # Returns
512
+ * - A boolean value indicating if the fusion_pool is a full-range only pool
513
+ */
514
+ export function isFullRangeOnly(tick_spacing) {
515
+ const ret = wasm.isFullRangeOnly(tick_spacing);
516
+ return ret !== 0;
517
+ }
518
+
519
+ /**
520
+ * Get the index of a tick in a tick array.
521
+ *
522
+ * # Parameters
523
+ * - `tick_index` - A i32 integer representing the tick index
524
+ * - `tick_array_start_index` - A i32 integer representing the start tick index of the tick array
525
+ * - `tick_spacing` - A u16 integer representing the tick spacing
526
+ *
527
+ * # Returns
528
+ * - A u32 integer representing the tick index in the tick array
529
+ */
530
+ export function getTickIndexInArray(tick_index, tick_array_start_index, tick_spacing) {
531
+ try {
532
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
533
+ wasm.getTickIndexInArray(retptr, tick_index, tick_array_start_index, tick_spacing);
534
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
535
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
536
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
537
+ if (r2) {
538
+ throw takeObject(r1);
539
+ }
540
+ return r0 >>> 0;
541
+ } finally {
542
+ wasm.__wbindgen_add_to_stack_pointer(16);
543
+ }
544
+ }
545
+
546
+ /**
547
+ * Calculate the quote for decreasing liquidity
548
+ *
549
+ * # Parameters
550
+ * - `liquidity_delta` - The amount of liquidity to decrease
551
+ * - `slippage_tolerance` - The slippage tolerance in bps
552
+ * - `current_sqrt_price` - The current sqrt price of the pool
553
+ * - `tick_index_1` - The first tick index of the position
554
+ * - `tick_index_2` - The second tick index of the position
555
+ * - `transfer_fee_a` - The transfer fee for token A in bps
556
+ * - `transfer_fee_b` - The transfer fee for token B in bps
557
+ *
558
+ * # Returns
559
+ * - A DecreaseLiquidityQuote struct containing the estimated token amounts
560
+ */
561
+ export function decreaseLiquidityQuote(liquidity_delta, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
562
+ try {
563
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
564
+ wasm.decreaseLiquidityQuote(retptr, liquidity_delta, liquidity_delta >> BigInt(64), slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
565
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
566
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
567
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
568
+ if (r2) {
569
+ throw takeObject(r1);
570
+ }
571
+ return takeObject(r0);
572
+ } finally {
573
+ wasm.__wbindgen_add_to_stack_pointer(16);
574
+ }
575
+ }
576
+
577
+ /**
578
+ * Calculate the quote for decreasing liquidity given a token a amount
579
+ *
580
+ * # Parameters
581
+ * - `token_amount_a` - The amount of token a to decrease
582
+ * - `slippage_tolerance` - The slippage tolerance in bps
583
+ * - `current_sqrt_price` - The current sqrt price of the pool
584
+ * - `tick_index_1` - The first tick index of the position
585
+ * - `tick_index_2` - The second tick index of the position
586
+ * - `transfer_fee_a` - The transfer fee for token A in bps
587
+ * - `transfer_fee_b` - The transfer fee for token B in bps
588
+ *
589
+ * # Returns
590
+ * - A DecreaseLiquidityQuote struct containing the estimated token amounts
591
+ */
592
+ export function decreaseLiquidityQuoteA(token_amount_a, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
593
+ try {
594
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
595
+ wasm.decreaseLiquidityQuoteA(retptr, token_amount_a, slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
596
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
597
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
598
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
599
+ if (r2) {
600
+ throw takeObject(r1);
601
+ }
602
+ return takeObject(r0);
603
+ } finally {
604
+ wasm.__wbindgen_add_to_stack_pointer(16);
605
+ }
606
+ }
607
+
608
+ /**
609
+ * Calculate the quote for decreasing liquidity given a token b amount
610
+ *
611
+ * # Parameters
612
+ * - `token_amount_b` - The amount of token b to decrease
613
+ * - `slippage_tolerance` - The slippage tolerance in bps
614
+ * - `current_sqrt_price` - The current sqrt price of the pool
615
+ * - `tick_index_1` - The first tick index of the position
616
+ * - `tick_index_2` - The second tick index of the position
617
+ * - `transfer_fee_a` - The transfer fee for token A in bps
618
+ * - `transfer_fee_b` - The transfer fee for token B in bps
619
+ *
620
+ * # Returns
621
+ * - A DecreaseLiquidityQuote struct containing the estimated token amounts
622
+ */
623
+ export function decreaseLiquidityQuoteB(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
624
+ try {
625
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
626
+ wasm.decreaseLiquidityQuoteB(retptr, token_amount_b, slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
627
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
628
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
629
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
630
+ if (r2) {
631
+ throw takeObject(r1);
632
+ }
633
+ return takeObject(r0);
634
+ } finally {
635
+ wasm.__wbindgen_add_to_stack_pointer(16);
636
+ }
637
+ }
638
+
639
+ /**
640
+ * Calculate the quote for increasing liquidity
641
+ *
642
+ * # Parameters
643
+ * - `liquidity_delta` - The amount of liquidity to increase
644
+ * - `slippage_tolerance` - The slippage tolerance in bps
645
+ * - `current_sqrt_price` - The current sqrt price of the pool
646
+ * - `tick_index_1` - The first tick index of the position
647
+ * - `tick_index_2` - The second tick index of the position
648
+ * - `transfer_fee_a` - The transfer fee for token A in bps
649
+ * - `transfer_fee_b` - The transfer fee for token B in bps
650
+ *
651
+ * # Returns
652
+ * - An IncreaseLiquidityQuote struct containing the estimated token amounts
653
+ */
654
+ export function increaseLiquidityQuote(liquidity_delta, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
655
+ try {
656
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
657
+ wasm.increaseLiquidityQuote(retptr, liquidity_delta, liquidity_delta >> BigInt(64), slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
658
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
659
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
660
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
661
+ if (r2) {
662
+ throw takeObject(r1);
663
+ }
664
+ return takeObject(r0);
665
+ } finally {
666
+ wasm.__wbindgen_add_to_stack_pointer(16);
667
+ }
668
+ }
669
+
670
+ /**
671
+ * Calculate the quote for increasing liquidity given a token a amount
672
+ *
673
+ * # Parameters
674
+ * - `token_amount_a` - The amount of token a to increase
675
+ * - `slippage_tolerance` - The slippage tolerance in bps
676
+ * - `current_sqrt_price` - The current sqrt price of the pool
677
+ * - `tick_index_1` - The first tick index of the position
678
+ * - `tick_index_2` - The second tick index of the position
679
+ * - `transfer_fee_a` - The transfer fee for token A in bps
680
+ * - `transfer_fee_b` - The transfer fee for token B in bps
681
+ *
682
+ * # Returns
683
+ * - An IncreaseLiquidityQuote struct containing the estimated token amounts
684
+ */
685
+ export function increaseLiquidityQuoteA(token_amount_a, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
686
+ try {
687
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
688
+ wasm.increaseLiquidityQuoteA(retptr, token_amount_a, slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
689
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
690
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
691
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
692
+ if (r2) {
693
+ throw takeObject(r1);
694
+ }
695
+ return takeObject(r0);
696
+ } finally {
697
+ wasm.__wbindgen_add_to_stack_pointer(16);
698
+ }
699
+ }
700
+
701
+ /**
702
+ * Calculate the quote for increasing liquidity given a token b amount
703
+ *
704
+ * # Parameters
705
+ * - `token_amount_b` - The amount of token b to increase
706
+ * - `slippage_tolerance` - The slippage tolerance in bps
707
+ * - `current_sqrt_price` - The current sqrt price of the pool
708
+ * - `tick_index_1` - The first tick index of the position
709
+ * - `tick_index_2` - The second tick index of the position
710
+ * - `transfer_fee_a` - The transfer fee for token A in bps
711
+ * - `transfer_fee_b` - The transfer fee for token B in bps
712
+ *
713
+ * # Returns
714
+ * - An IncreaseLiquidityQuote struct containing the estimated token amounts
715
+ */
716
+ export function increaseLiquidityQuoteB(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
717
+ try {
718
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
719
+ wasm.increaseLiquidityQuoteB(retptr, token_amount_b, slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
720
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
721
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
722
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
723
+ if (r2) {
724
+ throw takeObject(r1);
725
+ }
726
+ return takeObject(r0);
727
+ } finally {
728
+ wasm.__wbindgen_add_to_stack_pointer(16);
729
+ }
730
+ }
731
+
732
+ /**
733
+ * Get the first unoccupied position in a bundle
734
+ *
735
+ * # Arguments
736
+ * * `bundle` - The bundle to check
737
+ *
738
+ * # Returns
739
+ * * `u32` - The first unoccupied position (None if full)
740
+ */
741
+ export function firstUnoccupiedPositionInBundle(bitmap) {
742
+ const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export);
743
+ const len0 = WASM_VECTOR_LEN;
744
+ const ret = wasm.firstUnoccupiedPositionInBundle(ptr0, len0);
745
+ return ret === 0x100000001 ? undefined : ret;
746
+ }
747
+
748
+ /**
749
+ * Check whether a position bundle is full
750
+ * A position bundle can contain 256 positions
751
+ *
752
+ * # Arguments
753
+ * * `bundle` - The bundle to check
754
+ *
755
+ * # Returns
756
+ * * `bool` - Whether the bundle is full
757
+ */
758
+ export function isPositionBundleFull(bitmap) {
759
+ const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export);
760
+ const len0 = WASM_VECTOR_LEN;
761
+ const ret = wasm.isPositionBundleFull(ptr0, len0);
762
+ return ret !== 0;
763
+ }
764
+
765
+ /**
766
+ * Check whether a position bundle is empty
767
+ *
768
+ * # Arguments
769
+ * * `bundle` - The bundle to check
770
+ *
771
+ * # Returns
772
+ * * `bool` - Whether the bundle is empty
773
+ */
774
+ export function isPositionBundleEmpty(bitmap) {
775
+ const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export);
776
+ const len0 = WASM_VECTOR_LEN;
777
+ const ret = wasm.isPositionBundleEmpty(ptr0, len0);
778
+ return ret !== 0;
779
+ }
780
+
781
+ /**
782
+ * Check if a position is in range.
783
+ * When a position is in range it is earning fees and rewards
784
+ *
785
+ * # Parameters
786
+ * - `sqrt_price` - A u128 integer representing the sqrt price of the pool
787
+ * - `tick_index_1` - A i32 integer representing the first tick index of the position
788
+ * - `tick_index_2` - A i32 integer representing the second tick index of the position
789
+ *
790
+ * # Returns
791
+ * - A boolean value indicating if the position is in range
792
+ */
793
+ export function isPositionInRange(current_sqrt_price, tick_index_1, tick_index_2) {
794
+ const ret = wasm.isPositionInRange(current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2);
795
+ return ret !== 0;
796
+ }
797
+
798
+ /**
799
+ * Calculate the status of a position
800
+ * The status can be one of three values:
801
+ * - InRange: The position is in range
802
+ * - BelowRange: The position is below the range
803
+ * - AboveRange: The position is above the range
804
+ *
805
+ * # Parameters
806
+ * - `sqrt_price` - A u128 integer representing the sqrt price of the pool
807
+ * - `tick_index_1` - A i32 integer representing the first tick index of the position
808
+ * - `tick_index_2` - A i32 integer representing the second tick index of the position
809
+ *
810
+ * # Returns
811
+ * - A PositionStatus enum value indicating the status of the position
812
+ */
813
+ export function positionStatus(current_sqrt_price, tick_index_1, tick_index_2) {
814
+ const ret = wasm.positionStatus(current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2);
815
+ return takeObject(ret);
816
+ }
817
+
818
+ /**
819
+ * Calculate the token_a / token_b ratio of a (ficticious) position
820
+ *
821
+ * # Parameters
822
+ * - `sqrt_price` - A u128 integer representing the sqrt price of the pool
823
+ * - `tick_index_1` - A i32 integer representing the first tick index of the position
824
+ * - `tick_index_2` - A i32 integer representing the second tick index of the position
825
+ *
826
+ * # Returns
827
+ * - A PositionRatio struct containing the ratio of token_a and token_b
828
+ */
829
+ export function positionRatioX64(current_sqrt_price, tick_index_1, tick_index_2) {
830
+ const ret = wasm.positionRatioX64(current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2);
831
+ return takeObject(ret);
832
+ }
833
+
834
+ /**
835
+ * Convert a price into a sqrt priceX64
836
+ * IMPORTANT: floating point operations can reduce the precision of the result.
837
+ * Make sure to do these operations last and not to use the result for further calculations.
838
+ *
839
+ * # Parameters
840
+ * * `price` - The price to convert
841
+ * * `decimals_a` - The number of decimals of the base token
842
+ * * `decimals_b` - The number of decimals of the quote token
843
+ *
844
+ * # Returns
845
+ * * `u128` - The sqrt priceX64
846
+ */
847
+ export function priceToSqrtPrice(price, decimals_a, decimals_b) {
848
+ try {
849
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
850
+ wasm.priceToSqrtPrice(retptr, price, decimals_a, decimals_b);
851
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
852
+ var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
853
+ return (BigInt.asUintN(64, r0) | (BigInt.asUintN(64, r2) << BigInt(64)));
854
+ } finally {
855
+ wasm.__wbindgen_add_to_stack_pointer(16);
856
+ }
857
+ }
858
+
859
+ /**
860
+ * Convert a sqrt priceX64 into a tick index
861
+ * IMPORTANT: floating point operations can reduce the precision of the result.
862
+ * Make sure to do these operations last and not to use the result for further calculations.
863
+ *
864
+ * # Parameters
865
+ * * `sqrt_price` - The sqrt priceX64 to convert
866
+ * * `decimals_a` - The number of decimals of the base token
867
+ * * `decimals_b` - The number of decimals of the quote token
868
+ *
869
+ * # Returns
870
+ * * `f64` - The decimal price
871
+ */
872
+ export function sqrtPriceToPrice(sqrt_price, decimals_a, decimals_b) {
873
+ const ret = wasm.sqrtPriceToPrice(sqrt_price, sqrt_price >> BigInt(64), decimals_a, decimals_b);
874
+ return ret;
875
+ }
876
+
877
+ /**
878
+ * Invert a price
879
+ * IMPORTANT: floating point operations can reduce the precision of the result.
880
+ * Make sure to do these operations last and not to use the result for further calculations.
881
+ *
882
+ * # Parameters
883
+ * * `price` - The price to invert
884
+ * * `decimals_a` - The number of decimals of the base token
885
+ * * `decimals_b` - The number of decimals of the quote token
886
+ *
887
+ * # Returns
888
+ * * `f64` - The inverted price
889
+ */
890
+ export function invertPrice(price, decimals_a, decimals_b) {
891
+ const ret = wasm.invertPrice(price, decimals_a, decimals_b);
892
+ return ret;
893
+ }
894
+
895
+ /**
896
+ * Convert a tick index into a price
897
+ * IMPORTANT: floating point operations can reduce the precision of the result.
898
+ * Make sure to do these operations last and not to use the result for further calculations.
899
+ *
900
+ * # Parameters
901
+ * * `tick_index` - The tick index to convert
902
+ * * `decimals_a` - The number of decimals of the base token
903
+ * * `decimals_b` - The number of decimals of the quote token
708
904
  *
709
905
  * # Returns
710
- * - A boolean value indicating if the fusion_pool is a full-range only pool
906
+ * * `f64` - The decimal price
711
907
  */
712
- export function isFullRangeOnly(tick_spacing) {
713
- const ret = wasm.isFullRangeOnly(tick_spacing);
714
- return ret !== 0;
908
+ export function tickIndexToPrice(tick_index, decimals_a, decimals_b) {
909
+ const ret = wasm.tickIndexToPrice(tick_index, decimals_a, decimals_b);
910
+ return ret;
715
911
  }
716
912
 
717
913
  /**
718
- * Get the index of a tick in a tick array.
914
+ * Convert a price into a tick index
915
+ * IMPORTANT: floating point operations can reduce the precision of the result.
916
+ * Make sure to do these operations last and not to use the result for further calculations.
719
917
  *
720
918
  * # Parameters
721
- * - `tick_index` - A i32 integer representing the tick index
722
- * - `tick_array_start_index` - A i32 integer representing the start tick index of the tick array
723
- * - `tick_spacing` - A u16 integer representing the tick spacing
919
+ * * `price` - The price to convert
920
+ * * `decimals_a` - The number of decimals of the base token
921
+ * * `decimals_b` - The number of decimals of the quote token
724
922
  *
725
923
  * # Returns
726
- * - A u32 integer representing the tick index in the tick array
924
+ * * `i32` - The tick index
727
925
  */
728
- export function getTickIndexInArray(tick_index, tick_array_start_index, tick_spacing) {
926
+ export function priceToTickIndex(price, decimals_a, decimals_b) {
927
+ const ret = wasm.priceToTickIndex(price, decimals_a, decimals_b);
928
+ return ret;
929
+ }
930
+
931
+ export function getLiquidityFromAmountA(amount_a, sqrt_price_lower, sqrt_price_upper) {
729
932
  try {
730
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
731
- wasm.getTickIndexInArray(retptr, tick_index, tick_array_start_index, tick_spacing);
732
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
733
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
734
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
735
- if (r2) {
736
- throw takeObject(r1);
933
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-32);
934
+ wasm.getLiquidityFromAmountA(retptr, amount_a, sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64));
935
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
936
+ var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
937
+ var r4 = getDataViewMemory0().getInt32(retptr + 4 * 4, true);
938
+ var r5 = getDataViewMemory0().getInt32(retptr + 4 * 5, true);
939
+ if (r5) {
940
+ throw takeObject(r4);
737
941
  }
738
- return r0 >>> 0;
942
+ return (BigInt.asUintN(64, r0) | (BigInt.asUintN(64, r2) << BigInt(64)));
739
943
  } finally {
740
- wasm.__wbindgen_add_to_stack_pointer(16);
944
+ wasm.__wbindgen_add_to_stack_pointer(32);
741
945
  }
742
946
  }
743
947
 
744
- export function tryGetLiquidityFromAmountA(amount_a, sqrt_price_lower, sqrt_price_upper) {
948
+ export function getLiquidityFromAmountB(amount_b, sqrt_price_lower, sqrt_price_upper) {
745
949
  try {
746
950
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-32);
747
- wasm.tryGetLiquidityFromAmountA(retptr, amount_a, sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64));
951
+ wasm.getLiquidityFromAmountB(retptr, amount_b, sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64));
748
952
  var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
749
953
  var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
750
954
  var r4 = getDataViewMemory0().getInt32(retptr + 4 * 4, true);
@@ -758,10 +962,10 @@ export function tryGetLiquidityFromAmountA(amount_a, sqrt_price_lower, sqrt_pric
758
962
  }
759
963
  }
760
964
 
761
- export function tryGetAmountAFromLiquidity(liquidity, sqrt_price_lower, sqrt_price_upper, round_up) {
965
+ export function getAmountAFromLiquidity(liquidity, sqrt_price_lower, sqrt_price_upper, round_up) {
762
966
  try {
763
967
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
764
- wasm.tryGetAmountAFromLiquidity(retptr, liquidity, liquidity >> BigInt(64), sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64), round_up);
968
+ wasm.getAmountAFromLiquidity(retptr, liquidity, liquidity >> BigInt(64), sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64), round_up);
765
969
  var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
766
970
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
767
971
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
@@ -774,27 +978,10 @@ export function tryGetAmountAFromLiquidity(liquidity, sqrt_price_lower, sqrt_pri
774
978
  }
775
979
  }
776
980
 
777
- export function tryGetLiquidityFromAmountB(amount_b, sqrt_price_lower, sqrt_price_upper) {
778
- try {
779
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-32);
780
- wasm.tryGetLiquidityFromAmountB(retptr, amount_b, sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64));
781
- var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
782
- var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
783
- var r4 = getDataViewMemory0().getInt32(retptr + 4 * 4, true);
784
- var r5 = getDataViewMemory0().getInt32(retptr + 4 * 5, true);
785
- if (r5) {
786
- throw takeObject(r4);
787
- }
788
- return (BigInt.asUintN(64, r0) | (BigInt.asUintN(64, r2) << BigInt(64)));
789
- } finally {
790
- wasm.__wbindgen_add_to_stack_pointer(32);
791
- }
792
- }
793
-
794
- export function tryGetAmountBFromLiquidity(liquidity, sqrt_price_lower, sqrt_price_upper, round_up) {
981
+ export function getAmountBFromLiquidity(liquidity, sqrt_price_lower, sqrt_price_upper, round_up) {
795
982
  try {
796
983
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
797
- wasm.tryGetAmountBFromLiquidity(retptr, liquidity, liquidity >> BigInt(64), sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64), round_up);
984
+ wasm.getAmountBFromLiquidity(retptr, liquidity, liquidity >> BigInt(64), sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64), round_up);
798
985
  var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
799
986
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
800
987
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
@@ -807,10 +994,10 @@ export function tryGetAmountBFromLiquidity(liquidity, sqrt_price_lower, sqrt_pri
807
994
  }
808
995
  }
809
996
 
810
- export function tryGetAmountsFromLiquidity(liquidity, sqrt_price, tick_lower_index, tick_upper_index, round_up) {
997
+ export function getAmountsFromLiquidity(liquidity, sqrt_price, sqrt_price_lower, sqrt_price_upper, round_up) {
811
998
  try {
812
999
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
813
- wasm.tryGetAmountsFromLiquidity(retptr, liquidity, liquidity >> BigInt(64), sqrt_price, sqrt_price >> BigInt(64), tick_lower_index, tick_upper_index, round_up);
1000
+ wasm.getAmountsFromLiquidity(retptr, liquidity, liquidity >> BigInt(64), sqrt_price, sqrt_price >> BigInt(64), sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64), round_up);
814
1001
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
815
1002
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
816
1003
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -823,10 +1010,10 @@ export function tryGetAmountsFromLiquidity(liquidity, sqrt_price, tick_lower_ind
823
1010
  }
824
1011
  }
825
1012
 
826
- export function tryGetLiquidityFromAmounts(sqrt_price, sqrt_price_lower, sqrt_price_upper, amount_a, amount_b) {
1013
+ export function getLiquidityFromAmounts(sqrt_price, sqrt_price_lower, sqrt_price_upper, amount_a, amount_b) {
827
1014
  try {
828
1015
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-32);
829
- wasm.tryGetLiquidityFromAmounts(retptr, sqrt_price, sqrt_price >> BigInt(64), sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64), amount_a, amount_b);
1016
+ wasm.getLiquidityFromAmounts(retptr, sqrt_price, sqrt_price >> BigInt(64), sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64), amount_a, amount_b);
830
1017
  var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
831
1018
  var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
832
1019
  var r4 = getDataViewMemory0().getInt32(retptr + 4 * 4, true);
@@ -840,192 +1027,6 @@ export function tryGetLiquidityFromAmounts(sqrt_price, sqrt_price_lower, sqrt_pr
840
1027
  }
841
1028
  }
842
1029
 
843
- /**
844
- * Calculate the quote for decreasing liquidity
845
- *
846
- * # Parameters
847
- * - `liquidity_delta` - The amount of liquidity to decrease
848
- * - `slippage_tolerance` - The slippage tolerance in bps
849
- * - `current_sqrt_price` - The current sqrt price of the pool
850
- * - `tick_index_1` - The first tick index of the position
851
- * - `tick_index_2` - The second tick index of the position
852
- * - `transfer_fee_a` - The transfer fee for token A in bps
853
- * - `transfer_fee_b` - The transfer fee for token B in bps
854
- *
855
- * # Returns
856
- * - A DecreaseLiquidityQuote struct containing the estimated token amounts
857
- */
858
- export function decreaseLiquidityQuote(liquidity_delta, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
859
- try {
860
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
861
- wasm.decreaseLiquidityQuote(retptr, liquidity_delta, liquidity_delta >> BigInt(64), slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
862
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
863
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
864
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
865
- if (r2) {
866
- throw takeObject(r1);
867
- }
868
- return takeObject(r0);
869
- } finally {
870
- wasm.__wbindgen_add_to_stack_pointer(16);
871
- }
872
- }
873
-
874
- /**
875
- * Calculate the quote for decreasing liquidity given a token a amount
876
- *
877
- * # Parameters
878
- * - `token_amount_a` - The amount of token a to decrease
879
- * - `slippage_tolerance` - The slippage tolerance in bps
880
- * - `current_sqrt_price` - The current sqrt price of the pool
881
- * - `tick_index_1` - The first tick index of the position
882
- * - `tick_index_2` - The second tick index of the position
883
- * - `transfer_fee_a` - The transfer fee for token A in bps
884
- * - `transfer_fee_b` - The transfer fee for token B in bps
885
- *
886
- * # Returns
887
- * - A DecreaseLiquidityQuote struct containing the estimated token amounts
888
- */
889
- export function decreaseLiquidityQuoteA(token_amount_a, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
890
- try {
891
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
892
- wasm.decreaseLiquidityQuoteA(retptr, token_amount_a, slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
893
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
894
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
895
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
896
- if (r2) {
897
- throw takeObject(r1);
898
- }
899
- return takeObject(r0);
900
- } finally {
901
- wasm.__wbindgen_add_to_stack_pointer(16);
902
- }
903
- }
904
-
905
- /**
906
- * Calculate the quote for decreasing liquidity given a token b amount
907
- *
908
- * # Parameters
909
- * - `token_amount_b` - The amount of token b to decrease
910
- * - `slippage_tolerance` - The slippage tolerance in bps
911
- * - `current_sqrt_price` - The current sqrt price of the pool
912
- * - `tick_index_1` - The first tick index of the position
913
- * - `tick_index_2` - The second tick index of the position
914
- * - `transfer_fee_a` - The transfer fee for token A in bps
915
- * - `transfer_fee_b` - The transfer fee for token B in bps
916
- *
917
- * # Returns
918
- * - A DecreaseLiquidityQuote struct containing the estimated token amounts
919
- */
920
- export function decreaseLiquidityQuoteB(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
921
- try {
922
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
923
- wasm.decreaseLiquidityQuoteB(retptr, token_amount_b, slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
924
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
925
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
926
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
927
- if (r2) {
928
- throw takeObject(r1);
929
- }
930
- return takeObject(r0);
931
- } finally {
932
- wasm.__wbindgen_add_to_stack_pointer(16);
933
- }
934
- }
935
-
936
- /**
937
- * Calculate the quote for increasing liquidity
938
- *
939
- * # Parameters
940
- * - `liquidity_delta` - The amount of liquidity to increase
941
- * - `slippage_tolerance` - The slippage tolerance in bps
942
- * - `current_sqrt_price` - The current sqrt price of the pool
943
- * - `tick_index_1` - The first tick index of the position
944
- * - `tick_index_2` - The second tick index of the position
945
- * - `transfer_fee_a` - The transfer fee for token A in bps
946
- * - `transfer_fee_b` - The transfer fee for token B in bps
947
- *
948
- * # Returns
949
- * - An IncreaseLiquidityQuote struct containing the estimated token amounts
950
- */
951
- export function increaseLiquidityQuote(liquidity_delta, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
952
- try {
953
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
954
- wasm.increaseLiquidityQuote(retptr, liquidity_delta, liquidity_delta >> BigInt(64), slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
955
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
956
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
957
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
958
- if (r2) {
959
- throw takeObject(r1);
960
- }
961
- return takeObject(r0);
962
- } finally {
963
- wasm.__wbindgen_add_to_stack_pointer(16);
964
- }
965
- }
966
-
967
- /**
968
- * Calculate the quote for increasing liquidity given a token a amount
969
- *
970
- * # Parameters
971
- * - `token_amount_a` - The amount of token a to increase
972
- * - `slippage_tolerance` - The slippage tolerance in bps
973
- * - `current_sqrt_price` - The current sqrt price of the pool
974
- * - `tick_index_1` - The first tick index of the position
975
- * - `tick_index_2` - The second tick index of the position
976
- * - `transfer_fee_a` - The transfer fee for token A in bps
977
- * - `transfer_fee_b` - The transfer fee for token B in bps
978
- *
979
- * # Returns
980
- * - An IncreaseLiquidityQuote struct containing the estimated token amounts
981
- */
982
- export function increaseLiquidityQuoteA(token_amount_a, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
983
- try {
984
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
985
- wasm.increaseLiquidityQuoteA(retptr, token_amount_a, slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
986
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
987
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
988
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
989
- if (r2) {
990
- throw takeObject(r1);
991
- }
992
- return takeObject(r0);
993
- } finally {
994
- wasm.__wbindgen_add_to_stack_pointer(16);
995
- }
996
- }
997
-
998
- /**
999
- * Calculate the quote for increasing liquidity given a token b amount
1000
- *
1001
- * # Parameters
1002
- * - `token_amount_b` - The amount of token b to increase
1003
- * - `slippage_tolerance` - The slippage tolerance in bps
1004
- * - `current_sqrt_price` - The current sqrt price of the pool
1005
- * - `tick_index_1` - The first tick index of the position
1006
- * - `tick_index_2` - The second tick index of the position
1007
- * - `transfer_fee_a` - The transfer fee for token A in bps
1008
- * - `transfer_fee_b` - The transfer fee for token B in bps
1009
- *
1010
- * # Returns
1011
- * - An IncreaseLiquidityQuote struct containing the estimated token amounts
1012
- */
1013
- export function increaseLiquidityQuoteB(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
1014
- try {
1015
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1016
- wasm.increaseLiquidityQuoteB(retptr, token_amount_b, slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
1017
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1018
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1019
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1020
- if (r2) {
1021
- throw takeObject(r1);
1022
- }
1023
- return takeObject(r0);
1024
- } finally {
1025
- wasm.__wbindgen_add_to_stack_pointer(16);
1026
- }
1027
- }
1028
-
1029
1030
  /**
1030
1031
  * Calculate the amount A delta between two sqrt_prices
1031
1032
  *
@@ -1997,12 +1998,12 @@ export function solana_program_init() {
1997
1998
  wasm.solana_program_init();
1998
1999
  }
1999
2000
 
2000
- function __wasm_bindgen_func_elem_3154(arg0, arg1) {
2001
- wasm.__wasm_bindgen_func_elem_3154(arg0, arg1);
2001
+ function __wasm_bindgen_func_elem_3153(arg0, arg1) {
2002
+ wasm.__wasm_bindgen_func_elem_3153(arg0, arg1);
2002
2003
  }
2003
2004
 
2004
- function __wasm_bindgen_func_elem_3288(arg0, arg1, arg2) {
2005
- wasm.__wasm_bindgen_func_elem_3288(arg0, arg1, addHeapObject(arg2));
2005
+ function __wasm_bindgen_func_elem_3259(arg0, arg1, arg2) {
2006
+ wasm.__wasm_bindgen_func_elem_3259(arg0, arg1, addHeapObject(arg2));
2006
2007
  }
2007
2008
 
2008
2009
  function __wasm_bindgen_func_elem_494(arg0, arg1, arg2, arg3) {
@@ -3425,15 +3426,9 @@ export function __wbindgen_cast_4625c577ab2ec9ee(arg0) {
3425
3426
  return addHeapObject(ret);
3426
3427
  };
3427
3428
 
3428
- export function __wbindgen_cast_49dae81bf02b4884(arg0, arg1) {
3429
- // Cast intrinsic for `Closure(Closure { dtor_idx: 369, function: Function { arguments: [Externref], shim_idx: 380, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3430
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3261, __wasm_bindgen_func_elem_3288);
3431
- return addHeapObject(ret);
3432
- };
3433
-
3434
3429
  export function __wbindgen_cast_7879599246031d81(arg0, arg1) {
3435
3430
  // Cast intrinsic for `Closure(Closure { dtor_idx: 343, function: Function { arguments: [], shim_idx: 344, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3436
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3150, __wasm_bindgen_func_elem_3154);
3431
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3149, __wasm_bindgen_func_elem_3153);
3437
3432
  return addHeapObject(ret);
3438
3433
  };
3439
3434
 
@@ -3449,6 +3444,12 @@ export function __wbindgen_cast_d6cd19b81560fd6e(arg0) {
3449
3444
  return addHeapObject(ret);
3450
3445
  };
3451
3446
 
3447
+ export function __wbindgen_cast_e346b65485039441(arg0, arg1) {
3448
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 355, function: Function { arguments: [Externref], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3449
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3232, __wasm_bindgen_func_elem_3259);
3450
+ return addHeapObject(ret);
3451
+ };
3452
+
3452
3453
  export function __wbindgen_cast_e7b45dd881f38ce3(arg0, arg1) {
3453
3454
  // Cast intrinsic for `U128 -> Externref`.
3454
3455
  const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));