@orca-so/whirlpools-core 0.4.3 → 1.0.1
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 +159 -159
- package/dist/browser/orca_whirlpools_core_js_bindings_bg.js +378 -384
- package/dist/browser/orca_whirlpools_core_js_bindings_bg.wasm +0 -0
- package/dist/browser/orca_whirlpools_core_js_bindings_bg.wasm.d.ts +70 -70
- package/dist/nodejs/orca_whirlpools_core_js_bindings.d.ts +159 -159
- package/dist/nodejs/orca_whirlpools_core_js_bindings.js +378 -384
- package/dist/nodejs/orca_whirlpools_core_js_bindings_bg.wasm +0 -0
- package/dist/nodejs/orca_whirlpools_core_js_bindings_bg.wasm.d.ts +70 -70
- package/package.json +1 -1
|
@@ -1,5 +1,112 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export function _NUM_REWARDS(): number;
|
|
4
|
+
export function _TICK_ARRAY_SIZE(): number;
|
|
5
|
+
export function _FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD(): number;
|
|
6
|
+
export function _MIN_TICK_INDEX(): number;
|
|
7
|
+
export function _MAX_TICK_INDEX(): number;
|
|
8
|
+
/**
|
|
9
|
+
* Get the first unoccupied position in a bundle
|
|
10
|
+
*
|
|
11
|
+
* # Arguments
|
|
12
|
+
* * `bundle` - The bundle to check
|
|
13
|
+
*
|
|
14
|
+
* # Returns
|
|
15
|
+
* * `u32` - The first unoccupied position (None if full)
|
|
16
|
+
*/
|
|
17
|
+
export function firstUnoccupiedPositionInBundle(bitmap: Uint8Array): number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Check whether a position bundle is full
|
|
20
|
+
* A position bundle can contain 256 positions
|
|
21
|
+
*
|
|
22
|
+
* # Arguments
|
|
23
|
+
* * `bundle` - The bundle to check
|
|
24
|
+
*
|
|
25
|
+
* # Returns
|
|
26
|
+
* * `bool` - Whether the bundle is full
|
|
27
|
+
*/
|
|
28
|
+
export function isPositionBundleFull(bitmap: Uint8Array): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Check whether a position bundle is empty
|
|
31
|
+
*
|
|
32
|
+
* # Arguments
|
|
33
|
+
* * `bundle` - The bundle to check
|
|
34
|
+
*
|
|
35
|
+
* # Returns
|
|
36
|
+
* * `bool` - Whether the bundle is empty
|
|
37
|
+
*/
|
|
38
|
+
export function isPositionBundleEmpty(bitmap: Uint8Array): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Convert a price into a sqrt priceX64
|
|
41
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
42
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
43
|
+
*
|
|
44
|
+
* # Parameters
|
|
45
|
+
* * `price` - The price to convert
|
|
46
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
47
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
48
|
+
*
|
|
49
|
+
* # Returns
|
|
50
|
+
* * `u128` - The sqrt priceX64
|
|
51
|
+
*/
|
|
52
|
+
export function priceToSqrtPrice(price: number, decimals_a: number, decimals_b: number): bigint;
|
|
53
|
+
/**
|
|
54
|
+
* Convert a sqrt priceX64 into a tick index
|
|
55
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
56
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
57
|
+
*
|
|
58
|
+
* # Parameters
|
|
59
|
+
* * `sqrt_price` - The sqrt priceX64 to convert
|
|
60
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
61
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
62
|
+
*
|
|
63
|
+
* # Returns
|
|
64
|
+
* * `f64` - The decimal price
|
|
65
|
+
*/
|
|
66
|
+
export function sqrtPriceToPrice(sqrt_price: bigint, decimals_a: number, decimals_b: number): number;
|
|
67
|
+
/**
|
|
68
|
+
* Invert a price
|
|
69
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
70
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
71
|
+
*
|
|
72
|
+
* # Parameters
|
|
73
|
+
* * `price` - The price to invert
|
|
74
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
75
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
76
|
+
*
|
|
77
|
+
* # Returns
|
|
78
|
+
* * `f64` - The inverted price
|
|
79
|
+
*/
|
|
80
|
+
export function invertPrice(price: number, decimals_a: number, decimals_b: number): number;
|
|
81
|
+
/**
|
|
82
|
+
* Convert a tick index into a price
|
|
83
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
84
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
85
|
+
*
|
|
86
|
+
* # Parameters
|
|
87
|
+
* * `tick_index` - The tick index to convert
|
|
88
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
89
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
90
|
+
*
|
|
91
|
+
* # Returns
|
|
92
|
+
* * `f64` - The decimal price
|
|
93
|
+
*/
|
|
94
|
+
export function tickIndexToPrice(tick_index: number, decimals_a: number, decimals_b: number): number;
|
|
95
|
+
/**
|
|
96
|
+
* Convert a price into a tick index
|
|
97
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
98
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
99
|
+
*
|
|
100
|
+
* # Parameters
|
|
101
|
+
* * `price` - The price to convert
|
|
102
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
103
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
104
|
+
*
|
|
105
|
+
* # Returns
|
|
106
|
+
* * `i32` - The tick index
|
|
107
|
+
*/
|
|
108
|
+
export function priceToTickIndex(price: number, decimals_a: number, decimals_b: number): number;
|
|
109
|
+
export function _POSITION_BUNDLE_SIZE(): number;
|
|
3
110
|
/**
|
|
4
111
|
* Get the first tick index in the tick array that contains the specified tick index.
|
|
5
112
|
*
|
|
@@ -159,44 +266,7 @@ export function isFullRangeOnly(tick_spacing: number): boolean;
|
|
|
159
266
|
* - A u32 integer representing the tick index in the tick array
|
|
160
267
|
*/
|
|
161
268
|
export function getTickIndexInArray(tick_index: number, tick_array_start_index: number, tick_spacing: number): number;
|
|
162
|
-
export function _POSITION_BUNDLE_SIZE(): number;
|
|
163
|
-
export function _NUM_REWARDS(): number;
|
|
164
269
|
export function _FEE_RATE_DENOMINATOR(): number;
|
|
165
|
-
export function _TICK_ARRAY_SIZE(): number;
|
|
166
|
-
export function _FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD(): number;
|
|
167
|
-
export function _MIN_TICK_INDEX(): number;
|
|
168
|
-
export function _MAX_TICK_INDEX(): number;
|
|
169
|
-
/**
|
|
170
|
-
* Get the first unoccupied position in a bundle
|
|
171
|
-
*
|
|
172
|
-
* # Arguments
|
|
173
|
-
* * `bundle` - The bundle to check
|
|
174
|
-
*
|
|
175
|
-
* # Returns
|
|
176
|
-
* * `u32` - The first unoccupied position (None if full)
|
|
177
|
-
*/
|
|
178
|
-
export function firstUnoccupiedPositionInBundle(bitmap: Uint8Array): number | undefined;
|
|
179
|
-
/**
|
|
180
|
-
* Check whether a position bundle is full
|
|
181
|
-
* A position bundle can contain 256 positions
|
|
182
|
-
*
|
|
183
|
-
* # Arguments
|
|
184
|
-
* * `bundle` - The bundle to check
|
|
185
|
-
*
|
|
186
|
-
* # Returns
|
|
187
|
-
* * `bool` - Whether the bundle is full
|
|
188
|
-
*/
|
|
189
|
-
export function isPositionBundleFull(bitmap: Uint8Array): boolean;
|
|
190
|
-
/**
|
|
191
|
-
* Check whether a position bundle is empty
|
|
192
|
-
*
|
|
193
|
-
* # Arguments
|
|
194
|
-
* * `bundle` - The bundle to check
|
|
195
|
-
*
|
|
196
|
-
* # Returns
|
|
197
|
-
* * `bool` - Whether the bundle is empty
|
|
198
|
-
*/
|
|
199
|
-
export function isPositionBundleEmpty(bitmap: Uint8Array): boolean;
|
|
200
270
|
export function _TICK_ARRAY_NOT_EVENLY_SPACED(): string;
|
|
201
271
|
export function _TICK_INDEX_OUT_OF_BOUNDS(): string;
|
|
202
272
|
export function _INVALID_TICK_INDEX(): string;
|
|
@@ -412,76 +482,6 @@ export function swapQuoteByInputToken(token_in: bigint, specified_token_a: boole
|
|
|
412
482
|
* The exact input or output amount for the swap transaction.
|
|
413
483
|
*/
|
|
414
484
|
export function swapQuoteByOutputToken(token_out: bigint, specified_token_a: boolean, slippage_tolerance_bps: number, whirlpool: WhirlpoolFacade, tick_arrays: TickArrayFacade[], transfer_fee_a?: TransferFee, transfer_fee_b?: TransferFee): ExactOutSwapQuote;
|
|
415
|
-
/**
|
|
416
|
-
* Convert a price into a sqrt priceX64
|
|
417
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
418
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
419
|
-
*
|
|
420
|
-
* # Parameters
|
|
421
|
-
* * `price` - The price to convert
|
|
422
|
-
* * `decimals_a` - The number of decimals of the base token
|
|
423
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
424
|
-
*
|
|
425
|
-
* # Returns
|
|
426
|
-
* * `u128` - The sqrt priceX64
|
|
427
|
-
*/
|
|
428
|
-
export function priceToSqrtPrice(price: number, decimals_a: number, decimals_b: number): bigint;
|
|
429
|
-
/**
|
|
430
|
-
* Convert a sqrt priceX64 into a tick index
|
|
431
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
432
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
433
|
-
*
|
|
434
|
-
* # Parameters
|
|
435
|
-
* * `sqrt_price` - The sqrt priceX64 to convert
|
|
436
|
-
* * `decimals_a` - The number of decimals of the base token
|
|
437
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
438
|
-
*
|
|
439
|
-
* # Returns
|
|
440
|
-
* * `f64` - The decimal price
|
|
441
|
-
*/
|
|
442
|
-
export function sqrtPriceToPrice(sqrt_price: bigint, decimals_a: number, decimals_b: number): number;
|
|
443
|
-
/**
|
|
444
|
-
* Invert a price
|
|
445
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
446
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
447
|
-
*
|
|
448
|
-
* # Parameters
|
|
449
|
-
* * `price` - The price to invert
|
|
450
|
-
* * `decimals_a` - The number of decimals of the base token
|
|
451
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
452
|
-
*
|
|
453
|
-
* # Returns
|
|
454
|
-
* * `f64` - The inverted price
|
|
455
|
-
*/
|
|
456
|
-
export function invertPrice(price: number, decimals_a: number, decimals_b: number): number;
|
|
457
|
-
/**
|
|
458
|
-
* Convert a tick index into a price
|
|
459
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
460
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
461
|
-
*
|
|
462
|
-
* # Parameters
|
|
463
|
-
* * `tick_index` - The tick index to convert
|
|
464
|
-
* * `decimals_a` - The number of decimals of the base token
|
|
465
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
466
|
-
*
|
|
467
|
-
* # Returns
|
|
468
|
-
* * `f64` - The decimal price
|
|
469
|
-
*/
|
|
470
|
-
export function tickIndexToPrice(tick_index: number, decimals_a: number, decimals_b: number): number;
|
|
471
|
-
/**
|
|
472
|
-
* Convert a price into a tick index
|
|
473
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
474
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
475
|
-
*
|
|
476
|
-
* # Parameters
|
|
477
|
-
* * `price` - The price to convert
|
|
478
|
-
* * `decimals_a` - The number of decimals of the base token
|
|
479
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
480
|
-
*
|
|
481
|
-
* # Returns
|
|
482
|
-
* * `i32` - The tick index
|
|
483
|
-
*/
|
|
484
|
-
export function priceToTickIndex(price: number, decimals_a: number, decimals_b: number): number;
|
|
485
485
|
/**
|
|
486
486
|
* Calculate fees owed for a position
|
|
487
487
|
*
|
|
@@ -610,23 +610,30 @@ export function increaseLiquidityQuoteB(token_amount_b: bigint, slippage_toleran
|
|
|
610
610
|
* - `CollectRewardsQuote`: The rewards owed for the 3 reward tokens.
|
|
611
611
|
*/
|
|
612
612
|
export function collectRewardsQuote(whirlpool: WhirlpoolFacade, position: PositionFacade, tick_lower: TickFacade, tick_upper: TickFacade, current_timestamp: bigint, transfer_fee_1?: TransferFee, transfer_fee_2?: TransferFee, transfer_fee_3?: TransferFee): CollectRewardsQuote;
|
|
613
|
-
export interface
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
tokenMaxIn: bigint;
|
|
617
|
-
tradeFee: bigint;
|
|
613
|
+
export interface TransferFee {
|
|
614
|
+
feeBps: number;
|
|
615
|
+
maxFee: bigint;
|
|
618
616
|
}
|
|
619
617
|
|
|
620
|
-
export interface
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
618
|
+
export interface IncreaseLiquidityQuote {
|
|
619
|
+
liquidityDelta: bigint;
|
|
620
|
+
tokenEstA: bigint;
|
|
621
|
+
tokenEstB: bigint;
|
|
622
|
+
tokenMaxA: bigint;
|
|
623
|
+
tokenMaxB: bigint;
|
|
625
624
|
}
|
|
626
625
|
|
|
627
|
-
export interface
|
|
628
|
-
|
|
629
|
-
|
|
626
|
+
export interface DecreaseLiquidityQuote {
|
|
627
|
+
liquidityDelta: bigint;
|
|
628
|
+
tokenEstA: bigint;
|
|
629
|
+
tokenEstB: bigint;
|
|
630
|
+
tokenMinA: bigint;
|
|
631
|
+
tokenMinB: bigint;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
export interface CollectFeesQuote {
|
|
635
|
+
feeOwedA: bigint;
|
|
636
|
+
feeOwedB: bigint;
|
|
630
637
|
}
|
|
631
638
|
|
|
632
639
|
export interface TickArrayFacade {
|
|
@@ -648,6 +655,38 @@ export interface TickRange {
|
|
|
648
655
|
tickUpperIndex: number;
|
|
649
656
|
}
|
|
650
657
|
|
|
658
|
+
export interface ExactOutSwapQuote {
|
|
659
|
+
tokenOut: bigint;
|
|
660
|
+
tokenEstIn: bigint;
|
|
661
|
+
tokenMaxIn: bigint;
|
|
662
|
+
tradeFee: bigint;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
export interface ExactInSwapQuote {
|
|
666
|
+
tokenIn: bigint;
|
|
667
|
+
tokenEstOut: bigint;
|
|
668
|
+
tokenMinOut: bigint;
|
|
669
|
+
tradeFee: bigint;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
export interface WhirlpoolRewardInfoFacade {
|
|
673
|
+
emissionsPerSecondX64: bigint;
|
|
674
|
+
growthGlobalX64: bigint;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
export interface WhirlpoolFacade {
|
|
678
|
+
tickSpacing: number;
|
|
679
|
+
feeRate: number;
|
|
680
|
+
protocolFeeRate: number;
|
|
681
|
+
liquidity: bigint;
|
|
682
|
+
sqrtPrice: bigint;
|
|
683
|
+
tickCurrentIndex: number;
|
|
684
|
+
feeGrowthGlobalA: bigint;
|
|
685
|
+
feeGrowthGlobalB: bigint;
|
|
686
|
+
rewardLastUpdatedTimestamp: bigint;
|
|
687
|
+
rewardInfos: WhirlpoolRewardInfoFacade[];
|
|
688
|
+
}
|
|
689
|
+
|
|
651
690
|
export interface CollectRewardQuote {
|
|
652
691
|
rewardsOwed: bigint;
|
|
653
692
|
}
|
|
@@ -679,42 +718,3 @@ export interface PositionRatio {
|
|
|
679
718
|
ratioB: number;
|
|
680
719
|
}
|
|
681
720
|
|
|
682
|
-
export interface WhirlpoolRewardInfoFacade {
|
|
683
|
-
emissionsPerSecondX64: bigint;
|
|
684
|
-
growthGlobalX64: bigint;
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
export interface WhirlpoolFacade {
|
|
688
|
-
tickSpacing: number;
|
|
689
|
-
feeRate: number;
|
|
690
|
-
protocolFeeRate: number;
|
|
691
|
-
liquidity: bigint;
|
|
692
|
-
sqrtPrice: bigint;
|
|
693
|
-
tickCurrentIndex: number;
|
|
694
|
-
feeGrowthGlobalA: bigint;
|
|
695
|
-
feeGrowthGlobalB: bigint;
|
|
696
|
-
rewardLastUpdatedTimestamp: bigint;
|
|
697
|
-
rewardInfos: WhirlpoolRewardInfoFacade[];
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
export interface IncreaseLiquidityQuote {
|
|
701
|
-
liquidityDelta: bigint;
|
|
702
|
-
tokenEstA: bigint;
|
|
703
|
-
tokenEstB: bigint;
|
|
704
|
-
tokenMaxA: bigint;
|
|
705
|
-
tokenMaxB: bigint;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
export interface DecreaseLiquidityQuote {
|
|
709
|
-
liquidityDelta: bigint;
|
|
710
|
-
tokenEstA: bigint;
|
|
711
|
-
tokenEstB: bigint;
|
|
712
|
-
tokenMinA: bigint;
|
|
713
|
-
tokenMinB: bigint;
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
export interface CollectFeesQuote {
|
|
717
|
-
feeOwedA: bigint;
|
|
718
|
-
feeOwedB: bigint;
|
|
719
|
-
}
|
|
720
|
-
|