@orca-so/whirlpools-core 0.3.1 → 0.3.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.
@@ -22,6 +22,35 @@ function getStringFromWasm0(ptr, len) {
22
22
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
23
23
  }
24
24
 
25
+ const heap = new Array(128).fill(undefined);
26
+
27
+ heap.push(undefined, null, true, false);
28
+
29
+ let heap_next = heap.length;
30
+
31
+ function addHeapObject(obj) {
32
+ if (heap_next === heap.length) heap.push(heap.length + 1);
33
+ const idx = heap_next;
34
+ heap_next = heap[idx];
35
+
36
+ heap[idx] = obj;
37
+ return idx;
38
+ }
39
+
40
+ function getObject(idx) { return heap[idx]; }
41
+
42
+ function dropObject(idx) {
43
+ if (idx < 132) return;
44
+ heap[idx] = heap_next;
45
+ heap_next = idx;
46
+ }
47
+
48
+ function takeObject(idx) {
49
+ const ret = getObject(idx);
50
+ dropObject(idx);
51
+ return ret;
52
+ }
53
+
25
54
  let WASM_VECTOR_LEN = 0;
26
55
 
27
56
  let cachedTextEncoder = new TextEncoder('utf-8');
@@ -156,20 +185,76 @@ function debugString(val) {
156
185
  return className;
157
186
  }
158
187
 
159
- function addToExternrefTable0(obj) {
160
- const idx = wasm.__externref_table_alloc();
161
- wasm.__wbindgen_export_2.set(idx, obj);
162
- return idx;
163
- }
164
-
165
188
  function handleError(f, args) {
166
189
  try {
167
190
  return f.apply(this, args);
168
191
  } catch (e) {
169
- const idx = addToExternrefTable0(e);
170
- wasm.__wbindgen_exn_store(idx);
192
+ wasm.__wbindgen_export_2(addHeapObject(e));
171
193
  }
172
194
  }
195
+
196
+ function passArray8ToWasm0(arg, malloc) {
197
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
198
+ getUint8ArrayMemory0().set(arg, ptr / 1);
199
+ WASM_VECTOR_LEN = arg.length;
200
+ return ptr;
201
+ }
202
+ /**
203
+ * Get the first unoccupied position in a bundle
204
+ *
205
+ * # Arguments
206
+ * * `bundle` - The bundle to check
207
+ *
208
+ * # Returns
209
+ * * `u32` - The first unoccupied position (None if full)
210
+ */
211
+ module.exports.firstUnoccupiedPositionInBundle = function(bitmap) {
212
+ try {
213
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
214
+ const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
215
+ const len0 = WASM_VECTOR_LEN;
216
+ wasm.firstUnoccupiedPositionInBundle(retptr, ptr0, len0);
217
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
218
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
219
+ return r0 === 0 ? undefined : r1 >>> 0;
220
+ } finally {
221
+ wasm.__wbindgen_add_to_stack_pointer(16);
222
+ }
223
+ };
224
+
225
+ /**
226
+ * Check whether a position bundle is full
227
+ * A position bundle can contain 256 positions
228
+ *
229
+ * # Arguments
230
+ * * `bundle` - The bundle to check
231
+ *
232
+ * # Returns
233
+ * * `bool` - Whether the bundle is full
234
+ */
235
+ module.exports.isPositionBundleFull = function(bitmap) {
236
+ const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
237
+ const len0 = WASM_VECTOR_LEN;
238
+ const ret = wasm.isPositionBundleFull(ptr0, len0);
239
+ return ret !== 0;
240
+ };
241
+
242
+ /**
243
+ * Check whether a position bundle is empty
244
+ *
245
+ * # Arguments
246
+ * * `bundle` - The bundle to check
247
+ *
248
+ * # Returns
249
+ * * `bool` - Whether the bundle is empty
250
+ */
251
+ module.exports.isPositionBundleEmpty = function(bitmap) {
252
+ const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
253
+ const len0 = WASM_VECTOR_LEN;
254
+ const ret = wasm.isPositionBundleEmpty(ptr0, len0);
255
+ return ret !== 0;
256
+ };
257
+
173
258
  /**
174
259
  * Get the first tick index in the tick array that contains the specified tick index.
175
260
  *
@@ -197,7 +282,7 @@ module.exports.getTickArrayStartTickIndex = function(tick_index, tick_spacing) {
197
282
  */
198
283
  module.exports.tickIndexToSqrtPrice = function(tick_index) {
199
284
  const ret = wasm.tickIndexToSqrtPrice(tick_index);
200
- return ret;
285
+ return takeObject(ret);
201
286
  };
202
287
 
203
288
  /**
@@ -211,7 +296,7 @@ module.exports.tickIndexToSqrtPrice = function(tick_index) {
211
296
  * - `Ok`: A i32 integer representing the tick integer
212
297
  */
213
298
  module.exports.sqrtPriceToTickIndex = function(sqrt_price) {
214
- const ret = wasm.sqrtPriceToTickIndex(sqrt_price);
299
+ const ret = wasm.sqrtPriceToTickIndex(addHeapObject(sqrt_price));
215
300
  return ret;
216
301
  };
217
302
 
@@ -320,8 +405,8 @@ module.exports.invertTickIndex = function(tick_index) {
320
405
  * - A u128 integer representing the sqrt price for the inverse of the price
321
406
  */
322
407
  module.exports.invertSqrtPrice = function(sqrt_price) {
323
- const ret = wasm.invertSqrtPrice(sqrt_price);
324
- return ret;
408
+ const ret = wasm.invertSqrtPrice(addHeapObject(sqrt_price));
409
+ return takeObject(ret);
325
410
  };
326
411
 
327
412
  /**
@@ -335,7 +420,7 @@ module.exports.invertSqrtPrice = function(sqrt_price) {
335
420
  */
336
421
  module.exports.getFullRangeTickIndexes = function(tick_spacing) {
337
422
  const ret = wasm.getFullRangeTickIndexes(tick_spacing);
338
- return ret;
423
+ return takeObject(ret);
339
424
  };
340
425
 
341
426
  /**
@@ -352,7 +437,7 @@ module.exports.getFullRangeTickIndexes = function(tick_spacing) {
352
437
  */
353
438
  module.exports.orderTickIndexes = function(tick_index_1, tick_index_2) {
354
439
  const ret = wasm.orderTickIndexes(tick_index_1, tick_index_2);
355
- return ret;
440
+ return takeObject(ret);
356
441
  };
357
442
 
358
443
  /**
@@ -369,11 +454,6 @@ module.exports.isFullRangeOnly = function(tick_spacing) {
369
454
  return ret !== 0;
370
455
  };
371
456
 
372
- function takeFromExternrefTable0(idx) {
373
- const value = wasm.__wbindgen_export_2.get(idx);
374
- wasm.__externref_table_dealloc(idx);
375
- return value;
376
- }
377
457
  /**
378
458
  * Get the index of a tick in a tick array.
379
459
  *
@@ -386,66 +466,19 @@ function takeFromExternrefTable0(idx) {
386
466
  * - A u32 integer representing the tick index in the tick array
387
467
  */
388
468
  module.exports.getTickIndexInArray = function(tick_index, tick_array_start_index, tick_spacing) {
389
- const ret = wasm.getTickIndexInArray(tick_index, tick_array_start_index, tick_spacing);
390
- if (ret[2]) {
391
- throw takeFromExternrefTable0(ret[1]);
469
+ try {
470
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
471
+ wasm.getTickIndexInArray(retptr, tick_index, tick_array_start_index, tick_spacing);
472
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
473
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
474
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
475
+ if (r2) {
476
+ throw takeObject(r1);
477
+ }
478
+ return r0 >>> 0;
479
+ } finally {
480
+ wasm.__wbindgen_add_to_stack_pointer(16);
392
481
  }
393
- return ret[0] >>> 0;
394
- };
395
-
396
- function passArray8ToWasm0(arg, malloc) {
397
- const ptr = malloc(arg.length * 1, 1) >>> 0;
398
- getUint8ArrayMemory0().set(arg, ptr / 1);
399
- WASM_VECTOR_LEN = arg.length;
400
- return ptr;
401
- }
402
- /**
403
- * Get the first unoccupied position in a bundle
404
- *
405
- * # Arguments
406
- * * `bundle` - The bundle to check
407
- *
408
- * # Returns
409
- * * `u32` - The first unoccupied position (None if full)
410
- */
411
- module.exports.firstUnoccupiedPositionInBundle = function(bitmap) {
412
- const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
413
- const len0 = WASM_VECTOR_LEN;
414
- const ret = wasm.firstUnoccupiedPositionInBundle(ptr0, len0);
415
- return ret[0] === 0 ? undefined : ret[1] >>> 0;
416
- };
417
-
418
- /**
419
- * Check whether a position bundle is full
420
- * A position bundle can contain 256 positions
421
- *
422
- * # Arguments
423
- * * `bundle` - The bundle to check
424
- *
425
- * # Returns
426
- * * `bool` - Whether the bundle is full
427
- */
428
- module.exports.isPositionBundleFull = function(bitmap) {
429
- const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
430
- const len0 = WASM_VECTOR_LEN;
431
- const ret = wasm.isPositionBundleFull(ptr0, len0);
432
- return ret !== 0;
433
- };
434
-
435
- /**
436
- * Check whether a position bundle is empty
437
- *
438
- * # Arguments
439
- * * `bundle` - The bundle to check
440
- *
441
- * # Returns
442
- * * `bool` - Whether the bundle is empty
443
- */
444
- module.exports.isPositionBundleEmpty = function(bitmap) {
445
- const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
446
- const len0 = WASM_VECTOR_LEN;
447
- const ret = wasm.isPositionBundleEmpty(ptr0, len0);
448
- return ret !== 0;
449
482
  };
450
483
 
451
484
  module.exports._POSITION_BUNDLE_SIZE = function() {
@@ -566,7 +599,7 @@ module.exports._MAX_TICK_INDEX = function() {
566
599
  * - A boolean value indicating if the position is in range
567
600
  */
568
601
  module.exports.isPositionInRange = function(current_sqrt_price, tick_index_1, tick_index_2) {
569
- const ret = wasm.isPositionInRange(current_sqrt_price, tick_index_1, tick_index_2);
602
+ const ret = wasm.isPositionInRange(addHeapObject(current_sqrt_price), tick_index_1, tick_index_2);
570
603
  return ret !== 0;
571
604
  };
572
605
 
@@ -586,8 +619,8 @@ module.exports.isPositionInRange = function(current_sqrt_price, tick_index_1, ti
586
619
  * - A PositionStatus enum value indicating the status of the position
587
620
  */
588
621
  module.exports.positionStatus = function(current_sqrt_price, tick_index_1, tick_index_2) {
589
- const ret = wasm.positionStatus(current_sqrt_price, tick_index_1, tick_index_2);
590
- return ret;
622
+ const ret = wasm.positionStatus(addHeapObject(current_sqrt_price), tick_index_1, tick_index_2);
623
+ return takeObject(ret);
591
624
  };
592
625
 
593
626
  /**
@@ -602,8 +635,8 @@ module.exports.positionStatus = function(current_sqrt_price, tick_index_1, tick_
602
635
  * - A PositionRatio struct containing the ratio of token_a and token_b
603
636
  */
604
637
  module.exports.positionRatio = function(current_sqrt_price, tick_index_1, tick_index_2) {
605
- const ret = wasm.positionRatio(current_sqrt_price, tick_index_1, tick_index_2);
606
- return ret;
638
+ const ret = wasm.positionRatio(addHeapObject(current_sqrt_price), tick_index_1, tick_index_2);
639
+ return takeObject(ret);
607
640
  };
608
641
 
609
642
  /**
@@ -621,7 +654,7 @@ module.exports.positionRatio = function(current_sqrt_price, tick_index_1, tick_i
621
654
  */
622
655
  module.exports.priceToSqrtPrice = function(price, decimals_a, decimals_b) {
623
656
  const ret = wasm.priceToSqrtPrice(price, decimals_a, decimals_b);
624
- return ret;
657
+ return takeObject(ret);
625
658
  };
626
659
 
627
660
  /**
@@ -638,7 +671,7 @@ module.exports.priceToSqrtPrice = function(price, decimals_a, decimals_b) {
638
671
  * * `f64` - The decimal price
639
672
  */
640
673
  module.exports.sqrtPriceToPrice = function(sqrt_price, decimals_a, decimals_b) {
641
- const ret = wasm.sqrtPriceToPrice(sqrt_price, decimals_a, decimals_b);
674
+ const ret = wasm.sqrtPriceToPrice(addHeapObject(sqrt_price), decimals_a, decimals_b);
642
675
  return ret;
643
676
  };
644
677
 
@@ -709,11 +742,19 @@ module.exports.priceToTickIndex = function(price, decimals_a, decimals_b) {
709
742
  * - `u64`: The amount delta
710
743
  */
711
744
  module.exports.tryGetAmountDeltaA = function(sqrt_price_1, sqrt_price_2, liquidity, round_up) {
712
- const ret = wasm.tryGetAmountDeltaA(sqrt_price_1, sqrt_price_2, liquidity, round_up);
713
- if (ret[2]) {
714
- throw takeFromExternrefTable0(ret[1]);
745
+ try {
746
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
747
+ wasm.tryGetAmountDeltaA(retptr, addHeapObject(sqrt_price_1), addHeapObject(sqrt_price_2), addHeapObject(liquidity), round_up);
748
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
749
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
750
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
751
+ if (r3) {
752
+ throw takeObject(r2);
753
+ }
754
+ return BigInt.asUintN(64, r0);
755
+ } finally {
756
+ wasm.__wbindgen_add_to_stack_pointer(16);
715
757
  }
716
- return BigInt.asUintN(64, ret[0]);
717
758
  };
718
759
 
719
760
  /**
@@ -729,11 +770,19 @@ module.exports.tryGetAmountDeltaA = function(sqrt_price_1, sqrt_price_2, liquidi
729
770
  * - `u64`: The amount delta
730
771
  */
731
772
  module.exports.tryGetAmountDeltaB = function(sqrt_price_1, sqrt_price_2, liquidity, round_up) {
732
- const ret = wasm.tryGetAmountDeltaB(sqrt_price_1, sqrt_price_2, liquidity, round_up);
733
- if (ret[2]) {
734
- throw takeFromExternrefTable0(ret[1]);
773
+ try {
774
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
775
+ wasm.tryGetAmountDeltaB(retptr, addHeapObject(sqrt_price_1), addHeapObject(sqrt_price_2), addHeapObject(liquidity), round_up);
776
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
777
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
778
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
779
+ if (r3) {
780
+ throw takeObject(r2);
781
+ }
782
+ return BigInt.asUintN(64, r0);
783
+ } finally {
784
+ wasm.__wbindgen_add_to_stack_pointer(16);
735
785
  }
736
- return BigInt.asUintN(64, ret[0]);
737
786
  };
738
787
 
739
788
  /**
@@ -749,11 +798,19 @@ module.exports.tryGetAmountDeltaB = function(sqrt_price_1, sqrt_price_2, liquidi
749
798
  * - `u128`: The next square root price
750
799
  */
751
800
  module.exports.tryGetNextSqrtPriceFromA = function(current_sqrt_price, current_liquidity, amount, specified_input) {
752
- const ret = wasm.tryGetNextSqrtPriceFromA(current_sqrt_price, current_liquidity, amount, specified_input);
753
- if (ret[2]) {
754
- throw takeFromExternrefTable0(ret[1]);
801
+ try {
802
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
803
+ wasm.tryGetNextSqrtPriceFromA(retptr, addHeapObject(current_sqrt_price), addHeapObject(current_liquidity), amount, specified_input);
804
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
805
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
806
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
807
+ if (r2) {
808
+ throw takeObject(r1);
809
+ }
810
+ return takeObject(r0);
811
+ } finally {
812
+ wasm.__wbindgen_add_to_stack_pointer(16);
755
813
  }
756
- return takeFromExternrefTable0(ret[0]);
757
814
  };
758
815
 
759
816
  /**
@@ -769,11 +826,19 @@ module.exports.tryGetNextSqrtPriceFromA = function(current_sqrt_price, current_l
769
826
  * - `u128`: The next square root price
770
827
  */
771
828
  module.exports.tryGetNextSqrtPriceFromB = function(current_sqrt_price, current_liquidity, amount, specified_input) {
772
- const ret = wasm.tryGetNextSqrtPriceFromB(current_sqrt_price, current_liquidity, amount, specified_input);
773
- if (ret[2]) {
774
- throw takeFromExternrefTable0(ret[1]);
829
+ try {
830
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
831
+ wasm.tryGetNextSqrtPriceFromB(retptr, addHeapObject(current_sqrt_price), addHeapObject(current_liquidity), amount, specified_input);
832
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
833
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
834
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
835
+ if (r2) {
836
+ throw takeObject(r1);
837
+ }
838
+ return takeObject(r0);
839
+ } finally {
840
+ wasm.__wbindgen_add_to_stack_pointer(16);
775
841
  }
776
- return takeFromExternrefTable0(ret[0]);
777
842
  };
778
843
 
779
844
  /**
@@ -789,11 +854,19 @@ module.exports.tryGetNextSqrtPriceFromB = function(current_sqrt_price, current_l
789
854
  * - `u64`: The amount after the fee has been applied
790
855
  */
791
856
  module.exports.tryApplyTransferFee = function(amount, transfer_fee) {
792
- const ret = wasm.tryApplyTransferFee(amount, transfer_fee);
793
- if (ret[2]) {
794
- throw takeFromExternrefTable0(ret[1]);
857
+ try {
858
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
859
+ wasm.tryApplyTransferFee(retptr, amount, addHeapObject(transfer_fee));
860
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
861
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
862
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
863
+ if (r3) {
864
+ throw takeObject(r2);
865
+ }
866
+ return BigInt.asUintN(64, r0);
867
+ } finally {
868
+ wasm.__wbindgen_add_to_stack_pointer(16);
795
869
  }
796
- return BigInt.asUintN(64, ret[0]);
797
870
  };
798
871
 
799
872
  /**
@@ -809,11 +882,19 @@ module.exports.tryApplyTransferFee = function(amount, transfer_fee) {
809
882
  * - `u64`: The amount before the fee has been applied
810
883
  */
811
884
  module.exports.tryReverseApplyTransferFee = function(amount, transfer_fee) {
812
- const ret = wasm.tryReverseApplyTransferFee(amount, transfer_fee);
813
- if (ret[2]) {
814
- throw takeFromExternrefTable0(ret[1]);
885
+ try {
886
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
887
+ wasm.tryReverseApplyTransferFee(retptr, amount, addHeapObject(transfer_fee));
888
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
889
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
890
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
891
+ if (r3) {
892
+ throw takeObject(r2);
893
+ }
894
+ return BigInt.asUintN(64, r0);
895
+ } finally {
896
+ wasm.__wbindgen_add_to_stack_pointer(16);
815
897
  }
816
- return BigInt.asUintN(64, ret[0]);
817
898
  };
818
899
 
819
900
  /**
@@ -828,11 +909,19 @@ module.exports.tryReverseApplyTransferFee = function(amount, transfer_fee) {
828
909
  * - `u64`: The maximum amount
829
910
  */
830
911
  module.exports.tryGetMaxAmountWithSlippageTolerance = function(amount, slippage_tolerance_bps) {
831
- const ret = wasm.tryGetMaxAmountWithSlippageTolerance(amount, slippage_tolerance_bps);
832
- if (ret[2]) {
833
- throw takeFromExternrefTable0(ret[1]);
912
+ try {
913
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
914
+ wasm.tryGetMaxAmountWithSlippageTolerance(retptr, amount, slippage_tolerance_bps);
915
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
916
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
917
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
918
+ if (r3) {
919
+ throw takeObject(r2);
920
+ }
921
+ return BigInt.asUintN(64, r0);
922
+ } finally {
923
+ wasm.__wbindgen_add_to_stack_pointer(16);
834
924
  }
835
- return BigInt.asUintN(64, ret[0]);
836
925
  };
837
926
 
838
927
  /**
@@ -847,11 +936,19 @@ module.exports.tryGetMaxAmountWithSlippageTolerance = function(amount, slippage_
847
936
  * - `u64`: The minimum amount
848
937
  */
849
938
  module.exports.tryGetMinAmountWithSlippageTolerance = function(amount, slippage_tolerance_bps) {
850
- const ret = wasm.tryGetMinAmountWithSlippageTolerance(amount, slippage_tolerance_bps);
851
- if (ret[2]) {
852
- throw takeFromExternrefTable0(ret[1]);
939
+ try {
940
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
941
+ wasm.tryGetMinAmountWithSlippageTolerance(retptr, amount, slippage_tolerance_bps);
942
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
943
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
944
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
945
+ if (r3) {
946
+ throw takeObject(r2);
947
+ }
948
+ return BigInt.asUintN(64, r0);
949
+ } finally {
950
+ wasm.__wbindgen_add_to_stack_pointer(16);
853
951
  }
854
- return BigInt.asUintN(64, ret[0]);
855
952
  };
856
953
 
857
954
  /**
@@ -867,11 +964,19 @@ module.exports.tryGetMinAmountWithSlippageTolerance = function(amount, slippage_
867
964
  * - `u64`: The amount after the fee has been applied
868
965
  */
869
966
  module.exports.tryApplySwapFee = function(amount, fee_rate) {
870
- const ret = wasm.tryApplySwapFee(amount, fee_rate);
871
- if (ret[2]) {
872
- throw takeFromExternrefTable0(ret[1]);
967
+ try {
968
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
969
+ wasm.tryApplySwapFee(retptr, amount, fee_rate);
970
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
971
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
972
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
973
+ if (r3) {
974
+ throw takeObject(r2);
975
+ }
976
+ return BigInt.asUintN(64, r0);
977
+ } finally {
978
+ wasm.__wbindgen_add_to_stack_pointer(16);
873
979
  }
874
- return BigInt.asUintN(64, ret[0]);
875
980
  };
876
981
 
877
982
  /**
@@ -887,11 +992,19 @@ module.exports.tryApplySwapFee = function(amount, fee_rate) {
887
992
  * - `u64`: The amount before the fee has been applied
888
993
  */
889
994
  module.exports.tryReverseApplySwapFee = function(amount, fee_rate) {
890
- const ret = wasm.tryReverseApplySwapFee(amount, fee_rate);
891
- if (ret[2]) {
892
- throw takeFromExternrefTable0(ret[1]);
995
+ try {
996
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
997
+ wasm.tryReverseApplySwapFee(retptr, amount, fee_rate);
998
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
999
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1000
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1001
+ if (r3) {
1002
+ throw takeObject(r2);
1003
+ }
1004
+ return BigInt.asUintN(64, r0);
1005
+ } finally {
1006
+ wasm.__wbindgen_add_to_stack_pointer(16);
893
1007
  }
894
- return BigInt.asUintN(64, ret[0]);
895
1008
  };
896
1009
 
897
1010
  /**
@@ -910,11 +1023,19 @@ module.exports.tryReverseApplySwapFee = function(amount, fee_rate) {
910
1023
  * The exact input or output amount for the swap transaction.
911
1024
  */
912
1025
  module.exports.swapQuoteByInputToken = function(token_in, specified_token_a, slippage_tolerance_bps, whirlpool, tick_arrays, transfer_fee_a, transfer_fee_b) {
913
- const ret = wasm.swapQuoteByInputToken(token_in, specified_token_a, slippage_tolerance_bps, whirlpool, tick_arrays, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
914
- if (ret[2]) {
915
- throw takeFromExternrefTable0(ret[1]);
1026
+ try {
1027
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1028
+ wasm.swapQuoteByInputToken(retptr, token_in, specified_token_a, slippage_tolerance_bps, addHeapObject(whirlpool), addHeapObject(tick_arrays), isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
1029
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1030
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1031
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1032
+ if (r2) {
1033
+ throw takeObject(r1);
1034
+ }
1035
+ return takeObject(r0);
1036
+ } finally {
1037
+ wasm.__wbindgen_add_to_stack_pointer(16);
916
1038
  }
917
- return takeFromExternrefTable0(ret[0]);
918
1039
  };
919
1040
 
920
1041
  /**
@@ -933,11 +1054,19 @@ module.exports.swapQuoteByInputToken = function(token_in, specified_token_a, sli
933
1054
  * The exact input or output amount for the swap transaction.
934
1055
  */
935
1056
  module.exports.swapQuoteByOutputToken = function(token_out, specified_token_a, slippage_tolerance_bps, whirlpool, tick_arrays, transfer_fee_a, transfer_fee_b) {
936
- const ret = wasm.swapQuoteByOutputToken(token_out, specified_token_a, slippage_tolerance_bps, whirlpool, tick_arrays, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
937
- if (ret[2]) {
938
- throw takeFromExternrefTable0(ret[1]);
1057
+ try {
1058
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1059
+ wasm.swapQuoteByOutputToken(retptr, token_out, specified_token_a, slippage_tolerance_bps, addHeapObject(whirlpool), addHeapObject(tick_arrays), isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
1060
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1061
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1062
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1063
+ if (r2) {
1064
+ throw takeObject(r1);
1065
+ }
1066
+ return takeObject(r0);
1067
+ } finally {
1068
+ wasm.__wbindgen_add_to_stack_pointer(16);
939
1069
  }
940
- return takeFromExternrefTable0(ret[0]);
941
1070
  };
942
1071
 
943
1072
  /**
@@ -955,11 +1084,19 @@ module.exports.swapQuoteByOutputToken = function(token_out, specified_token_a, s
955
1084
  * - `CollectFeesQuote`: The fees owed for token A and token B
956
1085
  */
957
1086
  module.exports.collectFeesQuote = function(whirlpool, position, tick_lower, tick_upper, transfer_fee_a, transfer_fee_b) {
958
- const ret = wasm.collectFeesQuote(whirlpool, position, tick_lower, tick_upper, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
959
- if (ret[2]) {
960
- throw takeFromExternrefTable0(ret[1]);
1087
+ try {
1088
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1089
+ wasm.collectFeesQuote(retptr, addHeapObject(whirlpool), addHeapObject(position), addHeapObject(tick_lower), addHeapObject(tick_upper), isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
1090
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1091
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1092
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1093
+ if (r2) {
1094
+ throw takeObject(r1);
1095
+ }
1096
+ return takeObject(r0);
1097
+ } finally {
1098
+ wasm.__wbindgen_add_to_stack_pointer(16);
961
1099
  }
962
- return takeFromExternrefTable0(ret[0]);
963
1100
  };
964
1101
 
965
1102
  /**
@@ -978,11 +1115,19 @@ module.exports.collectFeesQuote = function(whirlpool, position, tick_lower, tick
978
1115
  * - A DecreaseLiquidityQuote struct containing the estimated token amounts
979
1116
  */
980
1117
  module.exports.decreaseLiquidityQuote = function(liquidity_delta, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
981
- const ret = wasm.decreaseLiquidityQuote(liquidity_delta, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
982
- if (ret[2]) {
983
- throw takeFromExternrefTable0(ret[1]);
1118
+ try {
1119
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1120
+ wasm.decreaseLiquidityQuote(retptr, addHeapObject(liquidity_delta), slippage_tolerance_bps, addHeapObject(current_sqrt_price), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
1121
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1122
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1123
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1124
+ if (r2) {
1125
+ throw takeObject(r1);
1126
+ }
1127
+ return takeObject(r0);
1128
+ } finally {
1129
+ wasm.__wbindgen_add_to_stack_pointer(16);
984
1130
  }
985
- return takeFromExternrefTable0(ret[0]);
986
1131
  };
987
1132
 
988
1133
  /**
@@ -1001,11 +1146,19 @@ module.exports.decreaseLiquidityQuote = function(liquidity_delta, slippage_toler
1001
1146
  * - A DecreaseLiquidityQuote struct containing the estimated token amounts
1002
1147
  */
1003
1148
  module.exports.decreaseLiquidityQuoteA = function(token_amount_a, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
1004
- const ret = wasm.decreaseLiquidityQuoteA(token_amount_a, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
1005
- if (ret[2]) {
1006
- throw takeFromExternrefTable0(ret[1]);
1149
+ try {
1150
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1151
+ wasm.decreaseLiquidityQuoteA(retptr, token_amount_a, slippage_tolerance_bps, addHeapObject(current_sqrt_price), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
1152
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1153
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1154
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1155
+ if (r2) {
1156
+ throw takeObject(r1);
1157
+ }
1158
+ return takeObject(r0);
1159
+ } finally {
1160
+ wasm.__wbindgen_add_to_stack_pointer(16);
1007
1161
  }
1008
- return takeFromExternrefTable0(ret[0]);
1009
1162
  };
1010
1163
 
1011
1164
  /**
@@ -1024,11 +1177,19 @@ module.exports.decreaseLiquidityQuoteA = function(token_amount_a, slippage_toler
1024
1177
  * - A DecreaseLiquidityQuote struct containing the estimated token amounts
1025
1178
  */
1026
1179
  module.exports.decreaseLiquidityQuoteB = function(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
1027
- const ret = wasm.decreaseLiquidityQuoteB(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
1028
- if (ret[2]) {
1029
- throw takeFromExternrefTable0(ret[1]);
1180
+ try {
1181
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1182
+ wasm.decreaseLiquidityQuoteB(retptr, token_amount_b, slippage_tolerance_bps, addHeapObject(current_sqrt_price), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
1183
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1184
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1185
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1186
+ if (r2) {
1187
+ throw takeObject(r1);
1188
+ }
1189
+ return takeObject(r0);
1190
+ } finally {
1191
+ wasm.__wbindgen_add_to_stack_pointer(16);
1030
1192
  }
1031
- return takeFromExternrefTable0(ret[0]);
1032
1193
  };
1033
1194
 
1034
1195
  /**
@@ -1047,11 +1208,19 @@ module.exports.decreaseLiquidityQuoteB = function(token_amount_b, slippage_toler
1047
1208
  * - An IncreaseLiquidityQuote struct containing the estimated token amounts
1048
1209
  */
1049
1210
  module.exports.increaseLiquidityQuote = function(liquidity_delta, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
1050
- const ret = wasm.increaseLiquidityQuote(liquidity_delta, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
1051
- if (ret[2]) {
1052
- throw takeFromExternrefTable0(ret[1]);
1211
+ try {
1212
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1213
+ wasm.increaseLiquidityQuote(retptr, addHeapObject(liquidity_delta), slippage_tolerance_bps, addHeapObject(current_sqrt_price), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
1214
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1215
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1216
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1217
+ if (r2) {
1218
+ throw takeObject(r1);
1219
+ }
1220
+ return takeObject(r0);
1221
+ } finally {
1222
+ wasm.__wbindgen_add_to_stack_pointer(16);
1053
1223
  }
1054
- return takeFromExternrefTable0(ret[0]);
1055
1224
  };
1056
1225
 
1057
1226
  /**
@@ -1070,11 +1239,19 @@ module.exports.increaseLiquidityQuote = function(liquidity_delta, slippage_toler
1070
1239
  * - An IncreaseLiquidityQuote struct containing the estimated token amounts
1071
1240
  */
1072
1241
  module.exports.increaseLiquidityQuoteA = function(token_amount_a, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
1073
- const ret = wasm.increaseLiquidityQuoteA(token_amount_a, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
1074
- if (ret[2]) {
1075
- throw takeFromExternrefTable0(ret[1]);
1242
+ try {
1243
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1244
+ wasm.increaseLiquidityQuoteA(retptr, token_amount_a, slippage_tolerance_bps, addHeapObject(current_sqrt_price), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
1245
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1246
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1247
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1248
+ if (r2) {
1249
+ throw takeObject(r1);
1250
+ }
1251
+ return takeObject(r0);
1252
+ } finally {
1253
+ wasm.__wbindgen_add_to_stack_pointer(16);
1076
1254
  }
1077
- return takeFromExternrefTable0(ret[0]);
1078
1255
  };
1079
1256
 
1080
1257
  /**
@@ -1093,11 +1270,19 @@ module.exports.increaseLiquidityQuoteA = function(token_amount_a, slippage_toler
1093
1270
  * - An IncreaseLiquidityQuote struct containing the estimated token amounts
1094
1271
  */
1095
1272
  module.exports.increaseLiquidityQuoteB = function(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
1096
- const ret = wasm.increaseLiquidityQuoteB(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
1097
- if (ret[2]) {
1098
- throw takeFromExternrefTable0(ret[1]);
1273
+ try {
1274
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1275
+ wasm.increaseLiquidityQuoteB(retptr, token_amount_b, slippage_tolerance_bps, addHeapObject(current_sqrt_price), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
1276
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1277
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1278
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1279
+ if (r2) {
1280
+ throw takeObject(r1);
1281
+ }
1282
+ return takeObject(r0);
1283
+ } finally {
1284
+ wasm.__wbindgen_add_to_stack_pointer(16);
1099
1285
  }
1100
- return takeFromExternrefTable0(ret[0]);
1101
1286
  };
1102
1287
 
1103
1288
  /**
@@ -1117,37 +1302,49 @@ module.exports.increaseLiquidityQuoteB = function(token_amount_b, slippage_toler
1117
1302
  * - `CollectRewardsQuote`: The rewards owed for the 3 reward tokens.
1118
1303
  */
1119
1304
  module.exports.collectRewardsQuote = function(whirlpool, position, tick_lower, tick_upper, current_timestamp, transfer_fee_1, transfer_fee_2, transfer_fee_3) {
1120
- const ret = wasm.collectRewardsQuote(whirlpool, position, tick_lower, tick_upper, current_timestamp, isLikeNone(transfer_fee_1) ? 0 : addToExternrefTable0(transfer_fee_1), isLikeNone(transfer_fee_2) ? 0 : addToExternrefTable0(transfer_fee_2), isLikeNone(transfer_fee_3) ? 0 : addToExternrefTable0(transfer_fee_3));
1121
- if (ret[2]) {
1122
- throw takeFromExternrefTable0(ret[1]);
1305
+ try {
1306
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1307
+ wasm.collectRewardsQuote(retptr, addHeapObject(whirlpool), addHeapObject(position), addHeapObject(tick_lower), addHeapObject(tick_upper), current_timestamp, isLikeNone(transfer_fee_1) ? 0 : addHeapObject(transfer_fee_1), isLikeNone(transfer_fee_2) ? 0 : addHeapObject(transfer_fee_2), isLikeNone(transfer_fee_3) ? 0 : addHeapObject(transfer_fee_3));
1308
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1309
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1310
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1311
+ if (r2) {
1312
+ throw takeObject(r1);
1313
+ }
1314
+ return takeObject(r0);
1315
+ } finally {
1316
+ wasm.__wbindgen_add_to_stack_pointer(16);
1123
1317
  }
1124
- return takeFromExternrefTable0(ret[0]);
1125
1318
  };
1126
1319
 
1127
1320
  module.exports.__wbindgen_string_new = function(arg0, arg1) {
1128
1321
  const ret = getStringFromWasm0(arg0, arg1);
1129
- return ret;
1322
+ return addHeapObject(ret);
1323
+ };
1324
+
1325
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
1326
+ takeObject(arg0);
1130
1327
  };
1131
1328
 
1132
1329
  module.exports.__wbindgen_string_get = function(arg0, arg1) {
1133
- const obj = arg1;
1330
+ const obj = getObject(arg1);
1134
1331
  const ret = typeof(obj) === 'string' ? obj : undefined;
1135
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1332
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1136
1333
  var len1 = WASM_VECTOR_LEN;
1137
1334
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1138
1335
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1139
1336
  };
1140
1337
 
1141
1338
  module.exports.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
1142
- const v = arg1;
1339
+ const v = getObject(arg1);
1143
1340
  const ret = typeof(v) === 'bigint' ? v : undefined;
1144
1341
  getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1145
1342
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1146
1343
  };
1147
1344
 
1148
1345
  module.exports.__wbindgen_debug_string = function(arg0, arg1) {
1149
- const ret = debugString(arg1);
1150
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1346
+ const ret = debugString(getObject(arg1));
1347
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1151
1348
  const len1 = WASM_VECTOR_LEN;
1152
1349
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1153
1350
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
@@ -1159,110 +1356,115 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
1159
1356
 
1160
1357
  module.exports.__wbindgen_memory = function() {
1161
1358
  const ret = wasm.memory;
1162
- return ret;
1359
+ return addHeapObject(ret);
1360
+ };
1361
+
1362
+ module.exports.__wbindgen_object_clone_ref = function(arg0) {
1363
+ const ret = getObject(arg0);
1364
+ return addHeapObject(ret);
1163
1365
  };
1164
1366
 
1165
1367
  module.exports.__wbg_get_ef828680c64da212 = function() { return handleError(function (arg0, arg1) {
1166
- const ret = Reflect.get(arg0, arg1);
1167
- return ret;
1368
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1369
+ return addHeapObject(ret);
1168
1370
  }, arguments) };
1169
1371
 
1170
1372
  module.exports.__wbg_buffer_ccaed51a635d8a2d = function(arg0) {
1171
- const ret = arg0.buffer;
1172
- return ret;
1373
+ const ret = getObject(arg0).buffer;
1374
+ return addHeapObject(ret);
1173
1375
  };
1174
1376
 
1175
1377
  module.exports.__wbg_get_5419cf6b954aa11d = function(arg0, arg1) {
1176
- const ret = arg0[arg1 >>> 0];
1177
- return ret;
1378
+ const ret = getObject(arg0)[arg1 >>> 0];
1379
+ return addHeapObject(ret);
1178
1380
  };
1179
1381
 
1180
1382
  module.exports.__wbg_length_f217bbbf7e8e4df4 = function(arg0) {
1181
- const ret = arg0.length;
1383
+ const ret = getObject(arg0).length;
1182
1384
  return ret;
1183
1385
  };
1184
1386
 
1185
1387
  module.exports.__wbg_new_034f913e7636e987 = function() {
1186
1388
  const ret = new Array();
1187
- return ret;
1389
+ return addHeapObject(ret);
1188
1390
  };
1189
1391
 
1190
1392
  module.exports.__wbindgen_number_new = function(arg0) {
1191
1393
  const ret = arg0;
1192
- return ret;
1394
+ return addHeapObject(ret);
1193
1395
  };
1194
1396
 
1195
1397
  module.exports.__wbindgen_is_function = function(arg0) {
1196
- const ret = typeof(arg0) === 'function';
1398
+ const ret = typeof(getObject(arg0)) === 'function';
1197
1399
  return ret;
1198
1400
  };
1199
1401
 
1200
1402
  module.exports.__wbindgen_is_object = function(arg0) {
1201
- const val = arg0;
1403
+ const val = getObject(arg0);
1202
1404
  const ret = typeof(val) === 'object' && val !== null;
1203
1405
  return ret;
1204
1406
  };
1205
1407
 
1206
1408
  module.exports.__wbg_next_13b477da1eaa3897 = function(arg0) {
1207
- const ret = arg0.next;
1208
- return ret;
1409
+ const ret = getObject(arg0).next;
1410
+ return addHeapObject(ret);
1209
1411
  };
1210
1412
 
1211
1413
  module.exports.__wbg_next_b06e115d1b01e10b = function() { return handleError(function (arg0) {
1212
- const ret = arg0.next();
1213
- return ret;
1414
+ const ret = getObject(arg0).next();
1415
+ return addHeapObject(ret);
1214
1416
  }, arguments) };
1215
1417
 
1216
1418
  module.exports.__wbg_done_983b5ffcaec8c583 = function(arg0) {
1217
- const ret = arg0.done;
1419
+ const ret = getObject(arg0).done;
1218
1420
  return ret;
1219
1421
  };
1220
1422
 
1221
1423
  module.exports.__wbg_value_2ab8a198c834c26a = function(arg0) {
1222
- const ret = arg0.value;
1223
- return ret;
1424
+ const ret = getObject(arg0).value;
1425
+ return addHeapObject(ret);
1224
1426
  };
1225
1427
 
1226
1428
  module.exports.__wbg_iterator_695d699a44d6234c = function() {
1227
1429
  const ret = Symbol.iterator;
1228
- return ret;
1430
+ return addHeapObject(ret);
1229
1431
  };
1230
1432
 
1231
1433
  module.exports.__wbg_call_a9ef466721e824f2 = function() { return handleError(function (arg0, arg1) {
1232
- const ret = arg0.call(arg1);
1233
- return ret;
1434
+ const ret = getObject(arg0).call(getObject(arg1));
1435
+ return addHeapObject(ret);
1234
1436
  }, arguments) };
1235
1437
 
1236
1438
  module.exports.__wbg_new_e69b5f66fda8f13c = function() {
1237
1439
  const ret = new Object();
1238
- return ret;
1440
+ return addHeapObject(ret);
1239
1441
  };
1240
1442
 
1241
1443
  module.exports.__wbindgen_number_get = function(arg0, arg1) {
1242
- const obj = arg1;
1444
+ const obj = getObject(arg1);
1243
1445
  const ret = typeof(obj) === 'number' ? obj : undefined;
1244
1446
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1245
1447
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1246
1448
  };
1247
1449
 
1248
1450
  module.exports.__wbindgen_is_undefined = function(arg0) {
1249
- const ret = arg0 === undefined;
1451
+ const ret = getObject(arg0) === undefined;
1250
1452
  return ret;
1251
1453
  };
1252
1454
 
1253
1455
  module.exports.__wbg_set_425e70f7c64ac962 = function(arg0, arg1, arg2) {
1254
- arg0[arg1 >>> 0] = arg2;
1456
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1255
1457
  };
1256
1458
 
1257
1459
  module.exports.__wbg_isArray_6f3b47f09adb61b5 = function(arg0) {
1258
- const ret = Array.isArray(arg0);
1460
+ const ret = Array.isArray(getObject(arg0));
1259
1461
  return ret;
1260
1462
  };
1261
1463
 
1262
1464
  module.exports.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7 = function(arg0) {
1263
1465
  let result;
1264
1466
  try {
1265
- result = arg0 instanceof ArrayBuffer;
1467
+ result = getObject(arg0) instanceof ArrayBuffer;
1266
1468
  } catch (_) {
1267
1469
  result = false;
1268
1470
  }
@@ -1271,28 +1473,28 @@ module.exports.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7 = function(arg0) {
1271
1473
  };
1272
1474
 
1273
1475
  module.exports.__wbg_isSafeInteger_b9dff570f01a9100 = function(arg0) {
1274
- const ret = Number.isSafeInteger(arg0);
1476
+ const ret = Number.isSafeInteger(getObject(arg0));
1275
1477
  return ret;
1276
1478
  };
1277
1479
 
1278
1480
  module.exports.__wbg_new_fec2611eb9180f95 = function(arg0) {
1279
- const ret = new Uint8Array(arg0);
1280
- return ret;
1481
+ const ret = new Uint8Array(getObject(arg0));
1482
+ return addHeapObject(ret);
1281
1483
  };
1282
1484
 
1283
1485
  module.exports.__wbg_set_ec2fcf81bc573fd9 = function(arg0, arg1, arg2) {
1284
- arg0.set(arg1, arg2 >>> 0);
1486
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
1285
1487
  };
1286
1488
 
1287
1489
  module.exports.__wbg_length_9254c4bd3b9f23c4 = function(arg0) {
1288
- const ret = arg0.length;
1490
+ const ret = getObject(arg0).length;
1289
1491
  return ret;
1290
1492
  };
1291
1493
 
1292
1494
  module.exports.__wbg_instanceof_Uint8Array_df0761410414ef36 = function(arg0) {
1293
1495
  let result;
1294
1496
  try {
1295
- result = arg0 instanceof Uint8Array;
1497
+ result = getObject(arg0) instanceof Uint8Array;
1296
1498
  } catch (_) {
1297
1499
  result = false;
1298
1500
  }
@@ -1302,96 +1504,85 @@ module.exports.__wbg_instanceof_Uint8Array_df0761410414ef36 = function(arg0) {
1302
1504
 
1303
1505
  module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
1304
1506
  const ret = BigInt.asUintN(64, arg0);
1305
- return ret;
1507
+ return addHeapObject(ret);
1306
1508
  };
1307
1509
 
1308
1510
  module.exports.__wbindgen_shr = function(arg0, arg1) {
1309
- const ret = arg0 >> arg1;
1310
- return ret;
1511
+ const ret = getObject(arg0) >> getObject(arg1);
1512
+ return addHeapObject(ret);
1311
1513
  };
1312
1514
 
1313
1515
  module.exports.__wbindgen_bigint_from_i64 = function(arg0) {
1314
1516
  const ret = arg0;
1315
- return ret;
1517
+ return addHeapObject(ret);
1316
1518
  };
1317
1519
 
1318
1520
  module.exports.__wbindgen_jsval_eq = function(arg0, arg1) {
1319
- const ret = arg0 === arg1;
1521
+ const ret = getObject(arg0) === getObject(arg1);
1320
1522
  return ret;
1321
1523
  };
1322
1524
 
1323
1525
  module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
1324
- const ret = arg0 == arg1;
1526
+ const ret = getObject(arg0) == getObject(arg1);
1325
1527
  return ret;
1326
1528
  };
1327
1529
 
1328
1530
  module.exports.__wbindgen_boolean_get = function(arg0) {
1329
- const v = arg0;
1531
+ const v = getObject(arg0);
1330
1532
  const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1331
1533
  return ret;
1332
1534
  };
1333
1535
 
1334
- module.exports.__wbg_String_88810dfeb4021902 = function(arg0, arg1) {
1335
- const ret = String(arg1);
1336
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1337
- const len1 = WASM_VECTOR_LEN;
1338
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1339
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1536
+ module.exports.__wbindgen_as_number = function(arg0) {
1537
+ const ret = +getObject(arg0);
1538
+ return ret;
1340
1539
  };
1341
1540
 
1342
1541
  module.exports.__wbindgen_error_new = function(arg0, arg1) {
1343
1542
  const ret = new Error(getStringFromWasm0(arg0, arg1));
1344
- return ret;
1543
+ return addHeapObject(ret);
1345
1544
  };
1346
1545
 
1347
1546
  module.exports.__wbindgen_bigint_from_u128 = function(arg0, arg1) {
1348
1547
  const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1);
1349
- return ret;
1350
- };
1351
-
1352
- module.exports.__wbg_getwithrefkey_5e6d9547403deab8 = function(arg0, arg1) {
1353
- const ret = arg0[arg1];
1354
- return ret;
1548
+ return addHeapObject(ret);
1355
1549
  };
1356
1550
 
1357
- module.exports.__wbg_set_841ac57cff3d672b = function(arg0, arg1, arg2) {
1358
- arg0[arg1] = arg2;
1551
+ module.exports.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
1552
+ const ret = getObject(arg0)[getObject(arg1)];
1553
+ return addHeapObject(ret);
1359
1554
  };
1360
1555
 
1361
- module.exports.__wbindgen_as_number = function(arg0) {
1362
- const ret = +arg0;
1363
- return ret;
1556
+ module.exports.__wbg_String_88810dfeb4021902 = function(arg0, arg1) {
1557
+ const ret = String(getObject(arg1));
1558
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1559
+ const len1 = WASM_VECTOR_LEN;
1560
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1561
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1364
1562
  };
1365
1563
 
1366
- module.exports.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
1367
- const ret = arg0[arg1];
1368
- return ret;
1564
+ module.exports.__wbg_getwithrefkey_5e6d9547403deab8 = function(arg0, arg1) {
1565
+ const ret = getObject(arg0)[getObject(arg1)];
1566
+ return addHeapObject(ret);
1369
1567
  };
1370
1568
 
1371
- module.exports.__wbindgen_is_array = function(arg0) {
1372
- const ret = Array.isArray(arg0);
1373
- return ret;
1569
+ module.exports.__wbg_set_841ac57cff3d672b = function(arg0, arg1, arg2) {
1570
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1374
1571
  };
1375
1572
 
1376
1573
  module.exports.__wbindgen_in = function(arg0, arg1) {
1377
- const ret = arg0 in arg1;
1574
+ const ret = getObject(arg0) in getObject(arg1);
1378
1575
  return ret;
1379
1576
  };
1380
1577
 
1381
1578
  module.exports.__wbindgen_is_bigint = function(arg0) {
1382
- const ret = typeof(arg0) === 'bigint';
1579
+ const ret = typeof(getObject(arg0)) === 'bigint';
1383
1580
  return ret;
1384
1581
  };
1385
1582
 
1386
- module.exports.__wbindgen_init_externref_table = function() {
1387
- const table = wasm.__wbindgen_export_2;
1388
- const offset = table.grow(4);
1389
- table.set(0, undefined);
1390
- table.set(offset + 0, undefined);
1391
- table.set(offset + 1, null);
1392
- table.set(offset + 2, true);
1393
- table.set(offset + 3, false);
1394
- ;
1583
+ module.exports.__wbindgen_is_array = function(arg0) {
1584
+ const ret = Array.isArray(getObject(arg0));
1585
+ return ret;
1395
1586
  };
1396
1587
 
1397
1588
  const path = require('path').join(__dirname, 'orca_whirlpools_core_js_bindings_bg.wasm');
@@ -1402,5 +1593,3 @@ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
1402
1593
  wasm = wasmInstance.exports;
1403
1594
  module.exports.__wasm = wasm;
1404
1595
 
1405
- wasm.__wbindgen_start();
1406
-