@orca-so/whirlpools-core 0.4.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,11 +2,15 @@
2
2
  let imports = {};
3
3
  imports['__wbindgen_placeholder__'] = module.exports;
4
4
  let wasm;
5
- const { TextDecoder, TextEncoder } = require(`util`);
5
+ const { TextEncoder, TextDecoder } = require(`util`);
6
6
 
7
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
7
+ const heap = new Array(128).fill(undefined);
8
8
 
9
- cachedTextDecoder.decode();
9
+ heap.push(undefined, null, true, false);
10
+
11
+ function getObject(idx) { return heap[idx]; }
12
+
13
+ let WASM_VECTOR_LEN = 0;
10
14
 
11
15
  let cachedUint8ArrayMemory0 = null;
12
16
 
@@ -17,42 +21,6 @@ function getUint8ArrayMemory0() {
17
21
  return cachedUint8ArrayMemory0;
18
22
  }
19
23
 
20
- function getStringFromWasm0(ptr, len) {
21
- ptr = ptr >>> 0;
22
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
23
- }
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
-
54
- let WASM_VECTOR_LEN = 0;
55
-
56
24
  let cachedTextEncoder = new TextEncoder('utf-8');
57
25
 
58
26
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -107,10 +75,6 @@ function passStringToWasm0(arg, malloc, realloc) {
107
75
  return ptr;
108
76
  }
109
77
 
110
- function isLikeNone(x) {
111
- return x === undefined || x === null;
112
- }
113
-
114
78
  let cachedDataViewMemory0 = null;
115
79
 
116
80
  function getDataViewMemory0() {
@@ -120,6 +84,41 @@ function getDataViewMemory0() {
120
84
  return cachedDataViewMemory0;
121
85
  }
122
86
 
87
+ let heap_next = heap.length;
88
+
89
+ function addHeapObject(obj) {
90
+ if (heap_next === heap.length) heap.push(heap.length + 1);
91
+ const idx = heap_next;
92
+ heap_next = heap[idx];
93
+
94
+ heap[idx] = obj;
95
+ return idx;
96
+ }
97
+
98
+ function handleError(f, args) {
99
+ try {
100
+ return f.apply(this, args);
101
+ } catch (e) {
102
+ wasm.__wbindgen_export_2(addHeapObject(e));
103
+ }
104
+ }
105
+
106
+ function dropObject(idx) {
107
+ if (idx < 132) return;
108
+ heap[idx] = heap_next;
109
+ heap_next = idx;
110
+ }
111
+
112
+ function takeObject(idx) {
113
+ const ret = getObject(idx);
114
+ dropObject(idx);
115
+ return ret;
116
+ }
117
+
118
+ function isLikeNone(x) {
119
+ return x === undefined || x === null;
120
+ }
121
+
123
122
  function debugString(val) {
124
123
  // primitive types
125
124
  const type = typeof val;
@@ -161,7 +160,7 @@ function debugString(val) {
161
160
  // Test for built-in
162
161
  const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
163
162
  let className;
164
- if (builtInMatches.length > 1) {
163
+ if (builtInMatches && builtInMatches.length > 1) {
165
164
  className = builtInMatches[1];
166
165
  } else {
167
166
  // Failed to match the standard '[object ClassName]'
@@ -185,382 +184,118 @@ function debugString(val) {
185
184
  return className;
186
185
  }
187
186
 
188
- function handleError(f, args) {
189
- try {
190
- return f.apply(this, args);
191
- } catch (e) {
192
- wasm.__wbindgen_export_2(addHeapObject(e));
193
- }
187
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
188
+
189
+ cachedTextDecoder.decode();
190
+
191
+ function getStringFromWasm0(ptr, len) {
192
+ ptr = ptr >>> 0;
193
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
194
194
  }
195
195
  /**
196
- * Get the first tick index in the tick array that contains the specified tick index.
196
+ * Check if a position is in range.
197
+ * When a position is in range it is earning fees and rewards
197
198
  *
198
199
  * # Parameters
199
- * - `tick_index` - A i32 integer representing the tick integer
200
- * - `tick_spacing` - A i32 integer representing the tick spacing
200
+ * - `sqrt_price` - A u128 integer representing the sqrt price of the pool
201
+ * - `tick_index_1` - A i32 integer representing the first tick index of the position
202
+ * - `tick_index_2` - A i32 integer representing the second tick index of the position
201
203
  *
202
204
  * # Returns
203
- * - A i32 integer representing the first tick index in the tick array
205
+ * - A boolean value indicating if the position is in range
204
206
  */
205
- module.exports.getTickArrayStartTickIndex = function(tick_index, tick_spacing) {
206
- const ret = wasm.getTickArrayStartTickIndex(tick_index, tick_spacing);
207
- return ret;
207
+ module.exports.isPositionInRange = function(current_sqrt_price, tick_index_1, tick_index_2) {
208
+ const ret = wasm.isPositionInRange(addHeapObject(current_sqrt_price), tick_index_1, tick_index_2);
209
+ return ret !== 0;
208
210
  };
209
211
 
210
212
  /**
211
- * Derive the sqrt-price from a tick index. The precision of this method is only guarranted
212
- * if tick is within the bounds of {max, min} tick-index.
213
+ * Calculate the status of a position
214
+ * The status can be one of three values:
215
+ * - InRange: The position is in range
216
+ * - BelowRange: The position is below the range
217
+ * - AboveRange: The position is above the range
213
218
  *
214
219
  * # Parameters
215
- * - `tick_index` - A i32 integer representing the tick integer
220
+ * - `sqrt_price` - A u128 integer representing the sqrt price of the pool
221
+ * - `tick_index_1` - A i32 integer representing the first tick index of the position
222
+ * - `tick_index_2` - A i32 integer representing the second tick index of the position
216
223
  *
217
224
  * # Returns
218
- * - `Ok`: A u128 Q32.64 representing the sqrt_price
225
+ * - A PositionStatus enum value indicating the status of the position
219
226
  */
220
- module.exports.tickIndexToSqrtPrice = function(tick_index) {
221
- const ret = wasm.tickIndexToSqrtPrice(tick_index);
227
+ module.exports.positionStatus = function(current_sqrt_price, tick_index_1, tick_index_2) {
228
+ const ret = wasm.positionStatus(addHeapObject(current_sqrt_price), tick_index_1, tick_index_2);
222
229
  return takeObject(ret);
223
230
  };
224
231
 
225
232
  /**
226
- * Derive the tick index from a sqrt price. The precision of this method is only guarranted
227
- * if tick is within the bounds of {max, min} tick-index.
233
+ * Calculate the token_a / token_b ratio of a (ficticious) position
228
234
  *
229
235
  * # Parameters
230
- * - `sqrt_price` - A u128 integer representing the sqrt price
236
+ * - `sqrt_price` - A u128 integer representing the sqrt price of the pool
237
+ * - `tick_index_1` - A i32 integer representing the first tick index of the position
238
+ * - `tick_index_2` - A i32 integer representing the second tick index of the position
231
239
  *
232
240
  * # Returns
233
- * - `Ok`: A i32 integer representing the tick integer
241
+ * - A PositionRatio struct containing the ratio of token_a and token_b
234
242
  */
235
- module.exports.sqrtPriceToTickIndex = function(sqrt_price) {
236
- const ret = wasm.sqrtPriceToTickIndex(addHeapObject(sqrt_price));
237
- return ret;
243
+ module.exports.positionRatio = function(current_sqrt_price, tick_index_1, tick_index_2) {
244
+ const ret = wasm.positionRatio(addHeapObject(current_sqrt_price), tick_index_1, tick_index_2);
245
+ return takeObject(ret);
238
246
  };
239
247
 
240
- /**
241
- * Get the initializable tick index.
242
- * If the tick index is already initializable, it is returned as is.
243
- *
244
- * # Parameters
245
- * - `tick_index` - A i32 integer representing the tick integer
246
- * - `tick_spacing` - A i32 integer representing the tick spacing
247
- * - `round_up` - A boolean value indicating if the supplied tick index should be rounded up. None will round to the nearest.
248
- *
249
- * # Returns
250
- * - A i32 integer representing the previous initializable tick index
251
- */
252
- module.exports.getInitializableTickIndex = function(tick_index, tick_spacing, round_up) {
253
- const ret = wasm.getInitializableTickIndex(tick_index, tick_spacing, isLikeNone(round_up) ? 0xFFFFFF : round_up ? 1 : 0);
254
- return ret;
248
+ module.exports._POSITION_BUNDLE_SIZE = function() {
249
+ const ret = wasm._POSITION_BUNDLE_SIZE();
250
+ return ret >>> 0;
255
251
  };
256
252
 
257
- /**
258
- * Get the previous initializable tick index.
259
- *
260
- * # Parameters
261
- * - `tick_index` - A i32 integer representing the tick integer
262
- * - `tick_spacing` - A i32 integer representing the tick spacing
263
- *
264
- * # Returns
265
- * - A i32 integer representing the previous initializable tick index
266
- */
267
- module.exports.getPrevInitializableTickIndex = function(tick_index, tick_spacing) {
268
- const ret = wasm.getPrevInitializableTickIndex(tick_index, tick_spacing);
269
- return ret;
253
+ module.exports._TICK_ARRAY_NOT_EVENLY_SPACED = function() {
254
+ try {
255
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
256
+ wasm._TICK_ARRAY_NOT_EVENLY_SPACED(retptr);
257
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
258
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
259
+ return getStringFromWasm0(r0, r1);
260
+ } finally {
261
+ wasm.__wbindgen_add_to_stack_pointer(16);
262
+ }
270
263
  };
271
264
 
272
- /**
273
- * Get the next initializable tick index.
274
- *
275
- * # Parameters
276
- * - `tick_index` - A i32 integer representing the tick integer
277
- * - `tick_spacing` - A i32 integer representing the tick spacing
278
- *
279
- * # Returns
280
- * - A i32 integer representing the next initializable tick index
281
- */
282
- module.exports.getNextInitializableTickIndex = function(tick_index, tick_spacing) {
283
- const ret = wasm.getNextInitializableTickIndex(tick_index, tick_spacing);
284
- return ret;
265
+ module.exports._TICK_INDEX_OUT_OF_BOUNDS = function() {
266
+ try {
267
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
268
+ wasm._TICK_INDEX_OUT_OF_BOUNDS(retptr);
269
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
270
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
271
+ return getStringFromWasm0(r0, r1);
272
+ } finally {
273
+ wasm.__wbindgen_add_to_stack_pointer(16);
274
+ }
285
275
  };
286
276
 
287
- /**
288
- * Check if a tick is in-bounds.
289
- *
290
- * # Parameters
291
- * - `tick_index` - A i32 integer representing the tick integer
292
- *
293
- * # Returns
294
- * - A boolean value indicating if the tick is in-bounds
295
- */
296
- module.exports.isTickIndexInBounds = function(tick_index) {
297
- const ret = wasm.isTickIndexInBounds(tick_index);
298
- return ret !== 0;
277
+ module.exports._INVALID_TICK_INDEX = function() {
278
+ try {
279
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
280
+ wasm._INVALID_TICK_INDEX(retptr);
281
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
282
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
283
+ return getStringFromWasm0(r0, r1);
284
+ } finally {
285
+ wasm.__wbindgen_add_to_stack_pointer(16);
286
+ }
299
287
  };
300
288
 
301
- /**
302
- * Check if a tick is initializable.
303
- * A tick is initializable if it is divisible by the tick spacing.
304
- *
305
- * # Parameters
306
- * - `tick_index` - A i32 integer representing the tick integer
307
- * - `tick_spacing` - A i32 integer representing the tick spacing
308
- *
309
- * # Returns
310
- * - A boolean value indicating if the tick is initializable
311
- */
312
- module.exports.isTickInitializable = function(tick_index, tick_spacing) {
313
- const ret = wasm.isTickInitializable(tick_index, tick_spacing);
314
- return ret !== 0;
315
- };
316
-
317
- /**
318
- * Get the tick index for the inverse of the price that this tick represents.
319
- * Eg: Consider tick i where Pb/Pa = 1.0001 ^ i
320
- * inverse of this, i.e. Pa/Pb = 1 / (1.0001 ^ i) = 1.0001^-i
321
- *
322
- * # Parameters
323
- * - `tick_index` - A i32 integer representing the tick integer
324
- *
325
- * # Returns
326
- * - A i32 integer representing the tick index for the inverse of the price
327
- */
328
- module.exports.invertTickIndex = function(tick_index) {
329
- const ret = wasm.invertTickIndex(tick_index);
330
- return ret;
331
- };
332
-
333
- /**
334
- * Get the sqrt price for the inverse of the price that this tick represents.
335
- * Because converting to a tick index and then back to a sqrt price is lossy,
336
- * this function is clamped to the nearest tick index.
337
- *
338
- * # Parameters
339
- * - `sqrt_price` - A u128 integer representing the sqrt price
340
- *
341
- * # Returns
342
- * - A u128 integer representing the sqrt price for the inverse of the price
343
- */
344
- module.exports.invertSqrtPrice = function(sqrt_price) {
345
- const ret = wasm.invertSqrtPrice(addHeapObject(sqrt_price));
346
- return takeObject(ret);
347
- };
348
-
349
- /**
350
- * Get the minimum and maximum tick index that can be initialized.
351
- *
352
- * # Parameters
353
- * - `tick_spacing` - A i32 integer representing the tick spacing
354
- *
355
- * # Returns
356
- * - A TickRange struct containing the lower and upper tick index
357
- */
358
- module.exports.getFullRangeTickIndexes = function(tick_spacing) {
359
- const ret = wasm.getFullRangeTickIndexes(tick_spacing);
360
- return takeObject(ret);
361
- };
362
-
363
- /**
364
- * Order tick indexes in ascending order.
365
- * If the lower tick index is greater than the upper tick index, the indexes are swapped.
366
- * This is useful for ensuring that the lower tick index is always less than the upper tick index.
367
- *
368
- * # Parameters
369
- * - `tick_index_1` - A i32 integer representing the first tick index
370
- * - `tick_index_2` - A i32 integer representing the second tick index
371
- *
372
- * # Returns
373
- * - A TickRange struct containing the lower and upper tick index
374
- */
375
- module.exports.orderTickIndexes = function(tick_index_1, tick_index_2) {
376
- const ret = wasm.orderTickIndexes(tick_index_1, tick_index_2);
377
- return takeObject(ret);
378
- };
379
-
380
- /**
381
- * Check if a whirlpool is a full-range only pool.
382
- *
383
- * # Parameters
384
- * - `tick_spacing` - A u16 integer representing the tick spacing
385
- *
386
- * # Returns
387
- * - A boolean value indicating if the whirlpool is a full-range only pool
388
- */
389
- module.exports.isFullRangeOnly = function(tick_spacing) {
390
- const ret = wasm.isFullRangeOnly(tick_spacing);
391
- return ret !== 0;
392
- };
393
-
394
- /**
395
- * Get the index of a tick in a tick array.
396
- *
397
- * # Parameters
398
- * - `tick_index` - A i32 integer representing the tick index
399
- * - `tick_array_start_index` - A i32 integer representing the start tick index of the tick array
400
- * - `tick_spacing` - A u16 integer representing the tick spacing
401
- *
402
- * # Returns
403
- * - A u32 integer representing the tick index in the tick array
404
- */
405
- module.exports.getTickIndexInArray = function(tick_index, tick_array_start_index, tick_spacing) {
406
- try {
407
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
408
- wasm.getTickIndexInArray(retptr, tick_index, tick_array_start_index, tick_spacing);
409
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
410
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
411
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
412
- if (r2) {
413
- throw takeObject(r1);
414
- }
415
- return r0 >>> 0;
416
- } finally {
417
- wasm.__wbindgen_add_to_stack_pointer(16);
418
- }
419
- };
420
-
421
- module.exports._POSITION_BUNDLE_SIZE = function() {
422
- const ret = wasm._POSITION_BUNDLE_SIZE();
423
- return ret >>> 0;
424
- };
425
-
426
- module.exports._NUM_REWARDS = function() {
427
- const ret = wasm._NUM_REWARDS();
428
- return ret >>> 0;
429
- };
430
-
431
- module.exports._FEE_RATE_DENOMINATOR = function() {
432
- const ret = wasm._FEE_RATE_DENOMINATOR();
433
- return ret >>> 0;
434
- };
435
-
436
- module.exports._TICK_ARRAY_SIZE = function() {
437
- const ret = wasm._TICK_ARRAY_SIZE();
438
- return ret >>> 0;
439
- };
440
-
441
- module.exports._FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD = function() {
442
- const ret = wasm._FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD();
443
- return ret;
444
- };
445
-
446
- module.exports._MIN_TICK_INDEX = function() {
447
- const ret = wasm._MIN_TICK_INDEX();
448
- return ret;
449
- };
450
-
451
- module.exports._MAX_TICK_INDEX = function() {
452
- const ret = wasm._MAX_TICK_INDEX();
453
- return ret;
454
- };
455
-
456
- function passArray8ToWasm0(arg, malloc) {
457
- const ptr = malloc(arg.length * 1, 1) >>> 0;
458
- getUint8ArrayMemory0().set(arg, ptr / 1);
459
- WASM_VECTOR_LEN = arg.length;
460
- return ptr;
461
- }
462
- /**
463
- * Get the first unoccupied position in a bundle
464
- *
465
- * # Arguments
466
- * * `bundle` - The bundle to check
467
- *
468
- * # Returns
469
- * * `u32` - The first unoccupied position (None if full)
470
- */
471
- module.exports.firstUnoccupiedPositionInBundle = function(bitmap) {
472
- try {
473
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
474
- const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
475
- const len0 = WASM_VECTOR_LEN;
476
- wasm.firstUnoccupiedPositionInBundle(retptr, ptr0, len0);
477
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
478
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
479
- return r0 === 0 ? undefined : r1 >>> 0;
480
- } finally {
481
- wasm.__wbindgen_add_to_stack_pointer(16);
482
- }
483
- };
484
-
485
- /**
486
- * Check whether a position bundle is full
487
- * A position bundle can contain 256 positions
488
- *
489
- * # Arguments
490
- * * `bundle` - The bundle to check
491
- *
492
- * # Returns
493
- * * `bool` - Whether the bundle is full
494
- */
495
- module.exports.isPositionBundleFull = function(bitmap) {
496
- const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
497
- const len0 = WASM_VECTOR_LEN;
498
- const ret = wasm.isPositionBundleFull(ptr0, len0);
499
- return ret !== 0;
500
- };
501
-
502
- /**
503
- * Check whether a position bundle is empty
504
- *
505
- * # Arguments
506
- * * `bundle` - The bundle to check
507
- *
508
- * # Returns
509
- * * `bool` - Whether the bundle is empty
510
- */
511
- module.exports.isPositionBundleEmpty = function(bitmap) {
512
- const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
513
- const len0 = WASM_VECTOR_LEN;
514
- const ret = wasm.isPositionBundleEmpty(ptr0, len0);
515
- return ret !== 0;
516
- };
517
-
518
- module.exports._TICK_ARRAY_NOT_EVENLY_SPACED = function() {
519
- try {
520
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
521
- wasm._TICK_ARRAY_NOT_EVENLY_SPACED(retptr);
522
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
523
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
524
- return getStringFromWasm0(r0, r1);
525
- } finally {
526
- wasm.__wbindgen_add_to_stack_pointer(16);
527
- }
528
- };
529
-
530
- module.exports._TICK_INDEX_OUT_OF_BOUNDS = function() {
531
- try {
532
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
533
- wasm._TICK_INDEX_OUT_OF_BOUNDS(retptr);
534
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
535
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
536
- return getStringFromWasm0(r0, r1);
537
- } finally {
538
- wasm.__wbindgen_add_to_stack_pointer(16);
539
- }
540
- };
541
-
542
- module.exports._INVALID_TICK_INDEX = function() {
543
- try {
544
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
545
- wasm._INVALID_TICK_INDEX(retptr);
546
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
547
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
548
- return getStringFromWasm0(r0, r1);
549
- } finally {
550
- wasm.__wbindgen_add_to_stack_pointer(16);
551
- }
552
- };
553
-
554
- module.exports._ARITHMETIC_OVERFLOW = function() {
555
- try {
556
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
557
- wasm._ARITHMETIC_OVERFLOW(retptr);
558
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
559
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
560
- return getStringFromWasm0(r0, r1);
561
- } finally {
562
- wasm.__wbindgen_add_to_stack_pointer(16);
563
- }
289
+ module.exports._ARITHMETIC_OVERFLOW = function() {
290
+ try {
291
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
292
+ wasm._ARITHMETIC_OVERFLOW(retptr);
293
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
294
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
295
+ return getStringFromWasm0(r0, r1);
296
+ } finally {
297
+ wasm.__wbindgen_add_to_stack_pointer(16);
298
+ }
564
299
  };
565
300
 
566
301
  module.exports._AMOUNT_EXCEEDS_MAX_U64 = function() {
@@ -683,59 +418,317 @@ module.exports._TICK_INDEX_NOT_IN_ARRAY = function() {
683
418
  }
684
419
  };
685
420
 
686
- /**
687
- * Check if a position is in range.
688
- * When a position is in range it is earning fees and rewards
689
- *
690
- * # Parameters
691
- * - `sqrt_price` - A u128 integer representing the sqrt price of the pool
692
- * - `tick_index_1` - A i32 integer representing the first tick index of the position
693
- * - `tick_index_2` - A i32 integer representing the second tick index of the position
694
- *
695
- * # Returns
696
- * - A boolean value indicating if the position is in range
697
- */
698
- module.exports.isPositionInRange = function(current_sqrt_price, tick_index_1, tick_index_2) {
699
- const ret = wasm.isPositionInRange(addHeapObject(current_sqrt_price), tick_index_1, tick_index_2);
421
+ module.exports._NUM_REWARDS = function() {
422
+ const ret = wasm._NUM_REWARDS();
423
+ return ret >>> 0;
424
+ };
425
+
426
+ module.exports._FEE_RATE_DENOMINATOR = function() {
427
+ const ret = wasm._FEE_RATE_DENOMINATOR();
428
+ return ret >>> 0;
429
+ };
430
+
431
+ module.exports._TICK_ARRAY_SIZE = function() {
432
+ const ret = wasm._TICK_ARRAY_SIZE();
433
+ return ret >>> 0;
434
+ };
435
+
436
+ module.exports._FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD = function() {
437
+ const ret = wasm._FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD();
438
+ return ret;
439
+ };
440
+
441
+ module.exports._MIN_TICK_INDEX = function() {
442
+ const ret = wasm._MIN_TICK_INDEX();
443
+ return ret;
444
+ };
445
+
446
+ module.exports._MAX_TICK_INDEX = function() {
447
+ const ret = wasm._MAX_TICK_INDEX();
448
+ return ret;
449
+ };
450
+
451
+ function passArray8ToWasm0(arg, malloc) {
452
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
453
+ getUint8ArrayMemory0().set(arg, ptr / 1);
454
+ WASM_VECTOR_LEN = arg.length;
455
+ return ptr;
456
+ }
457
+ /**
458
+ * Get the first unoccupied position in a bundle
459
+ *
460
+ * # Arguments
461
+ * * `bundle` - The bundle to check
462
+ *
463
+ * # Returns
464
+ * * `u32` - The first unoccupied position (None if full)
465
+ */
466
+ module.exports.firstUnoccupiedPositionInBundle = function(bitmap) {
467
+ const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
468
+ const len0 = WASM_VECTOR_LEN;
469
+ const ret = wasm.firstUnoccupiedPositionInBundle(ptr0, len0);
470
+ return ret === 0x100000001 ? undefined : ret;
471
+ };
472
+
473
+ /**
474
+ * Check whether a position bundle is full
475
+ * A position bundle can contain 256 positions
476
+ *
477
+ * # Arguments
478
+ * * `bundle` - The bundle to check
479
+ *
480
+ * # Returns
481
+ * * `bool` - Whether the bundle is full
482
+ */
483
+ module.exports.isPositionBundleFull = function(bitmap) {
484
+ const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
485
+ const len0 = WASM_VECTOR_LEN;
486
+ const ret = wasm.isPositionBundleFull(ptr0, len0);
700
487
  return ret !== 0;
701
488
  };
702
489
 
703
490
  /**
704
- * Calculate the status of a position
705
- * The status can be one of three values:
706
- * - InRange: The position is in range
707
- * - BelowRange: The position is below the range
708
- * - AboveRange: The position is above the range
491
+ * Check whether a position bundle is empty
492
+ *
493
+ * # Arguments
494
+ * * `bundle` - The bundle to check
495
+ *
496
+ * # Returns
497
+ * * `bool` - Whether the bundle is empty
498
+ */
499
+ module.exports.isPositionBundleEmpty = function(bitmap) {
500
+ const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export_0);
501
+ const len0 = WASM_VECTOR_LEN;
502
+ const ret = wasm.isPositionBundleEmpty(ptr0, len0);
503
+ return ret !== 0;
504
+ };
505
+
506
+ /**
507
+ * Get the first tick index in the tick array that contains the specified tick index.
709
508
  *
710
509
  * # Parameters
711
- * - `sqrt_price` - A u128 integer representing the sqrt price of the pool
712
- * - `tick_index_1` - A i32 integer representing the first tick index of the position
713
- * - `tick_index_2` - A i32 integer representing the second tick index of the position
510
+ * - `tick_index` - A i32 integer representing the tick integer
511
+ * - `tick_spacing` - A i32 integer representing the tick spacing
714
512
  *
715
513
  * # Returns
716
- * - A PositionStatus enum value indicating the status of the position
514
+ * - A i32 integer representing the first tick index in the tick array
717
515
  */
718
- module.exports.positionStatus = function(current_sqrt_price, tick_index_1, tick_index_2) {
719
- const ret = wasm.positionStatus(addHeapObject(current_sqrt_price), tick_index_1, tick_index_2);
516
+ module.exports.getTickArrayStartTickIndex = function(tick_index, tick_spacing) {
517
+ const ret = wasm.getTickArrayStartTickIndex(tick_index, tick_spacing);
518
+ return ret;
519
+ };
520
+
521
+ /**
522
+ * Derive the sqrt-price from a tick index. The precision of this method is only guarranted
523
+ * if tick is within the bounds of {max, min} tick-index.
524
+ *
525
+ * # Parameters
526
+ * - `tick_index` - A i32 integer representing the tick integer
527
+ *
528
+ * # Returns
529
+ * - `Ok`: A u128 Q32.64 representing the sqrt_price
530
+ */
531
+ module.exports.tickIndexToSqrtPrice = function(tick_index) {
532
+ const ret = wasm.tickIndexToSqrtPrice(tick_index);
720
533
  return takeObject(ret);
721
534
  };
722
535
 
723
536
  /**
724
- * Calculate the token_a / token_b ratio of a (ficticious) position
537
+ * Derive the tick index from a sqrt price. The precision of this method is only guarranted
538
+ * if tick is within the bounds of {max, min} tick-index.
725
539
  *
726
540
  * # Parameters
727
- * - `sqrt_price` - A u128 integer representing the sqrt price of the pool
728
- * - `tick_index_1` - A i32 integer representing the first tick index of the position
729
- * - `tick_index_2` - A i32 integer representing the second tick index of the position
541
+ * - `sqrt_price` - A u128 integer representing the sqrt price
730
542
  *
731
543
  * # Returns
732
- * - A PositionRatio struct containing the ratio of token_a and token_b
544
+ * - `Ok`: A i32 integer representing the tick integer
733
545
  */
734
- module.exports.positionRatio = function(current_sqrt_price, tick_index_1, tick_index_2) {
735
- const ret = wasm.positionRatio(addHeapObject(current_sqrt_price), tick_index_1, tick_index_2);
546
+ module.exports.sqrtPriceToTickIndex = function(sqrt_price) {
547
+ const ret = wasm.sqrtPriceToTickIndex(addHeapObject(sqrt_price));
548
+ return ret;
549
+ };
550
+
551
+ /**
552
+ * Get the initializable tick index.
553
+ * If the tick index is already initializable, it is returned as is.
554
+ *
555
+ * # Parameters
556
+ * - `tick_index` - A i32 integer representing the tick integer
557
+ * - `tick_spacing` - A i32 integer representing the tick spacing
558
+ * - `round_up` - A boolean value indicating if the supplied tick index should be rounded up. None will round to the nearest.
559
+ *
560
+ * # Returns
561
+ * - A i32 integer representing the previous initializable tick index
562
+ */
563
+ module.exports.getInitializableTickIndex = function(tick_index, tick_spacing, round_up) {
564
+ const ret = wasm.getInitializableTickIndex(tick_index, tick_spacing, isLikeNone(round_up) ? 0xFFFFFF : round_up ? 1 : 0);
565
+ return ret;
566
+ };
567
+
568
+ /**
569
+ * Get the previous initializable 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 previous initializable tick index
577
+ */
578
+ module.exports.getPrevInitializableTickIndex = function(tick_index, tick_spacing) {
579
+ const ret = wasm.getPrevInitializableTickIndex(tick_index, tick_spacing);
580
+ return ret;
581
+ };
582
+
583
+ /**
584
+ * Get the next initializable tick index.
585
+ *
586
+ * # Parameters
587
+ * - `tick_index` - A i32 integer representing the tick integer
588
+ * - `tick_spacing` - A i32 integer representing the tick spacing
589
+ *
590
+ * # Returns
591
+ * - A i32 integer representing the next initializable tick index
592
+ */
593
+ module.exports.getNextInitializableTickIndex = function(tick_index, tick_spacing) {
594
+ const ret = wasm.getNextInitializableTickIndex(tick_index, tick_spacing);
595
+ return ret;
596
+ };
597
+
598
+ /**
599
+ * Check if a tick is in-bounds.
600
+ *
601
+ * # Parameters
602
+ * - `tick_index` - A i32 integer representing the tick integer
603
+ *
604
+ * # Returns
605
+ * - A boolean value indicating if the tick is in-bounds
606
+ */
607
+ module.exports.isTickIndexInBounds = function(tick_index) {
608
+ const ret = wasm.isTickIndexInBounds(tick_index);
609
+ return ret !== 0;
610
+ };
611
+
612
+ /**
613
+ * Check if a tick is initializable.
614
+ * A tick is initializable if it is divisible by the tick spacing.
615
+ *
616
+ * # Parameters
617
+ * - `tick_index` - A i32 integer representing the tick integer
618
+ * - `tick_spacing` - A i32 integer representing the tick spacing
619
+ *
620
+ * # Returns
621
+ * - A boolean value indicating if the tick is initializable
622
+ */
623
+ module.exports.isTickInitializable = function(tick_index, tick_spacing) {
624
+ const ret = wasm.isTickInitializable(tick_index, tick_spacing);
625
+ return ret !== 0;
626
+ };
627
+
628
+ /**
629
+ * Get the tick index for the inverse of the price that this tick represents.
630
+ * Eg: Consider tick i where Pb/Pa = 1.0001 ^ i
631
+ * inverse of this, i.e. Pa/Pb = 1 / (1.0001 ^ i) = 1.0001^-i
632
+ *
633
+ * # Parameters
634
+ * - `tick_index` - A i32 integer representing the tick integer
635
+ *
636
+ * # Returns
637
+ * - A i32 integer representing the tick index for the inverse of the price
638
+ */
639
+ module.exports.invertTickIndex = function(tick_index) {
640
+ const ret = wasm.invertTickIndex(tick_index);
641
+ return ret;
642
+ };
643
+
644
+ /**
645
+ * Get the sqrt price for the inverse of the price that this tick represents.
646
+ * Because converting to a tick index and then back to a sqrt price is lossy,
647
+ * this function is clamped to the nearest tick index.
648
+ *
649
+ * # Parameters
650
+ * - `sqrt_price` - A u128 integer representing the sqrt price
651
+ *
652
+ * # Returns
653
+ * - A u128 integer representing the sqrt price for the inverse of the price
654
+ */
655
+ module.exports.invertSqrtPrice = function(sqrt_price) {
656
+ const ret = wasm.invertSqrtPrice(addHeapObject(sqrt_price));
657
+ return takeObject(ret);
658
+ };
659
+
660
+ /**
661
+ * Get the minimum and maximum tick index that can be initialized.
662
+ *
663
+ * # Parameters
664
+ * - `tick_spacing` - A i32 integer representing the tick spacing
665
+ *
666
+ * # Returns
667
+ * - A TickRange struct containing the lower and upper tick index
668
+ */
669
+ module.exports.getFullRangeTickIndexes = function(tick_spacing) {
670
+ const ret = wasm.getFullRangeTickIndexes(tick_spacing);
736
671
  return takeObject(ret);
737
672
  };
738
673
 
674
+ /**
675
+ * Order tick indexes in ascending order.
676
+ * If the lower tick index is greater than the upper tick index, the indexes are swapped.
677
+ * This is useful for ensuring that the lower tick index is always less than the upper tick index.
678
+ *
679
+ * # Parameters
680
+ * - `tick_index_1` - A i32 integer representing the first tick index
681
+ * - `tick_index_2` - A i32 integer representing the second tick index
682
+ *
683
+ * # Returns
684
+ * - A TickRange struct containing the lower and upper tick index
685
+ */
686
+ module.exports.orderTickIndexes = function(tick_index_1, tick_index_2) {
687
+ const ret = wasm.orderTickIndexes(tick_index_1, tick_index_2);
688
+ return takeObject(ret);
689
+ };
690
+
691
+ /**
692
+ * Check if a whirlpool is a full-range only pool.
693
+ *
694
+ * # Parameters
695
+ * - `tick_spacing` - A u16 integer representing the tick spacing
696
+ *
697
+ * # Returns
698
+ * - A boolean value indicating if the whirlpool is a full-range only pool
699
+ */
700
+ module.exports.isFullRangeOnly = function(tick_spacing) {
701
+ const ret = wasm.isFullRangeOnly(tick_spacing);
702
+ return ret !== 0;
703
+ };
704
+
705
+ /**
706
+ * Get the index of a tick in a tick array.
707
+ *
708
+ * # Parameters
709
+ * - `tick_index` - A i32 integer representing the tick index
710
+ * - `tick_array_start_index` - A i32 integer representing the start tick index of the tick array
711
+ * - `tick_spacing` - A u16 integer representing the tick spacing
712
+ *
713
+ * # Returns
714
+ * - A u32 integer representing the tick index in the tick array
715
+ */
716
+ module.exports.getTickIndexInArray = function(tick_index, tick_array_start_index, tick_spacing) {
717
+ try {
718
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
719
+ wasm.getTickIndexInArray(retptr, tick_index, tick_array_start_index, tick_spacing);
720
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
721
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
722
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
723
+ if (r2) {
724
+ throw takeObject(r1);
725
+ }
726
+ return r0 >>> 0;
727
+ } finally {
728
+ wasm.__wbindgen_add_to_stack_pointer(16);
729
+ }
730
+ };
731
+
739
732
  /**
740
733
  * Calculate the amount A delta between two sqrt_prices
741
734
  *
@@ -1414,272 +1407,272 @@ module.exports.collectRewardsQuote = function(whirlpool, position, tick_lower, t
1414
1407
  }
1415
1408
  };
1416
1409
 
1417
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
1418
- const ret = getStringFromWasm0(arg0, arg1);
1419
- return addHeapObject(ret);
1420
- };
1421
-
1422
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
1423
- takeObject(arg0);
1424
- };
1425
-
1426
- module.exports.__wbindgen_string_get = function(arg0, arg1) {
1427
- const obj = getObject(arg1);
1428
- const ret = typeof(obj) === 'string' ? obj : undefined;
1429
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1430
- var len1 = WASM_VECTOR_LEN;
1431
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1432
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1433
- };
1434
-
1435
- module.exports.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
1436
- const v = getObject(arg1);
1437
- const ret = typeof(v) === 'bigint' ? v : undefined;
1438
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1439
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1440
- };
1441
-
1442
- module.exports.__wbindgen_debug_string = function(arg0, arg1) {
1443
- const ret = debugString(getObject(arg1));
1410
+ module.exports.__wbg_String_eecc4a11987127d6 = function(arg0, arg1) {
1411
+ const ret = String(getObject(arg1));
1444
1412
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1445
1413
  const len1 = WASM_VECTOR_LEN;
1446
1414
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1447
1415
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1448
1416
  };
1449
1417
 
1450
- module.exports.__wbindgen_throw = function(arg0, arg1) {
1451
- throw new Error(getStringFromWasm0(arg0, arg1));
1418
+ module.exports.__wbg_buffer_6e1d53ff183194fc = function(arg0) {
1419
+ const ret = getObject(arg0).buffer;
1420
+ return addHeapObject(ret);
1452
1421
  };
1453
1422
 
1454
- module.exports.__wbindgen_memory = function() {
1455
- const ret = wasm.memory;
1423
+ module.exports.__wbg_call_3114932863209ca6 = function() { return handleError(function (arg0, arg1) {
1424
+ const ret = getObject(arg0).call(getObject(arg1));
1456
1425
  return addHeapObject(ret);
1426
+ }, arguments) };
1427
+
1428
+ module.exports.__wbg_done_adfd3f40364def50 = function(arg0) {
1429
+ const ret = getObject(arg0).done;
1430
+ return ret;
1457
1431
  };
1458
1432
 
1459
- module.exports.__wbindgen_object_clone_ref = function(arg0) {
1460
- const ret = getObject(arg0);
1433
+ module.exports.__wbg_get_68aa371864aa301a = function(arg0, arg1) {
1434
+ const ret = getObject(arg0)[arg1 >>> 0];
1461
1435
  return addHeapObject(ret);
1462
1436
  };
1463
1437
 
1464
- module.exports.__wbg_get_ef828680c64da212 = function() { return handleError(function (arg0, arg1) {
1438
+ module.exports.__wbg_get_92a4780a3beb5fe9 = function() { return handleError(function (arg0, arg1) {
1465
1439
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
1466
1440
  return addHeapObject(ret);
1467
1441
  }, arguments) };
1468
1442
 
1469
- module.exports.__wbg_buffer_ccaed51a635d8a2d = function(arg0) {
1470
- const ret = getObject(arg0).buffer;
1443
+ module.exports.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
1444
+ const ret = getObject(arg0)[getObject(arg1)];
1471
1445
  return addHeapObject(ret);
1472
1446
  };
1473
1447
 
1474
- module.exports.__wbg_get_5419cf6b954aa11d = function(arg0, arg1) {
1475
- const ret = getObject(arg0)[arg1 >>> 0];
1448
+ module.exports.__wbg_getwithrefkey_6550b2c093d2eb18 = function(arg0, arg1) {
1449
+ const ret = getObject(arg0)[getObject(arg1)];
1476
1450
  return addHeapObject(ret);
1477
1451
  };
1478
1452
 
1479
- module.exports.__wbg_length_f217bbbf7e8e4df4 = function(arg0) {
1480
- const ret = getObject(arg0).length;
1453
+ module.exports.__wbg_instanceof_ArrayBuffer_435fcead703e2827 = function(arg0) {
1454
+ let result;
1455
+ try {
1456
+ result = getObject(arg0) instanceof ArrayBuffer;
1457
+ } catch (_) {
1458
+ result = false;
1459
+ }
1460
+ const ret = result;
1481
1461
  return ret;
1482
1462
  };
1483
1463
 
1484
- module.exports.__wbg_new_034f913e7636e987 = function() {
1485
- const ret = new Array();
1486
- return addHeapObject(ret);
1487
- };
1488
-
1489
- module.exports.__wbindgen_number_new = function(arg0) {
1490
- const ret = arg0;
1491
- return addHeapObject(ret);
1464
+ module.exports.__wbg_instanceof_Uint8Array_9b67296cab48238f = function(arg0) {
1465
+ let result;
1466
+ try {
1467
+ result = getObject(arg0) instanceof Uint8Array;
1468
+ } catch (_) {
1469
+ result = false;
1470
+ }
1471
+ const ret = result;
1472
+ return ret;
1492
1473
  };
1493
1474
 
1494
- module.exports.__wbindgen_is_function = function(arg0) {
1495
- const ret = typeof(getObject(arg0)) === 'function';
1475
+ module.exports.__wbg_isArray_fcd559a3bcfde1e9 = function(arg0) {
1476
+ const ret = Array.isArray(getObject(arg0));
1496
1477
  return ret;
1497
1478
  };
1498
1479
 
1499
- module.exports.__wbindgen_is_object = function(arg0) {
1500
- const val = getObject(arg0);
1501
- const ret = typeof(val) === 'object' && val !== null;
1480
+ module.exports.__wbg_isSafeInteger_4de146aa53f6e470 = function(arg0) {
1481
+ const ret = Number.isSafeInteger(getObject(arg0));
1502
1482
  return ret;
1503
1483
  };
1504
1484
 
1505
- module.exports.__wbg_next_13b477da1eaa3897 = function(arg0) {
1506
- const ret = getObject(arg0).next;
1485
+ module.exports.__wbg_iterator_7a20c20ce22add0f = function() {
1486
+ const ret = Symbol.iterator;
1507
1487
  return addHeapObject(ret);
1508
1488
  };
1509
1489
 
1510
- module.exports.__wbg_next_b06e115d1b01e10b = function() { return handleError(function (arg0) {
1511
- const ret = getObject(arg0).next();
1512
- return addHeapObject(ret);
1513
- }, arguments) };
1490
+ module.exports.__wbg_length_2e63ba34c4121df5 = function(arg0) {
1491
+ const ret = getObject(arg0).length;
1492
+ return ret;
1493
+ };
1514
1494
 
1515
- module.exports.__wbg_done_983b5ffcaec8c583 = function(arg0) {
1516
- const ret = getObject(arg0).done;
1495
+ module.exports.__wbg_length_e74df4881604f1d9 = function(arg0) {
1496
+ const ret = getObject(arg0).length;
1517
1497
  return ret;
1518
1498
  };
1519
1499
 
1520
- module.exports.__wbg_value_2ab8a198c834c26a = function(arg0) {
1521
- const ret = getObject(arg0).value;
1500
+ module.exports.__wbg_new_076cac58bb698dd4 = function() {
1501
+ const ret = new Object();
1522
1502
  return addHeapObject(ret);
1523
1503
  };
1524
1504
 
1525
- module.exports.__wbg_iterator_695d699a44d6234c = function() {
1526
- const ret = Symbol.iterator;
1505
+ module.exports.__wbg_new_0c28e72025e00594 = function() {
1506
+ const ret = new Array();
1527
1507
  return addHeapObject(ret);
1528
1508
  };
1529
1509
 
1530
- module.exports.__wbg_call_a9ef466721e824f2 = function() { return handleError(function (arg0, arg1) {
1531
- const ret = getObject(arg0).call(getObject(arg1));
1510
+ module.exports.__wbg_new_23362fa370a0a372 = function(arg0) {
1511
+ const ret = new Uint8Array(getObject(arg0));
1512
+ return addHeapObject(ret);
1513
+ };
1514
+
1515
+ module.exports.__wbg_next_c591766a7286b02a = function() { return handleError(function (arg0) {
1516
+ const ret = getObject(arg0).next();
1532
1517
  return addHeapObject(ret);
1533
1518
  }, arguments) };
1534
1519
 
1535
- module.exports.__wbg_new_e69b5f66fda8f13c = function() {
1536
- const ret = new Object();
1520
+ module.exports.__wbg_next_f387ecc56a94ba00 = function(arg0) {
1521
+ const ret = getObject(arg0).next;
1537
1522
  return addHeapObject(ret);
1538
1523
  };
1539
1524
 
1540
- module.exports.__wbindgen_number_get = function(arg0, arg1) {
1541
- const obj = getObject(arg1);
1542
- const ret = typeof(obj) === 'number' ? obj : undefined;
1543
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1544
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1525
+ module.exports.__wbg_set_3807d5f0bfc24aa7 = function(arg0, arg1, arg2) {
1526
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1545
1527
  };
1546
1528
 
1547
- module.exports.__wbindgen_is_undefined = function(arg0) {
1548
- const ret = getObject(arg0) === undefined;
1549
- return ret;
1529
+ module.exports.__wbg_set_7b70226104a82921 = function(arg0, arg1, arg2) {
1530
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
1550
1531
  };
1551
1532
 
1552
- module.exports.__wbg_set_425e70f7c64ac962 = function(arg0, arg1, arg2) {
1533
+ module.exports.__wbg_set_a1fb6291729caffb = function(arg0, arg1, arg2) {
1553
1534
  getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1554
1535
  };
1555
1536
 
1556
- module.exports.__wbg_isArray_6f3b47f09adb61b5 = function(arg0) {
1557
- const ret = Array.isArray(getObject(arg0));
1558
- return ret;
1537
+ module.exports.__wbg_value_30db1d77772f3236 = function(arg0) {
1538
+ const ret = getObject(arg0).value;
1539
+ return addHeapObject(ret);
1559
1540
  };
1560
1541
 
1561
- module.exports.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7 = function(arg0) {
1562
- let result;
1563
- try {
1564
- result = getObject(arg0) instanceof ArrayBuffer;
1565
- } catch (_) {
1566
- result = false;
1567
- }
1568
- const ret = result;
1542
+ module.exports.__wbindgen_as_number = function(arg0) {
1543
+ const ret = +getObject(arg0);
1569
1544
  return ret;
1570
1545
  };
1571
1546
 
1572
- module.exports.__wbg_isSafeInteger_b9dff570f01a9100 = function(arg0) {
1573
- const ret = Number.isSafeInteger(getObject(arg0));
1574
- return ret;
1547
+ module.exports.__wbindgen_bigint_from_i64 = function(arg0) {
1548
+ const ret = arg0;
1549
+ return addHeapObject(ret);
1575
1550
  };
1576
1551
 
1577
- module.exports.__wbg_new_fec2611eb9180f95 = function(arg0) {
1578
- const ret = new Uint8Array(getObject(arg0));
1552
+ module.exports.__wbindgen_bigint_from_u128 = function(arg0, arg1) {
1553
+ const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1);
1579
1554
  return addHeapObject(ret);
1580
1555
  };
1581
1556
 
1582
- module.exports.__wbg_set_ec2fcf81bc573fd9 = function(arg0, arg1, arg2) {
1583
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
1557
+ module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
1558
+ const ret = BigInt.asUintN(64, arg0);
1559
+ return addHeapObject(ret);
1584
1560
  };
1585
1561
 
1586
- module.exports.__wbg_length_9254c4bd3b9f23c4 = function(arg0) {
1587
- const ret = getObject(arg0).length;
1588
- return ret;
1562
+ module.exports.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
1563
+ const v = getObject(arg1);
1564
+ const ret = typeof(v) === 'bigint' ? v : undefined;
1565
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1566
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1589
1567
  };
1590
1568
 
1591
- module.exports.__wbg_instanceof_Uint8Array_df0761410414ef36 = function(arg0) {
1592
- let result;
1593
- try {
1594
- result = getObject(arg0) instanceof Uint8Array;
1595
- } catch (_) {
1596
- result = false;
1597
- }
1598
- const ret = result;
1569
+ module.exports.__wbindgen_boolean_get = function(arg0) {
1570
+ const v = getObject(arg0);
1571
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1599
1572
  return ret;
1600
1573
  };
1601
1574
 
1602
- module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
1603
- const ret = BigInt.asUintN(64, arg0);
1604
- return addHeapObject(ret);
1575
+ module.exports.__wbindgen_debug_string = function(arg0, arg1) {
1576
+ const ret = debugString(getObject(arg1));
1577
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1578
+ const len1 = WASM_VECTOR_LEN;
1579
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1580
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1605
1581
  };
1606
1582
 
1607
- module.exports.__wbindgen_shr = function(arg0, arg1) {
1608
- const ret = getObject(arg0) >> getObject(arg1);
1583
+ module.exports.__wbindgen_error_new = function(arg0, arg1) {
1584
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1609
1585
  return addHeapObject(ret);
1610
1586
  };
1611
1587
 
1612
- module.exports.__wbindgen_bigint_from_i64 = function(arg0) {
1613
- const ret = arg0;
1614
- return addHeapObject(ret);
1588
+ module.exports.__wbindgen_in = function(arg0, arg1) {
1589
+ const ret = getObject(arg0) in getObject(arg1);
1590
+ return ret;
1615
1591
  };
1616
1592
 
1617
- module.exports.__wbindgen_jsval_eq = function(arg0, arg1) {
1618
- const ret = getObject(arg0) === getObject(arg1);
1593
+ module.exports.__wbindgen_is_array = function(arg0) {
1594
+ const ret = Array.isArray(getObject(arg0));
1619
1595
  return ret;
1620
1596
  };
1621
1597
 
1622
- module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
1623
- const ret = getObject(arg0) == getObject(arg1);
1598
+ module.exports.__wbindgen_is_bigint = function(arg0) {
1599
+ const ret = typeof(getObject(arg0)) === 'bigint';
1624
1600
  return ret;
1625
1601
  };
1626
1602
 
1627
- module.exports.__wbindgen_boolean_get = function(arg0) {
1628
- const v = getObject(arg0);
1629
- const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1603
+ module.exports.__wbindgen_is_function = function(arg0) {
1604
+ const ret = typeof(getObject(arg0)) === 'function';
1630
1605
  return ret;
1631
1606
  };
1632
1607
 
1633
- module.exports.__wbg_String_88810dfeb4021902 = function(arg0, arg1) {
1634
- const ret = String(getObject(arg1));
1635
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1636
- const len1 = WASM_VECTOR_LEN;
1637
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1638
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1608
+ module.exports.__wbindgen_is_object = function(arg0) {
1609
+ const val = getObject(arg0);
1610
+ const ret = typeof(val) === 'object' && val !== null;
1611
+ return ret;
1639
1612
  };
1640
1613
 
1641
- module.exports.__wbindgen_error_new = function(arg0, arg1) {
1642
- const ret = new Error(getStringFromWasm0(arg0, arg1));
1643
- return addHeapObject(ret);
1614
+ module.exports.__wbindgen_is_undefined = function(arg0) {
1615
+ const ret = getObject(arg0) === undefined;
1616
+ return ret;
1644
1617
  };
1645
1618
 
1646
- module.exports.__wbindgen_bigint_from_u128 = function(arg0, arg1) {
1647
- const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1);
1619
+ module.exports.__wbindgen_jsval_eq = function(arg0, arg1) {
1620
+ const ret = getObject(arg0) === getObject(arg1);
1621
+ return ret;
1622
+ };
1623
+
1624
+ module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
1625
+ const ret = getObject(arg0) == getObject(arg1);
1626
+ return ret;
1627
+ };
1628
+
1629
+ module.exports.__wbindgen_memory = function() {
1630
+ const ret = wasm.memory;
1648
1631
  return addHeapObject(ret);
1649
1632
  };
1650
1633
 
1651
- module.exports.__wbg_getwithrefkey_5e6d9547403deab8 = function(arg0, arg1) {
1652
- const ret = getObject(arg0)[getObject(arg1)];
1634
+ module.exports.__wbindgen_number_get = function(arg0, arg1) {
1635
+ const obj = getObject(arg1);
1636
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1637
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1638
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1639
+ };
1640
+
1641
+ module.exports.__wbindgen_number_new = function(arg0) {
1642
+ const ret = arg0;
1653
1643
  return addHeapObject(ret);
1654
1644
  };
1655
1645
 
1656
- module.exports.__wbg_set_841ac57cff3d672b = function(arg0, arg1, arg2) {
1657
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1646
+ module.exports.__wbindgen_object_clone_ref = function(arg0) {
1647
+ const ret = getObject(arg0);
1648
+ return addHeapObject(ret);
1658
1649
  };
1659
1650
 
1660
- module.exports.__wbindgen_as_number = function(arg0) {
1661
- const ret = +getObject(arg0);
1662
- return ret;
1651
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
1652
+ takeObject(arg0);
1663
1653
  };
1664
1654
 
1665
- module.exports.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
1666
- const ret = getObject(arg0)[getObject(arg1)];
1655
+ module.exports.__wbindgen_shr = function(arg0, arg1) {
1656
+ const ret = getObject(arg0) >> getObject(arg1);
1667
1657
  return addHeapObject(ret);
1668
1658
  };
1669
1659
 
1670
- module.exports.__wbindgen_in = function(arg0, arg1) {
1671
- const ret = getObject(arg0) in getObject(arg1);
1672
- return ret;
1660
+ module.exports.__wbindgen_string_get = function(arg0, arg1) {
1661
+ const obj = getObject(arg1);
1662
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1663
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1664
+ var len1 = WASM_VECTOR_LEN;
1665
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1666
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1673
1667
  };
1674
1668
 
1675
- module.exports.__wbindgen_is_bigint = function(arg0) {
1676
- const ret = typeof(getObject(arg0)) === 'bigint';
1677
- return ret;
1669
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
1670
+ const ret = getStringFromWasm0(arg0, arg1);
1671
+ return addHeapObject(ret);
1678
1672
  };
1679
1673
 
1680
- module.exports.__wbindgen_is_array = function(arg0) {
1681
- const ret = Array.isArray(getObject(arg0));
1682
- return ret;
1674
+ module.exports.__wbindgen_throw = function(arg0, arg1) {
1675
+ throw new Error(getStringFromWasm0(arg0, arg1));
1683
1676
  };
1684
1677
 
1685
1678
  const path = require('path').join(__dirname, 'orca_whirlpools_core_js_bindings_bg.wasm');