@orca-so/whirlpools-core 0.3.0 → 0.3.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 +91 -91
- package/dist/browser/orca_whirlpools_core_js_bindings_bg.js +73 -74
- package/dist/browser/orca_whirlpools_core_js_bindings_bg.wasm +0 -0
- package/dist/nodejs/orca_whirlpools_core_js_bindings.d.ts +91 -91
- package/dist/nodejs/orca_whirlpools_core_js_bindings.js +73 -74
- package/dist/nodejs/orca_whirlpools_core_js_bindings_bg.wasm +0 -0
- package/package.json +1 -1
|
@@ -1,36 +1,5 @@
|
|
|
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;
|
|
34
3
|
/**
|
|
35
4
|
* Get the first tick index in the tick array that contains the specified tick index.
|
|
36
5
|
*
|
|
@@ -190,6 +159,37 @@ export function isFullRangeOnly(tick_spacing: number): boolean;
|
|
|
190
159
|
* - A u32 integer representing the tick index in the tick array
|
|
191
160
|
*/
|
|
192
161
|
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,36 +610,48 @@ 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 PositionRewardInfoFacade {
|
|
614
|
+
growthInsideCheckpoint: bigint;
|
|
615
|
+
amountOwed: bigint;
|
|
618
616
|
}
|
|
619
617
|
|
|
620
|
-
export interface
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
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[];
|
|
625
627
|
}
|
|
626
628
|
|
|
627
|
-
export
|
|
628
|
-
|
|
629
|
-
|
|
629
|
+
export type PositionStatus = "priceInRange" | "priceBelowRange" | "priceAboveRange" | "invalid";
|
|
630
|
+
|
|
631
|
+
export interface PositionRatio {
|
|
632
|
+
ratioA: number;
|
|
633
|
+
ratioB: number;
|
|
630
634
|
}
|
|
631
635
|
|
|
632
|
-
export interface
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
636
|
+
export interface IncreaseLiquidityQuote {
|
|
637
|
+
liquidityDelta: bigint;
|
|
638
|
+
tokenEstA: bigint;
|
|
639
|
+
tokenEstB: bigint;
|
|
640
|
+
tokenMaxA: bigint;
|
|
641
|
+
tokenMaxB: bigint;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
export interface DecreaseLiquidityQuote {
|
|
645
|
+
liquidityDelta: bigint;
|
|
646
|
+
tokenEstA: bigint;
|
|
647
|
+
tokenEstB: bigint;
|
|
648
|
+
tokenMinA: bigint;
|
|
649
|
+
tokenMinB: bigint;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
export interface CollectFeesQuote {
|
|
653
|
+
feeOwedA: bigint;
|
|
654
|
+
feeOwedB: bigint;
|
|
643
655
|
}
|
|
644
656
|
|
|
645
657
|
export interface TransferFee {
|
|
@@ -674,47 +686,35 @@ export interface CollectRewardsQuote {
|
|
|
674
686
|
rewards: CollectRewardQuote[];
|
|
675
687
|
}
|
|
676
688
|
|
|
677
|
-
export interface
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
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[];
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
export type PositionStatus = "priceInRange" | "priceBelowRange" | "priceAboveRange" | "invalid";
|
|
694
|
-
|
|
695
|
-
export interface PositionRatio {
|
|
696
|
-
ratioA: number;
|
|
697
|
-
ratioB: number;
|
|
689
|
+
export interface ExactOutSwapQuote {
|
|
690
|
+
tokenOut: bigint;
|
|
691
|
+
tokenEstIn: bigint;
|
|
692
|
+
tokenMaxIn: bigint;
|
|
693
|
+
tradeFee: bigint;
|
|
698
694
|
}
|
|
699
695
|
|
|
700
|
-
export interface
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
tokenMaxB: bigint;
|
|
696
|
+
export interface ExactInSwapQuote {
|
|
697
|
+
tokenIn: bigint;
|
|
698
|
+
tokenEstOut: bigint;
|
|
699
|
+
tokenMinOut: bigint;
|
|
700
|
+
tradeFee: bigint;
|
|
706
701
|
}
|
|
707
702
|
|
|
708
|
-
export interface
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
tokenEstB: bigint;
|
|
712
|
-
tokenMinA: bigint;
|
|
713
|
-
tokenMinB: bigint;
|
|
703
|
+
export interface WhirlpoolRewardInfoFacade {
|
|
704
|
+
emissionsPerSecondX64: bigint;
|
|
705
|
+
growthGlobalX64: bigint;
|
|
714
706
|
}
|
|
715
707
|
|
|
716
|
-
export interface
|
|
717
|
-
|
|
718
|
-
|
|
708
|
+
export interface WhirlpoolFacade {
|
|
709
|
+
tickSpacing: number;
|
|
710
|
+
feeRate: number;
|
|
711
|
+
protocolFeeRate: number;
|
|
712
|
+
liquidity: bigint;
|
|
713
|
+
sqrtPrice: bigint;
|
|
714
|
+
tickCurrentIndex: number;
|
|
715
|
+
feeGrowthGlobalA: bigint;
|
|
716
|
+
feeGrowthGlobalB: bigint;
|
|
717
|
+
rewardLastUpdatedTimestamp: bigint;
|
|
718
|
+
rewardInfos: WhirlpoolRewardInfoFacade[];
|
|
719
719
|
}
|
|
720
720
|
|
|
@@ -174,62 +174,6 @@ 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
|
-
|
|
233
177
|
/**
|
|
234
178
|
* Get the first tick index in the tick array that contains the specified tick index.
|
|
235
179
|
*
|
|
@@ -453,6 +397,61 @@ export function getTickIndexInArray(tick_index, tick_array_start_index, tick_spa
|
|
|
453
397
|
return ret[0] >>> 0;
|
|
454
398
|
}
|
|
455
399
|
|
|
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
|
+
|
|
456
455
|
export function _POSITION_BUNDLE_SIZE() {
|
|
457
456
|
const ret = wasm._POSITION_BUNDLE_SIZE();
|
|
458
457
|
return ret >>> 0;
|
|
@@ -1336,9 +1335,12 @@ export function __wbindgen_boolean_get(arg0) {
|
|
|
1336
1335
|
return ret;
|
|
1337
1336
|
};
|
|
1338
1337
|
|
|
1339
|
-
export function
|
|
1340
|
-
const ret =
|
|
1341
|
-
|
|
1338
|
+
export function __wbg_String_88810dfeb4021902(arg0, arg1) {
|
|
1339
|
+
const ret = String(arg1);
|
|
1340
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1341
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1342
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1343
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1342
1344
|
};
|
|
1343
1345
|
|
|
1344
1346
|
export function __wbindgen_error_new(arg0, arg1) {
|
|
@@ -1351,26 +1353,28 @@ export function __wbindgen_bigint_from_u128(arg0, arg1) {
|
|
|
1351
1353
|
return ret;
|
|
1352
1354
|
};
|
|
1353
1355
|
|
|
1354
|
-
export function
|
|
1356
|
+
export function __wbg_getwithrefkey_5e6d9547403deab8(arg0, arg1) {
|
|
1355
1357
|
const ret = arg0[arg1];
|
|
1356
1358
|
return ret;
|
|
1357
1359
|
};
|
|
1358
1360
|
|
|
1359
|
-
export function
|
|
1360
|
-
|
|
1361
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1362
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1363
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1364
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1361
|
+
export function __wbg_set_841ac57cff3d672b(arg0, arg1, arg2) {
|
|
1362
|
+
arg0[arg1] = arg2;
|
|
1365
1363
|
};
|
|
1366
1364
|
|
|
1367
|
-
export function
|
|
1365
|
+
export function __wbindgen_as_number(arg0) {
|
|
1366
|
+
const ret = +arg0;
|
|
1367
|
+
return ret;
|
|
1368
|
+
};
|
|
1369
|
+
|
|
1370
|
+
export function __wbg_getwithrefkey_edc2c8960f0f1191(arg0, arg1) {
|
|
1368
1371
|
const ret = arg0[arg1];
|
|
1369
1372
|
return ret;
|
|
1370
1373
|
};
|
|
1371
1374
|
|
|
1372
|
-
export function
|
|
1373
|
-
|
|
1375
|
+
export function __wbindgen_is_array(arg0) {
|
|
1376
|
+
const ret = Array.isArray(arg0);
|
|
1377
|
+
return ret;
|
|
1374
1378
|
};
|
|
1375
1379
|
|
|
1376
1380
|
export function __wbindgen_in(arg0, arg1) {
|
|
@@ -1383,11 +1387,6 @@ export function __wbindgen_is_bigint(arg0) {
|
|
|
1383
1387
|
return ret;
|
|
1384
1388
|
};
|
|
1385
1389
|
|
|
1386
|
-
export function __wbindgen_is_array(arg0) {
|
|
1387
|
-
const ret = Array.isArray(arg0);
|
|
1388
|
-
return ret;
|
|
1389
|
-
};
|
|
1390
|
-
|
|
1391
1390
|
export function __wbindgen_init_externref_table() {
|
|
1392
1391
|
const table = wasm.__wbindgen_export_2;
|
|
1393
1392
|
const offset = table.grow(4);
|
|
Binary file
|
|
@@ -1,36 +1,5 @@
|
|
|
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;
|
|
34
3
|
/**
|
|
35
4
|
* Get the first tick index in the tick array that contains the specified tick index.
|
|
36
5
|
*
|
|
@@ -190,6 +159,37 @@ export function isFullRangeOnly(tick_spacing: number): boolean;
|
|
|
190
159
|
* - A u32 integer representing the tick index in the tick array
|
|
191
160
|
*/
|
|
192
161
|
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,36 +610,48 @@ 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 PositionRewardInfoFacade {
|
|
614
|
+
growthInsideCheckpoint: bigint;
|
|
615
|
+
amountOwed: bigint;
|
|
618
616
|
}
|
|
619
617
|
|
|
620
|
-
export interface
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
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[];
|
|
625
627
|
}
|
|
626
628
|
|
|
627
|
-
export
|
|
628
|
-
|
|
629
|
-
|
|
629
|
+
export type PositionStatus = "priceInRange" | "priceBelowRange" | "priceAboveRange" | "invalid";
|
|
630
|
+
|
|
631
|
+
export interface PositionRatio {
|
|
632
|
+
ratioA: number;
|
|
633
|
+
ratioB: number;
|
|
630
634
|
}
|
|
631
635
|
|
|
632
|
-
export interface
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
636
|
+
export interface IncreaseLiquidityQuote {
|
|
637
|
+
liquidityDelta: bigint;
|
|
638
|
+
tokenEstA: bigint;
|
|
639
|
+
tokenEstB: bigint;
|
|
640
|
+
tokenMaxA: bigint;
|
|
641
|
+
tokenMaxB: bigint;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
export interface DecreaseLiquidityQuote {
|
|
645
|
+
liquidityDelta: bigint;
|
|
646
|
+
tokenEstA: bigint;
|
|
647
|
+
tokenEstB: bigint;
|
|
648
|
+
tokenMinA: bigint;
|
|
649
|
+
tokenMinB: bigint;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
export interface CollectFeesQuote {
|
|
653
|
+
feeOwedA: bigint;
|
|
654
|
+
feeOwedB: bigint;
|
|
643
655
|
}
|
|
644
656
|
|
|
645
657
|
export interface TransferFee {
|
|
@@ -674,47 +686,35 @@ export interface CollectRewardsQuote {
|
|
|
674
686
|
rewards: CollectRewardQuote[];
|
|
675
687
|
}
|
|
676
688
|
|
|
677
|
-
export interface
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
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[];
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
export type PositionStatus = "priceInRange" | "priceBelowRange" | "priceAboveRange" | "invalid";
|
|
694
|
-
|
|
695
|
-
export interface PositionRatio {
|
|
696
|
-
ratioA: number;
|
|
697
|
-
ratioB: number;
|
|
689
|
+
export interface ExactOutSwapQuote {
|
|
690
|
+
tokenOut: bigint;
|
|
691
|
+
tokenEstIn: bigint;
|
|
692
|
+
tokenMaxIn: bigint;
|
|
693
|
+
tradeFee: bigint;
|
|
698
694
|
}
|
|
699
695
|
|
|
700
|
-
export interface
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
tokenMaxB: bigint;
|
|
696
|
+
export interface ExactInSwapQuote {
|
|
697
|
+
tokenIn: bigint;
|
|
698
|
+
tokenEstOut: bigint;
|
|
699
|
+
tokenMinOut: bigint;
|
|
700
|
+
tradeFee: bigint;
|
|
706
701
|
}
|
|
707
702
|
|
|
708
|
-
export interface
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
tokenEstB: bigint;
|
|
712
|
-
tokenMinA: bigint;
|
|
713
|
-
tokenMinB: bigint;
|
|
703
|
+
export interface WhirlpoolRewardInfoFacade {
|
|
704
|
+
emissionsPerSecondX64: bigint;
|
|
705
|
+
growthGlobalX64: bigint;
|
|
714
706
|
}
|
|
715
707
|
|
|
716
|
-
export interface
|
|
717
|
-
|
|
718
|
-
|
|
708
|
+
export interface WhirlpoolFacade {
|
|
709
|
+
tickSpacing: number;
|
|
710
|
+
feeRate: number;
|
|
711
|
+
protocolFeeRate: number;
|
|
712
|
+
liquidity: bigint;
|
|
713
|
+
sqrtPrice: bigint;
|
|
714
|
+
tickCurrentIndex: number;
|
|
715
|
+
feeGrowthGlobalA: bigint;
|
|
716
|
+
feeGrowthGlobalB: bigint;
|
|
717
|
+
rewardLastUpdatedTimestamp: bigint;
|
|
718
|
+
rewardInfos: WhirlpoolRewardInfoFacade[];
|
|
719
719
|
}
|
|
720
720
|
|
|
@@ -170,62 +170,6 @@ 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
|
-
|
|
229
173
|
/**
|
|
230
174
|
* Get the first tick index in the tick array that contains the specified tick index.
|
|
231
175
|
*
|
|
@@ -449,6 +393,61 @@ module.exports.getTickIndexInArray = function(tick_index, tick_array_start_index
|
|
|
449
393
|
return ret[0] >>> 0;
|
|
450
394
|
};
|
|
451
395
|
|
|
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
|
+
|
|
452
451
|
module.exports._POSITION_BUNDLE_SIZE = function() {
|
|
453
452
|
const ret = wasm._POSITION_BUNDLE_SIZE();
|
|
454
453
|
return ret >>> 0;
|
|
@@ -1332,9 +1331,12 @@ module.exports.__wbindgen_boolean_get = function(arg0) {
|
|
|
1332
1331
|
return ret;
|
|
1333
1332
|
};
|
|
1334
1333
|
|
|
1335
|
-
module.exports.
|
|
1336
|
-
const ret =
|
|
1337
|
-
|
|
1334
|
+
module.exports.__wbg_String_88810dfeb4021902 = function(arg0, arg1) {
|
|
1335
|
+
const ret = String(arg1);
|
|
1336
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1337
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1338
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1339
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1338
1340
|
};
|
|
1339
1341
|
|
|
1340
1342
|
module.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
@@ -1347,26 +1349,28 @@ module.exports.__wbindgen_bigint_from_u128 = function(arg0, arg1) {
|
|
|
1347
1349
|
return ret;
|
|
1348
1350
|
};
|
|
1349
1351
|
|
|
1350
|
-
module.exports.
|
|
1352
|
+
module.exports.__wbg_getwithrefkey_5e6d9547403deab8 = function(arg0, arg1) {
|
|
1351
1353
|
const ret = arg0[arg1];
|
|
1352
1354
|
return ret;
|
|
1353
1355
|
};
|
|
1354
1356
|
|
|
1355
|
-
module.exports.
|
|
1356
|
-
|
|
1357
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1358
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1359
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1360
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1357
|
+
module.exports.__wbg_set_841ac57cff3d672b = function(arg0, arg1, arg2) {
|
|
1358
|
+
arg0[arg1] = arg2;
|
|
1361
1359
|
};
|
|
1362
1360
|
|
|
1363
|
-
module.exports.
|
|
1361
|
+
module.exports.__wbindgen_as_number = function(arg0) {
|
|
1362
|
+
const ret = +arg0;
|
|
1363
|
+
return ret;
|
|
1364
|
+
};
|
|
1365
|
+
|
|
1366
|
+
module.exports.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
|
|
1364
1367
|
const ret = arg0[arg1];
|
|
1365
1368
|
return ret;
|
|
1366
1369
|
};
|
|
1367
1370
|
|
|
1368
|
-
module.exports.
|
|
1369
|
-
|
|
1371
|
+
module.exports.__wbindgen_is_array = function(arg0) {
|
|
1372
|
+
const ret = Array.isArray(arg0);
|
|
1373
|
+
return ret;
|
|
1370
1374
|
};
|
|
1371
1375
|
|
|
1372
1376
|
module.exports.__wbindgen_in = function(arg0, arg1) {
|
|
@@ -1379,11 +1383,6 @@ module.exports.__wbindgen_is_bigint = function(arg0) {
|
|
|
1379
1383
|
return ret;
|
|
1380
1384
|
};
|
|
1381
1385
|
|
|
1382
|
-
module.exports.__wbindgen_is_array = function(arg0) {
|
|
1383
|
-
const ret = Array.isArray(arg0);
|
|
1384
|
-
return ret;
|
|
1385
|
-
};
|
|
1386
|
-
|
|
1387
1386
|
module.exports.__wbindgen_init_externref_table = function() {
|
|
1388
1387
|
const table = wasm.__wbindgen_export_2;
|
|
1389
1388
|
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.3.
|
|
4
|
+
"version": "0.3.1",
|
|
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",
|