@orca-so/whirlpools-core 0.4.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/orca_whirlpools_core_js_bindings.d.ts +128 -128
- package/dist/browser/orca_whirlpools_core_js_bindings_bg.js +561 -568
- 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 +128 -128
- package/dist/nodejs/orca_whirlpools_core_js_bindings.js +562 -569
- 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,98 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Check if a position is in range.
|
|
5
|
+
* When a position is in range it is earning fees and rewards
|
|
6
|
+
*
|
|
7
|
+
* # Parameters
|
|
8
|
+
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
9
|
+
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
10
|
+
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
11
|
+
*
|
|
12
|
+
* # Returns
|
|
13
|
+
* - A boolean value indicating if the position is in range
|
|
14
|
+
*/
|
|
15
|
+
export function isPositionInRange(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Calculate the status of a position
|
|
18
|
+
* The status can be one of three values:
|
|
19
|
+
* - InRange: The position is in range
|
|
20
|
+
* - BelowRange: The position is below the range
|
|
21
|
+
* - AboveRange: The position is above the range
|
|
22
|
+
*
|
|
23
|
+
* # Parameters
|
|
24
|
+
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
25
|
+
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
26
|
+
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
27
|
+
*
|
|
28
|
+
* # Returns
|
|
29
|
+
* - A PositionStatus enum value indicating the status of the position
|
|
30
|
+
*/
|
|
31
|
+
export function positionStatus(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): PositionStatus;
|
|
32
|
+
/**
|
|
33
|
+
* Calculate the token_a / token_b ratio of a (ficticious) position
|
|
34
|
+
*
|
|
35
|
+
* # Parameters
|
|
36
|
+
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
37
|
+
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
38
|
+
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
39
|
+
*
|
|
40
|
+
* # Returns
|
|
41
|
+
* - A PositionRatio struct containing the ratio of token_a and token_b
|
|
42
|
+
*/
|
|
43
|
+
export function positionRatio(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): PositionRatio;
|
|
44
|
+
export function _POSITION_BUNDLE_SIZE(): number;
|
|
45
|
+
export function _TICK_ARRAY_NOT_EVENLY_SPACED(): string;
|
|
46
|
+
export function _TICK_INDEX_OUT_OF_BOUNDS(): string;
|
|
47
|
+
export function _INVALID_TICK_INDEX(): string;
|
|
48
|
+
export function _ARITHMETIC_OVERFLOW(): string;
|
|
49
|
+
export function _AMOUNT_EXCEEDS_MAX_U64(): string;
|
|
50
|
+
export function _SQRT_PRICE_OUT_OF_BOUNDS(): string;
|
|
51
|
+
export function _TICK_SEQUENCE_EMPTY(): string;
|
|
52
|
+
export function _SQRT_PRICE_LIMIT_OUT_OF_BOUNDS(): string;
|
|
53
|
+
export function _INVALID_SQRT_PRICE_LIMIT_DIRECTION(): string;
|
|
54
|
+
export function _ZERO_TRADABLE_AMOUNT(): string;
|
|
55
|
+
export function _INVALID_TIMESTAMP(): string;
|
|
56
|
+
export function _INVALID_TRANSFER_FEE(): string;
|
|
57
|
+
export function _INVALID_SLIPPAGE_TOLERANCE(): string;
|
|
58
|
+
export function _TICK_INDEX_NOT_IN_ARRAY(): string;
|
|
59
|
+
export function _NUM_REWARDS(): number;
|
|
60
|
+
export function _FEE_RATE_DENOMINATOR(): number;
|
|
61
|
+
export function _TICK_ARRAY_SIZE(): number;
|
|
62
|
+
export function _FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD(): number;
|
|
63
|
+
export function _MIN_TICK_INDEX(): number;
|
|
64
|
+
export function _MAX_TICK_INDEX(): number;
|
|
65
|
+
/**
|
|
66
|
+
* Get the first unoccupied position in a bundle
|
|
67
|
+
*
|
|
68
|
+
* # Arguments
|
|
69
|
+
* * `bundle` - The bundle to check
|
|
70
|
+
*
|
|
71
|
+
* # Returns
|
|
72
|
+
* * `u32` - The first unoccupied position (None if full)
|
|
73
|
+
*/
|
|
74
|
+
export function firstUnoccupiedPositionInBundle(bitmap: Uint8Array): number | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Check whether a position bundle is full
|
|
77
|
+
* A position bundle can contain 256 positions
|
|
78
|
+
*
|
|
79
|
+
* # Arguments
|
|
80
|
+
* * `bundle` - The bundle to check
|
|
81
|
+
*
|
|
82
|
+
* # Returns
|
|
83
|
+
* * `bool` - Whether the bundle is full
|
|
84
|
+
*/
|
|
85
|
+
export function isPositionBundleFull(bitmap: Uint8Array): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Check whether a position bundle is empty
|
|
88
|
+
*
|
|
89
|
+
* # Arguments
|
|
90
|
+
* * `bundle` - The bundle to check
|
|
91
|
+
*
|
|
92
|
+
* # Returns
|
|
93
|
+
* * `bool` - Whether the bundle is empty
|
|
94
|
+
*/
|
|
95
|
+
export function isPositionBundleEmpty(bitmap: Uint8Array): boolean;
|
|
3
96
|
/**
|
|
4
97
|
* Get the first tick index in the tick array that contains the specified tick index.
|
|
5
98
|
*
|
|
@@ -159,99 +252,6 @@ export function isFullRangeOnly(tick_spacing: number): boolean;
|
|
|
159
252
|
* - A u32 integer representing the tick index in the tick array
|
|
160
253
|
*/
|
|
161
254
|
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
|
-
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
|
-
export function _TICK_ARRAY_NOT_EVENLY_SPACED(): string;
|
|
201
|
-
export function _TICK_INDEX_OUT_OF_BOUNDS(): string;
|
|
202
|
-
export function _INVALID_TICK_INDEX(): string;
|
|
203
|
-
export function _ARITHMETIC_OVERFLOW(): string;
|
|
204
|
-
export function _AMOUNT_EXCEEDS_MAX_U64(): string;
|
|
205
|
-
export function _SQRT_PRICE_OUT_OF_BOUNDS(): string;
|
|
206
|
-
export function _TICK_SEQUENCE_EMPTY(): string;
|
|
207
|
-
export function _SQRT_PRICE_LIMIT_OUT_OF_BOUNDS(): string;
|
|
208
|
-
export function _INVALID_SQRT_PRICE_LIMIT_DIRECTION(): string;
|
|
209
|
-
export function _ZERO_TRADABLE_AMOUNT(): string;
|
|
210
|
-
export function _INVALID_TIMESTAMP(): string;
|
|
211
|
-
export function _INVALID_TRANSFER_FEE(): string;
|
|
212
|
-
export function _INVALID_SLIPPAGE_TOLERANCE(): string;
|
|
213
|
-
export function _TICK_INDEX_NOT_IN_ARRAY(): string;
|
|
214
|
-
/**
|
|
215
|
-
* Check if a position is in range.
|
|
216
|
-
* When a position is in range it is earning fees and rewards
|
|
217
|
-
*
|
|
218
|
-
* # Parameters
|
|
219
|
-
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
220
|
-
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
221
|
-
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
222
|
-
*
|
|
223
|
-
* # Returns
|
|
224
|
-
* - A boolean value indicating if the position is in range
|
|
225
|
-
*/
|
|
226
|
-
export function isPositionInRange(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): boolean;
|
|
227
|
-
/**
|
|
228
|
-
* Calculate the status of a position
|
|
229
|
-
* The status can be one of three values:
|
|
230
|
-
* - InRange: The position is in range
|
|
231
|
-
* - BelowRange: The position is below the range
|
|
232
|
-
* - AboveRange: The position is above the range
|
|
233
|
-
*
|
|
234
|
-
* # Parameters
|
|
235
|
-
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
236
|
-
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
237
|
-
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
238
|
-
*
|
|
239
|
-
* # Returns
|
|
240
|
-
* - A PositionStatus enum value indicating the status of the position
|
|
241
|
-
*/
|
|
242
|
-
export function positionStatus(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): PositionStatus;
|
|
243
|
-
/**
|
|
244
|
-
* Calculate the token_a / token_b ratio of a (ficticious) position
|
|
245
|
-
*
|
|
246
|
-
* # Parameters
|
|
247
|
-
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
248
|
-
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
249
|
-
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
250
|
-
*
|
|
251
|
-
* # Returns
|
|
252
|
-
* - A PositionRatio struct containing the ratio of token_a and token_b
|
|
253
|
-
*/
|
|
254
|
-
export function positionRatio(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): PositionRatio;
|
|
255
255
|
/**
|
|
256
256
|
* Calculate the amount A delta between two sqrt_prices
|
|
257
257
|
*
|
|
@@ -610,20 +610,6 @@ 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 ExactOutSwapQuote {
|
|
614
|
-
tokenOut: bigint;
|
|
615
|
-
tokenEstIn: bigint;
|
|
616
|
-
tokenMaxIn: bigint;
|
|
617
|
-
tradeFee: bigint;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
export interface ExactInSwapQuote {
|
|
621
|
-
tokenIn: bigint;
|
|
622
|
-
tokenEstOut: bigint;
|
|
623
|
-
tokenMinOut: bigint;
|
|
624
|
-
tradeFee: bigint;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
613
|
export interface TransferFee {
|
|
628
614
|
feeBps: number;
|
|
629
615
|
maxFee: bigint;
|
|
@@ -648,6 +634,41 @@ export interface TickRange {
|
|
|
648
634
|
tickUpperIndex: number;
|
|
649
635
|
}
|
|
650
636
|
|
|
637
|
+
export interface IncreaseLiquidityQuote {
|
|
638
|
+
liquidityDelta: bigint;
|
|
639
|
+
tokenEstA: bigint;
|
|
640
|
+
tokenEstB: bigint;
|
|
641
|
+
tokenMaxA: bigint;
|
|
642
|
+
tokenMaxB: bigint;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export interface DecreaseLiquidityQuote {
|
|
646
|
+
liquidityDelta: bigint;
|
|
647
|
+
tokenEstA: bigint;
|
|
648
|
+
tokenEstB: bigint;
|
|
649
|
+
tokenMinA: bigint;
|
|
650
|
+
tokenMinB: bigint;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
export interface ExactOutSwapQuote {
|
|
654
|
+
tokenOut: bigint;
|
|
655
|
+
tokenEstIn: bigint;
|
|
656
|
+
tokenMaxIn: bigint;
|
|
657
|
+
tradeFee: bigint;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
export interface ExactInSwapQuote {
|
|
661
|
+
tokenIn: bigint;
|
|
662
|
+
tokenEstOut: bigint;
|
|
663
|
+
tokenMinOut: bigint;
|
|
664
|
+
tradeFee: bigint;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
export interface CollectFeesQuote {
|
|
668
|
+
feeOwedA: bigint;
|
|
669
|
+
feeOwedB: bigint;
|
|
670
|
+
}
|
|
671
|
+
|
|
651
672
|
export interface CollectRewardQuote {
|
|
652
673
|
rewardsOwed: bigint;
|
|
653
674
|
}
|
|
@@ -697,24 +718,3 @@ export interface WhirlpoolFacade {
|
|
|
697
718
|
rewardInfos: WhirlpoolRewardInfoFacade[];
|
|
698
719
|
}
|
|
699
720
|
|
|
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
|
-
|