@orca-so/whirlpools-core 0.2.3 → 0.3.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/README.md +1 -1
- package/dist/browser/README.md +1 -1
- package/dist/browser/orca_whirlpools_core_js_bindings.d.ts +91 -91
- package/dist/browser/orca_whirlpools_core_js_bindings_bg.js +61 -60
- package/dist/browser/orca_whirlpools_core_js_bindings_bg.wasm +0 -0
- package/dist/nodejs/README.md +1 -1
- package/dist/nodejs/orca_whirlpools_core_js_bindings.d.ts +91 -91
- package/dist/nodejs/orca_whirlpools_core_js_bindings.js +61 -60
- package/dist/nodejs/orca_whirlpools_core_js_bindings_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Expected output:
|
|
|
33
33
|
Position in range? true
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
### Quote Example
|
|
36
|
+
### Adjust Liquidity Quote Example
|
|
37
37
|
The following example demonstrates how to use the `increaseLiquidityQuoteA` function to calculate a quote for increasing liquidity given a token A amount.
|
|
38
38
|
|
|
39
39
|
```tsx
|
package/dist/browser/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Expected output:
|
|
|
33
33
|
Position in range? true
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
### Quote Example
|
|
36
|
+
### Adjust Liquidity Quote Example
|
|
37
37
|
The following example demonstrates how to use the `increaseLiquidityQuoteA` function to calculate a quote for increasing liquidity given a token A amount.
|
|
38
38
|
|
|
39
39
|
```tsx
|
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Get the first unoccupied position in a bundle
|
|
5
|
+
*
|
|
6
|
+
* # Arguments
|
|
7
|
+
* * `bundle` - The bundle to check
|
|
8
|
+
*
|
|
9
|
+
* # Returns
|
|
10
|
+
* * `u32` - The first unoccupied position (None if full)
|
|
11
|
+
*/
|
|
12
|
+
export function firstUnoccupiedPositionInBundle(bitmap: Uint8Array): number | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Check whether a position bundle is full
|
|
15
|
+
* A position bundle can contain 256 positions
|
|
16
|
+
*
|
|
17
|
+
* # Arguments
|
|
18
|
+
* * `bundle` - The bundle to check
|
|
19
|
+
*
|
|
20
|
+
* # Returns
|
|
21
|
+
* * `bool` - Whether the bundle is full
|
|
22
|
+
*/
|
|
23
|
+
export function isPositionBundleFull(bitmap: Uint8Array): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Check whether a position bundle is empty
|
|
26
|
+
*
|
|
27
|
+
* # Arguments
|
|
28
|
+
* * `bundle` - The bundle to check
|
|
29
|
+
*
|
|
30
|
+
* # Returns
|
|
31
|
+
* * `bool` - Whether the bundle is empty
|
|
32
|
+
*/
|
|
33
|
+
export function isPositionBundleEmpty(bitmap: Uint8Array): boolean;
|
|
3
34
|
/**
|
|
4
35
|
* Get the first tick index in the tick array that contains the specified tick index.
|
|
5
36
|
*
|
|
@@ -159,37 +190,6 @@ export function isFullRangeOnly(tick_spacing: number): boolean;
|
|
|
159
190
|
* - A u32 integer representing the tick index in the tick array
|
|
160
191
|
*/
|
|
161
192
|
export function getTickIndexInArray(tick_index: number, tick_array_start_index: number, tick_spacing: number): number;
|
|
162
|
-
/**
|
|
163
|
-
* Get the first unoccupied position in a bundle
|
|
164
|
-
*
|
|
165
|
-
* # Arguments
|
|
166
|
-
* * `bundle` - The bundle to check
|
|
167
|
-
*
|
|
168
|
-
* # Returns
|
|
169
|
-
* * `u32` - The first unoccupied position (None if full)
|
|
170
|
-
*/
|
|
171
|
-
export function firstUnoccupiedPositionInBundle(bitmap: Uint8Array): number | undefined;
|
|
172
|
-
/**
|
|
173
|
-
* Check whether a position bundle is full
|
|
174
|
-
* A position bundle can contain 256 positions
|
|
175
|
-
*
|
|
176
|
-
* # Arguments
|
|
177
|
-
* * `bundle` - The bundle to check
|
|
178
|
-
*
|
|
179
|
-
* # Returns
|
|
180
|
-
* * `bool` - Whether the bundle is full
|
|
181
|
-
*/
|
|
182
|
-
export function isPositionBundleFull(bitmap: Uint8Array): boolean;
|
|
183
|
-
/**
|
|
184
|
-
* Check whether a position bundle is empty
|
|
185
|
-
*
|
|
186
|
-
* # Arguments
|
|
187
|
-
* * `bundle` - The bundle to check
|
|
188
|
-
*
|
|
189
|
-
* # Returns
|
|
190
|
-
* * `bool` - Whether the bundle is empty
|
|
191
|
-
*/
|
|
192
|
-
export function isPositionBundleEmpty(bitmap: Uint8Array): boolean;
|
|
193
193
|
export function _POSITION_BUNDLE_SIZE(): number;
|
|
194
194
|
export function _TICK_ARRAY_NOT_EVENLY_SPACED(): number;
|
|
195
195
|
export function _TICK_INDEX_OUT_OF_BOUNDS(): number;
|
|
@@ -610,48 +610,36 @@ 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
|
-
|
|
617
|
-
|
|
618
|
-
export interface PositionFacade {
|
|
619
|
-
liquidity: bigint;
|
|
620
|
-
tickLowerIndex: number;
|
|
621
|
-
tickUpperIndex: number;
|
|
622
|
-
feeGrowthCheckpointA: bigint;
|
|
623
|
-
feeOwedA: bigint;
|
|
624
|
-
feeGrowthCheckpointB: bigint;
|
|
625
|
-
feeOwedB: bigint;
|
|
626
|
-
rewardInfos: PositionRewardInfoFacade[];
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
export type PositionStatus = "priceInRange" | "priceBelowRange" | "priceAboveRange" | "invalid";
|
|
630
|
-
|
|
631
|
-
export interface PositionRatio {
|
|
632
|
-
ratioA: number;
|
|
633
|
-
ratioB: number;
|
|
613
|
+
export interface ExactOutSwapQuote {
|
|
614
|
+
tokenOut: bigint;
|
|
615
|
+
tokenEstIn: bigint;
|
|
616
|
+
tokenMaxIn: bigint;
|
|
617
|
+
tradeFee: bigint;
|
|
634
618
|
}
|
|
635
619
|
|
|
636
|
-
export interface
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
tokenMaxB: bigint;
|
|
620
|
+
export interface ExactInSwapQuote {
|
|
621
|
+
tokenIn: bigint;
|
|
622
|
+
tokenEstOut: bigint;
|
|
623
|
+
tokenMinOut: bigint;
|
|
624
|
+
tradeFee: bigint;
|
|
642
625
|
}
|
|
643
626
|
|
|
644
|
-
export interface
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
tokenEstB: bigint;
|
|
648
|
-
tokenMinA: bigint;
|
|
649
|
-
tokenMinB: bigint;
|
|
627
|
+
export interface WhirlpoolRewardInfoFacade {
|
|
628
|
+
emissionsPerSecondX64: bigint;
|
|
629
|
+
growthGlobalX64: bigint;
|
|
650
630
|
}
|
|
651
631
|
|
|
652
|
-
export interface
|
|
653
|
-
|
|
654
|
-
|
|
632
|
+
export interface WhirlpoolFacade {
|
|
633
|
+
tickSpacing: number;
|
|
634
|
+
feeRate: number;
|
|
635
|
+
protocolFeeRate: number;
|
|
636
|
+
liquidity: bigint;
|
|
637
|
+
sqrtPrice: bigint;
|
|
638
|
+
tickCurrentIndex: number;
|
|
639
|
+
feeGrowthGlobalA: bigint;
|
|
640
|
+
feeGrowthGlobalB: bigint;
|
|
641
|
+
rewardLastUpdatedTimestamp: bigint;
|
|
642
|
+
rewardInfos: WhirlpoolRewardInfoFacade[];
|
|
655
643
|
}
|
|
656
644
|
|
|
657
645
|
export interface TransferFee {
|
|
@@ -686,35 +674,47 @@ export interface CollectRewardsQuote {
|
|
|
686
674
|
rewards: CollectRewardQuote[];
|
|
687
675
|
}
|
|
688
676
|
|
|
689
|
-
export interface
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
tokenMaxIn: bigint;
|
|
693
|
-
tradeFee: bigint;
|
|
677
|
+
export interface PositionRewardInfoFacade {
|
|
678
|
+
growthInsideCheckpoint: bigint;
|
|
679
|
+
amountOwed: bigint;
|
|
694
680
|
}
|
|
695
681
|
|
|
696
|
-
export interface
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
682
|
+
export interface PositionFacade {
|
|
683
|
+
liquidity: bigint;
|
|
684
|
+
tickLowerIndex: number;
|
|
685
|
+
tickUpperIndex: number;
|
|
686
|
+
feeGrowthCheckpointA: bigint;
|
|
687
|
+
feeOwedA: bigint;
|
|
688
|
+
feeGrowthCheckpointB: bigint;
|
|
689
|
+
feeOwedB: bigint;
|
|
690
|
+
rewardInfos: PositionRewardInfoFacade[];
|
|
701
691
|
}
|
|
702
692
|
|
|
703
|
-
export
|
|
704
|
-
|
|
705
|
-
|
|
693
|
+
export type PositionStatus = "priceInRange" | "priceBelowRange" | "priceAboveRange" | "invalid";
|
|
694
|
+
|
|
695
|
+
export interface PositionRatio {
|
|
696
|
+
ratioA: number;
|
|
697
|
+
ratioB: number;
|
|
706
698
|
}
|
|
707
699
|
|
|
708
|
-
export interface
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
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
719
|
}
|
|
720
720
|
|
|
@@ -174,6 +174,62 @@ function handleError(f, args) {
|
|
|
174
174
|
wasm.__wbindgen_exn_store(idx);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
+
|
|
178
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
179
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
180
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
181
|
+
WASM_VECTOR_LEN = arg.length;
|
|
182
|
+
return ptr;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get the first unoccupied position in a bundle
|
|
186
|
+
*
|
|
187
|
+
* # Arguments
|
|
188
|
+
* * `bundle` - The bundle to check
|
|
189
|
+
*
|
|
190
|
+
* # Returns
|
|
191
|
+
* * `u32` - The first unoccupied position (None if full)
|
|
192
|
+
*/
|
|
193
|
+
export function firstUnoccupiedPositionInBundle(bitmap) {
|
|
194
|
+
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
|
|
195
|
+
const len0 = WASM_VECTOR_LEN;
|
|
196
|
+
const ret = wasm.firstUnoccupiedPositionInBundle(ptr0, len0);
|
|
197
|
+
return ret[0] === 0 ? undefined : ret[1] >>> 0;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Check whether a position bundle is full
|
|
202
|
+
* A position bundle can contain 256 positions
|
|
203
|
+
*
|
|
204
|
+
* # Arguments
|
|
205
|
+
* * `bundle` - The bundle to check
|
|
206
|
+
*
|
|
207
|
+
* # Returns
|
|
208
|
+
* * `bool` - Whether the bundle is full
|
|
209
|
+
*/
|
|
210
|
+
export function isPositionBundleFull(bitmap) {
|
|
211
|
+
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
|
|
212
|
+
const len0 = WASM_VECTOR_LEN;
|
|
213
|
+
const ret = wasm.isPositionBundleFull(ptr0, len0);
|
|
214
|
+
return ret !== 0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Check whether a position bundle is empty
|
|
219
|
+
*
|
|
220
|
+
* # Arguments
|
|
221
|
+
* * `bundle` - The bundle to check
|
|
222
|
+
*
|
|
223
|
+
* # Returns
|
|
224
|
+
* * `bool` - Whether the bundle is empty
|
|
225
|
+
*/
|
|
226
|
+
export function isPositionBundleEmpty(bitmap) {
|
|
227
|
+
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
|
|
228
|
+
const len0 = WASM_VECTOR_LEN;
|
|
229
|
+
const ret = wasm.isPositionBundleEmpty(ptr0, len0);
|
|
230
|
+
return ret !== 0;
|
|
231
|
+
}
|
|
232
|
+
|
|
177
233
|
/**
|
|
178
234
|
* Get the first tick index in the tick array that contains the specified tick index.
|
|
179
235
|
*
|
|
@@ -397,61 +453,6 @@ export function getTickIndexInArray(tick_index, tick_array_start_index, tick_spa
|
|
|
397
453
|
return ret[0] >>> 0;
|
|
398
454
|
}
|
|
399
455
|
|
|
400
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
401
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
402
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
403
|
-
WASM_VECTOR_LEN = arg.length;
|
|
404
|
-
return ptr;
|
|
405
|
-
}
|
|
406
|
-
/**
|
|
407
|
-
* Get the first unoccupied position in a bundle
|
|
408
|
-
*
|
|
409
|
-
* # Arguments
|
|
410
|
-
* * `bundle` - The bundle to check
|
|
411
|
-
*
|
|
412
|
-
* # Returns
|
|
413
|
-
* * `u32` - The first unoccupied position (None if full)
|
|
414
|
-
*/
|
|
415
|
-
export function firstUnoccupiedPositionInBundle(bitmap) {
|
|
416
|
-
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
|
|
417
|
-
const len0 = WASM_VECTOR_LEN;
|
|
418
|
-
const ret = wasm.firstUnoccupiedPositionInBundle(ptr0, len0);
|
|
419
|
-
return ret[0] === 0 ? undefined : ret[1] >>> 0;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* Check whether a position bundle is full
|
|
424
|
-
* A position bundle can contain 256 positions
|
|
425
|
-
*
|
|
426
|
-
* # Arguments
|
|
427
|
-
* * `bundle` - The bundle to check
|
|
428
|
-
*
|
|
429
|
-
* # Returns
|
|
430
|
-
* * `bool` - Whether the bundle is full
|
|
431
|
-
*/
|
|
432
|
-
export function isPositionBundleFull(bitmap) {
|
|
433
|
-
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
|
|
434
|
-
const len0 = WASM_VECTOR_LEN;
|
|
435
|
-
const ret = wasm.isPositionBundleFull(ptr0, len0);
|
|
436
|
-
return ret !== 0;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Check whether a position bundle is empty
|
|
441
|
-
*
|
|
442
|
-
* # Arguments
|
|
443
|
-
* * `bundle` - The bundle to check
|
|
444
|
-
*
|
|
445
|
-
* # Returns
|
|
446
|
-
* * `bool` - Whether the bundle is empty
|
|
447
|
-
*/
|
|
448
|
-
export function isPositionBundleEmpty(bitmap) {
|
|
449
|
-
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
|
|
450
|
-
const len0 = WASM_VECTOR_LEN;
|
|
451
|
-
const ret = wasm.isPositionBundleEmpty(ptr0, len0);
|
|
452
|
-
return ret !== 0;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
456
|
export function _POSITION_BUNDLE_SIZE() {
|
|
456
457
|
const ret = wasm._POSITION_BUNDLE_SIZE();
|
|
457
458
|
return ret >>> 0;
|
|
@@ -1372,11 +1373,6 @@ export function __wbg_set_841ac57cff3d672b(arg0, arg1, arg2) {
|
|
|
1372
1373
|
arg0[arg1] = arg2;
|
|
1373
1374
|
};
|
|
1374
1375
|
|
|
1375
|
-
export function __wbindgen_is_array(arg0) {
|
|
1376
|
-
const ret = Array.isArray(arg0);
|
|
1377
|
-
return ret;
|
|
1378
|
-
};
|
|
1379
|
-
|
|
1380
1376
|
export function __wbindgen_in(arg0, arg1) {
|
|
1381
1377
|
const ret = arg0 in arg1;
|
|
1382
1378
|
return ret;
|
|
@@ -1387,6 +1383,11 @@ export function __wbindgen_is_bigint(arg0) {
|
|
|
1387
1383
|
return ret;
|
|
1388
1384
|
};
|
|
1389
1385
|
|
|
1386
|
+
export function __wbindgen_is_array(arg0) {
|
|
1387
|
+
const ret = Array.isArray(arg0);
|
|
1388
|
+
return ret;
|
|
1389
|
+
};
|
|
1390
|
+
|
|
1390
1391
|
export function __wbindgen_init_externref_table() {
|
|
1391
1392
|
const table = wasm.__wbindgen_export_2;
|
|
1392
1393
|
const offset = table.grow(4);
|
|
Binary file
|
package/dist/nodejs/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Expected output:
|
|
|
33
33
|
Position in range? true
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
### Quote Example
|
|
36
|
+
### Adjust Liquidity Quote Example
|
|
37
37
|
The following example demonstrates how to use the `increaseLiquidityQuoteA` function to calculate a quote for increasing liquidity given a token A amount.
|
|
38
38
|
|
|
39
39
|
```tsx
|
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Get the first unoccupied position in a bundle
|
|
5
|
+
*
|
|
6
|
+
* # Arguments
|
|
7
|
+
* * `bundle` - The bundle to check
|
|
8
|
+
*
|
|
9
|
+
* # Returns
|
|
10
|
+
* * `u32` - The first unoccupied position (None if full)
|
|
11
|
+
*/
|
|
12
|
+
export function firstUnoccupiedPositionInBundle(bitmap: Uint8Array): number | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Check whether a position bundle is full
|
|
15
|
+
* A position bundle can contain 256 positions
|
|
16
|
+
*
|
|
17
|
+
* # Arguments
|
|
18
|
+
* * `bundle` - The bundle to check
|
|
19
|
+
*
|
|
20
|
+
* # Returns
|
|
21
|
+
* * `bool` - Whether the bundle is full
|
|
22
|
+
*/
|
|
23
|
+
export function isPositionBundleFull(bitmap: Uint8Array): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Check whether a position bundle is empty
|
|
26
|
+
*
|
|
27
|
+
* # Arguments
|
|
28
|
+
* * `bundle` - The bundle to check
|
|
29
|
+
*
|
|
30
|
+
* # Returns
|
|
31
|
+
* * `bool` - Whether the bundle is empty
|
|
32
|
+
*/
|
|
33
|
+
export function isPositionBundleEmpty(bitmap: Uint8Array): boolean;
|
|
3
34
|
/**
|
|
4
35
|
* Get the first tick index in the tick array that contains the specified tick index.
|
|
5
36
|
*
|
|
@@ -159,37 +190,6 @@ export function isFullRangeOnly(tick_spacing: number): boolean;
|
|
|
159
190
|
* - A u32 integer representing the tick index in the tick array
|
|
160
191
|
*/
|
|
161
192
|
export function getTickIndexInArray(tick_index: number, tick_array_start_index: number, tick_spacing: number): number;
|
|
162
|
-
/**
|
|
163
|
-
* Get the first unoccupied position in a bundle
|
|
164
|
-
*
|
|
165
|
-
* # Arguments
|
|
166
|
-
* * `bundle` - The bundle to check
|
|
167
|
-
*
|
|
168
|
-
* # Returns
|
|
169
|
-
* * `u32` - The first unoccupied position (None if full)
|
|
170
|
-
*/
|
|
171
|
-
export function firstUnoccupiedPositionInBundle(bitmap: Uint8Array): number | undefined;
|
|
172
|
-
/**
|
|
173
|
-
* Check whether a position bundle is full
|
|
174
|
-
* A position bundle can contain 256 positions
|
|
175
|
-
*
|
|
176
|
-
* # Arguments
|
|
177
|
-
* * `bundle` - The bundle to check
|
|
178
|
-
*
|
|
179
|
-
* # Returns
|
|
180
|
-
* * `bool` - Whether the bundle is full
|
|
181
|
-
*/
|
|
182
|
-
export function isPositionBundleFull(bitmap: Uint8Array): boolean;
|
|
183
|
-
/**
|
|
184
|
-
* Check whether a position bundle is empty
|
|
185
|
-
*
|
|
186
|
-
* # Arguments
|
|
187
|
-
* * `bundle` - The bundle to check
|
|
188
|
-
*
|
|
189
|
-
* # Returns
|
|
190
|
-
* * `bool` - Whether the bundle is empty
|
|
191
|
-
*/
|
|
192
|
-
export function isPositionBundleEmpty(bitmap: Uint8Array): boolean;
|
|
193
193
|
export function _POSITION_BUNDLE_SIZE(): number;
|
|
194
194
|
export function _TICK_ARRAY_NOT_EVENLY_SPACED(): number;
|
|
195
195
|
export function _TICK_INDEX_OUT_OF_BOUNDS(): number;
|
|
@@ -610,48 +610,36 @@ 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
|
-
|
|
617
|
-
|
|
618
|
-
export interface PositionFacade {
|
|
619
|
-
liquidity: bigint;
|
|
620
|
-
tickLowerIndex: number;
|
|
621
|
-
tickUpperIndex: number;
|
|
622
|
-
feeGrowthCheckpointA: bigint;
|
|
623
|
-
feeOwedA: bigint;
|
|
624
|
-
feeGrowthCheckpointB: bigint;
|
|
625
|
-
feeOwedB: bigint;
|
|
626
|
-
rewardInfos: PositionRewardInfoFacade[];
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
export type PositionStatus = "priceInRange" | "priceBelowRange" | "priceAboveRange" | "invalid";
|
|
630
|
-
|
|
631
|
-
export interface PositionRatio {
|
|
632
|
-
ratioA: number;
|
|
633
|
-
ratioB: number;
|
|
613
|
+
export interface ExactOutSwapQuote {
|
|
614
|
+
tokenOut: bigint;
|
|
615
|
+
tokenEstIn: bigint;
|
|
616
|
+
tokenMaxIn: bigint;
|
|
617
|
+
tradeFee: bigint;
|
|
634
618
|
}
|
|
635
619
|
|
|
636
|
-
export interface
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
tokenMaxB: bigint;
|
|
620
|
+
export interface ExactInSwapQuote {
|
|
621
|
+
tokenIn: bigint;
|
|
622
|
+
tokenEstOut: bigint;
|
|
623
|
+
tokenMinOut: bigint;
|
|
624
|
+
tradeFee: bigint;
|
|
642
625
|
}
|
|
643
626
|
|
|
644
|
-
export interface
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
tokenEstB: bigint;
|
|
648
|
-
tokenMinA: bigint;
|
|
649
|
-
tokenMinB: bigint;
|
|
627
|
+
export interface WhirlpoolRewardInfoFacade {
|
|
628
|
+
emissionsPerSecondX64: bigint;
|
|
629
|
+
growthGlobalX64: bigint;
|
|
650
630
|
}
|
|
651
631
|
|
|
652
|
-
export interface
|
|
653
|
-
|
|
654
|
-
|
|
632
|
+
export interface WhirlpoolFacade {
|
|
633
|
+
tickSpacing: number;
|
|
634
|
+
feeRate: number;
|
|
635
|
+
protocolFeeRate: number;
|
|
636
|
+
liquidity: bigint;
|
|
637
|
+
sqrtPrice: bigint;
|
|
638
|
+
tickCurrentIndex: number;
|
|
639
|
+
feeGrowthGlobalA: bigint;
|
|
640
|
+
feeGrowthGlobalB: bigint;
|
|
641
|
+
rewardLastUpdatedTimestamp: bigint;
|
|
642
|
+
rewardInfos: WhirlpoolRewardInfoFacade[];
|
|
655
643
|
}
|
|
656
644
|
|
|
657
645
|
export interface TransferFee {
|
|
@@ -686,35 +674,47 @@ export interface CollectRewardsQuote {
|
|
|
686
674
|
rewards: CollectRewardQuote[];
|
|
687
675
|
}
|
|
688
676
|
|
|
689
|
-
export interface
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
tokenMaxIn: bigint;
|
|
693
|
-
tradeFee: bigint;
|
|
677
|
+
export interface PositionRewardInfoFacade {
|
|
678
|
+
growthInsideCheckpoint: bigint;
|
|
679
|
+
amountOwed: bigint;
|
|
694
680
|
}
|
|
695
681
|
|
|
696
|
-
export interface
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
682
|
+
export interface PositionFacade {
|
|
683
|
+
liquidity: bigint;
|
|
684
|
+
tickLowerIndex: number;
|
|
685
|
+
tickUpperIndex: number;
|
|
686
|
+
feeGrowthCheckpointA: bigint;
|
|
687
|
+
feeOwedA: bigint;
|
|
688
|
+
feeGrowthCheckpointB: bigint;
|
|
689
|
+
feeOwedB: bigint;
|
|
690
|
+
rewardInfos: PositionRewardInfoFacade[];
|
|
701
691
|
}
|
|
702
692
|
|
|
703
|
-
export
|
|
704
|
-
|
|
705
|
-
|
|
693
|
+
export type PositionStatus = "priceInRange" | "priceBelowRange" | "priceAboveRange" | "invalid";
|
|
694
|
+
|
|
695
|
+
export interface PositionRatio {
|
|
696
|
+
ratioA: number;
|
|
697
|
+
ratioB: number;
|
|
706
698
|
}
|
|
707
699
|
|
|
708
|
-
export interface
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
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
719
|
}
|
|
720
720
|
|
|
@@ -170,6 +170,62 @@ function handleError(f, args) {
|
|
|
170
170
|
wasm.__wbindgen_exn_store(idx);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
+
|
|
174
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
175
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
176
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
177
|
+
WASM_VECTOR_LEN = arg.length;
|
|
178
|
+
return ptr;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Get the first unoccupied position in a bundle
|
|
182
|
+
*
|
|
183
|
+
* # Arguments
|
|
184
|
+
* * `bundle` - The bundle to check
|
|
185
|
+
*
|
|
186
|
+
* # Returns
|
|
187
|
+
* * `u32` - The first unoccupied position (None if full)
|
|
188
|
+
*/
|
|
189
|
+
module.exports.firstUnoccupiedPositionInBundle = function(bitmap) {
|
|
190
|
+
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
|
|
191
|
+
const len0 = WASM_VECTOR_LEN;
|
|
192
|
+
const ret = wasm.firstUnoccupiedPositionInBundle(ptr0, len0);
|
|
193
|
+
return ret[0] === 0 ? undefined : ret[1] >>> 0;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Check whether a position bundle is full
|
|
198
|
+
* A position bundle can contain 256 positions
|
|
199
|
+
*
|
|
200
|
+
* # Arguments
|
|
201
|
+
* * `bundle` - The bundle to check
|
|
202
|
+
*
|
|
203
|
+
* # Returns
|
|
204
|
+
* * `bool` - Whether the bundle is full
|
|
205
|
+
*/
|
|
206
|
+
module.exports.isPositionBundleFull = function(bitmap) {
|
|
207
|
+
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
|
|
208
|
+
const len0 = WASM_VECTOR_LEN;
|
|
209
|
+
const ret = wasm.isPositionBundleFull(ptr0, len0);
|
|
210
|
+
return ret !== 0;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Check whether a position bundle is empty
|
|
215
|
+
*
|
|
216
|
+
* # Arguments
|
|
217
|
+
* * `bundle` - The bundle to check
|
|
218
|
+
*
|
|
219
|
+
* # Returns
|
|
220
|
+
* * `bool` - Whether the bundle is empty
|
|
221
|
+
*/
|
|
222
|
+
module.exports.isPositionBundleEmpty = function(bitmap) {
|
|
223
|
+
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
|
|
224
|
+
const len0 = WASM_VECTOR_LEN;
|
|
225
|
+
const ret = wasm.isPositionBundleEmpty(ptr0, len0);
|
|
226
|
+
return ret !== 0;
|
|
227
|
+
};
|
|
228
|
+
|
|
173
229
|
/**
|
|
174
230
|
* Get the first tick index in the tick array that contains the specified tick index.
|
|
175
231
|
*
|
|
@@ -393,61 +449,6 @@ module.exports.getTickIndexInArray = function(tick_index, tick_array_start_index
|
|
|
393
449
|
return ret[0] >>> 0;
|
|
394
450
|
};
|
|
395
451
|
|
|
396
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
397
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
398
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
399
|
-
WASM_VECTOR_LEN = arg.length;
|
|
400
|
-
return ptr;
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Get the first unoccupied position in a bundle
|
|
404
|
-
*
|
|
405
|
-
* # Arguments
|
|
406
|
-
* * `bundle` - The bundle to check
|
|
407
|
-
*
|
|
408
|
-
* # Returns
|
|
409
|
-
* * `u32` - The first unoccupied position (None if full)
|
|
410
|
-
*/
|
|
411
|
-
module.exports.firstUnoccupiedPositionInBundle = function(bitmap) {
|
|
412
|
-
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
|
|
413
|
-
const len0 = WASM_VECTOR_LEN;
|
|
414
|
-
const ret = wasm.firstUnoccupiedPositionInBundle(ptr0, len0);
|
|
415
|
-
return ret[0] === 0 ? undefined : ret[1] >>> 0;
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Check whether a position bundle is full
|
|
420
|
-
* A position bundle can contain 256 positions
|
|
421
|
-
*
|
|
422
|
-
* # Arguments
|
|
423
|
-
* * `bundle` - The bundle to check
|
|
424
|
-
*
|
|
425
|
-
* # Returns
|
|
426
|
-
* * `bool` - Whether the bundle is full
|
|
427
|
-
*/
|
|
428
|
-
module.exports.isPositionBundleFull = function(bitmap) {
|
|
429
|
-
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
|
|
430
|
-
const len0 = WASM_VECTOR_LEN;
|
|
431
|
-
const ret = wasm.isPositionBundleFull(ptr0, len0);
|
|
432
|
-
return ret !== 0;
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Check whether a position bundle is empty
|
|
437
|
-
*
|
|
438
|
-
* # Arguments
|
|
439
|
-
* * `bundle` - The bundle to check
|
|
440
|
-
*
|
|
441
|
-
* # Returns
|
|
442
|
-
* * `bool` - Whether the bundle is empty
|
|
443
|
-
*/
|
|
444
|
-
module.exports.isPositionBundleEmpty = function(bitmap) {
|
|
445
|
-
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
|
|
446
|
-
const len0 = WASM_VECTOR_LEN;
|
|
447
|
-
const ret = wasm.isPositionBundleEmpty(ptr0, len0);
|
|
448
|
-
return ret !== 0;
|
|
449
|
-
};
|
|
450
|
-
|
|
451
452
|
module.exports._POSITION_BUNDLE_SIZE = function() {
|
|
452
453
|
const ret = wasm._POSITION_BUNDLE_SIZE();
|
|
453
454
|
return ret >>> 0;
|
|
@@ -1368,11 +1369,6 @@ module.exports.__wbg_set_841ac57cff3d672b = function(arg0, arg1, arg2) {
|
|
|
1368
1369
|
arg0[arg1] = arg2;
|
|
1369
1370
|
};
|
|
1370
1371
|
|
|
1371
|
-
module.exports.__wbindgen_is_array = function(arg0) {
|
|
1372
|
-
const ret = Array.isArray(arg0);
|
|
1373
|
-
return ret;
|
|
1374
|
-
};
|
|
1375
|
-
|
|
1376
1372
|
module.exports.__wbindgen_in = function(arg0, arg1) {
|
|
1377
1373
|
const ret = arg0 in arg1;
|
|
1378
1374
|
return ret;
|
|
@@ -1383,6 +1379,11 @@ module.exports.__wbindgen_is_bigint = function(arg0) {
|
|
|
1383
1379
|
return ret;
|
|
1384
1380
|
};
|
|
1385
1381
|
|
|
1382
|
+
module.exports.__wbindgen_is_array = function(arg0) {
|
|
1383
|
+
const ret = Array.isArray(arg0);
|
|
1384
|
+
return ret;
|
|
1385
|
+
};
|
|
1386
|
+
|
|
1386
1387
|
module.exports.__wbindgen_init_externref_table = function() {
|
|
1387
1388
|
const table = wasm.__wbindgen_export_2;
|
|
1388
1389
|
const offset = table.grow(4);
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orca-so/whirlpools-core",
|
|
3
3
|
"description": "Orca's core typescript package.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"main": "./dist/nodejs/orca_whirlpools_core_js_bindings.js",
|
|
6
6
|
"types": "./dist/nodejs/orca_whirlpools_core_js_bindings.d.ts",
|
|
7
7
|
"browser": "./dist/browser/orca_whirlpools_core_js_bindings.js",
|