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