@crypticdot/defituna-core 3.3.6 → 3.4.2

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.
@@ -252,232 +252,6 @@ function passArray8ToWasm0(arg, malloc) {
252
252
  WASM_VECTOR_LEN = arg.length;
253
253
  return ptr;
254
254
  }
255
- /**
256
- * Get the first tick index in the tick array that contains the specified tick index.
257
- *
258
- * # Parameters
259
- * - `tick_index` - A i32 integer representing the tick integer
260
- * - `tick_spacing` - A i32 integer representing the tick spacing
261
- *
262
- * # Returns
263
- * - A i32 integer representing the first tick index in the tick array
264
- */
265
- exports.getTickArrayStartTickIndex = function(tick_index, tick_spacing) {
266
- const ret = wasm.getTickArrayStartTickIndex(tick_index, tick_spacing);
267
- return ret;
268
- };
269
-
270
- /**
271
- * Derive the sqrt-price from a tick index. The precision of this method is only guarranted
272
- * if tick is within the bounds of {max, min} tick-index.
273
- *
274
- * # Parameters
275
- * - `tick_index` - A i32 integer representing the tick integer
276
- *
277
- * # Returns
278
- * - `Ok`: A u128 Q32.64 representing the sqrt_price
279
- */
280
- exports.tickIndexToSqrtPrice = function(tick_index) {
281
- const ret = wasm.tickIndexToSqrtPrice(tick_index);
282
- return takeObject(ret);
283
- };
284
-
285
- /**
286
- * Derive the tick index from a sqrt price. The precision of this method is only guarranted
287
- * if tick is within the bounds of {max, min} tick-index.
288
- *
289
- * # Parameters
290
- * - `sqrt_price` - A u128 integer representing the sqrt price
291
- *
292
- * # Returns
293
- * - `Ok`: A i32 integer representing the tick integer
294
- */
295
- exports.sqrtPriceToTickIndex = function(sqrt_price) {
296
- const ret = wasm.sqrtPriceToTickIndex(addHeapObject(sqrt_price));
297
- return ret;
298
- };
299
-
300
- /**
301
- * Get the initializable tick index.
302
- * If the tick index is already initializable, it is returned as is.
303
- *
304
- * # Parameters
305
- * - `tick_index` - A i32 integer representing the tick integer
306
- * - `tick_spacing` - A i32 integer representing the tick spacing
307
- * - `round_up` - A boolean value indicating if the supplied tick index should be rounded up. None will round to the nearest.
308
- *
309
- * # Returns
310
- * - A i32 integer representing the previous initializable tick index
311
- */
312
- exports.getInitializableTickIndex = function(tick_index, tick_spacing, round_up) {
313
- const ret = wasm.getInitializableTickIndex(tick_index, tick_spacing, isLikeNone(round_up) ? 0xFFFFFF : round_up ? 1 : 0);
314
- return ret;
315
- };
316
-
317
- /**
318
- * Get the previous initializable tick index.
319
- *
320
- * # Parameters
321
- * - `tick_index` - A i32 integer representing the tick integer
322
- * - `tick_spacing` - A i32 integer representing the tick spacing
323
- *
324
- * # Returns
325
- * - A i32 integer representing the previous initializable tick index
326
- */
327
- exports.getPrevInitializableTickIndex = function(tick_index, tick_spacing) {
328
- const ret = wasm.getPrevInitializableTickIndex(tick_index, tick_spacing);
329
- return ret;
330
- };
331
-
332
- /**
333
- * Get the next initializable tick index.
334
- *
335
- * # Parameters
336
- * - `tick_index` - A i32 integer representing the tick integer
337
- * - `tick_spacing` - A i32 integer representing the tick spacing
338
- *
339
- * # Returns
340
- * - A i32 integer representing the next initializable tick index
341
- */
342
- exports.getNextInitializableTickIndex = function(tick_index, tick_spacing) {
343
- const ret = wasm.getNextInitializableTickIndex(tick_index, tick_spacing);
344
- return ret;
345
- };
346
-
347
- /**
348
- * Check if a tick is in-bounds.
349
- *
350
- * # Parameters
351
- * - `tick_index` - A i32 integer representing the tick integer
352
- *
353
- * # Returns
354
- * - A boolean value indicating if the tick is in-bounds
355
- */
356
- exports.isTickIndexInBounds = function(tick_index) {
357
- const ret = wasm.isTickIndexInBounds(tick_index);
358
- return ret !== 0;
359
- };
360
-
361
- /**
362
- * Check if a tick is initializable.
363
- * A tick is initializable if it is divisible by the tick spacing.
364
- *
365
- * # Parameters
366
- * - `tick_index` - A i32 integer representing the tick integer
367
- * - `tick_spacing` - A i32 integer representing the tick spacing
368
- *
369
- * # Returns
370
- * - A boolean value indicating if the tick is initializable
371
- */
372
- exports.isTickInitializable = function(tick_index, tick_spacing) {
373
- const ret = wasm.isTickInitializable(tick_index, tick_spacing);
374
- return ret !== 0;
375
- };
376
-
377
- /**
378
- * Get the tick index for the inverse of the price that this tick represents.
379
- * Eg: Consider tick i where Pb/Pa = 1.0001 ^ i
380
- * inverse of this, i.e. Pa/Pb = 1 / (1.0001 ^ i) = 1.0001^-i
381
- *
382
- * # Parameters
383
- * - `tick_index` - A i32 integer representing the tick integer
384
- *
385
- * # Returns
386
- * - A i32 integer representing the tick index for the inverse of the price
387
- */
388
- exports.invertTickIndex = function(tick_index) {
389
- const ret = wasm.invertTickIndex(tick_index);
390
- return ret;
391
- };
392
-
393
- /**
394
- * Get the sqrt price for the inverse of the price that this tick represents.
395
- * Because converting to a tick index and then back to a sqrt price is lossy,
396
- * this function is clamped to the nearest tick index.
397
- *
398
- * # Parameters
399
- * - `sqrt_price` - A u128 integer representing the sqrt price
400
- *
401
- * # Returns
402
- * - A u128 integer representing the sqrt price for the inverse of the price
403
- */
404
- exports.invertSqrtPrice = function(sqrt_price) {
405
- const ret = wasm.invertSqrtPrice(addHeapObject(sqrt_price));
406
- return takeObject(ret);
407
- };
408
-
409
- /**
410
- * Get the minimum and maximum tick index that can be initialized.
411
- *
412
- * # Parameters
413
- * - `tick_spacing` - A i32 integer representing the tick spacing
414
- *
415
- * # Returns
416
- * - A TickRange struct containing the lower and upper tick index
417
- */
418
- exports.getFullRangeTickIndexes = function(tick_spacing) {
419
- const ret = wasm.getFullRangeTickIndexes(tick_spacing);
420
- return takeObject(ret);
421
- };
422
-
423
- /**
424
- * Order tick indexes in ascending order.
425
- * If the lower tick index is greater than the upper tick index, the indexes are swapped.
426
- * This is useful for ensuring that the lower tick index is always less than the upper tick index.
427
- *
428
- * # Parameters
429
- * - `tick_index_1` - A i32 integer representing the first tick index
430
- * - `tick_index_2` - A i32 integer representing the second tick index
431
- *
432
- * # Returns
433
- * - A TickRange struct containing the lower and upper tick index
434
- */
435
- exports.orderTickIndexes = function(tick_index_1, tick_index_2) {
436
- const ret = wasm.orderTickIndexes(tick_index_1, tick_index_2);
437
- return takeObject(ret);
438
- };
439
-
440
- /**
441
- * Check if a fusion_pool is a full-range only pool.
442
- *
443
- * # Parameters
444
- * - `tick_spacing` - A u16 integer representing the tick spacing
445
- *
446
- * # Returns
447
- * - A boolean value indicating if the fusion_pool is a full-range only pool
448
- */
449
- exports.isFullRangeOnly = function(tick_spacing) {
450
- const ret = wasm.isFullRangeOnly(tick_spacing);
451
- return ret !== 0;
452
- };
453
-
454
- /**
455
- * Get the index of a tick in a tick array.
456
- *
457
- * # Parameters
458
- * - `tick_index` - A i32 integer representing the tick index
459
- * - `tick_array_start_index` - A i32 integer representing the start tick index of the tick array
460
- * - `tick_spacing` - A u16 integer representing the tick spacing
461
- *
462
- * # Returns
463
- * - A u32 integer representing the tick index in the tick array
464
- */
465
- exports.getTickIndexInArray = function(tick_index, tick_array_start_index, tick_spacing) {
466
- try {
467
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
468
- wasm.getTickIndexInArray(retptr, tick_index, tick_array_start_index, tick_spacing);
469
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
470
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
471
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
472
- if (r2) {
473
- throw takeObject(r1);
474
- }
475
- return r0 >>> 0;
476
- } finally {
477
- wasm.__wbindgen_add_to_stack_pointer(16);
478
- }
479
- };
480
-
481
255
  /**
482
256
  * Calculate the amount A delta between two sqrt_prices
483
257
  *
@@ -674,171 +448,344 @@ exports.tryGetMaxAmountWithSlippageTolerance = function(amount, slippage_toleran
674
448
  };
675
449
 
676
450
  /**
677
- * Get the minimum amount with a slippage tolerance
678
- * e.g. Your estimated amount you receive is 10000 with 100 slippage tolerance. The min amount you receive will be 9900.
451
+ * Get the minimum amount with a slippage tolerance
452
+ * e.g. Your estimated amount you receive is 10000 with 100 slippage tolerance. The min amount you receive will be 9900.
453
+ *
454
+ * # Parameters
455
+ * - `amount`: The amount to apply the fee to
456
+ * - `slippage_tolerance_bps`: The slippage tolerance in bps (should be in range 0..BPS_DENOMINATOR)
457
+ *
458
+ * # Returns
459
+ * - `u64`: The minimum amount
460
+ */
461
+ exports.tryGetMinAmountWithSlippageTolerance = function(amount, slippage_tolerance_bps) {
462
+ try {
463
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
464
+ wasm.tryGetMinAmountWithSlippageTolerance(retptr, amount, slippage_tolerance_bps);
465
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
466
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
467
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
468
+ if (r3) {
469
+ throw takeObject(r2);
470
+ }
471
+ return BigInt.asUintN(64, r0);
472
+ } finally {
473
+ wasm.__wbindgen_add_to_stack_pointer(16);
474
+ }
475
+ };
476
+
477
+ /**
478
+ * Apply a swap fee to an amount
479
+ * e.g. You send 10000 amount with 10000 fee rate. The fee amount will be 100.
480
+ * So the amount after fee will be 9900.
481
+ *
482
+ * # Parameters
483
+ * - `amount`: The amount to apply the fee to
484
+ * - `fee_rate`: The fee rate to apply denominated in 1e6
485
+ *
486
+ * # Returns
487
+ * - `u64`: The amount after the fee has been applied
488
+ */
489
+ exports.tryApplySwapFee = function(amount, fee_rate) {
490
+ try {
491
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
492
+ wasm.tryApplySwapFee(retptr, amount, fee_rate);
493
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
494
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
495
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
496
+ if (r3) {
497
+ throw takeObject(r2);
498
+ }
499
+ return BigInt.asUintN(64, r0);
500
+ } finally {
501
+ wasm.__wbindgen_add_to_stack_pointer(16);
502
+ }
503
+ };
504
+
505
+ /**
506
+ * Reverse the application of a swap fee to an amount
507
+ * e.g. You received 9900 amount with 10000 fee rate. The fee amount will be 100.
508
+ * So the amount before fee will be 10000.
509
+ *
510
+ * # Parameters
511
+ * - `amount`: The amount to reverse the fee from
512
+ * - `fee_rate`: The fee rate to reverse denominated in 1e6
513
+ *
514
+ * # Returns
515
+ * - `u64`: The amount before the fee has been applied
516
+ */
517
+ exports.tryReverseApplySwapFee = function(amount, fee_rate) {
518
+ try {
519
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
520
+ wasm.tryReverseApplySwapFee(retptr, amount, fee_rate);
521
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
522
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
523
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
524
+ if (r3) {
525
+ throw takeObject(r2);
526
+ }
527
+ return BigInt.asUintN(64, r0);
528
+ } finally {
529
+ wasm.__wbindgen_add_to_stack_pointer(16);
530
+ }
531
+ };
532
+
533
+ exports._FEE_RATE_MUL_VALUE = function() {
534
+ const ret = wasm._FEE_RATE_MUL_VALUE();
535
+ return ret >>> 0;
536
+ };
537
+
538
+ exports._MAX_PROTOCOL_FEE_RATE = function() {
539
+ const ret = wasm._MAX_PROTOCOL_FEE_RATE();
540
+ return ret;
541
+ };
542
+
543
+ exports._PROTOCOL_FEE_RATE_MUL_VALUE = function() {
544
+ const ret = wasm._PROTOCOL_FEE_RATE_MUL_VALUE();
545
+ return ret;
546
+ };
547
+
548
+ exports._TICK_ARRAY_SIZE = function() {
549
+ const ret = wasm._TICK_ARRAY_SIZE();
550
+ return ret >>> 0;
551
+ };
552
+
553
+ exports._FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD = function() {
554
+ const ret = wasm._FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD();
555
+ return ret;
556
+ };
557
+
558
+ exports._MIN_TICK_INDEX = function() {
559
+ const ret = wasm._MIN_TICK_INDEX();
560
+ return ret;
561
+ };
562
+
563
+ exports._MAX_TICK_INDEX = function() {
564
+ const ret = wasm._MAX_TICK_INDEX();
565
+ return ret;
566
+ };
567
+
568
+ /**
569
+ * Get the first tick index in the tick array that contains the specified tick index.
570
+ *
571
+ * # Parameters
572
+ * - `tick_index` - A i32 integer representing the tick integer
573
+ * - `tick_spacing` - A i32 integer representing the tick spacing
574
+ *
575
+ * # Returns
576
+ * - A i32 integer representing the first tick index in the tick array
577
+ */
578
+ exports.getTickArrayStartTickIndex = function(tick_index, tick_spacing) {
579
+ const ret = wasm.getTickArrayStartTickIndex(tick_index, tick_spacing);
580
+ return ret;
581
+ };
582
+
583
+ /**
584
+ * Derive the sqrt-price from a tick index. The precision of this method is only guarranted
585
+ * if tick is within the bounds of {max, min} tick-index.
586
+ *
587
+ * # Parameters
588
+ * - `tick_index` - A i32 integer representing the tick integer
589
+ *
590
+ * # Returns
591
+ * - `Ok`: A u128 Q32.64 representing the sqrt_price
592
+ */
593
+ exports.tickIndexToSqrtPrice = function(tick_index) {
594
+ const ret = wasm.tickIndexToSqrtPrice(tick_index);
595
+ return takeObject(ret);
596
+ };
597
+
598
+ /**
599
+ * Derive the tick index from a sqrt price. The precision of this method is only guarranted
600
+ * if tick is within the bounds of {max, min} tick-index.
601
+ *
602
+ * # Parameters
603
+ * - `sqrt_price` - A u128 integer representing the sqrt price
604
+ *
605
+ * # Returns
606
+ * - `Ok`: A i32 integer representing the tick integer
607
+ */
608
+ exports.sqrtPriceToTickIndex = function(sqrt_price) {
609
+ const ret = wasm.sqrtPriceToTickIndex(addHeapObject(sqrt_price));
610
+ return ret;
611
+ };
612
+
613
+ /**
614
+ * Get the initializable tick index.
615
+ * If the tick index is already initializable, it is returned as is.
616
+ *
617
+ * # Parameters
618
+ * - `tick_index` - A i32 integer representing the tick integer
619
+ * - `tick_spacing` - A i32 integer representing the tick spacing
620
+ * - `round_up` - A boolean value indicating if the supplied tick index should be rounded up. None will round to the nearest.
621
+ *
622
+ * # Returns
623
+ * - A i32 integer representing the previous initializable tick index
624
+ */
625
+ exports.getInitializableTickIndex = function(tick_index, tick_spacing, round_up) {
626
+ const ret = wasm.getInitializableTickIndex(tick_index, tick_spacing, isLikeNone(round_up) ? 0xFFFFFF : round_up ? 1 : 0);
627
+ return ret;
628
+ };
629
+
630
+ /**
631
+ * Get the previous initializable tick index.
632
+ *
633
+ * # Parameters
634
+ * - `tick_index` - A i32 integer representing the tick integer
635
+ * - `tick_spacing` - A i32 integer representing the tick spacing
636
+ *
637
+ * # Returns
638
+ * - A i32 integer representing the previous initializable tick index
639
+ */
640
+ exports.getPrevInitializableTickIndex = function(tick_index, tick_spacing) {
641
+ const ret = wasm.getPrevInitializableTickIndex(tick_index, tick_spacing);
642
+ return ret;
643
+ };
644
+
645
+ /**
646
+ * Get the next initializable tick index.
647
+ *
648
+ * # Parameters
649
+ * - `tick_index` - A i32 integer representing the tick integer
650
+ * - `tick_spacing` - A i32 integer representing the tick spacing
651
+ *
652
+ * # Returns
653
+ * - A i32 integer representing the next initializable tick index
654
+ */
655
+ exports.getNextInitializableTickIndex = function(tick_index, tick_spacing) {
656
+ const ret = wasm.getNextInitializableTickIndex(tick_index, tick_spacing);
657
+ return ret;
658
+ };
659
+
660
+ /**
661
+ * Check if a tick is in-bounds.
662
+ *
663
+ * # Parameters
664
+ * - `tick_index` - A i32 integer representing the tick integer
665
+ *
666
+ * # Returns
667
+ * - A boolean value indicating if the tick is in-bounds
668
+ */
669
+ exports.isTickIndexInBounds = function(tick_index) {
670
+ const ret = wasm.isTickIndexInBounds(tick_index);
671
+ return ret !== 0;
672
+ };
673
+
674
+ /**
675
+ * Check if a tick is initializable.
676
+ * A tick is initializable if it is divisible by the tick spacing.
677
+ *
678
+ * # Parameters
679
+ * - `tick_index` - A i32 integer representing the tick integer
680
+ * - `tick_spacing` - A i32 integer representing the tick spacing
681
+ *
682
+ * # Returns
683
+ * - A boolean value indicating if the tick is initializable
684
+ */
685
+ exports.isTickInitializable = function(tick_index, tick_spacing) {
686
+ const ret = wasm.isTickInitializable(tick_index, tick_spacing);
687
+ return ret !== 0;
688
+ };
689
+
690
+ /**
691
+ * Get the tick index for the inverse of the price that this tick represents.
692
+ * Eg: Consider tick i where Pb/Pa = 1.0001 ^ i
693
+ * inverse of this, i.e. Pa/Pb = 1 / (1.0001 ^ i) = 1.0001^-i
679
694
  *
680
695
  * # Parameters
681
- * - `amount`: The amount to apply the fee to
682
- * - `slippage_tolerance_bps`: The slippage tolerance in bps (should be in range 0..BPS_DENOMINATOR)
696
+ * - `tick_index` - A i32 integer representing the tick integer
683
697
  *
684
698
  * # Returns
685
- * - `u64`: The minimum amount
699
+ * - A i32 integer representing the tick index for the inverse of the price
686
700
  */
687
- exports.tryGetMinAmountWithSlippageTolerance = function(amount, slippage_tolerance_bps) {
688
- try {
689
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
690
- wasm.tryGetMinAmountWithSlippageTolerance(retptr, amount, slippage_tolerance_bps);
691
- var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
692
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
693
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
694
- if (r3) {
695
- throw takeObject(r2);
696
- }
697
- return BigInt.asUintN(64, r0);
698
- } finally {
699
- wasm.__wbindgen_add_to_stack_pointer(16);
700
- }
701
+ exports.invertTickIndex = function(tick_index) {
702
+ const ret = wasm.invertTickIndex(tick_index);
703
+ return ret;
701
704
  };
702
705
 
703
706
  /**
704
- * Apply a swap fee to an amount
705
- * e.g. You send 10000 amount with 10000 fee rate. The fee amount will be 100.
706
- * So the amount after fee will be 9900.
707
+ * Get the sqrt price for the inverse of the price that this tick represents.
708
+ * Because converting to a tick index and then back to a sqrt price is lossy,
709
+ * this function is clamped to the nearest tick index.
707
710
  *
708
711
  * # Parameters
709
- * - `amount`: The amount to apply the fee to
710
- * - `fee_rate`: The fee rate to apply denominated in 1e6
712
+ * - `sqrt_price` - A u128 integer representing the sqrt price
711
713
  *
712
714
  * # Returns
713
- * - `u64`: The amount after the fee has been applied
715
+ * - A u128 integer representing the sqrt price for the inverse of the price
714
716
  */
715
- exports.tryApplySwapFee = function(amount, fee_rate) {
716
- try {
717
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
718
- wasm.tryApplySwapFee(retptr, amount, fee_rate);
719
- var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
720
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
721
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
722
- if (r3) {
723
- throw takeObject(r2);
724
- }
725
- return BigInt.asUintN(64, r0);
726
- } finally {
727
- wasm.__wbindgen_add_to_stack_pointer(16);
728
- }
717
+ exports.invertSqrtPrice = function(sqrt_price) {
718
+ const ret = wasm.invertSqrtPrice(addHeapObject(sqrt_price));
719
+ return takeObject(ret);
729
720
  };
730
721
 
731
722
  /**
732
- * Reverse the application of a swap fee to an amount
733
- * e.g. You received 9900 amount with 10000 fee rate. The fee amount will be 100.
734
- * So the amount before fee will be 10000.
723
+ * Get the minimum and maximum tick index that can be initialized.
735
724
  *
736
725
  * # Parameters
737
- * - `amount`: The amount to reverse the fee from
738
- * - `fee_rate`: The fee rate to reverse denominated in 1e6
726
+ * - `tick_spacing` - A i32 integer representing the tick spacing
739
727
  *
740
728
  * # Returns
741
- * - `u64`: The amount before the fee has been applied
729
+ * - A TickRange struct containing the lower and upper tick index
742
730
  */
743
- exports.tryReverseApplySwapFee = function(amount, fee_rate) {
744
- try {
745
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
746
- wasm.tryReverseApplySwapFee(retptr, amount, fee_rate);
747
- var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
748
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
749
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
750
- if (r3) {
751
- throw takeObject(r2);
752
- }
753
- return BigInt.asUintN(64, r0);
754
- } finally {
755
- wasm.__wbindgen_add_to_stack_pointer(16);
756
- }
731
+ exports.getFullRangeTickIndexes = function(tick_spacing) {
732
+ const ret = wasm.getFullRangeTickIndexes(tick_spacing);
733
+ return takeObject(ret);
757
734
  };
758
735
 
759
736
  /**
760
- * Computes the limit order output amount by input amount.
761
- * ### Parameters
762
- * - `amount_in` - The input token amount of a limit order.
763
- * - `a_to_b_order` - The limit order direction.
764
- * - `tick_index` - The tick index of an order.
765
- * - `fusion_pool` - The fusion_pool state.
737
+ * Order tick indexes in ascending order.
738
+ * If the lower tick index is greater than the upper tick index, the indexes are swapped.
739
+ * This is useful for ensuring that the lower tick index is always less than the upper tick index.
740
+ *
741
+ * # Parameters
742
+ * - `tick_index_1` - A i32 integer representing the first tick index
743
+ * - `tick_index_2` - A i32 integer representing the second tick index
744
+ *
745
+ * # Returns
746
+ * - A TickRange struct containing the lower and upper tick index
766
747
  */
767
- exports.limitOrderQuoteByInputToken = function(amount_in, a_to_b_order, tick_index, fusion_pool) {
768
- try {
769
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
770
- wasm.limitOrderQuoteByInputToken(retptr, amount_in, a_to_b_order, tick_index, addHeapObject(fusion_pool));
771
- var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
772
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
773
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
774
- if (r3) {
775
- throw takeObject(r2);
776
- }
777
- return BigInt.asUintN(64, r0);
778
- } finally {
779
- wasm.__wbindgen_add_to_stack_pointer(16);
780
- }
748
+ exports.orderTickIndexes = function(tick_index_1, tick_index_2) {
749
+ const ret = wasm.orderTickIndexes(tick_index_1, tick_index_2);
750
+ return takeObject(ret);
781
751
  };
782
752
 
783
753
  /**
784
- * Computes the limit order input amount by output amount.
785
- * ### Parameters
786
- * - `amount_out` - The output token amount of a limit order.
787
- * - `a_to_b_order` - The limit order direction.
788
- * - `tick_index` - The tick index of an order.
789
- * - `fusion_pool` - The fusion_pool state.
754
+ * Check if a fusion_pool is a full-range only pool.
755
+ *
756
+ * # Parameters
757
+ * - `tick_spacing` - A u16 integer representing the tick spacing
758
+ *
759
+ * # Returns
760
+ * - A boolean value indicating if the fusion_pool is a full-range only pool
790
761
  */
791
- exports.limitOrderQuoteByOutputToken = function(amount_out, a_to_b_order, tick_index, fusion_pool) {
792
- try {
793
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
794
- wasm.limitOrderQuoteByOutputToken(retptr, amount_out, a_to_b_order, tick_index, addHeapObject(fusion_pool));
795
- var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
796
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
797
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
798
- if (r3) {
799
- throw takeObject(r2);
800
- }
801
- return BigInt.asUintN(64, r0);
802
- } finally {
803
- wasm.__wbindgen_add_to_stack_pointer(16);
804
- }
762
+ exports.isFullRangeOnly = function(tick_spacing) {
763
+ const ret = wasm.isFullRangeOnly(tick_spacing);
764
+ return ret !== 0;
805
765
  };
806
766
 
807
767
  /**
808
- * Computes the limit order reward by input amount.
809
- * ### Parameters
810
- * - `amount_out` - The output token amount of a limit order (swap input).
811
- * - `a_to_b_order` - The limit order direction.
812
- * - `tick_index` - The tick index of an order.
813
- * - `fusion_pool` - The fusion_pool state.
768
+ * Get the index of a tick in a tick array.
769
+ *
770
+ * # Parameters
771
+ * - `tick_index` - A i32 integer representing the tick index
772
+ * - `tick_array_start_index` - A i32 integer representing the start tick index of the tick array
773
+ * - `tick_spacing` - A u16 integer representing the tick spacing
774
+ *
775
+ * # Returns
776
+ * - A u32 integer representing the tick index in the tick array
814
777
  */
815
- exports.limitOrderRewardByOutputToken = function(amount_out, fee_rate, protocol_fee_rate) {
816
- try {
817
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
818
- wasm.limitOrderRewardByOutputToken(retptr, amount_out, fee_rate, protocol_fee_rate);
819
- var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
820
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
821
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
822
- if (r3) {
823
- throw takeObject(r2);
824
- }
825
- return BigInt.asUintN(64, r0);
826
- } finally {
827
- wasm.__wbindgen_add_to_stack_pointer(16);
828
- }
829
- };
830
-
831
- exports.decreaseLimitOrderQuote = function(fusion_pool, limit_order, tick, amount, transfer_fee_a, transfer_fee_b) {
778
+ exports.getTickIndexInArray = function(tick_index, tick_array_start_index, tick_spacing) {
832
779
  try {
833
780
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
834
- wasm.decreaseLimitOrderQuote(retptr, addHeapObject(fusion_pool), addHeapObject(limit_order), addHeapObject(tick), amount, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
781
+ wasm.getTickIndexInArray(retptr, tick_index, tick_array_start_index, tick_spacing);
835
782
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
836
783
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
837
784
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
838
785
  if (r2) {
839
786
  throw takeObject(r1);
840
787
  }
841
- return takeObject(r0);
788
+ return r0 >>> 0;
842
789
  } finally {
843
790
  wasm.__wbindgen_add_to_stack_pointer(16);
844
791
  }
@@ -1147,114 +1094,92 @@ exports.limitOrderFee = function(fusion_pool) {
1147
1094
  return ret;
1148
1095
  };
1149
1096
 
1150
- exports._TICK_ARRAY_SIZE = function() {
1151
- const ret = wasm._TICK_ARRAY_SIZE();
1152
- return ret >>> 0;
1153
- };
1154
-
1155
- exports._FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD = function() {
1156
- const ret = wasm._FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD();
1157
- return ret;
1158
- };
1159
-
1160
- exports._MIN_TICK_INDEX = function() {
1161
- const ret = wasm._MIN_TICK_INDEX();
1162
- return ret;
1163
- };
1164
-
1165
- exports._MAX_TICK_INDEX = function() {
1166
- const ret = wasm._MAX_TICK_INDEX();
1167
- return ret;
1168
- };
1169
-
1170
- /**
1171
- * Convert a price into a sqrt priceX64
1172
- * IMPORTANT: floating point operations can reduce the precision of the result.
1173
- * Make sure to do these operations last and not to use the result for further calculations.
1174
- *
1175
- * # Parameters
1176
- * * `price` - The price to convert
1177
- * * `decimals_a` - The number of decimals of the base token
1178
- * * `decimals_b` - The number of decimals of the quote token
1179
- *
1180
- * # Returns
1181
- * * `u128` - The sqrt priceX64
1182
- */
1183
- exports.priceToSqrtPrice = function(price, decimals_a, decimals_b) {
1184
- const ret = wasm.priceToSqrtPrice(price, decimals_a, decimals_b);
1185
- return takeObject(ret);
1186
- };
1187
-
1188
1097
  /**
1189
- * Convert a sqrt priceX64 into a tick index
1190
- * IMPORTANT: floating point operations can reduce the precision of the result.
1191
- * Make sure to do these operations last and not to use the result for further calculations.
1192
- *
1193
- * # Parameters
1194
- * * `sqrt_price` - The sqrt priceX64 to convert
1195
- * * `decimals_a` - The number of decimals of the base token
1196
- * * `decimals_b` - The number of decimals of the quote token
1197
- *
1198
- * # Returns
1199
- * * `f64` - The decimal price
1098
+ * Computes the limit order output amount by input amount.
1099
+ * ### Parameters
1100
+ * - `amount_in` - The input token amount of a limit order.
1101
+ * - `a_to_b_order` - The limit order direction.
1102
+ * - `tick_index` - The tick index of an order.
1103
+ * - `fusion_pool` - The fusion_pool state.
1200
1104
  */
1201
- exports.sqrtPriceToPrice = function(sqrt_price, decimals_a, decimals_b) {
1202
- const ret = wasm.sqrtPriceToPrice(addHeapObject(sqrt_price), decimals_a, decimals_b);
1203
- return ret;
1105
+ exports.limitOrderQuoteByInputToken = function(amount_in, a_to_b_order, tick_index, fusion_pool) {
1106
+ try {
1107
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1108
+ wasm.limitOrderQuoteByInputToken(retptr, amount_in, a_to_b_order, tick_index, addHeapObject(fusion_pool));
1109
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
1110
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1111
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1112
+ if (r3) {
1113
+ throw takeObject(r2);
1114
+ }
1115
+ return BigInt.asUintN(64, r0);
1116
+ } finally {
1117
+ wasm.__wbindgen_add_to_stack_pointer(16);
1118
+ }
1204
1119
  };
1205
1120
 
1206
1121
  /**
1207
- * Invert a price
1208
- * IMPORTANT: floating point operations can reduce the precision of the result.
1209
- * Make sure to do these operations last and not to use the result for further calculations.
1210
- *
1211
- * # Parameters
1212
- * * `price` - The price to invert
1213
- * * `decimals_a` - The number of decimals of the base token
1214
- * * `decimals_b` - The number of decimals of the quote token
1215
- *
1216
- * # Returns
1217
- * * `f64` - The inverted price
1122
+ * Computes the limit order input amount by output amount.
1123
+ * ### Parameters
1124
+ * - `amount_out` - The output token amount of a limit order.
1125
+ * - `a_to_b_order` - The limit order direction.
1126
+ * - `tick_index` - The tick index of an order.
1127
+ * - `fusion_pool` - The fusion_pool state.
1218
1128
  */
1219
- exports.invertPrice = function(price, decimals_a, decimals_b) {
1220
- const ret = wasm.invertPrice(price, decimals_a, decimals_b);
1221
- return ret;
1129
+ exports.limitOrderQuoteByOutputToken = function(amount_out, a_to_b_order, tick_index, fusion_pool) {
1130
+ try {
1131
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1132
+ wasm.limitOrderQuoteByOutputToken(retptr, amount_out, a_to_b_order, tick_index, addHeapObject(fusion_pool));
1133
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
1134
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1135
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1136
+ if (r3) {
1137
+ throw takeObject(r2);
1138
+ }
1139
+ return BigInt.asUintN(64, r0);
1140
+ } finally {
1141
+ wasm.__wbindgen_add_to_stack_pointer(16);
1142
+ }
1222
1143
  };
1223
1144
 
1224
1145
  /**
1225
- * Convert a tick index into a price
1226
- * IMPORTANT: floating point operations can reduce the precision of the result.
1227
- * Make sure to do these operations last and not to use the result for further calculations.
1228
- *
1229
- * # Parameters
1230
- * * `tick_index` - The tick index to convert
1231
- * * `decimals_a` - The number of decimals of the base token
1232
- * * `decimals_b` - The number of decimals of the quote token
1233
- *
1234
- * # Returns
1235
- * * `f64` - The decimal price
1146
+ * Computes the limit order reward by input amount.
1147
+ * ### Parameters
1148
+ * - `amount_out` - The output token amount of a limit order (swap input).
1149
+ * - `a_to_b_order` - The limit order direction.
1150
+ * - `tick_index` - The tick index of an order.
1151
+ * - `fusion_pool` - The fusion_pool state.
1236
1152
  */
1237
- exports.tickIndexToPrice = function(tick_index, decimals_a, decimals_b) {
1238
- const ret = wasm.tickIndexToPrice(tick_index, decimals_a, decimals_b);
1239
- return ret;
1153
+ exports.limitOrderRewardByOutputToken = function(amount_out, fee_rate, protocol_fee_rate) {
1154
+ try {
1155
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1156
+ wasm.limitOrderRewardByOutputToken(retptr, amount_out, fee_rate, protocol_fee_rate);
1157
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
1158
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1159
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1160
+ if (r3) {
1161
+ throw takeObject(r2);
1162
+ }
1163
+ return BigInt.asUintN(64, r0);
1164
+ } finally {
1165
+ wasm.__wbindgen_add_to_stack_pointer(16);
1166
+ }
1240
1167
  };
1241
1168
 
1242
- /**
1243
- * Convert a price into a tick index
1244
- * IMPORTANT: floating point operations can reduce the precision of the result.
1245
- * Make sure to do these operations last and not to use the result for further calculations.
1246
- *
1247
- * # Parameters
1248
- * * `price` - The price to convert
1249
- * * `decimals_a` - The number of decimals of the base token
1250
- * * `decimals_b` - The number of decimals of the quote token
1251
- *
1252
- * # Returns
1253
- * * `i32` - The tick index
1254
- */
1255
- exports.priceToTickIndex = function(price, decimals_a, decimals_b) {
1256
- const ret = wasm.priceToTickIndex(price, decimals_a, decimals_b);
1257
- return ret;
1169
+ exports.decreaseLimitOrderQuote = function(fusion_pool, limit_order, tick, amount, transfer_fee_a, transfer_fee_b) {
1170
+ try {
1171
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1172
+ wasm.decreaseLimitOrderQuote(retptr, addHeapObject(fusion_pool), addHeapObject(limit_order), addHeapObject(tick), amount, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
1173
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1174
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1175
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1176
+ if (r2) {
1177
+ throw takeObject(r1);
1178
+ }
1179
+ return takeObject(r0);
1180
+ } finally {
1181
+ wasm.__wbindgen_add_to_stack_pointer(16);
1182
+ }
1258
1183
  };
1259
1184
 
1260
1185
  exports._POSITION_BUNDLE_SIZE = function() {
@@ -1466,21 +1391,6 @@ exports._LIMIT_ORDER_AND_POOL_ARE_OUT_OF_SYNC = function() {
1466
1391
  }
1467
1392
  };
1468
1393
 
1469
- exports._FEE_RATE_MUL_VALUE = function() {
1470
- const ret = wasm._FEE_RATE_MUL_VALUE();
1471
- return ret >>> 0;
1472
- };
1473
-
1474
- exports._MAX_PROTOCOL_FEE_RATE = function() {
1475
- const ret = wasm._MAX_PROTOCOL_FEE_RATE();
1476
- return ret;
1477
- };
1478
-
1479
- exports._PROTOCOL_FEE_RATE_MUL_VALUE = function() {
1480
- const ret = wasm._PROTOCOL_FEE_RATE_MUL_VALUE();
1481
- return ret;
1482
- };
1483
-
1484
1394
  /**
1485
1395
  * Get the first unoccupied position in a bundle
1486
1396
  *
@@ -1583,6 +1493,96 @@ exports.positionRatioX64 = function(current_sqrt_price, tick_index_1, tick_index
1583
1493
  return takeObject(ret);
1584
1494
  };
1585
1495
 
1496
+ /**
1497
+ * Convert a price into a sqrt priceX64
1498
+ * IMPORTANT: floating point operations can reduce the precision of the result.
1499
+ * Make sure to do these operations last and not to use the result for further calculations.
1500
+ *
1501
+ * # Parameters
1502
+ * * `price` - The price to convert
1503
+ * * `decimals_a` - The number of decimals of the base token
1504
+ * * `decimals_b` - The number of decimals of the quote token
1505
+ *
1506
+ * # Returns
1507
+ * * `u128` - The sqrt priceX64
1508
+ */
1509
+ exports.priceToSqrtPrice = function(price, decimals_a, decimals_b) {
1510
+ const ret = wasm.priceToSqrtPrice(price, decimals_a, decimals_b);
1511
+ return takeObject(ret);
1512
+ };
1513
+
1514
+ /**
1515
+ * Convert a sqrt priceX64 into a tick index
1516
+ * IMPORTANT: floating point operations can reduce the precision of the result.
1517
+ * Make sure to do these operations last and not to use the result for further calculations.
1518
+ *
1519
+ * # Parameters
1520
+ * * `sqrt_price` - The sqrt priceX64 to convert
1521
+ * * `decimals_a` - The number of decimals of the base token
1522
+ * * `decimals_b` - The number of decimals of the quote token
1523
+ *
1524
+ * # Returns
1525
+ * * `f64` - The decimal price
1526
+ */
1527
+ exports.sqrtPriceToPrice = function(sqrt_price, decimals_a, decimals_b) {
1528
+ const ret = wasm.sqrtPriceToPrice(addHeapObject(sqrt_price), decimals_a, decimals_b);
1529
+ return ret;
1530
+ };
1531
+
1532
+ /**
1533
+ * Invert a price
1534
+ * IMPORTANT: floating point operations can reduce the precision of the result.
1535
+ * Make sure to do these operations last and not to use the result for further calculations.
1536
+ *
1537
+ * # Parameters
1538
+ * * `price` - The price to invert
1539
+ * * `decimals_a` - The number of decimals of the base token
1540
+ * * `decimals_b` - The number of decimals of the quote token
1541
+ *
1542
+ * # Returns
1543
+ * * `f64` - The inverted price
1544
+ */
1545
+ exports.invertPrice = function(price, decimals_a, decimals_b) {
1546
+ const ret = wasm.invertPrice(price, decimals_a, decimals_b);
1547
+ return ret;
1548
+ };
1549
+
1550
+ /**
1551
+ * Convert a tick index into a price
1552
+ * IMPORTANT: floating point operations can reduce the precision of the result.
1553
+ * Make sure to do these operations last and not to use the result for further calculations.
1554
+ *
1555
+ * # Parameters
1556
+ * * `tick_index` - The tick index to convert
1557
+ * * `decimals_a` - The number of decimals of the base token
1558
+ * * `decimals_b` - The number of decimals of the quote token
1559
+ *
1560
+ * # Returns
1561
+ * * `f64` - The decimal price
1562
+ */
1563
+ exports.tickIndexToPrice = function(tick_index, decimals_a, decimals_b) {
1564
+ const ret = wasm.tickIndexToPrice(tick_index, decimals_a, decimals_b);
1565
+ return ret;
1566
+ };
1567
+
1568
+ /**
1569
+ * Convert a price into a tick index
1570
+ * IMPORTANT: floating point operations can reduce the precision of the result.
1571
+ * Make sure to do these operations last and not to use the result for further calculations.
1572
+ *
1573
+ * # Parameters
1574
+ * * `price` - The price to convert
1575
+ * * `decimals_a` - The number of decimals of the base token
1576
+ * * `decimals_b` - The number of decimals of the quote token
1577
+ *
1578
+ * # Returns
1579
+ * * `i32` - The tick index
1580
+ */
1581
+ exports.priceToTickIndex = function(price, decimals_a, decimals_b) {
1582
+ const ret = wasm.priceToTickIndex(price, decimals_a, decimals_b);
1583
+ return ret;
1584
+ };
1585
+
1586
1586
  /**
1587
1587
  * Computes the exact input or output amount for a swap transaction.
1588
1588
  *
@@ -1645,6 +1645,64 @@ exports.swapQuoteByOutputToken = function(token_out, specified_token_a, slippage
1645
1645
  }
1646
1646
  };
1647
1647
 
1648
+ /**
1649
+ * Computes the liquidation prices for an existing position.
1650
+ *
1651
+ * # Parameters
1652
+ * - `tick_lower_index`: The lower tick index of the position.
1653
+ * - `tick_upper_index`: The upper tick index of the position.
1654
+ * - `leftovers_a`: The amount of leftovers A in the position.
1655
+ * - `leftovers_a`: The amount of leftovers B in the position.
1656
+ * - `liquidity`: Liquidity of the position.
1657
+ * - `debt_a`: The amount of tokens A borrowed.
1658
+ * - `debt_b`: The amount of tokens B borrowed.
1659
+ * - `liquidation_threshold`: The liquidation threshold of the market.
1660
+ *
1661
+ * # Returns
1662
+ * - `LiquidationPrices`: An object containing lower/upper liquidation prices.
1663
+ */
1664
+ exports.getLpPositionLiquidationPrices = function(tick_lower_index, tick_upper_index, liquidity, leftovers_a, leftovers_b, debt_a, debt_b, liquidation_threshold) {
1665
+ try {
1666
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1667
+ wasm.getLpPositionLiquidationPrices(retptr, tick_lower_index, tick_upper_index, addHeapObject(liquidity), leftovers_a, leftovers_b, debt_a, debt_b, liquidation_threshold);
1668
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1669
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1670
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1671
+ if (r2) {
1672
+ throw takeObject(r1);
1673
+ }
1674
+ return takeObject(r0);
1675
+ } finally {
1676
+ wasm.__wbindgen_add_to_stack_pointer(16);
1677
+ }
1678
+ };
1679
+
1680
+ exports.getIncreaseLpPositionQuote = function(args) {
1681
+ try {
1682
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1683
+ wasm.getIncreaseLpPositionQuote(retptr, addHeapObject(args));
1684
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1685
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1686
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1687
+ if (r2) {
1688
+ throw takeObject(r1);
1689
+ }
1690
+ return takeObject(r0);
1691
+ } finally {
1692
+ wasm.__wbindgen_add_to_stack_pointer(16);
1693
+ }
1694
+ };
1695
+
1696
+ exports._HUNDRED_PERCENT = function() {
1697
+ const ret = wasm._HUNDRED_PERCENT();
1698
+ return ret >>> 0;
1699
+ };
1700
+
1701
+ exports._COMPUTED_AMOUNT = function() {
1702
+ const ret = wasm._COMPUTED_AMOUNT();
1703
+ return BigInt.asUintN(64, ret);
1704
+ };
1705
+
1648
1706
  /**
1649
1707
  * Spot position increase quote
1650
1708
  *
@@ -1711,10 +1769,10 @@ exports.getDecreaseSpotPositionQuote = function(decrease_amount, collateral_toke
1711
1769
  * # Returns
1712
1770
  * - `f64`: Decimal liquidation price
1713
1771
  */
1714
- exports.getLiquidationPrice = function(position_token, amount, debt, liquidation_threshold) {
1772
+ exports.getSpotPositionLiquidationPrice = function(position_token, amount, debt, liquidation_threshold) {
1715
1773
  try {
1716
1774
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1717
- wasm.getLiquidationPrice(retptr, position_token, amount, debt, liquidation_threshold);
1775
+ wasm.getSpotPositionLiquidationPrice(retptr, position_token, amount, debt, liquidation_threshold);
1718
1776
  var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
1719
1777
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1720
1778
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
@@ -1760,11 +1818,16 @@ exports.getTradableAmount = function(collateral_token, available_balance, levera
1760
1818
  }
1761
1819
  };
1762
1820
 
1763
- exports.calculateTunaProtocolFee = function(collateral_token, borrowed_token, collateral, borrow, protocol_fee_rate_on_collateral, protocol_fee_rate) {
1764
- const ret = wasm.calculateTunaProtocolFee(collateral_token, borrowed_token, collateral, borrow, protocol_fee_rate_on_collateral, protocol_fee_rate);
1821
+ exports.calculateTunaSpotPositionProtocolFee = function(collateral_token, borrowed_token, collateral, borrow, protocol_fee_rate_on_collateral, protocol_fee_rate) {
1822
+ const ret = wasm.calculateTunaSpotPositionProtocolFee(collateral_token, borrowed_token, collateral, borrow, protocol_fee_rate_on_collateral, protocol_fee_rate);
1765
1823
  return takeObject(ret);
1766
1824
  };
1767
1825
 
1826
+ exports.calculateTunaProtocolFee = function(collateral, borrow, protocol_fee_rate_on_collateral, protocol_fee_rate) {
1827
+ const ret = wasm.calculateTunaProtocolFee(collateral, borrow, protocol_fee_rate_on_collateral, protocol_fee_rate);
1828
+ return BigInt.asUintN(64, ret);
1829
+ };
1830
+
1768
1831
  exports._INVALID_ARGUMENTS = function() {
1769
1832
  try {
1770
1833
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -1808,16 +1871,16 @@ exports.solana_program_init = function() {
1808
1871
  wasm.solana_program_init();
1809
1872
  };
1810
1873
 
1811
- function __wasm_bindgen_func_elem_3103(arg0, arg1) {
1812
- wasm.__wasm_bindgen_func_elem_3103(arg0, arg1);
1874
+ function __wasm_bindgen_func_elem_2635(arg0, arg1, arg2) {
1875
+ wasm.__wasm_bindgen_func_elem_2635(arg0, arg1, addHeapObject(arg2));
1813
1876
  }
1814
1877
 
1815
- function __wasm_bindgen_func_elem_3312(arg0, arg1, arg2) {
1816
- wasm.__wasm_bindgen_func_elem_3312(arg0, arg1, addHeapObject(arg2));
1878
+ function __wasm_bindgen_func_elem_3208(arg0, arg1) {
1879
+ wasm.__wasm_bindgen_func_elem_3208(arg0, arg1);
1817
1880
  }
1818
1881
 
1819
- function __wasm_bindgen_func_elem_480(arg0, arg1, arg2, arg3) {
1820
- wasm.__wasm_bindgen_func_elem_480(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1882
+ function __wasm_bindgen_func_elem_495(arg0, arg1, arg2, arg3) {
1883
+ wasm.__wasm_bindgen_func_elem_495(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1821
1884
  }
1822
1885
 
1823
1886
  const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
@@ -2996,7 +3059,7 @@ exports.__wbg_new_3c3d849046688a66 = function(arg0, arg1) {
2996
3059
  const a = state0.a;
2997
3060
  state0.a = 0;
2998
3061
  try {
2999
- return __wasm_bindgen_func_elem_480(a, state0.b, arg0, arg1);
3062
+ return __wasm_bindgen_func_elem_495(a, state0.b, arg0, arg1);
3000
3063
  } finally {
3001
3064
  state0.a = a;
3002
3065
  }
@@ -3240,21 +3303,27 @@ exports.__wbg_warn_1d74dddbe2fd1dbb = function(arg0) {
3240
3303
  console.warn(getObject(arg0));
3241
3304
  };
3242
3305
 
3306
+ exports.__wbindgen_cast_0660a350899916ec = function(arg0, arg1) {
3307
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3308
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3204, __wasm_bindgen_func_elem_3208);
3309
+ return addHeapObject(ret);
3310
+ };
3311
+
3243
3312
  exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
3244
3313
  // Cast intrinsic for `Ref(String) -> Externref`.
3245
3314
  const ret = getStringFromWasm0(arg0, arg1);
3246
3315
  return addHeapObject(ret);
3247
3316
  };
3248
3317
 
3249
- exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
3250
- // Cast intrinsic for `U64 -> Externref`.
3251
- const ret = BigInt.asUintN(64, arg0);
3318
+ exports.__wbindgen_cast_2e5f7f1574aa20c6 = function(arg0, arg1) {
3319
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 232, function: Function { arguments: [Externref], shim_idx: 227, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3320
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_2654, __wasm_bindgen_func_elem_2635);
3252
3321
  return addHeapObject(ret);
3253
3322
  };
3254
3323
 
3255
- exports.__wbindgen_cast_829978f7e672581b = function(arg0, arg1) {
3256
- // Cast intrinsic for `Closure(Closure { dtor_idx: 337, function: Function { arguments: [], shim_idx: 338, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3257
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3099, __wasm_bindgen_func_elem_3103);
3324
+ exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
3325
+ // Cast intrinsic for `U64 -> Externref`.
3326
+ const ret = BigInt.asUintN(64, arg0);
3258
3327
  return addHeapObject(ret);
3259
3328
  };
3260
3329
 
@@ -3276,12 +3345,6 @@ exports.__wbindgen_cast_e7b45dd881f38ce3 = function(arg0, arg1) {
3276
3345
  return addHeapObject(ret);
3277
3346
  };
3278
3347
 
3279
- exports.__wbindgen_cast_e9643297b4d6a498 = function(arg0, arg1) {
3280
- // Cast intrinsic for `Closure(Closure { dtor_idx: 372, function: Function { arguments: [Externref], shim_idx: 383, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3281
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3285, __wasm_bindgen_func_elem_3312);
3282
- return addHeapObject(ret);
3283
- };
3284
-
3285
3348
  exports.__wbindgen_object_clone_ref = function(arg0) {
3286
3349
  const ret = getObject(arg0);
3287
3350
  return addHeapObject(ret);