@crypticdot/defituna-core 3.4.4 → 3.4.6
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/defituna_core_js_bindings.d.ts +342 -313
- package/dist/browser/defituna_core_js_bindings_bg.js +524 -449
- package/dist/browser/defituna_core_js_bindings_bg.wasm +0 -0
- package/dist/browser/defituna_core_js_bindings_bg.wasm.d.ts +38 -33
- package/dist/nodejs/defituna_core_js_bindings.d.ts +342 -313
- package/dist/nodejs/defituna_core_js_bindings.js +524 -449
- package/dist/nodejs/defituna_core_js_bindings_bg.wasm +0 -0
- package/dist/nodejs/defituna_core_js_bindings_bg.wasm.d.ts +38 -33
- package/package.json +2 -2
|
@@ -1,5 +1,147 @@
|
|
|
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
|
+
/**
|
|
35
|
+
* Check if a position is in range.
|
|
36
|
+
* When a position is in range it is earning fees and rewards
|
|
37
|
+
*
|
|
38
|
+
* # Parameters
|
|
39
|
+
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
40
|
+
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
41
|
+
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
42
|
+
*
|
|
43
|
+
* # Returns
|
|
44
|
+
* - A boolean value indicating if the position is in range
|
|
45
|
+
*/
|
|
46
|
+
export function isPositionInRange(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Calculate the status of a position
|
|
49
|
+
* The status can be one of three values:
|
|
50
|
+
* - InRange: The position is in range
|
|
51
|
+
* - BelowRange: The position is below the range
|
|
52
|
+
* - AboveRange: The position is above the range
|
|
53
|
+
*
|
|
54
|
+
* # Parameters
|
|
55
|
+
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
56
|
+
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
57
|
+
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
58
|
+
*
|
|
59
|
+
* # Returns
|
|
60
|
+
* - A PositionStatus enum value indicating the status of the position
|
|
61
|
+
*/
|
|
62
|
+
export function positionStatus(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): PositionStatus;
|
|
63
|
+
/**
|
|
64
|
+
* Calculate the token_a / token_b ratio of a (ficticious) position
|
|
65
|
+
*
|
|
66
|
+
* # Parameters
|
|
67
|
+
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
68
|
+
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
69
|
+
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
70
|
+
*
|
|
71
|
+
* # Returns
|
|
72
|
+
* - A PositionRatio struct containing the ratio of token_a and token_b
|
|
73
|
+
*/
|
|
74
|
+
export function positionRatioX64(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): PositionRatio;
|
|
75
|
+
/**
|
|
76
|
+
* Convert a price into a sqrt priceX64
|
|
77
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
78
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
79
|
+
*
|
|
80
|
+
* # Parameters
|
|
81
|
+
* * `price` - The price to convert
|
|
82
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
83
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
84
|
+
*
|
|
85
|
+
* # Returns
|
|
86
|
+
* * `u128` - The sqrt priceX64
|
|
87
|
+
*/
|
|
88
|
+
export function priceToSqrtPrice(price: number, decimals_a: number, decimals_b: number): bigint;
|
|
89
|
+
/**
|
|
90
|
+
* Convert a sqrt priceX64 into a tick index
|
|
91
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
92
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
93
|
+
*
|
|
94
|
+
* # Parameters
|
|
95
|
+
* * `sqrt_price` - The sqrt priceX64 to convert
|
|
96
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
97
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
98
|
+
*
|
|
99
|
+
* # Returns
|
|
100
|
+
* * `f64` - The decimal price
|
|
101
|
+
*/
|
|
102
|
+
export function sqrtPriceToPrice(sqrt_price: bigint, decimals_a: number, decimals_b: number): number;
|
|
103
|
+
/**
|
|
104
|
+
* Invert a price
|
|
105
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
106
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
107
|
+
*
|
|
108
|
+
* # Parameters
|
|
109
|
+
* * `price` - The price to invert
|
|
110
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
111
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
112
|
+
*
|
|
113
|
+
* # Returns
|
|
114
|
+
* * `f64` - The inverted price
|
|
115
|
+
*/
|
|
116
|
+
export function invertPrice(price: number, decimals_a: number, decimals_b: number): number;
|
|
117
|
+
/**
|
|
118
|
+
* Convert a tick index into a price
|
|
119
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
120
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
121
|
+
*
|
|
122
|
+
* # Parameters
|
|
123
|
+
* * `tick_index` - The tick index to convert
|
|
124
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
125
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
126
|
+
*
|
|
127
|
+
* # Returns
|
|
128
|
+
* * `f64` - The decimal price
|
|
129
|
+
*/
|
|
130
|
+
export function tickIndexToPrice(tick_index: number, decimals_a: number, decimals_b: number): number;
|
|
131
|
+
/**
|
|
132
|
+
* Convert a price into a tick index
|
|
133
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
134
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
135
|
+
*
|
|
136
|
+
* # Parameters
|
|
137
|
+
* * `price` - The price to convert
|
|
138
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
139
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
140
|
+
*
|
|
141
|
+
* # Returns
|
|
142
|
+
* * `i32` - The tick index
|
|
143
|
+
*/
|
|
144
|
+
export function priceToTickIndex(price: number, decimals_a: number, decimals_b: number): number;
|
|
3
145
|
export function _POSITION_BUNDLE_SIZE(): number;
|
|
4
146
|
export function _FEE_RATE_MUL_VALUE(): number;
|
|
5
147
|
export function _MAX_PROTOCOL_FEE_RATE(): number;
|
|
@@ -167,6 +309,12 @@ export function isFullRangeOnly(tick_spacing: number): boolean;
|
|
|
167
309
|
* - A u32 integer representing the tick index in the tick array
|
|
168
310
|
*/
|
|
169
311
|
export function getTickIndexInArray(tick_index: number, tick_array_start_index: number, tick_spacing: number): number;
|
|
312
|
+
export function tryGetLiquidityFromAmountA(amount_a: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint): bigint;
|
|
313
|
+
export function tryGetAmountAFromLiquidity(liquidity: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint, round_up: boolean): bigint;
|
|
314
|
+
export function tryGetLiquidityFromAmountB(amount_b: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint): bigint;
|
|
315
|
+
export function tryGetAmountBFromLiquidity(liquidity: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint, round_up: boolean): bigint;
|
|
316
|
+
export function tryGetAmountsFromLiquidity(liquidity: bigint, sqrt_price: bigint, tick_lower_index: number, tick_upper_index: number, round_up: boolean): TokenPair;
|
|
317
|
+
export function tryGetLiquidityFromAmounts(sqrt_price: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint, amount_a: bigint, amount_b: bigint): bigint;
|
|
170
318
|
/**
|
|
171
319
|
* Calculate the quote for decreasing liquidity
|
|
172
320
|
*
|
|
@@ -263,28 +411,6 @@ export function increaseLiquidityQuoteA(token_amount_a: bigint, slippage_toleran
|
|
|
263
411
|
* - An IncreaseLiquidityQuote struct containing the estimated token amounts
|
|
264
412
|
*/
|
|
265
413
|
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;
|
|
266
|
-
export function tryGetLiquidityFromA(token_delta_a: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint): bigint;
|
|
267
|
-
export function tryGetTokenAFromLiquidity(liquidity_delta: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint, round_up: boolean): bigint;
|
|
268
|
-
export function tryGetLiquidityFromB(token_delta_b: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint): bigint;
|
|
269
|
-
export function tryGetTokenBFromLiquidity(liquidity_delta: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint, round_up: boolean): bigint;
|
|
270
|
-
export function tryGetAmountsFromLiquidity(liquidity_delta: bigint, current_sqrt_price: bigint, tick_lower_index: number, tick_upper_index: number, round_up: boolean): TokenPair;
|
|
271
|
-
export function tryGetLiquidityFromAmounts(sqrt_price: bigint, sqrt_price_a_x64: bigint, sqrt_price_b_x64: bigint, amount_a: bigint, amount_b: bigint): bigint;
|
|
272
|
-
/**
|
|
273
|
-
* Calculate fees owed for a position
|
|
274
|
-
*
|
|
275
|
-
* # Paramters
|
|
276
|
-
* - `fusion_pool`: The fusion_pool state
|
|
277
|
-
* - `position`: The position state
|
|
278
|
-
* - `tick_lower`: The lower tick state
|
|
279
|
-
* - `tick_upper`: The upper tick state
|
|
280
|
-
* - `transfer_fee_a`: The transfer fee for token A
|
|
281
|
-
* - `transfer_fee_b`: The transfer fee for token B
|
|
282
|
-
*
|
|
283
|
-
* # Returns
|
|
284
|
-
* - `CollectFeesQuote`: The fees owed for token A and token B
|
|
285
|
-
*/
|
|
286
|
-
export function collectFeesQuote(fusion_pool: FusionPoolFacade, position: PositionFacade, tick_lower: TickFacade, tick_upper: TickFacade, transfer_fee_a?: TransferFee | null, transfer_fee_b?: TransferFee | null): CollectFeesQuote;
|
|
287
|
-
export function limitOrderFee(fusion_pool: FusionPoolFacade): number;
|
|
288
414
|
/**
|
|
289
415
|
* Calculate the amount A delta between two sqrt_prices
|
|
290
416
|
*
|
|
@@ -442,238 +568,95 @@ export function limitOrderQuoteByOutputToken(amount_out: bigint, a_to_b_order: b
|
|
|
442
568
|
export function limitOrderRewardByOutputToken(amount_out: bigint, fee_rate: number, protocol_fee_rate: number): bigint;
|
|
443
569
|
export function decreaseLimitOrderQuote(fusion_pool: FusionPoolFacade, limit_order: LimitOrderFacade, tick: TickFacade, amount: bigint, transfer_fee_a?: TransferFee | null, transfer_fee_b?: TransferFee | null): LimitOrderDecreaseQuote;
|
|
444
570
|
/**
|
|
445
|
-
*
|
|
571
|
+
* Calculate fees owed for a position
|
|
446
572
|
*
|
|
447
|
-
* #
|
|
448
|
-
*
|
|
573
|
+
* # Paramters
|
|
574
|
+
* - `fusion_pool`: The fusion_pool state
|
|
575
|
+
* - `position`: The position state
|
|
576
|
+
* - `tick_lower`: The lower tick state
|
|
577
|
+
* - `tick_upper`: The upper tick state
|
|
578
|
+
* - `transfer_fee_a`: The transfer fee for token A
|
|
579
|
+
* - `transfer_fee_b`: The transfer fee for token B
|
|
449
580
|
*
|
|
450
581
|
* # Returns
|
|
451
|
-
*
|
|
582
|
+
* - `CollectFeesQuote`: The fees owed for token A and token B
|
|
452
583
|
*/
|
|
453
|
-
export function
|
|
584
|
+
export function collectFeesQuote(fusion_pool: FusionPoolFacade, position: PositionFacade, tick_lower: TickFacade, tick_upper: TickFacade, transfer_fee_a?: TransferFee | null, transfer_fee_b?: TransferFee | null): CollectFeesQuote;
|
|
585
|
+
export function limitOrderFee(fusion_pool: FusionPoolFacade): number;
|
|
586
|
+
export function _TICK_ARRAY_NOT_EVENLY_SPACED(): string;
|
|
587
|
+
export function _TICK_INDEX_OUT_OF_BOUNDS(): string;
|
|
588
|
+
export function _INVALID_TICK_INDEX(): string;
|
|
589
|
+
export function _ARITHMETIC_OVERFLOW(): string;
|
|
590
|
+
export function _AMOUNT_EXCEEDS_MAX_U64(): string;
|
|
591
|
+
export function _AMOUNT_EXCEEDS_LIMIT_ORDER_INPUT_AMOUNT(): string;
|
|
592
|
+
export function _SQRT_PRICE_OUT_OF_BOUNDS(): string;
|
|
593
|
+
export function _TICK_SEQUENCE_EMPTY(): string;
|
|
594
|
+
export function _SQRT_PRICE_LIMIT_OUT_OF_BOUNDS(): string;
|
|
595
|
+
export function _INVALID_SQRT_PRICE_LIMIT_DIRECTION(): string;
|
|
596
|
+
export function _INVALID_RANGE_BOUNDS(): string;
|
|
597
|
+
export function _ZERO_TRADABLE_AMOUNT(): string;
|
|
598
|
+
export function _INVALID_TIMESTAMP(): string;
|
|
599
|
+
export function _INVALID_TRANSFER_FEE(): string;
|
|
600
|
+
export function _INVALID_SLIPPAGE_TOLERANCE(): string;
|
|
601
|
+
export function _TICK_INDEX_NOT_IN_ARRAY(): string;
|
|
602
|
+
export function _INVALID_TICK_ARRAY_SEQUENCE(): string;
|
|
603
|
+
export function _LIMIT_ORDER_AND_POOL_ARE_OUT_OF_SYNC(): string;
|
|
454
604
|
/**
|
|
455
|
-
*
|
|
456
|
-
* A position bundle can contain 256 positions
|
|
605
|
+
* Computes the exact input or output amount for a swap transaction.
|
|
457
606
|
*
|
|
458
607
|
* # Arguments
|
|
459
|
-
*
|
|
608
|
+
* - `token_in`: The input token amount.
|
|
609
|
+
* - `specified_token_a`: If `true`, the input token is token A. Otherwise, it is token B.
|
|
610
|
+
* - `slippage_tolerance`: The slippage tolerance in basis points.
|
|
611
|
+
* - `fusion_pool`: The fusion_pool state.
|
|
612
|
+
* - `tick_arrays`: The tick arrays needed for the swap.
|
|
613
|
+
* - `transfer_fee_a`: The transfer fee for token A.
|
|
614
|
+
* - `transfer_fee_b`: The transfer fee for token B.
|
|
460
615
|
*
|
|
461
616
|
* # Returns
|
|
462
|
-
*
|
|
617
|
+
* The exact input or output amount for the swap transaction.
|
|
463
618
|
*/
|
|
464
|
-
export function
|
|
619
|
+
export function swapQuoteByInputToken(token_in: bigint, specified_token_a: boolean, slippage_tolerance_bps: number, fusion_pool: FusionPoolFacade, tick_arrays: TickArrayFacade[], transfer_fee_a?: TransferFee | null, transfer_fee_b?: TransferFee | null): ExactInSwapQuote;
|
|
465
620
|
/**
|
|
466
|
-
*
|
|
621
|
+
* Computes the exact input or output amount for a swap transaction.
|
|
467
622
|
*
|
|
468
623
|
* # Arguments
|
|
469
|
-
*
|
|
624
|
+
* - `token_out`: The output token amount.
|
|
625
|
+
* - `specified_token_a`: If `true`, the output token is token A. Otherwise, it is token B.
|
|
626
|
+
* - `slippage_tolerance`: The slippage tolerance in basis points.
|
|
627
|
+
* - `fusion_pool`: The fusion_pool state.
|
|
628
|
+
* - `tick_arrays`: The tick arrays needed for the swap.
|
|
629
|
+
* - `transfer_fee_a`: The transfer fee for token A.
|
|
630
|
+
* - `transfer_fee_b`: The transfer fee for token B.
|
|
470
631
|
*
|
|
471
632
|
* # Returns
|
|
472
|
-
*
|
|
633
|
+
* The exact input or output amount for the swap transaction.
|
|
473
634
|
*/
|
|
474
|
-
export function
|
|
635
|
+
export function swapQuoteByOutputToken(token_out: bigint, specified_token_a: boolean, slippage_tolerance_bps: number, fusion_pool: FusionPoolFacade, tick_arrays: TickArrayFacade[], transfer_fee_a?: TransferFee | null, transfer_fee_b?: TransferFee | null): ExactOutSwapQuote;
|
|
636
|
+
export function _HUNDRED_PERCENT(): number;
|
|
637
|
+
export function _COMPUTED_AMOUNT(): bigint;
|
|
475
638
|
/**
|
|
476
|
-
*
|
|
477
|
-
* When a position is in range it is earning fees and rewards
|
|
639
|
+
* Spot position increase quote
|
|
478
640
|
*
|
|
479
641
|
* # Parameters
|
|
480
|
-
* - `
|
|
481
|
-
* - `
|
|
482
|
-
* - `
|
|
642
|
+
* - `increase_amount`: Position total size in the collateral_token.
|
|
643
|
+
* - `collateral_token`: Collateral token.
|
|
644
|
+
* - `position_token`: Token of the position.
|
|
645
|
+
* - `leverage`: Leverage (1.0 or higher).
|
|
646
|
+
* - `slippage_tolerance_bps`: An optional slippage tolerance in basis points. Defaults to the global slippage tolerance if not provided.
|
|
647
|
+
* - `protocol_fee_rate`: Protocol fee rate from a market account represented as hundredths of a basis point (0.01% = 100).
|
|
648
|
+
* - `protocol_fee_rate_on_collateral`: Protocol fee rate from a market account represented as hundredths of a basis point (0.01% = 100).
|
|
649
|
+
* - `mint_a`: Token A mint address
|
|
650
|
+
* - `mint_b`: Token B mint address
|
|
651
|
+
* - `fusion_pool`: Fusion pool.
|
|
652
|
+
* - `tick_arrays`: Optional five tick arrays around the current pool price. If not provided, the quote will be calculated using the Jupiter Aggregator.
|
|
483
653
|
*
|
|
484
654
|
* # Returns
|
|
485
|
-
* -
|
|
655
|
+
* - `IncreaseSpotPositionQuoteResult`: quote result
|
|
486
656
|
*/
|
|
487
|
-
export function
|
|
657
|
+
export function getIncreaseSpotPositionQuote(increase_amount: bigint, collateral_token: number, position_token: number, leverage: number, slippage_tolerance_bps: number | null | undefined, protocol_fee_rate: number, protocol_fee_rate_on_collateral: number, mint_a: Pubkey, mint_b: Pubkey, fusion_pool: FusionPoolFacade, tick_arrays?: TickArrayFacade[] | null): Promise<any>;
|
|
488
658
|
/**
|
|
489
|
-
*
|
|
490
|
-
* The status can be one of three values:
|
|
491
|
-
* - InRange: The position is in range
|
|
492
|
-
* - BelowRange: The position is below the range
|
|
493
|
-
* - AboveRange: The position is above the range
|
|
494
|
-
*
|
|
495
|
-
* # Parameters
|
|
496
|
-
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
497
|
-
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
498
|
-
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
499
|
-
*
|
|
500
|
-
* # Returns
|
|
501
|
-
* - A PositionStatus enum value indicating the status of the position
|
|
502
|
-
*/
|
|
503
|
-
export function positionStatus(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): PositionStatus;
|
|
504
|
-
/**
|
|
505
|
-
* Calculate the token_a / token_b ratio of a (ficticious) position
|
|
506
|
-
*
|
|
507
|
-
* # Parameters
|
|
508
|
-
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
509
|
-
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
510
|
-
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
511
|
-
*
|
|
512
|
-
* # Returns
|
|
513
|
-
* - A PositionRatio struct containing the ratio of token_a and token_b
|
|
514
|
-
*/
|
|
515
|
-
export function positionRatioX64(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): PositionRatio;
|
|
516
|
-
/**
|
|
517
|
-
* Convert a price into a sqrt priceX64
|
|
518
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
519
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
520
|
-
*
|
|
521
|
-
* # Parameters
|
|
522
|
-
* * `price` - The price to convert
|
|
523
|
-
* * `decimals_a` - The number of decimals of the base token
|
|
524
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
525
|
-
*
|
|
526
|
-
* # Returns
|
|
527
|
-
* * `u128` - The sqrt priceX64
|
|
528
|
-
*/
|
|
529
|
-
export function priceToSqrtPrice(price: number, decimals_a: number, decimals_b: number): bigint;
|
|
530
|
-
/**
|
|
531
|
-
* Convert a sqrt priceX64 into a tick index
|
|
532
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
533
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
534
|
-
*
|
|
535
|
-
* # Parameters
|
|
536
|
-
* * `sqrt_price` - The sqrt priceX64 to convert
|
|
537
|
-
* * `decimals_a` - The number of decimals of the base token
|
|
538
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
539
|
-
*
|
|
540
|
-
* # Returns
|
|
541
|
-
* * `f64` - The decimal price
|
|
542
|
-
*/
|
|
543
|
-
export function sqrtPriceToPrice(sqrt_price: bigint, decimals_a: number, decimals_b: number): number;
|
|
544
|
-
/**
|
|
545
|
-
* Invert a price
|
|
546
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
547
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
548
|
-
*
|
|
549
|
-
* # Parameters
|
|
550
|
-
* * `price` - The price to invert
|
|
551
|
-
* * `decimals_a` - The number of decimals of the base token
|
|
552
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
553
|
-
*
|
|
554
|
-
* # Returns
|
|
555
|
-
* * `f64` - The inverted price
|
|
556
|
-
*/
|
|
557
|
-
export function invertPrice(price: number, decimals_a: number, decimals_b: number): number;
|
|
558
|
-
/**
|
|
559
|
-
* Convert a tick index into a price
|
|
560
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
561
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
562
|
-
*
|
|
563
|
-
* # Parameters
|
|
564
|
-
* * `tick_index` - The tick index to convert
|
|
565
|
-
* * `decimals_a` - The number of decimals of the base token
|
|
566
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
567
|
-
*
|
|
568
|
-
* # Returns
|
|
569
|
-
* * `f64` - The decimal price
|
|
570
|
-
*/
|
|
571
|
-
export function tickIndexToPrice(tick_index: number, decimals_a: number, decimals_b: number): number;
|
|
572
|
-
/**
|
|
573
|
-
* Convert a price into a tick index
|
|
574
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
575
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
576
|
-
*
|
|
577
|
-
* # Parameters
|
|
578
|
-
* * `price` - The price to convert
|
|
579
|
-
* * `decimals_a` - The number of decimals of the base token
|
|
580
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
581
|
-
*
|
|
582
|
-
* # Returns
|
|
583
|
-
* * `i32` - The tick index
|
|
584
|
-
*/
|
|
585
|
-
export function priceToTickIndex(price: number, decimals_a: number, decimals_b: number): number;
|
|
586
|
-
export function _TICK_ARRAY_NOT_EVENLY_SPACED(): string;
|
|
587
|
-
export function _TICK_INDEX_OUT_OF_BOUNDS(): string;
|
|
588
|
-
export function _INVALID_TICK_INDEX(): string;
|
|
589
|
-
export function _ARITHMETIC_OVERFLOW(): string;
|
|
590
|
-
export function _AMOUNT_EXCEEDS_MAX_U64(): string;
|
|
591
|
-
export function _AMOUNT_EXCEEDS_LIMIT_ORDER_INPUT_AMOUNT(): string;
|
|
592
|
-
export function _SQRT_PRICE_OUT_OF_BOUNDS(): string;
|
|
593
|
-
export function _TICK_SEQUENCE_EMPTY(): string;
|
|
594
|
-
export function _SQRT_PRICE_LIMIT_OUT_OF_BOUNDS(): string;
|
|
595
|
-
export function _INVALID_SQRT_PRICE_LIMIT_DIRECTION(): string;
|
|
596
|
-
export function _ZERO_TRADABLE_AMOUNT(): string;
|
|
597
|
-
export function _INVALID_TIMESTAMP(): string;
|
|
598
|
-
export function _INVALID_TRANSFER_FEE(): string;
|
|
599
|
-
export function _INVALID_SLIPPAGE_TOLERANCE(): string;
|
|
600
|
-
export function _TICK_INDEX_NOT_IN_ARRAY(): string;
|
|
601
|
-
export function _INVALID_TICK_ARRAY_SEQUENCE(): string;
|
|
602
|
-
export function _LIMIT_ORDER_AND_POOL_ARE_OUT_OF_SYNC(): string;
|
|
603
|
-
/**
|
|
604
|
-
* Computes the exact input or output amount for a swap transaction.
|
|
605
|
-
*
|
|
606
|
-
* # Arguments
|
|
607
|
-
* - `token_in`: The input token amount.
|
|
608
|
-
* - `specified_token_a`: If `true`, the input token is token A. Otherwise, it is token B.
|
|
609
|
-
* - `slippage_tolerance`: The slippage tolerance in basis points.
|
|
610
|
-
* - `fusion_pool`: The fusion_pool state.
|
|
611
|
-
* - `tick_arrays`: The tick arrays needed for the swap.
|
|
612
|
-
* - `transfer_fee_a`: The transfer fee for token A.
|
|
613
|
-
* - `transfer_fee_b`: The transfer fee for token B.
|
|
614
|
-
*
|
|
615
|
-
* # Returns
|
|
616
|
-
* The exact input or output amount for the swap transaction.
|
|
617
|
-
*/
|
|
618
|
-
export function swapQuoteByInputToken(token_in: bigint, specified_token_a: boolean, slippage_tolerance_bps: number, fusion_pool: FusionPoolFacade, tick_arrays: TickArrayFacade[], transfer_fee_a?: TransferFee | null, transfer_fee_b?: TransferFee | null): ExactInSwapQuote;
|
|
619
|
-
/**
|
|
620
|
-
* Computes the exact input or output amount for a swap transaction.
|
|
621
|
-
*
|
|
622
|
-
* # Arguments
|
|
623
|
-
* - `token_out`: The output token amount.
|
|
624
|
-
* - `specified_token_a`: If `true`, the output token is token A. Otherwise, it is token B.
|
|
625
|
-
* - `slippage_tolerance`: The slippage tolerance in basis points.
|
|
626
|
-
* - `fusion_pool`: The fusion_pool state.
|
|
627
|
-
* - `tick_arrays`: The tick arrays needed for the swap.
|
|
628
|
-
* - `transfer_fee_a`: The transfer fee for token A.
|
|
629
|
-
* - `transfer_fee_b`: The transfer fee for token B.
|
|
630
|
-
*
|
|
631
|
-
* # Returns
|
|
632
|
-
* The exact input or output amount for the swap transaction.
|
|
633
|
-
*/
|
|
634
|
-
export function swapQuoteByOutputToken(token_out: bigint, specified_token_a: boolean, slippage_tolerance_bps: number, fusion_pool: FusionPoolFacade, tick_arrays: TickArrayFacade[], transfer_fee_a?: TransferFee | null, transfer_fee_b?: TransferFee | null): ExactOutSwapQuote;
|
|
635
|
-
/**
|
|
636
|
-
* Computes the liquidation prices for an existing position.
|
|
637
|
-
*
|
|
638
|
-
* # Parameters
|
|
639
|
-
* - `tick_lower_index`: The lower tick index of the position.
|
|
640
|
-
* - `tick_upper_index`: The upper tick index of the position.
|
|
641
|
-
* - `leftovers_a`: The amount of leftovers A in the position.
|
|
642
|
-
* - `leftovers_a`: The amount of leftovers B in the position.
|
|
643
|
-
* - `liquidity`: Liquidity of the position.
|
|
644
|
-
* - `debt_a`: The amount of tokens A borrowed.
|
|
645
|
-
* - `debt_b`: The amount of tokens B borrowed.
|
|
646
|
-
* - `liquidation_threshold`: The liquidation threshold of the market.
|
|
647
|
-
*
|
|
648
|
-
* # Returns
|
|
649
|
-
* - `LiquidationPrices`: An object containing lower/upper liquidation prices.
|
|
650
|
-
*/
|
|
651
|
-
export function getLpPositionLiquidationPrices(tick_lower_index: number, tick_upper_index: number, liquidity: bigint, leftovers_a: bigint, leftovers_b: bigint, debt_a: bigint, debt_b: bigint, liquidation_threshold: number): LiquidationPrices;
|
|
652
|
-
export function getIncreaseLpPositionQuote(args: IncreaseLpPositionQuoteArgs): IncreaseLpPositionQuoteResult;
|
|
653
|
-
export function _HUNDRED_PERCENT(): number;
|
|
654
|
-
export function _COMPUTED_AMOUNT(): bigint;
|
|
655
|
-
/**
|
|
656
|
-
* Spot position increase quote
|
|
657
|
-
*
|
|
658
|
-
* # Parameters
|
|
659
|
-
* - `increase_amount`: Position total size in the collateral_token.
|
|
660
|
-
* - `collateral_token`: Collateral token.
|
|
661
|
-
* - `position_token`: Token of the position.
|
|
662
|
-
* - `leverage`: Leverage (1.0 or higher).
|
|
663
|
-
* - `slippage_tolerance_bps`: An optional slippage tolerance in basis points. Defaults to the global slippage tolerance if not provided.
|
|
664
|
-
* - `protocol_fee_rate`: Protocol fee rate from a market account represented as hundredths of a basis point (0.01% = 100).
|
|
665
|
-
* - `protocol_fee_rate_on_collateral`: Protocol fee rate from a market account represented as hundredths of a basis point (0.01% = 100).
|
|
666
|
-
* - `mint_a`: Token A mint address
|
|
667
|
-
* - `mint_b`: Token B mint address
|
|
668
|
-
* - `fusion_pool`: Fusion pool.
|
|
669
|
-
* - `tick_arrays`: Optional five tick arrays around the current pool price. If not provided, the quote will be calculated using the Jupiter Aggregator.
|
|
670
|
-
*
|
|
671
|
-
* # Returns
|
|
672
|
-
* - `IncreaseSpotPositionQuoteResult`: quote result
|
|
673
|
-
*/
|
|
674
|
-
export function getIncreaseSpotPositionQuote(increase_amount: bigint, collateral_token: number, position_token: number, leverage: number, slippage_tolerance_bps: number | null | undefined, protocol_fee_rate: number, protocol_fee_rate_on_collateral: number, mint_a: Pubkey, mint_b: Pubkey, fusion_pool: FusionPoolFacade, tick_arrays?: TickArrayFacade[] | null): Promise<any>;
|
|
675
|
-
/**
|
|
676
|
-
* Spot position decrease quote
|
|
659
|
+
* Spot position decrease quote
|
|
677
660
|
*
|
|
678
661
|
* # Parameters
|
|
679
662
|
* - `decrease_amount`: Position total decrease size in the collateral_token.
|
|
@@ -722,7 +705,29 @@ export function getSpotPositionLiquidationPrice(position_token: number, amount:
|
|
|
722
705
|
*/
|
|
723
706
|
export function getTradableAmount(collateral_token: number, available_balance: bigint, leverage: number, position_token: number, position_amount: bigint, protocol_fee_rate: number, protocol_fee_rate_on_collateral: number, fusion_pool: FusionPoolFacade, increase: boolean): bigint;
|
|
724
707
|
export function calculateTunaSpotPositionProtocolFee(collateral_token: number, borrowed_token: number, collateral: bigint, borrow: bigint, protocol_fee_rate_on_collateral: number, protocol_fee_rate: number): TokenPair;
|
|
708
|
+
export function applyTunaProtocolFee(amount: bigint, protocol_fee_rate: number, round_up: boolean): bigint;
|
|
709
|
+
export function reverseApplyTunaProtocolFee(amount: bigint, protocol_fee_rate: number, round_up: boolean): bigint;
|
|
725
710
|
export function calculateTunaProtocolFee(collateral: bigint, borrow: bigint, protocol_fee_rate_on_collateral: number, protocol_fee_rate: number): bigint;
|
|
711
|
+
/**
|
|
712
|
+
* Computes the liquidation prices for an existing position.
|
|
713
|
+
*
|
|
714
|
+
* # Parameters
|
|
715
|
+
* - `tick_lower_index`: The lower tick index of the position.
|
|
716
|
+
* - `tick_upper_index`: The upper tick index of the position.
|
|
717
|
+
* - `leftovers_a`: The amount of leftovers A in the position.
|
|
718
|
+
* - `leftovers_a`: The amount of leftovers B in the position.
|
|
719
|
+
* - `liquidity`: Liquidity of the position.
|
|
720
|
+
* - `debt_a`: The amount of tokens A borrowed.
|
|
721
|
+
* - `debt_b`: The amount of tokens B borrowed.
|
|
722
|
+
* - `liquidation_threshold`: The liquidation threshold of the market.
|
|
723
|
+
*
|
|
724
|
+
* # Returns
|
|
725
|
+
* - `LiquidationPrices`: An object containing lower/upper liquidation prices.
|
|
726
|
+
*/
|
|
727
|
+
export function getLpPositionLiquidationPrices(tick_lower_index: number, tick_upper_index: number, liquidity: bigint, leftovers_a: bigint, leftovers_b: bigint, debt_a: bigint, debt_b: bigint, liquidation_threshold: number): LiquidationPrices;
|
|
728
|
+
export function getIncreaseLpPositionQuote(args: IncreaseLpPositionQuoteArgs): IncreaseLpPositionQuoteResult;
|
|
729
|
+
export function getRepayLpPositionDebtQuote(args: RepayLpPositionDebtQuoteArgs): RepayLpPositionDebtQuoteResult;
|
|
730
|
+
export function computeLeverage(total_a: bigint, total_b: bigint, debt_a: bigint, debt_b: bigint, sqrt_price: bigint): number;
|
|
726
731
|
export function _INVALID_ARGUMENTS(): string;
|
|
727
732
|
export function _JUPITER_QUOTE_REQUEST_ERROR(): string;
|
|
728
733
|
export function _JUPITER_SWAP_INSTRUCTIONS_REQUEST_ERROR(): string;
|
|
@@ -730,20 +735,23 @@ export function _JUPITER_SWAP_INSTRUCTIONS_REQUEST_ERROR(): string;
|
|
|
730
735
|
* Initialize Javascript logging and panic handler
|
|
731
736
|
*/
|
|
732
737
|
export function solana_program_init(): void;
|
|
733
|
-
export interface
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
tokenMaxIn: bigint;
|
|
737
|
-
tradeFee: bigint;
|
|
738
|
-
nextSqrtPrice: bigint;
|
|
738
|
+
export interface CollectFeesQuote {
|
|
739
|
+
feeOwedA: bigint;
|
|
740
|
+
feeOwedB: bigint;
|
|
739
741
|
}
|
|
740
742
|
|
|
741
|
-
export interface
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
743
|
+
export interface LimitOrderDecreaseQuote {
|
|
744
|
+
amountOutA: bigint;
|
|
745
|
+
amountOutB: bigint;
|
|
746
|
+
rewardA: bigint;
|
|
747
|
+
rewardB: bigint;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
export interface LimitOrderFacade {
|
|
751
|
+
tickIndex: number;
|
|
752
|
+
amount: bigint;
|
|
753
|
+
aToB: boolean;
|
|
754
|
+
age: bigint;
|
|
747
755
|
}
|
|
748
756
|
|
|
749
757
|
export interface FusionPoolFacade {
|
|
@@ -763,33 +771,30 @@ export interface FusionPoolFacade {
|
|
|
763
771
|
olpFeeOwedB: bigint;
|
|
764
772
|
}
|
|
765
773
|
|
|
766
|
-
export interface CollectFeesQuote {
|
|
767
|
-
feeOwedA: bigint;
|
|
768
|
-
feeOwedB: bigint;
|
|
769
|
-
}
|
|
770
|
-
|
|
771
774
|
export interface TokenPair {
|
|
772
775
|
a: bigint;
|
|
773
776
|
b: bigint;
|
|
774
777
|
}
|
|
775
778
|
|
|
776
|
-
export interface
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
rewardA: bigint;
|
|
780
|
-
rewardB: bigint;
|
|
779
|
+
export interface TransferFee {
|
|
780
|
+
feeBps: number;
|
|
781
|
+
maxFee: bigint;
|
|
781
782
|
}
|
|
782
783
|
|
|
783
|
-
export interface
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
784
|
+
export interface IncreaseLiquidityQuote {
|
|
785
|
+
liquidityDelta: bigint;
|
|
786
|
+
tokenEstA: bigint;
|
|
787
|
+
tokenEstB: bigint;
|
|
788
|
+
tokenMaxA: bigint;
|
|
789
|
+
tokenMaxB: bigint;
|
|
788
790
|
}
|
|
789
791
|
|
|
790
|
-
export interface
|
|
791
|
-
|
|
792
|
-
|
|
792
|
+
export interface DecreaseLiquidityQuote {
|
|
793
|
+
liquidityDelta: bigint;
|
|
794
|
+
tokenEstA: bigint;
|
|
795
|
+
tokenEstB: bigint;
|
|
796
|
+
tokenMinA: bigint;
|
|
797
|
+
tokenMinB: bigint;
|
|
793
798
|
}
|
|
794
799
|
|
|
795
800
|
export interface PositionFacade {
|
|
@@ -809,20 +814,20 @@ export interface PositionRatio {
|
|
|
809
814
|
ratioB: bigint;
|
|
810
815
|
}
|
|
811
816
|
|
|
812
|
-
export interface
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
817
|
+
export interface ExactOutSwapQuote {
|
|
818
|
+
tokenOut: bigint;
|
|
819
|
+
tokenEstIn: bigint;
|
|
820
|
+
tokenMaxIn: bigint;
|
|
821
|
+
tradeFee: bigint;
|
|
822
|
+
nextSqrtPrice: bigint;
|
|
818
823
|
}
|
|
819
824
|
|
|
820
|
-
export interface
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
825
|
+
export interface ExactInSwapQuote {
|
|
826
|
+
tokenIn: bigint;
|
|
827
|
+
tokenEstOut: bigint;
|
|
828
|
+
tokenMinOut: bigint;
|
|
829
|
+
tradeFee: bigint;
|
|
830
|
+
nextSqrtPrice: bigint;
|
|
826
831
|
}
|
|
827
832
|
|
|
828
833
|
export interface TickArrayFacade {
|
|
@@ -849,46 +854,6 @@ export interface TickRange {
|
|
|
849
854
|
tickUpperIndex: number;
|
|
850
855
|
}
|
|
851
856
|
|
|
852
|
-
export interface IncreaseLpPositionQuoteResult {
|
|
853
|
-
collateralA: bigint;
|
|
854
|
-
collateralB: bigint;
|
|
855
|
-
maxCollateralA: bigint;
|
|
856
|
-
maxCollateralB: bigint;
|
|
857
|
-
borrowA: bigint;
|
|
858
|
-
borrowB: bigint;
|
|
859
|
-
totalA: bigint;
|
|
860
|
-
totalB: bigint;
|
|
861
|
-
minTotalA: bigint;
|
|
862
|
-
minTotalB: bigint;
|
|
863
|
-
swapInput: bigint;
|
|
864
|
-
swapOutput: bigint;
|
|
865
|
-
swapAToB: boolean;
|
|
866
|
-
protocolFeeA: bigint;
|
|
867
|
-
protocolFeeB: bigint;
|
|
868
|
-
liquidationLowerPrice: number;
|
|
869
|
-
liquidationUpperPrice: number;
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
export interface IncreaseLpPositionQuoteArgs {
|
|
873
|
-
collateralA: bigint;
|
|
874
|
-
collateralB: bigint;
|
|
875
|
-
borrowA: bigint;
|
|
876
|
-
borrowB: bigint;
|
|
877
|
-
protocolFeeRate: number;
|
|
878
|
-
protocolFeeRateOnCollateral: number;
|
|
879
|
-
swapFeeRate: number;
|
|
880
|
-
sqrtPrice: bigint;
|
|
881
|
-
tickLowerIndex: number;
|
|
882
|
-
tickUpperIndex: number;
|
|
883
|
-
maxAmountSlippage: number;
|
|
884
|
-
liquidationThreshold: number;
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
export interface LiquidationPrices {
|
|
888
|
-
lower: number;
|
|
889
|
-
upper: number;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
857
|
export interface SwapInstruction {
|
|
893
858
|
data: number[];
|
|
894
859
|
accounts: AccountMeta[];
|
|
@@ -931,6 +896,70 @@ export interface TunaSpotPositionFacade {
|
|
|
931
896
|
upperLimitOrderSqrtPrice: bigint;
|
|
932
897
|
}
|
|
933
898
|
|
|
899
|
+
export interface RepayLpPositionDebtQuoteResult {
|
|
900
|
+
debtA: bigint;
|
|
901
|
+
debtB: bigint;
|
|
902
|
+
leverage: number;
|
|
903
|
+
liquidationLowerPrice: number;
|
|
904
|
+
liquidationUpperPrice: number;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
export interface RepayLpPositionDebtQuoteArgs {
|
|
908
|
+
liquidity: bigint;
|
|
909
|
+
debtA: bigint;
|
|
910
|
+
debtB: bigint;
|
|
911
|
+
leftoversA: bigint;
|
|
912
|
+
leftoversB: bigint;
|
|
913
|
+
tickLowerIndex: number;
|
|
914
|
+
tickUpperIndex: number;
|
|
915
|
+
repayA: bigint;
|
|
916
|
+
repayB: bigint;
|
|
917
|
+
sqrtPrice: bigint;
|
|
918
|
+
liquidationThreshold: number;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
export interface IncreaseLpPositionQuoteResult {
|
|
922
|
+
collateralA: bigint;
|
|
923
|
+
collateralB: bigint;
|
|
924
|
+
maxCollateralA: bigint;
|
|
925
|
+
maxCollateralB: bigint;
|
|
926
|
+
borrowA: bigint;
|
|
927
|
+
borrowB: bigint;
|
|
928
|
+
totalA: bigint;
|
|
929
|
+
totalB: bigint;
|
|
930
|
+
minTotalA: bigint;
|
|
931
|
+
minTotalB: bigint;
|
|
932
|
+
swapInput: bigint;
|
|
933
|
+
swapOutput: bigint;
|
|
934
|
+
swapAToB: boolean;
|
|
935
|
+
protocolFeeA: bigint;
|
|
936
|
+
protocolFeeB: bigint;
|
|
937
|
+
liquidity: bigint;
|
|
938
|
+
leverage: number;
|
|
939
|
+
liquidationLowerPrice: number;
|
|
940
|
+
liquidationUpperPrice: number;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
export interface IncreaseLpPositionQuoteArgs {
|
|
944
|
+
collateralA: bigint;
|
|
945
|
+
collateralB: bigint;
|
|
946
|
+
borrowA: bigint;
|
|
947
|
+
borrowB: bigint;
|
|
948
|
+
protocolFeeRate: number;
|
|
949
|
+
protocolFeeRateOnCollateral: number;
|
|
950
|
+
swapFeeRate: number;
|
|
951
|
+
sqrtPrice: bigint;
|
|
952
|
+
tickLowerIndex: number;
|
|
953
|
+
tickUpperIndex: number;
|
|
954
|
+
maxAmountSlippage: number;
|
|
955
|
+
liquidationThreshold: number;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
export interface LiquidationPrices {
|
|
959
|
+
lower: number;
|
|
960
|
+
upper: number;
|
|
961
|
+
}
|
|
962
|
+
|
|
934
963
|
/**
|
|
935
964
|
* A hash; the 32-byte output of a hashing algorithm.
|
|
936
965
|
*
|