@crypticdot/defituna-core 3.4.4 → 3.4.6
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/defituna_core_js_bindings.d.ts +342 -313
- package/dist/browser/defituna_core_js_bindings_bg.js +524 -449
- package/dist/browser/defituna_core_js_bindings_bg.wasm +0 -0
- package/dist/browser/defituna_core_js_bindings_bg.wasm.d.ts +38 -33
- package/dist/nodejs/defituna_core_js_bindings.d.ts +342 -313
- package/dist/nodejs/defituna_core_js_bindings.js +524 -449
- package/dist/nodejs/defituna_core_js_bindings_bg.wasm +0 -0
- package/dist/nodejs/defituna_core_js_bindings_bg.wasm.d.ts +38 -33
- package/package.json +2 -2
|
@@ -262,6 +262,204 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
262
262
|
WASM_VECTOR_LEN = arg.length;
|
|
263
263
|
return ptr;
|
|
264
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* Get the first unoccupied position in a bundle
|
|
267
|
+
*
|
|
268
|
+
* # Arguments
|
|
269
|
+
* * `bundle` - The bundle to check
|
|
270
|
+
*
|
|
271
|
+
* # Returns
|
|
272
|
+
* * `u32` - The first unoccupied position (None if full)
|
|
273
|
+
*/
|
|
274
|
+
export function firstUnoccupiedPositionInBundle(bitmap) {
|
|
275
|
+
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export);
|
|
276
|
+
const len0 = WASM_VECTOR_LEN;
|
|
277
|
+
const ret = wasm.firstUnoccupiedPositionInBundle(ptr0, len0);
|
|
278
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Check whether a position bundle is full
|
|
283
|
+
* A position bundle can contain 256 positions
|
|
284
|
+
*
|
|
285
|
+
* # Arguments
|
|
286
|
+
* * `bundle` - The bundle to check
|
|
287
|
+
*
|
|
288
|
+
* # Returns
|
|
289
|
+
* * `bool` - Whether the bundle is full
|
|
290
|
+
*/
|
|
291
|
+
export function isPositionBundleFull(bitmap) {
|
|
292
|
+
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export);
|
|
293
|
+
const len0 = WASM_VECTOR_LEN;
|
|
294
|
+
const ret = wasm.isPositionBundleFull(ptr0, len0);
|
|
295
|
+
return ret !== 0;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Check whether a position bundle is empty
|
|
300
|
+
*
|
|
301
|
+
* # Arguments
|
|
302
|
+
* * `bundle` - The bundle to check
|
|
303
|
+
*
|
|
304
|
+
* # Returns
|
|
305
|
+
* * `bool` - Whether the bundle is empty
|
|
306
|
+
*/
|
|
307
|
+
export function isPositionBundleEmpty(bitmap) {
|
|
308
|
+
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export);
|
|
309
|
+
const len0 = WASM_VECTOR_LEN;
|
|
310
|
+
const ret = wasm.isPositionBundleEmpty(ptr0, len0);
|
|
311
|
+
return ret !== 0;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Check if a position is in range.
|
|
316
|
+
* When a position is in range it is earning fees and rewards
|
|
317
|
+
*
|
|
318
|
+
* # Parameters
|
|
319
|
+
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
320
|
+
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
321
|
+
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
322
|
+
*
|
|
323
|
+
* # Returns
|
|
324
|
+
* - A boolean value indicating if the position is in range
|
|
325
|
+
*/
|
|
326
|
+
export function isPositionInRange(current_sqrt_price, tick_index_1, tick_index_2) {
|
|
327
|
+
const ret = wasm.isPositionInRange(current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2);
|
|
328
|
+
return ret !== 0;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Calculate the status of a position
|
|
333
|
+
* The status can be one of three values:
|
|
334
|
+
* - InRange: The position is in range
|
|
335
|
+
* - BelowRange: The position is below the range
|
|
336
|
+
* - AboveRange: The position is above the range
|
|
337
|
+
*
|
|
338
|
+
* # Parameters
|
|
339
|
+
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
340
|
+
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
341
|
+
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
342
|
+
*
|
|
343
|
+
* # Returns
|
|
344
|
+
* - A PositionStatus enum value indicating the status of the position
|
|
345
|
+
*/
|
|
346
|
+
export function positionStatus(current_sqrt_price, tick_index_1, tick_index_2) {
|
|
347
|
+
const ret = wasm.positionStatus(current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2);
|
|
348
|
+
return takeObject(ret);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Calculate the token_a / token_b ratio of a (ficticious) position
|
|
353
|
+
*
|
|
354
|
+
* # Parameters
|
|
355
|
+
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
356
|
+
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
357
|
+
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
358
|
+
*
|
|
359
|
+
* # Returns
|
|
360
|
+
* - A PositionRatio struct containing the ratio of token_a and token_b
|
|
361
|
+
*/
|
|
362
|
+
export function positionRatioX64(current_sqrt_price, tick_index_1, tick_index_2) {
|
|
363
|
+
const ret = wasm.positionRatioX64(current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2);
|
|
364
|
+
return takeObject(ret);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Convert a price into a sqrt priceX64
|
|
369
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
370
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
371
|
+
*
|
|
372
|
+
* # Parameters
|
|
373
|
+
* * `price` - The price to convert
|
|
374
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
375
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
376
|
+
*
|
|
377
|
+
* # Returns
|
|
378
|
+
* * `u128` - The sqrt priceX64
|
|
379
|
+
*/
|
|
380
|
+
export function priceToSqrtPrice(price, decimals_a, decimals_b) {
|
|
381
|
+
try {
|
|
382
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
383
|
+
wasm.priceToSqrtPrice(retptr, price, decimals_a, decimals_b);
|
|
384
|
+
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
385
|
+
var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
|
|
386
|
+
return (BigInt.asUintN(64, r0) | (BigInt.asUintN(64, r2) << BigInt(64)));
|
|
387
|
+
} finally {
|
|
388
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Convert a sqrt priceX64 into a tick index
|
|
394
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
395
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
396
|
+
*
|
|
397
|
+
* # Parameters
|
|
398
|
+
* * `sqrt_price` - The sqrt priceX64 to convert
|
|
399
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
400
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
401
|
+
*
|
|
402
|
+
* # Returns
|
|
403
|
+
* * `f64` - The decimal price
|
|
404
|
+
*/
|
|
405
|
+
export function sqrtPriceToPrice(sqrt_price, decimals_a, decimals_b) {
|
|
406
|
+
const ret = wasm.sqrtPriceToPrice(sqrt_price, sqrt_price >> BigInt(64), decimals_a, decimals_b);
|
|
407
|
+
return ret;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Invert a price
|
|
412
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
413
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
414
|
+
*
|
|
415
|
+
* # Parameters
|
|
416
|
+
* * `price` - The price to invert
|
|
417
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
418
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
419
|
+
*
|
|
420
|
+
* # Returns
|
|
421
|
+
* * `f64` - The inverted price
|
|
422
|
+
*/
|
|
423
|
+
export function invertPrice(price, decimals_a, decimals_b) {
|
|
424
|
+
const ret = wasm.invertPrice(price, decimals_a, decimals_b);
|
|
425
|
+
return ret;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Convert a tick index into a price
|
|
430
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
431
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
432
|
+
*
|
|
433
|
+
* # Parameters
|
|
434
|
+
* * `tick_index` - The tick index to convert
|
|
435
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
436
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
437
|
+
*
|
|
438
|
+
* # Returns
|
|
439
|
+
* * `f64` - The decimal price
|
|
440
|
+
*/
|
|
441
|
+
export function tickIndexToPrice(tick_index, decimals_a, decimals_b) {
|
|
442
|
+
const ret = wasm.tickIndexToPrice(tick_index, decimals_a, decimals_b);
|
|
443
|
+
return ret;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Convert a price into a tick index
|
|
448
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
449
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
450
|
+
*
|
|
451
|
+
* # Parameters
|
|
452
|
+
* * `price` - The price to convert
|
|
453
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
454
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
455
|
+
*
|
|
456
|
+
* # Returns
|
|
457
|
+
* * `i32` - The tick index
|
|
458
|
+
*/
|
|
459
|
+
export function priceToTickIndex(price, decimals_a, decimals_b) {
|
|
460
|
+
const ret = wasm.priceToTickIndex(price, decimals_a, decimals_b);
|
|
461
|
+
return ret;
|
|
462
|
+
}
|
|
265
463
|
|
|
266
464
|
export function _POSITION_BUNDLE_SIZE() {
|
|
267
465
|
const ret = wasm._POSITION_BUNDLE_SIZE();
|
|
@@ -543,87 +741,76 @@ export function getTickIndexInArray(tick_index, tick_array_start_index, tick_spa
|
|
|
543
741
|
}
|
|
544
742
|
}
|
|
545
743
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
744
|
+
export function tryGetLiquidityFromAmountA(amount_a, sqrt_price_lower, sqrt_price_upper) {
|
|
745
|
+
try {
|
|
746
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-32);
|
|
747
|
+
wasm.tryGetLiquidityFromAmountA(retptr, amount_a, sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64));
|
|
748
|
+
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
749
|
+
var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
|
|
750
|
+
var r4 = getDataViewMemory0().getInt32(retptr + 4 * 4, true);
|
|
751
|
+
var r5 = getDataViewMemory0().getInt32(retptr + 4 * 5, true);
|
|
752
|
+
if (r5) {
|
|
753
|
+
throw takeObject(r4);
|
|
754
|
+
}
|
|
755
|
+
return (BigInt.asUintN(64, r0) | (BigInt.asUintN(64, r2) << BigInt(64)));
|
|
756
|
+
} finally {
|
|
757
|
+
wasm.__wbindgen_add_to_stack_pointer(32);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
export function tryGetAmountAFromLiquidity(liquidity, sqrt_price_lower, sqrt_price_upper, round_up) {
|
|
562
762
|
try {
|
|
563
763
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
564
|
-
wasm.
|
|
565
|
-
var r0 = getDataViewMemory0().
|
|
566
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
764
|
+
wasm.tryGetAmountAFromLiquidity(retptr, liquidity, liquidity >> BigInt(64), sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64), round_up);
|
|
765
|
+
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
567
766
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
568
|
-
|
|
569
|
-
|
|
767
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
768
|
+
if (r3) {
|
|
769
|
+
throw takeObject(r2);
|
|
570
770
|
}
|
|
571
|
-
return
|
|
771
|
+
return BigInt.asUintN(64, r0);
|
|
572
772
|
} finally {
|
|
573
773
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
574
774
|
}
|
|
575
775
|
}
|
|
576
776
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
777
|
+
export function tryGetLiquidityFromAmountB(amount_b, sqrt_price_lower, sqrt_price_upper) {
|
|
778
|
+
try {
|
|
779
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-32);
|
|
780
|
+
wasm.tryGetLiquidityFromAmountB(retptr, amount_b, sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64));
|
|
781
|
+
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
782
|
+
var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
|
|
783
|
+
var r4 = getDataViewMemory0().getInt32(retptr + 4 * 4, true);
|
|
784
|
+
var r5 = getDataViewMemory0().getInt32(retptr + 4 * 5, true);
|
|
785
|
+
if (r5) {
|
|
786
|
+
throw takeObject(r4);
|
|
787
|
+
}
|
|
788
|
+
return (BigInt.asUintN(64, r0) | (BigInt.asUintN(64, r2) << BigInt(64)));
|
|
789
|
+
} finally {
|
|
790
|
+
wasm.__wbindgen_add_to_stack_pointer(32);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
export function tryGetAmountBFromLiquidity(liquidity, sqrt_price_lower, sqrt_price_upper, round_up) {
|
|
593
795
|
try {
|
|
594
796
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
595
|
-
wasm.
|
|
596
|
-
var r0 = getDataViewMemory0().
|
|
597
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
797
|
+
wasm.tryGetAmountBFromLiquidity(retptr, liquidity, liquidity >> BigInt(64), sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64), round_up);
|
|
798
|
+
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
598
799
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
599
|
-
|
|
600
|
-
|
|
800
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
801
|
+
if (r3) {
|
|
802
|
+
throw takeObject(r2);
|
|
601
803
|
}
|
|
602
|
-
return
|
|
804
|
+
return BigInt.asUintN(64, r0);
|
|
603
805
|
} finally {
|
|
604
806
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
605
807
|
}
|
|
606
808
|
}
|
|
607
809
|
|
|
608
|
-
|
|
609
|
-
* Calculate the quote for decreasing liquidity given a token b amount
|
|
610
|
-
*
|
|
611
|
-
* # Parameters
|
|
612
|
-
* - `token_amount_b` - The amount of token b to decrease
|
|
613
|
-
* - `slippage_tolerance` - The slippage tolerance in bps
|
|
614
|
-
* - `current_sqrt_price` - The current sqrt price of the pool
|
|
615
|
-
* - `tick_index_1` - The first tick index of the position
|
|
616
|
-
* - `tick_index_2` - The second tick index of the position
|
|
617
|
-
* - `transfer_fee_a` - The transfer fee for token A in bps
|
|
618
|
-
* - `transfer_fee_b` - The transfer fee for token B in bps
|
|
619
|
-
*
|
|
620
|
-
* # Returns
|
|
621
|
-
* - A DecreaseLiquidityQuote struct containing the estimated token amounts
|
|
622
|
-
*/
|
|
623
|
-
export function decreaseLiquidityQuoteB(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
|
|
810
|
+
export function tryGetAmountsFromLiquidity(liquidity, sqrt_price, tick_lower_index, tick_upper_index, round_up) {
|
|
624
811
|
try {
|
|
625
812
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
626
|
-
wasm.
|
|
813
|
+
wasm.tryGetAmountsFromLiquidity(retptr, liquidity, liquidity >> BigInt(64), sqrt_price, sqrt_price >> BigInt(64), tick_lower_index, tick_upper_index, round_up);
|
|
627
814
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
628
815
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
629
816
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -636,11 +823,28 @@ export function decreaseLiquidityQuoteB(token_amount_b, slippage_tolerance_bps,
|
|
|
636
823
|
}
|
|
637
824
|
}
|
|
638
825
|
|
|
826
|
+
export function tryGetLiquidityFromAmounts(sqrt_price, sqrt_price_lower, sqrt_price_upper, amount_a, amount_b) {
|
|
827
|
+
try {
|
|
828
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-32);
|
|
829
|
+
wasm.tryGetLiquidityFromAmounts(retptr, sqrt_price, sqrt_price >> BigInt(64), sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64), amount_a, amount_b);
|
|
830
|
+
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
831
|
+
var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
|
|
832
|
+
var r4 = getDataViewMemory0().getInt32(retptr + 4 * 4, true);
|
|
833
|
+
var r5 = getDataViewMemory0().getInt32(retptr + 4 * 5, true);
|
|
834
|
+
if (r5) {
|
|
835
|
+
throw takeObject(r4);
|
|
836
|
+
}
|
|
837
|
+
return (BigInt.asUintN(64, r0) | (BigInt.asUintN(64, r2) << BigInt(64)));
|
|
838
|
+
} finally {
|
|
839
|
+
wasm.__wbindgen_add_to_stack_pointer(32);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
|
|
639
843
|
/**
|
|
640
|
-
* Calculate the quote for
|
|
844
|
+
* Calculate the quote for decreasing liquidity
|
|
641
845
|
*
|
|
642
846
|
* # Parameters
|
|
643
|
-
* - `liquidity_delta` - The amount of liquidity to
|
|
847
|
+
* - `liquidity_delta` - The amount of liquidity to decrease
|
|
644
848
|
* - `slippage_tolerance` - The slippage tolerance in bps
|
|
645
849
|
* - `current_sqrt_price` - The current sqrt price of the pool
|
|
646
850
|
* - `tick_index_1` - The first tick index of the position
|
|
@@ -649,12 +853,12 @@ export function decreaseLiquidityQuoteB(token_amount_b, slippage_tolerance_bps,
|
|
|
649
853
|
* - `transfer_fee_b` - The transfer fee for token B in bps
|
|
650
854
|
*
|
|
651
855
|
* # Returns
|
|
652
|
-
* -
|
|
856
|
+
* - A DecreaseLiquidityQuote struct containing the estimated token amounts
|
|
653
857
|
*/
|
|
654
|
-
export function
|
|
858
|
+
export function decreaseLiquidityQuote(liquidity_delta, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
|
|
655
859
|
try {
|
|
656
860
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
657
|
-
wasm.
|
|
861
|
+
wasm.decreaseLiquidityQuote(retptr, liquidity_delta, liquidity_delta >> BigInt(64), slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
|
|
658
862
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
659
863
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
660
864
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -668,10 +872,10 @@ export function increaseLiquidityQuote(liquidity_delta, slippage_tolerance_bps,
|
|
|
668
872
|
}
|
|
669
873
|
|
|
670
874
|
/**
|
|
671
|
-
* Calculate the quote for
|
|
875
|
+
* Calculate the quote for decreasing liquidity given a token a amount
|
|
672
876
|
*
|
|
673
877
|
* # Parameters
|
|
674
|
-
* - `token_amount_a` - The amount of token a to
|
|
878
|
+
* - `token_amount_a` - The amount of token a to decrease
|
|
675
879
|
* - `slippage_tolerance` - The slippage tolerance in bps
|
|
676
880
|
* - `current_sqrt_price` - The current sqrt price of the pool
|
|
677
881
|
* - `tick_index_1` - The first tick index of the position
|
|
@@ -680,12 +884,12 @@ export function increaseLiquidityQuote(liquidity_delta, slippage_tolerance_bps,
|
|
|
680
884
|
* - `transfer_fee_b` - The transfer fee for token B in bps
|
|
681
885
|
*
|
|
682
886
|
* # Returns
|
|
683
|
-
* -
|
|
887
|
+
* - A DecreaseLiquidityQuote struct containing the estimated token amounts
|
|
684
888
|
*/
|
|
685
|
-
export function
|
|
889
|
+
export function decreaseLiquidityQuoteA(token_amount_a, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
|
|
686
890
|
try {
|
|
687
891
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
688
|
-
wasm.
|
|
892
|
+
wasm.decreaseLiquidityQuoteA(retptr, token_amount_a, slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
|
|
689
893
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
690
894
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
691
895
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -699,10 +903,10 @@ export function increaseLiquidityQuoteA(token_amount_a, slippage_tolerance_bps,
|
|
|
699
903
|
}
|
|
700
904
|
|
|
701
905
|
/**
|
|
702
|
-
* Calculate the quote for
|
|
906
|
+
* Calculate the quote for decreasing liquidity given a token b amount
|
|
703
907
|
*
|
|
704
908
|
* # Parameters
|
|
705
|
-
* - `token_amount_b` - The amount of token b to
|
|
909
|
+
* - `token_amount_b` - The amount of token b to decrease
|
|
706
910
|
* - `slippage_tolerance` - The slippage tolerance in bps
|
|
707
911
|
* - `current_sqrt_price` - The current sqrt price of the pool
|
|
708
912
|
* - `tick_index_1` - The first tick index of the position
|
|
@@ -710,95 +914,44 @@ export function increaseLiquidityQuoteA(token_amount_a, slippage_tolerance_bps,
|
|
|
710
914
|
* - `transfer_fee_a` - The transfer fee for token A in bps
|
|
711
915
|
* - `transfer_fee_b` - The transfer fee for token B in bps
|
|
712
916
|
*
|
|
713
|
-
* # Returns
|
|
714
|
-
* -
|
|
715
|
-
*/
|
|
716
|
-
export function
|
|
717
|
-
try {
|
|
718
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
719
|
-
wasm.increaseLiquidityQuoteB(retptr, token_amount_b, slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
|
|
720
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
721
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
722
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
723
|
-
if (r2) {
|
|
724
|
-
throw takeObject(r1);
|
|
725
|
-
}
|
|
726
|
-
return takeObject(r0);
|
|
727
|
-
} finally {
|
|
728
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
export function tryGetLiquidityFromA(token_delta_a, sqrt_price_lower, sqrt_price_upper) {
|
|
733
|
-
try {
|
|
734
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-32);
|
|
735
|
-
wasm.tryGetLiquidityFromA(retptr, token_delta_a, sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64));
|
|
736
|
-
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
737
|
-
var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
|
|
738
|
-
var r4 = getDataViewMemory0().getInt32(retptr + 4 * 4, true);
|
|
739
|
-
var r5 = getDataViewMemory0().getInt32(retptr + 4 * 5, true);
|
|
740
|
-
if (r5) {
|
|
741
|
-
throw takeObject(r4);
|
|
742
|
-
}
|
|
743
|
-
return (BigInt.asUintN(64, r0) | (BigInt.asUintN(64, r2) << BigInt(64)));
|
|
744
|
-
} finally {
|
|
745
|
-
wasm.__wbindgen_add_to_stack_pointer(32);
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
export function tryGetTokenAFromLiquidity(liquidity_delta, sqrt_price_lower, sqrt_price_upper, round_up) {
|
|
750
|
-
try {
|
|
751
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
752
|
-
wasm.tryGetTokenAFromLiquidity(retptr, liquidity_delta, liquidity_delta >> BigInt(64), sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64), round_up);
|
|
753
|
-
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
754
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
755
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
756
|
-
if (r3) {
|
|
757
|
-
throw takeObject(r2);
|
|
758
|
-
}
|
|
759
|
-
return BigInt.asUintN(64, r0);
|
|
760
|
-
} finally {
|
|
761
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
export function tryGetLiquidityFromB(token_delta_b, sqrt_price_lower, sqrt_price_upper) {
|
|
766
|
-
try {
|
|
767
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-32);
|
|
768
|
-
wasm.tryGetLiquidityFromB(retptr, token_delta_b, sqrt_price_lower, sqrt_price_lower >> BigInt(64), sqrt_price_upper, sqrt_price_upper >> BigInt(64));
|
|
769
|
-
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
770
|
-
var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
|
|
771
|
-
var r4 = getDataViewMemory0().getInt32(retptr + 4 * 4, true);
|
|
772
|
-
var r5 = getDataViewMemory0().getInt32(retptr + 4 * 5, true);
|
|
773
|
-
if (r5) {
|
|
774
|
-
throw takeObject(r4);
|
|
775
|
-
}
|
|
776
|
-
return (BigInt.asUintN(64, r0) | (BigInt.asUintN(64, r2) << BigInt(64)));
|
|
777
|
-
} finally {
|
|
778
|
-
wasm.__wbindgen_add_to_stack_pointer(32);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
export function tryGetTokenBFromLiquidity(liquidity_delta, sqrt_price_lower, sqrt_price_upper, round_up) {
|
|
917
|
+
* # Returns
|
|
918
|
+
* - A DecreaseLiquidityQuote struct containing the estimated token amounts
|
|
919
|
+
*/
|
|
920
|
+
export function decreaseLiquidityQuoteB(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
|
|
783
921
|
try {
|
|
784
922
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
785
|
-
wasm.
|
|
786
|
-
var r0 = getDataViewMemory0().
|
|
923
|
+
wasm.decreaseLiquidityQuoteB(retptr, token_amount_b, slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
|
|
924
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
925
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
787
926
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
throw takeObject(r2);
|
|
927
|
+
if (r2) {
|
|
928
|
+
throw takeObject(r1);
|
|
791
929
|
}
|
|
792
|
-
return
|
|
930
|
+
return takeObject(r0);
|
|
793
931
|
} finally {
|
|
794
932
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
795
933
|
}
|
|
796
934
|
}
|
|
797
935
|
|
|
798
|
-
|
|
936
|
+
/**
|
|
937
|
+
* Calculate the quote for increasing liquidity
|
|
938
|
+
*
|
|
939
|
+
* # Parameters
|
|
940
|
+
* - `liquidity_delta` - The amount of liquidity to increase
|
|
941
|
+
* - `slippage_tolerance` - The slippage tolerance in bps
|
|
942
|
+
* - `current_sqrt_price` - The current sqrt price of the pool
|
|
943
|
+
* - `tick_index_1` - The first tick index of the position
|
|
944
|
+
* - `tick_index_2` - The second tick index of the position
|
|
945
|
+
* - `transfer_fee_a` - The transfer fee for token A in bps
|
|
946
|
+
* - `transfer_fee_b` - The transfer fee for token B in bps
|
|
947
|
+
*
|
|
948
|
+
* # Returns
|
|
949
|
+
* - An IncreaseLiquidityQuote struct containing the estimated token amounts
|
|
950
|
+
*/
|
|
951
|
+
export function increaseLiquidityQuote(liquidity_delta, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
|
|
799
952
|
try {
|
|
800
953
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
801
|
-
wasm.
|
|
954
|
+
wasm.increaseLiquidityQuote(retptr, liquidity_delta, liquidity_delta >> BigInt(64), slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
|
|
802
955
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
803
956
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
804
957
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -811,41 +964,56 @@ export function tryGetAmountsFromLiquidity(liquidity_delta, current_sqrt_price,
|
|
|
811
964
|
}
|
|
812
965
|
}
|
|
813
966
|
|
|
814
|
-
|
|
967
|
+
/**
|
|
968
|
+
* Calculate the quote for increasing liquidity given a token a amount
|
|
969
|
+
*
|
|
970
|
+
* # Parameters
|
|
971
|
+
* - `token_amount_a` - The amount of token a to increase
|
|
972
|
+
* - `slippage_tolerance` - The slippage tolerance in bps
|
|
973
|
+
* - `current_sqrt_price` - The current sqrt price of the pool
|
|
974
|
+
* - `tick_index_1` - The first tick index of the position
|
|
975
|
+
* - `tick_index_2` - The second tick index of the position
|
|
976
|
+
* - `transfer_fee_a` - The transfer fee for token A in bps
|
|
977
|
+
* - `transfer_fee_b` - The transfer fee for token B in bps
|
|
978
|
+
*
|
|
979
|
+
* # Returns
|
|
980
|
+
* - An IncreaseLiquidityQuote struct containing the estimated token amounts
|
|
981
|
+
*/
|
|
982
|
+
export function increaseLiquidityQuoteA(token_amount_a, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
|
|
815
983
|
try {
|
|
816
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-
|
|
817
|
-
wasm.
|
|
818
|
-
var r0 = getDataViewMemory0().
|
|
819
|
-
var
|
|
820
|
-
var
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
throw takeObject(r4);
|
|
984
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
985
|
+
wasm.increaseLiquidityQuoteA(retptr, token_amount_a, slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
|
|
986
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
987
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
988
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
989
|
+
if (r2) {
|
|
990
|
+
throw takeObject(r1);
|
|
824
991
|
}
|
|
825
|
-
return (
|
|
992
|
+
return takeObject(r0);
|
|
826
993
|
} finally {
|
|
827
|
-
wasm.__wbindgen_add_to_stack_pointer(
|
|
994
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
828
995
|
}
|
|
829
996
|
}
|
|
830
997
|
|
|
831
998
|
/**
|
|
832
|
-
* Calculate
|
|
999
|
+
* Calculate the quote for increasing liquidity given a token b amount
|
|
833
1000
|
*
|
|
834
|
-
* #
|
|
835
|
-
* - `
|
|
836
|
-
* - `
|
|
837
|
-
* - `
|
|
838
|
-
* - `
|
|
839
|
-
* - `
|
|
840
|
-
* - `
|
|
1001
|
+
* # Parameters
|
|
1002
|
+
* - `token_amount_b` - The amount of token b to increase
|
|
1003
|
+
* - `slippage_tolerance` - The slippage tolerance in bps
|
|
1004
|
+
* - `current_sqrt_price` - The current sqrt price of the pool
|
|
1005
|
+
* - `tick_index_1` - The first tick index of the position
|
|
1006
|
+
* - `tick_index_2` - The second tick index of the position
|
|
1007
|
+
* - `transfer_fee_a` - The transfer fee for token A in bps
|
|
1008
|
+
* - `transfer_fee_b` - The transfer fee for token B in bps
|
|
841
1009
|
*
|
|
842
1010
|
* # Returns
|
|
843
|
-
* -
|
|
1011
|
+
* - An IncreaseLiquidityQuote struct containing the estimated token amounts
|
|
844
1012
|
*/
|
|
845
|
-
export function
|
|
1013
|
+
export function increaseLiquidityQuoteB(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
|
|
846
1014
|
try {
|
|
847
1015
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
848
|
-
wasm.
|
|
1016
|
+
wasm.increaseLiquidityQuoteB(retptr, token_amount_b, slippage_tolerance_bps, current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
|
|
849
1017
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
850
1018
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
851
1019
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -858,11 +1026,6 @@ export function collectFeesQuote(fusion_pool, position, tick_lower, tick_upper,
|
|
|
858
1026
|
}
|
|
859
1027
|
}
|
|
860
1028
|
|
|
861
|
-
export function limitOrderFee(fusion_pool) {
|
|
862
|
-
const ret = wasm.limitOrderFee(addHeapObject(fusion_pool));
|
|
863
|
-
return ret;
|
|
864
|
-
}
|
|
865
|
-
|
|
866
1029
|
/**
|
|
867
1030
|
* Calculate the amount A delta between two sqrt_prices
|
|
868
1031
|
*
|
|
@@ -1212,221 +1375,57 @@ export function limitOrderRewardByOutputToken(amount_out, fee_rate, protocol_fee
|
|
|
1212
1375
|
return BigInt.asUintN(64, r0);
|
|
1213
1376
|
} finally {
|
|
1214
1377
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
export function decreaseLimitOrderQuote(fusion_pool, limit_order, tick, amount, transfer_fee_a, transfer_fee_b) {
|
|
1219
|
-
try {
|
|
1220
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1221
|
-
wasm.decreaseLimitOrderQuote(retptr, addHeapObject(fusion_pool), addHeapObject(limit_order), addHeapObject(tick), amount, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
|
|
1222
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1223
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1224
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1225
|
-
if (r2) {
|
|
1226
|
-
throw takeObject(r1);
|
|
1227
|
-
}
|
|
1228
|
-
return takeObject(r0);
|
|
1229
|
-
} finally {
|
|
1230
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
/**
|
|
1235
|
-
* Get the first unoccupied position in a bundle
|
|
1236
|
-
*
|
|
1237
|
-
* # Arguments
|
|
1238
|
-
* * `bundle` - The bundle to check
|
|
1239
|
-
*
|
|
1240
|
-
* # Returns
|
|
1241
|
-
* * `u32` - The first unoccupied position (None if full)
|
|
1242
|
-
*/
|
|
1243
|
-
export function firstUnoccupiedPositionInBundle(bitmap) {
|
|
1244
|
-
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export);
|
|
1245
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1246
|
-
const ret = wasm.firstUnoccupiedPositionInBundle(ptr0, len0);
|
|
1247
|
-
return ret === 0x100000001 ? undefined : ret;
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
/**
|
|
1251
|
-
* Check whether a position bundle is full
|
|
1252
|
-
* A position bundle can contain 256 positions
|
|
1253
|
-
*
|
|
1254
|
-
* # Arguments
|
|
1255
|
-
* * `bundle` - The bundle to check
|
|
1256
|
-
*
|
|
1257
|
-
* # Returns
|
|
1258
|
-
* * `bool` - Whether the bundle is full
|
|
1259
|
-
*/
|
|
1260
|
-
export function isPositionBundleFull(bitmap) {
|
|
1261
|
-
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export);
|
|
1262
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1263
|
-
const ret = wasm.isPositionBundleFull(ptr0, len0);
|
|
1264
|
-
return ret !== 0;
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
/**
|
|
1268
|
-
* Check whether a position bundle is empty
|
|
1269
|
-
*
|
|
1270
|
-
* # Arguments
|
|
1271
|
-
* * `bundle` - The bundle to check
|
|
1272
|
-
*
|
|
1273
|
-
* # Returns
|
|
1274
|
-
* * `bool` - Whether the bundle is empty
|
|
1275
|
-
*/
|
|
1276
|
-
export function isPositionBundleEmpty(bitmap) {
|
|
1277
|
-
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_export);
|
|
1278
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1279
|
-
const ret = wasm.isPositionBundleEmpty(ptr0, len0);
|
|
1280
|
-
return ret !== 0;
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
/**
|
|
1284
|
-
* Check if a position is in range.
|
|
1285
|
-
* When a position is in range it is earning fees and rewards
|
|
1286
|
-
*
|
|
1287
|
-
* # Parameters
|
|
1288
|
-
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
1289
|
-
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
1290
|
-
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
1291
|
-
*
|
|
1292
|
-
* # Returns
|
|
1293
|
-
* - A boolean value indicating if the position is in range
|
|
1294
|
-
*/
|
|
1295
|
-
export function isPositionInRange(current_sqrt_price, tick_index_1, tick_index_2) {
|
|
1296
|
-
const ret = wasm.isPositionInRange(current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2);
|
|
1297
|
-
return ret !== 0;
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
/**
|
|
1301
|
-
* Calculate the status of a position
|
|
1302
|
-
* The status can be one of three values:
|
|
1303
|
-
* - InRange: The position is in range
|
|
1304
|
-
* - BelowRange: The position is below the range
|
|
1305
|
-
* - AboveRange: The position is above the range
|
|
1306
|
-
*
|
|
1307
|
-
* # Parameters
|
|
1308
|
-
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
1309
|
-
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
1310
|
-
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
1311
|
-
*
|
|
1312
|
-
* # Returns
|
|
1313
|
-
* - A PositionStatus enum value indicating the status of the position
|
|
1314
|
-
*/
|
|
1315
|
-
export function positionStatus(current_sqrt_price, tick_index_1, tick_index_2) {
|
|
1316
|
-
const ret = wasm.positionStatus(current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2);
|
|
1317
|
-
return takeObject(ret);
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
/**
|
|
1321
|
-
* Calculate the token_a / token_b ratio of a (ficticious) position
|
|
1322
|
-
*
|
|
1323
|
-
* # Parameters
|
|
1324
|
-
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
1325
|
-
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
1326
|
-
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
1327
|
-
*
|
|
1328
|
-
* # Returns
|
|
1329
|
-
* - A PositionRatio struct containing the ratio of token_a and token_b
|
|
1330
|
-
*/
|
|
1331
|
-
export function positionRatioX64(current_sqrt_price, tick_index_1, tick_index_2) {
|
|
1332
|
-
const ret = wasm.positionRatioX64(current_sqrt_price, current_sqrt_price >> BigInt(64), tick_index_1, tick_index_2);
|
|
1333
|
-
return takeObject(ret);
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
/**
|
|
1337
|
-
* Convert a price into a sqrt priceX64
|
|
1338
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
1339
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
1340
|
-
*
|
|
1341
|
-
* # Parameters
|
|
1342
|
-
* * `price` - The price to convert
|
|
1343
|
-
* * `decimals_a` - The number of decimals of the base token
|
|
1344
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
1345
|
-
*
|
|
1346
|
-
* # Returns
|
|
1347
|
-
* * `u128` - The sqrt priceX64
|
|
1348
|
-
*/
|
|
1349
|
-
export function priceToSqrtPrice(price, decimals_a, decimals_b) {
|
|
1350
|
-
try {
|
|
1351
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1352
|
-
wasm.priceToSqrtPrice(retptr, price, decimals_a, decimals_b);
|
|
1353
|
-
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
1354
|
-
var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
|
|
1355
|
-
return (BigInt.asUintN(64, r0) | (BigInt.asUintN(64, r2) << BigInt(64)));
|
|
1356
|
-
} finally {
|
|
1357
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
/**
|
|
1362
|
-
* Convert a sqrt priceX64 into a tick index
|
|
1363
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
1364
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
1365
|
-
*
|
|
1366
|
-
* # Parameters
|
|
1367
|
-
* * `sqrt_price` - The sqrt priceX64 to convert
|
|
1368
|
-
* * `decimals_a` - The number of decimals of the base token
|
|
1369
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
1370
|
-
*
|
|
1371
|
-
* # Returns
|
|
1372
|
-
* * `f64` - The decimal price
|
|
1373
|
-
*/
|
|
1374
|
-
export function sqrtPriceToPrice(sqrt_price, decimals_a, decimals_b) {
|
|
1375
|
-
const ret = wasm.sqrtPriceToPrice(sqrt_price, sqrt_price >> BigInt(64), decimals_a, decimals_b);
|
|
1376
|
-
return ret;
|
|
1378
|
+
}
|
|
1377
1379
|
}
|
|
1378
1380
|
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
*
|
|
1384
|
-
*
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
const ret = wasm.invertPrice(price, decimals_a, decimals_b);
|
|
1394
|
-
return ret;
|
|
1381
|
+
export function decreaseLimitOrderQuote(fusion_pool, limit_order, tick, amount, transfer_fee_a, transfer_fee_b) {
|
|
1382
|
+
try {
|
|
1383
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1384
|
+
wasm.decreaseLimitOrderQuote(retptr, addHeapObject(fusion_pool), addHeapObject(limit_order), addHeapObject(tick), amount, isLikeNone(transfer_fee_a) ? 0 : addHeapObject(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addHeapObject(transfer_fee_b));
|
|
1385
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1386
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1387
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1388
|
+
if (r2) {
|
|
1389
|
+
throw takeObject(r1);
|
|
1390
|
+
}
|
|
1391
|
+
return takeObject(r0);
|
|
1392
|
+
} finally {
|
|
1393
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1394
|
+
}
|
|
1395
1395
|
}
|
|
1396
1396
|
|
|
1397
1397
|
/**
|
|
1398
|
-
*
|
|
1399
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
1400
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
1398
|
+
* Calculate fees owed for a position
|
|
1401
1399
|
*
|
|
1402
|
-
* #
|
|
1403
|
-
*
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1400
|
+
* # Paramters
|
|
1401
|
+
* - `fusion_pool`: The fusion_pool state
|
|
1402
|
+
* - `position`: The position state
|
|
1403
|
+
* - `tick_lower`: The lower tick state
|
|
1404
|
+
* - `tick_upper`: The upper tick state
|
|
1405
|
+
* - `transfer_fee_a`: The transfer fee for token A
|
|
1406
|
+
* - `transfer_fee_b`: The transfer fee for token B
|
|
1406
1407
|
*
|
|
1407
1408
|
* # Returns
|
|
1408
|
-
*
|
|
1409
|
+
* - `CollectFeesQuote`: The fees owed for token A and token B
|
|
1409
1410
|
*/
|
|
1410
|
-
export function
|
|
1411
|
-
|
|
1412
|
-
|
|
1411
|
+
export function collectFeesQuote(fusion_pool, position, tick_lower, tick_upper, transfer_fee_a, transfer_fee_b) {
|
|
1412
|
+
try {
|
|
1413
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1414
|
+
wasm.collectFeesQuote(retptr, addHeapObject(fusion_pool), 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));
|
|
1415
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1416
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1417
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1418
|
+
if (r2) {
|
|
1419
|
+
throw takeObject(r1);
|
|
1420
|
+
}
|
|
1421
|
+
return takeObject(r0);
|
|
1422
|
+
} finally {
|
|
1423
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1424
|
+
}
|
|
1413
1425
|
}
|
|
1414
1426
|
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
1418
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
1419
|
-
*
|
|
1420
|
-
* # Parameters
|
|
1421
|
-
* * `price` - The price to convert
|
|
1422
|
-
* * `decimals_a` - The number of decimals of the base token
|
|
1423
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
1424
|
-
*
|
|
1425
|
-
* # Returns
|
|
1426
|
-
* * `i32` - The tick index
|
|
1427
|
-
*/
|
|
1428
|
-
export function priceToTickIndex(price, decimals_a, decimals_b) {
|
|
1429
|
-
const ret = wasm.priceToTickIndex(price, decimals_a, decimals_b);
|
|
1427
|
+
export function limitOrderFee(fusion_pool) {
|
|
1428
|
+
const ret = wasm.limitOrderFee(addHeapObject(fusion_pool));
|
|
1430
1429
|
return ret;
|
|
1431
1430
|
}
|
|
1432
1431
|
|
|
@@ -1550,6 +1549,18 @@ export function _INVALID_SQRT_PRICE_LIMIT_DIRECTION() {
|
|
|
1550
1549
|
}
|
|
1551
1550
|
}
|
|
1552
1551
|
|
|
1552
|
+
export function _INVALID_RANGE_BOUNDS() {
|
|
1553
|
+
try {
|
|
1554
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1555
|
+
wasm._INVALID_RANGE_BOUNDS(retptr);
|
|
1556
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1557
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1558
|
+
return getStringFromWasm0(r0, r1);
|
|
1559
|
+
} finally {
|
|
1560
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1553
1564
|
export function _ZERO_TRADABLE_AMOUNT() {
|
|
1554
1565
|
try {
|
|
1555
1566
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
@@ -1696,54 +1707,6 @@ export function swapQuoteByOutputToken(token_out, specified_token_a, slippage_to
|
|
|
1696
1707
|
}
|
|
1697
1708
|
}
|
|
1698
1709
|
|
|
1699
|
-
/**
|
|
1700
|
-
* Computes the liquidation prices for an existing position.
|
|
1701
|
-
*
|
|
1702
|
-
* # Parameters
|
|
1703
|
-
* - `tick_lower_index`: The lower tick index of the position.
|
|
1704
|
-
* - `tick_upper_index`: The upper tick index of the position.
|
|
1705
|
-
* - `leftovers_a`: The amount of leftovers A in the position.
|
|
1706
|
-
* - `leftovers_a`: The amount of leftovers B in the position.
|
|
1707
|
-
* - `liquidity`: Liquidity of the position.
|
|
1708
|
-
* - `debt_a`: The amount of tokens A borrowed.
|
|
1709
|
-
* - `debt_b`: The amount of tokens B borrowed.
|
|
1710
|
-
* - `liquidation_threshold`: The liquidation threshold of the market.
|
|
1711
|
-
*
|
|
1712
|
-
* # Returns
|
|
1713
|
-
* - `LiquidationPrices`: An object containing lower/upper liquidation prices.
|
|
1714
|
-
*/
|
|
1715
|
-
export function getLpPositionLiquidationPrices(tick_lower_index, tick_upper_index, liquidity, leftovers_a, leftovers_b, debt_a, debt_b, liquidation_threshold) {
|
|
1716
|
-
try {
|
|
1717
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1718
|
-
wasm.getLpPositionLiquidationPrices(retptr, tick_lower_index, tick_upper_index, liquidity, liquidity >> BigInt(64), leftovers_a, leftovers_b, debt_a, debt_b, liquidation_threshold);
|
|
1719
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1720
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1721
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1722
|
-
if (r2) {
|
|
1723
|
-
throw takeObject(r1);
|
|
1724
|
-
}
|
|
1725
|
-
return takeObject(r0);
|
|
1726
|
-
} finally {
|
|
1727
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1728
|
-
}
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
export function getIncreaseLpPositionQuote(args) {
|
|
1732
|
-
try {
|
|
1733
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1734
|
-
wasm.getIncreaseLpPositionQuote(retptr, addHeapObject(args));
|
|
1735
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1736
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1737
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1738
|
-
if (r2) {
|
|
1739
|
-
throw takeObject(r1);
|
|
1740
|
-
}
|
|
1741
|
-
return takeObject(r0);
|
|
1742
|
-
} finally {
|
|
1743
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
1710
|
export function _HUNDRED_PERCENT() {
|
|
1748
1711
|
const ret = wasm._HUNDRED_PERCENT();
|
|
1749
1712
|
return ret >>> 0;
|
|
@@ -1874,11 +1837,123 @@ export function calculateTunaSpotPositionProtocolFee(collateral_token, borrowed_
|
|
|
1874
1837
|
return takeObject(ret);
|
|
1875
1838
|
}
|
|
1876
1839
|
|
|
1840
|
+
export function applyTunaProtocolFee(amount, protocol_fee_rate, round_up) {
|
|
1841
|
+
try {
|
|
1842
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1843
|
+
wasm.applyTunaProtocolFee(retptr, amount, protocol_fee_rate, round_up);
|
|
1844
|
+
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
1845
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1846
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1847
|
+
if (r3) {
|
|
1848
|
+
throw takeObject(r2);
|
|
1849
|
+
}
|
|
1850
|
+
return BigInt.asUintN(64, r0);
|
|
1851
|
+
} finally {
|
|
1852
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
export function reverseApplyTunaProtocolFee(amount, protocol_fee_rate, round_up) {
|
|
1857
|
+
try {
|
|
1858
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1859
|
+
wasm.reverseApplyTunaProtocolFee(retptr, amount, protocol_fee_rate, round_up);
|
|
1860
|
+
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
1861
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1862
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1863
|
+
if (r3) {
|
|
1864
|
+
throw takeObject(r2);
|
|
1865
|
+
}
|
|
1866
|
+
return BigInt.asUintN(64, r0);
|
|
1867
|
+
} finally {
|
|
1868
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1877
1872
|
export function calculateTunaProtocolFee(collateral, borrow, protocol_fee_rate_on_collateral, protocol_fee_rate) {
|
|
1878
1873
|
const ret = wasm.calculateTunaProtocolFee(collateral, borrow, protocol_fee_rate_on_collateral, protocol_fee_rate);
|
|
1879
1874
|
return BigInt.asUintN(64, ret);
|
|
1880
1875
|
}
|
|
1881
1876
|
|
|
1877
|
+
/**
|
|
1878
|
+
* Computes the liquidation prices for an existing position.
|
|
1879
|
+
*
|
|
1880
|
+
* # Parameters
|
|
1881
|
+
* - `tick_lower_index`: The lower tick index of the position.
|
|
1882
|
+
* - `tick_upper_index`: The upper tick index of the position.
|
|
1883
|
+
* - `leftovers_a`: The amount of leftovers A in the position.
|
|
1884
|
+
* - `leftovers_a`: The amount of leftovers B in the position.
|
|
1885
|
+
* - `liquidity`: Liquidity of the position.
|
|
1886
|
+
* - `debt_a`: The amount of tokens A borrowed.
|
|
1887
|
+
* - `debt_b`: The amount of tokens B borrowed.
|
|
1888
|
+
* - `liquidation_threshold`: The liquidation threshold of the market.
|
|
1889
|
+
*
|
|
1890
|
+
* # Returns
|
|
1891
|
+
* - `LiquidationPrices`: An object containing lower/upper liquidation prices.
|
|
1892
|
+
*/
|
|
1893
|
+
export function getLpPositionLiquidationPrices(tick_lower_index, tick_upper_index, liquidity, leftovers_a, leftovers_b, debt_a, debt_b, liquidation_threshold) {
|
|
1894
|
+
try {
|
|
1895
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1896
|
+
wasm.getLpPositionLiquidationPrices(retptr, tick_lower_index, tick_upper_index, liquidity, liquidity >> BigInt(64), leftovers_a, leftovers_b, debt_a, debt_b, liquidation_threshold);
|
|
1897
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1898
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1899
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1900
|
+
if (r2) {
|
|
1901
|
+
throw takeObject(r1);
|
|
1902
|
+
}
|
|
1903
|
+
return takeObject(r0);
|
|
1904
|
+
} finally {
|
|
1905
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
export function getIncreaseLpPositionQuote(args) {
|
|
1910
|
+
try {
|
|
1911
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1912
|
+
wasm.getIncreaseLpPositionQuote(retptr, addHeapObject(args));
|
|
1913
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1914
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1915
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1916
|
+
if (r2) {
|
|
1917
|
+
throw takeObject(r1);
|
|
1918
|
+
}
|
|
1919
|
+
return takeObject(r0);
|
|
1920
|
+
} finally {
|
|
1921
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
export function getRepayLpPositionDebtQuote(args) {
|
|
1926
|
+
try {
|
|
1927
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1928
|
+
wasm.getRepayLpPositionDebtQuote(retptr, addHeapObject(args));
|
|
1929
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1930
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1931
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1932
|
+
if (r2) {
|
|
1933
|
+
throw takeObject(r1);
|
|
1934
|
+
}
|
|
1935
|
+
return takeObject(r0);
|
|
1936
|
+
} finally {
|
|
1937
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
export function computeLeverage(total_a, total_b, debt_a, debt_b, sqrt_price) {
|
|
1942
|
+
try {
|
|
1943
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1944
|
+
wasm.computeLeverage(retptr, total_a, total_b, debt_a, debt_b, sqrt_price, sqrt_price >> BigInt(64));
|
|
1945
|
+
var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
|
|
1946
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1947
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1948
|
+
if (r3) {
|
|
1949
|
+
throw takeObject(r2);
|
|
1950
|
+
}
|
|
1951
|
+
return r0;
|
|
1952
|
+
} finally {
|
|
1953
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1882
1957
|
export function _INVALID_ARGUMENTS() {
|
|
1883
1958
|
try {
|
|
1884
1959
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
@@ -1922,16 +1997,16 @@ export function solana_program_init() {
|
|
|
1922
1997
|
wasm.solana_program_init();
|
|
1923
1998
|
}
|
|
1924
1999
|
|
|
1925
|
-
function
|
|
1926
|
-
wasm.
|
|
2000
|
+
function __wasm_bindgen_func_elem_3154(arg0, arg1) {
|
|
2001
|
+
wasm.__wasm_bindgen_func_elem_3154(arg0, arg1);
|
|
1927
2002
|
}
|
|
1928
2003
|
|
|
1929
|
-
function
|
|
1930
|
-
wasm.
|
|
2004
|
+
function __wasm_bindgen_func_elem_3288(arg0, arg1, arg2) {
|
|
2005
|
+
wasm.__wasm_bindgen_func_elem_3288(arg0, arg1, addHeapObject(arg2));
|
|
1931
2006
|
}
|
|
1932
2007
|
|
|
1933
|
-
function
|
|
1934
|
-
wasm.
|
|
2008
|
+
function __wasm_bindgen_func_elem_494(arg0, arg1, arg2, arg3) {
|
|
2009
|
+
wasm.__wasm_bindgen_func_elem_494(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
1935
2010
|
}
|
|
1936
2011
|
|
|
1937
2012
|
const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
|
|
@@ -3094,7 +3169,7 @@ export function __wbg_new_3c3d849046688a66(arg0, arg1) {
|
|
|
3094
3169
|
const a = state0.a;
|
|
3095
3170
|
state0.a = 0;
|
|
3096
3171
|
try {
|
|
3097
|
-
return
|
|
3172
|
+
return __wasm_bindgen_func_elem_494(a, state0.b, arg0, arg1);
|
|
3098
3173
|
} finally {
|
|
3099
3174
|
state0.a = a;
|
|
3100
3175
|
}
|
|
@@ -3338,30 +3413,30 @@ export function __wbg_warn_1d74dddbe2fd1dbb(arg0) {
|
|
|
3338
3413
|
console.warn(getObject(arg0));
|
|
3339
3414
|
};
|
|
3340
3415
|
|
|
3341
|
-
export function __wbindgen_cast_0660a350899916ec(arg0, arg1) {
|
|
3342
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3343
|
-
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3203, __wasm_bindgen_func_elem_3207);
|
|
3344
|
-
return addHeapObject(ret);
|
|
3345
|
-
};
|
|
3346
|
-
|
|
3347
3416
|
export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
|
|
3348
3417
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
3349
3418
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
3350
3419
|
return addHeapObject(ret);
|
|
3351
3420
|
};
|
|
3352
3421
|
|
|
3353
|
-
export function __wbindgen_cast_2e5f7f1574aa20c6(arg0, arg1) {
|
|
3354
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 232, function: Function { arguments: [Externref], shim_idx: 227, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3355
|
-
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_2653, __wasm_bindgen_func_elem_2634);
|
|
3356
|
-
return addHeapObject(ret);
|
|
3357
|
-
};
|
|
3358
|
-
|
|
3359
3422
|
export function __wbindgen_cast_4625c577ab2ec9ee(arg0) {
|
|
3360
3423
|
// Cast intrinsic for `U64 -> Externref`.
|
|
3361
3424
|
const ret = BigInt.asUintN(64, arg0);
|
|
3362
3425
|
return addHeapObject(ret);
|
|
3363
3426
|
};
|
|
3364
3427
|
|
|
3428
|
+
export function __wbindgen_cast_49dae81bf02b4884(arg0, arg1) {
|
|
3429
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 369, function: Function { arguments: [Externref], shim_idx: 380, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3430
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3261, __wasm_bindgen_func_elem_3288);
|
|
3431
|
+
return addHeapObject(ret);
|
|
3432
|
+
};
|
|
3433
|
+
|
|
3434
|
+
export function __wbindgen_cast_7879599246031d81(arg0, arg1) {
|
|
3435
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 343, function: Function { arguments: [], shim_idx: 344, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3436
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3150, __wasm_bindgen_func_elem_3154);
|
|
3437
|
+
return addHeapObject(ret);
|
|
3438
|
+
};
|
|
3439
|
+
|
|
3365
3440
|
export function __wbindgen_cast_9ae0607507abb057(arg0) {
|
|
3366
3441
|
// Cast intrinsic for `I64 -> Externref`.
|
|
3367
3442
|
const ret = arg0;
|