@orca-so/whirlpools-core 2.0.0 → 3.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 +86 -85
- package/dist/browser/orca_whirlpools_core_js_bindings_bg.js +235 -234
- package/dist/browser/orca_whirlpools_core_js_bindings_bg.wasm +0 -0
- package/dist/browser/orca_whirlpools_core_js_bindings_bg.wasm.d.ts +28 -28
- package/dist/browser/package.json +1 -1
- package/dist/nodejs/orca_whirlpools_core_js_bindings.d.ts +86 -85
- package/dist/nodejs/orca_whirlpools_core_js_bindings.js +235 -234
- package/dist/nodejs/orca_whirlpools_core_js_bindings_bg.wasm +0 -0
- package/dist/nodejs/orca_whirlpools_core_js_bindings_bg.wasm.d.ts +28 -28
- package/dist/nodejs/package.json +1 -1
- package/package.json +4 -2
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Check if the whirlpool is initialized with adaptive fee
|
|
5
|
-
*
|
|
6
|
-
* # Paramters
|
|
7
|
-
* - `whirlpool`: The whirlpool state
|
|
8
|
-
*
|
|
9
|
-
* # Returns
|
|
10
|
-
* - A boolean value indicating if the whirlpool is initialized with adaptive fee
|
|
11
|
-
*/
|
|
12
|
-
export function isInitializedWithAdaptiveFee(whirlpool: WhirlpoolFacade): boolean;
|
|
13
3
|
/**
|
|
14
4
|
* Calculate the amount A delta between two sqrt_prices
|
|
15
5
|
*
|
|
@@ -155,37 +145,6 @@ export function tryReverseApplySwapFee(amount: bigint, fee_rate: number): bigint
|
|
|
155
145
|
* - `CollectRewardsQuote`: The rewards owed for the 3 reward tokens.
|
|
156
146
|
*/
|
|
157
147
|
export function collectRewardsQuote(whirlpool: WhirlpoolFacade, position: PositionFacade, tick_lower: TickFacade, tick_upper: TickFacade, current_timestamp: bigint, transfer_fee_1?: TransferFee | null, transfer_fee_2?: TransferFee | null, transfer_fee_3?: TransferFee | null): CollectRewardsQuote;
|
|
158
|
-
/**
|
|
159
|
-
* Get the first unoccupied position in a bundle
|
|
160
|
-
*
|
|
161
|
-
* # Arguments
|
|
162
|
-
* * `bundle` - The bundle to check
|
|
163
|
-
*
|
|
164
|
-
* # Returns
|
|
165
|
-
* * `u32` - The first unoccupied position (None if full)
|
|
166
|
-
*/
|
|
167
|
-
export function firstUnoccupiedPositionInBundle(bitmap: Uint8Array): number | undefined;
|
|
168
|
-
/**
|
|
169
|
-
* Check whether a position bundle is full
|
|
170
|
-
* A position bundle can contain 256 positions
|
|
171
|
-
*
|
|
172
|
-
* # Arguments
|
|
173
|
-
* * `bundle` - The bundle to check
|
|
174
|
-
*
|
|
175
|
-
* # Returns
|
|
176
|
-
* * `bool` - Whether the bundle is full
|
|
177
|
-
*/
|
|
178
|
-
export function isPositionBundleFull(bitmap: Uint8Array): boolean;
|
|
179
|
-
/**
|
|
180
|
-
* Check whether a position bundle is empty
|
|
181
|
-
*
|
|
182
|
-
* # Arguments
|
|
183
|
-
* * `bundle` - The bundle to check
|
|
184
|
-
*
|
|
185
|
-
* # Returns
|
|
186
|
-
* * `bool` - Whether the bundle is empty
|
|
187
|
-
*/
|
|
188
|
-
export function isPositionBundleEmpty(bitmap: Uint8Array): boolean;
|
|
189
148
|
/**
|
|
190
149
|
* Get the first tick index in the tick array that contains the specified tick index.
|
|
191
150
|
*
|
|
@@ -211,6 +170,7 @@ export function tickIndexToSqrtPrice(tick_index: number): bigint;
|
|
|
211
170
|
/**
|
|
212
171
|
* Derive the tick index from a sqrt price. The precision of this method is only guarranted
|
|
213
172
|
* if tick is within the bounds of {max, min} tick-index.
|
|
173
|
+
* This function will make panic for zero sqrt price.
|
|
214
174
|
*
|
|
215
175
|
* # Parameters
|
|
216
176
|
* - `sqrt_price` - A u128 integer representing the sqrt price
|
|
@@ -351,28 +311,43 @@ export function _ADAPTIVE_FEE_CONTROL_FACTOR_DENOMINATOR(): number;
|
|
|
351
311
|
export function _MAX_REFERENCE_AGE(): bigint;
|
|
352
312
|
export function _FEE_RATE_HARD_LIMIT(): number;
|
|
353
313
|
export function _POSITION_BUNDLE_SIZE(): number;
|
|
354
|
-
export function _TICK_ARRAY_NOT_EVENLY_SPACED(): string;
|
|
355
|
-
export function _TICK_INDEX_OUT_OF_BOUNDS(): string;
|
|
356
|
-
export function _INVALID_TICK_INDEX(): string;
|
|
357
|
-
export function _ARITHMETIC_OVERFLOW(): string;
|
|
358
|
-
export function _AMOUNT_EXCEEDS_MAX_U64(): string;
|
|
359
|
-
export function _SQRT_PRICE_OUT_OF_BOUNDS(): string;
|
|
360
|
-
export function _TICK_SEQUENCE_EMPTY(): string;
|
|
361
|
-
export function _SQRT_PRICE_LIMIT_OUT_OF_BOUNDS(): string;
|
|
362
|
-
export function _INVALID_SQRT_PRICE_LIMIT_DIRECTION(): string;
|
|
363
|
-
export function _ZERO_TRADABLE_AMOUNT(): string;
|
|
364
|
-
export function _INVALID_TIMESTAMP(): string;
|
|
365
|
-
export function _INVALID_TRANSFER_FEE(): string;
|
|
366
|
-
export function _INVALID_SLIPPAGE_TOLERANCE(): string;
|
|
367
|
-
export function _TICK_INDEX_NOT_IN_ARRAY(): string;
|
|
368
|
-
export function _INVALID_TICK_ARRAY_SEQUENCE(): string;
|
|
369
|
-
export function _INVALID_ADAPTIVE_FEE_INFO(): string;
|
|
370
314
|
export function _NUM_REWARDS(): number;
|
|
371
315
|
export function _FEE_RATE_DENOMINATOR(): number;
|
|
372
316
|
export function _TICK_ARRAY_SIZE(): number;
|
|
373
317
|
export function _FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD(): number;
|
|
374
318
|
export function _MIN_TICK_INDEX(): number;
|
|
375
319
|
export function _MAX_TICK_INDEX(): number;
|
|
320
|
+
/**
|
|
321
|
+
* Get the first unoccupied position in a bundle
|
|
322
|
+
*
|
|
323
|
+
* # Arguments
|
|
324
|
+
* * `bundle` - The bundle to check
|
|
325
|
+
*
|
|
326
|
+
* # Returns
|
|
327
|
+
* * `u32` - The first unoccupied position (None if full)
|
|
328
|
+
*/
|
|
329
|
+
export function firstUnoccupiedPositionInBundle(bitmap: Uint8Array): number | undefined;
|
|
330
|
+
/**
|
|
331
|
+
* Check whether a position bundle is full
|
|
332
|
+
* A position bundle can contain 256 positions
|
|
333
|
+
*
|
|
334
|
+
* # Arguments
|
|
335
|
+
* * `bundle` - The bundle to check
|
|
336
|
+
*
|
|
337
|
+
* # Returns
|
|
338
|
+
* * `bool` - Whether the bundle is full
|
|
339
|
+
*/
|
|
340
|
+
export function isPositionBundleFull(bitmap: Uint8Array): boolean;
|
|
341
|
+
/**
|
|
342
|
+
* Check whether a position bundle is empty
|
|
343
|
+
*
|
|
344
|
+
* # Arguments
|
|
345
|
+
* * `bundle` - The bundle to check
|
|
346
|
+
*
|
|
347
|
+
* # Returns
|
|
348
|
+
* * `bool` - Whether the bundle is empty
|
|
349
|
+
*/
|
|
350
|
+
export function isPositionBundleEmpty(bitmap: Uint8Array): boolean;
|
|
376
351
|
/**
|
|
377
352
|
* Check if a position is in range.
|
|
378
353
|
* When a position is in range it is earning fees and rewards
|
|
@@ -484,6 +459,32 @@ export function tickIndexToPrice(tick_index: number, decimals_a: number, decimal
|
|
|
484
459
|
* * `i32` - The tick index
|
|
485
460
|
*/
|
|
486
461
|
export function priceToTickIndex(price: number, decimals_a: number, decimals_b: number): number;
|
|
462
|
+
export function _TICK_ARRAY_NOT_EVENLY_SPACED(): string;
|
|
463
|
+
export function _TICK_INDEX_OUT_OF_BOUNDS(): string;
|
|
464
|
+
export function _INVALID_TICK_INDEX(): string;
|
|
465
|
+
export function _ARITHMETIC_OVERFLOW(): string;
|
|
466
|
+
export function _AMOUNT_EXCEEDS_MAX_U64(): string;
|
|
467
|
+
export function _SQRT_PRICE_OUT_OF_BOUNDS(): string;
|
|
468
|
+
export function _TICK_SEQUENCE_EMPTY(): string;
|
|
469
|
+
export function _SQRT_PRICE_LIMIT_OUT_OF_BOUNDS(): string;
|
|
470
|
+
export function _INVALID_SQRT_PRICE_LIMIT_DIRECTION(): string;
|
|
471
|
+
export function _ZERO_TRADABLE_AMOUNT(): string;
|
|
472
|
+
export function _INVALID_TIMESTAMP(): string;
|
|
473
|
+
export function _INVALID_TRANSFER_FEE(): string;
|
|
474
|
+
export function _INVALID_SLIPPAGE_TOLERANCE(): string;
|
|
475
|
+
export function _TICK_INDEX_NOT_IN_ARRAY(): string;
|
|
476
|
+
export function _INVALID_TICK_ARRAY_SEQUENCE(): string;
|
|
477
|
+
export function _INVALID_ADAPTIVE_FEE_INFO(): string;
|
|
478
|
+
/**
|
|
479
|
+
* Check if the whirlpool is initialized with adaptive fee
|
|
480
|
+
*
|
|
481
|
+
* # Paramters
|
|
482
|
+
* - `whirlpool`: The whirlpool state
|
|
483
|
+
*
|
|
484
|
+
* # Returns
|
|
485
|
+
* - A boolean value indicating if the whirlpool is initialized with adaptive fee
|
|
486
|
+
*/
|
|
487
|
+
export function isInitializedWithAdaptiveFee(whirlpool: WhirlpoolFacade): boolean;
|
|
487
488
|
/**
|
|
488
489
|
* Computes the exact input or output amount for a swap transaction.
|
|
489
490
|
*
|
|
@@ -631,14 +632,22 @@ export function increaseLiquidityQuoteA(token_amount_a: bigint, slippage_toleran
|
|
|
631
632
|
* - An IncreaseLiquidityQuote struct containing the estimated token amounts
|
|
632
633
|
*/
|
|
633
634
|
export function increaseLiquidityQuoteB(token_amount_b: bigint, slippage_tolerance_bps: number, current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number, transfer_fee_a?: TransferFee | null, transfer_fee_b?: TransferFee | null): IncreaseLiquidityQuote;
|
|
634
|
-
export interface
|
|
635
|
-
|
|
636
|
-
|
|
635
|
+
export interface ExactOutSwapQuote {
|
|
636
|
+
tokenOut: bigint;
|
|
637
|
+
tokenEstIn: bigint;
|
|
638
|
+
tokenMaxIn: bigint;
|
|
639
|
+
tradeFee: bigint;
|
|
640
|
+
tradeFeeRateMin: number;
|
|
641
|
+
tradeFeeRateMax: number;
|
|
637
642
|
}
|
|
638
643
|
|
|
639
|
-
export interface
|
|
640
|
-
|
|
641
|
-
|
|
644
|
+
export interface ExactInSwapQuote {
|
|
645
|
+
tokenIn: bigint;
|
|
646
|
+
tokenEstOut: bigint;
|
|
647
|
+
tokenMinOut: bigint;
|
|
648
|
+
tradeFee: bigint;
|
|
649
|
+
tradeFeeRateMin: number;
|
|
650
|
+
tradeFeeRateMax: number;
|
|
642
651
|
}
|
|
643
652
|
|
|
644
653
|
export interface IncreaseLiquidityQuote {
|
|
@@ -657,22 +666,22 @@ export interface DecreaseLiquidityQuote {
|
|
|
657
666
|
tokenMinB: bigint;
|
|
658
667
|
}
|
|
659
668
|
|
|
660
|
-
export interface
|
|
661
|
-
|
|
662
|
-
tokenEstIn: bigint;
|
|
663
|
-
tokenMaxIn: bigint;
|
|
664
|
-
tradeFee: bigint;
|
|
665
|
-
tradeFeeRateMin: number;
|
|
666
|
-
tradeFeeRateMax: number;
|
|
669
|
+
export interface CollectRewardQuote {
|
|
670
|
+
rewardsOwed: bigint;
|
|
667
671
|
}
|
|
668
672
|
|
|
669
|
-
export interface
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
673
|
+
export interface CollectRewardsQuote {
|
|
674
|
+
rewards: CollectRewardQuote[];
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
export interface TransferFee {
|
|
678
|
+
feeBps: number;
|
|
679
|
+
maxFee: bigint;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
export interface CollectFeesQuote {
|
|
683
|
+
feeOwedA: bigint;
|
|
684
|
+
feeOwedB: bigint;
|
|
676
685
|
}
|
|
677
686
|
|
|
678
687
|
export interface TickArrayFacade {
|
|
@@ -765,11 +774,3 @@ export interface OracleFacade {
|
|
|
765
774
|
adaptiveFeeVariables: AdaptiveFeeVariablesFacade;
|
|
766
775
|
}
|
|
767
776
|
|
|
768
|
-
export interface CollectRewardQuote {
|
|
769
|
-
rewardsOwed: bigint;
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
export interface CollectRewardsQuote {
|
|
773
|
-
rewards: CollectRewardQuote[];
|
|
774
|
-
}
|
|
775
|
-
|