@crypticdot/defituna-core 3.4.5 → 3.4.7
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 +203 -202
- package/dist/browser/defituna_core_js_bindings_bg.js +268 -256
- package/dist/browser/defituna_core_js_bindings_bg.wasm +0 -0
- package/dist/browser/defituna_core_js_bindings_bg.wasm.d.ts +30 -29
- package/dist/nodejs/defituna_core_js_bindings.d.ts +203 -202
- package/dist/nodejs/defituna_core_js_bindings.js +268 -256
- package/dist/nodejs/defituna_core_js_bindings_bg.wasm +0 -0
- package/dist/nodejs/defituna_core_js_bindings_bg.wasm.d.ts +30 -29
- package/package.json +2 -2
|
@@ -66,18 +66,6 @@ export const hash_constructor: (a: number, b: number) => void;
|
|
|
66
66
|
export const hash_toString: (a: number, b: number) => void;
|
|
67
67
|
export const hash_equals: (a: number, b: number) => number;
|
|
68
68
|
export const hash_toBytes: (a: number, b: number) => void;
|
|
69
|
-
export const decreaseLiquidityQuote: (a: number, b: bigint, c: bigint, d: number, e: bigint, f: bigint, g: number, h: number, i: number, j: number) => void;
|
|
70
|
-
export const decreaseLiquidityQuoteA: (a: number, b: bigint, c: number, d: bigint, e: bigint, f: number, g: number, h: number, i: number) => void;
|
|
71
|
-
export const decreaseLiquidityQuoteB: (a: number, b: bigint, c: number, d: bigint, e: bigint, f: number, g: number, h: number, i: number) => void;
|
|
72
|
-
export const increaseLiquidityQuote: (a: number, b: bigint, c: bigint, d: number, e: bigint, f: bigint, g: number, h: number, i: number, j: number) => void;
|
|
73
|
-
export const increaseLiquidityQuoteA: (a: number, b: bigint, c: number, d: bigint, e: bigint, f: number, g: number, h: number, i: number) => void;
|
|
74
|
-
export const increaseLiquidityQuoteB: (a: number, b: bigint, c: number, d: bigint, e: bigint, f: number, g: number, h: number, i: number) => void;
|
|
75
|
-
export const tryGetLiquidityFromA: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint) => void;
|
|
76
|
-
export const tryGetTokenAFromLiquidity: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: number) => void;
|
|
77
|
-
export const tryGetLiquidityFromB: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint) => void;
|
|
78
|
-
export const tryGetTokenBFromLiquidity: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: number) => void;
|
|
79
|
-
export const tryGetAmountsFromLiquidity: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: number, g: number, h: number) => void;
|
|
80
|
-
export const tryGetLiquidityFromAmounts: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: bigint, i: bigint) => void;
|
|
81
69
|
export const tryGetAmountDeltaA: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: number) => void;
|
|
82
70
|
export const tryGetAmountDeltaB: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: number) => void;
|
|
83
71
|
export const tryGetNextSqrtPriceFromA: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: number) => void;
|
|
@@ -90,6 +78,23 @@ export const tryApplySwapFee: (a: number, b: bigint, c: number) => void;
|
|
|
90
78
|
export const tryReverseApplySwapFee: (a: number, b: bigint, c: number) => void;
|
|
91
79
|
export const swapQuoteByInputToken: (a: number, b: bigint, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
92
80
|
export const swapQuoteByOutputToken: (a: number, b: bigint, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
81
|
+
export const getLiquidityFromAmountA: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint) => void;
|
|
82
|
+
export const getLiquidityFromAmountB: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint) => void;
|
|
83
|
+
export const getAmountAFromLiquidity: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: number) => void;
|
|
84
|
+
export const getAmountBFromLiquidity: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: number) => void;
|
|
85
|
+
export const getAmountsFromLiquidity: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: bigint, i: bigint, j: number) => void;
|
|
86
|
+
export const getLiquidityFromAmounts: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: bigint, i: bigint) => void;
|
|
87
|
+
export const firstUnoccupiedPositionInBundle: (a: number, b: number) => number;
|
|
88
|
+
export const isPositionBundleFull: (a: number, b: number) => number;
|
|
89
|
+
export const isPositionBundleEmpty: (a: number, b: number) => number;
|
|
90
|
+
export const isPositionInRange: (a: bigint, b: bigint, c: number, d: number) => number;
|
|
91
|
+
export const positionStatus: (a: bigint, b: bigint, c: number, d: number) => number;
|
|
92
|
+
export const positionRatioX64: (a: bigint, b: bigint, c: number, d: number) => number;
|
|
93
|
+
export const priceToSqrtPrice: (a: number, b: number, c: number, d: number) => void;
|
|
94
|
+
export const sqrtPriceToPrice: (a: bigint, b: bigint, c: number, d: number) => number;
|
|
95
|
+
export const invertPrice: (a: number, b: number, c: number) => number;
|
|
96
|
+
export const tickIndexToPrice: (a: number, b: number, c: number) => number;
|
|
97
|
+
export const priceToTickIndex: (a: number, b: number, c: number) => number;
|
|
93
98
|
export const _TICK_ARRAY_NOT_EVENLY_SPACED: (a: number) => void;
|
|
94
99
|
export const _TICK_INDEX_OUT_OF_BOUNDS: (a: number) => void;
|
|
95
100
|
export const _INVALID_TICK_INDEX: (a: number) => void;
|
|
@@ -100,6 +105,7 @@ export const _SQRT_PRICE_OUT_OF_BOUNDS: (a: number) => void;
|
|
|
100
105
|
export const _TICK_SEQUENCE_EMPTY: (a: number) => void;
|
|
101
106
|
export const _SQRT_PRICE_LIMIT_OUT_OF_BOUNDS: (a: number) => void;
|
|
102
107
|
export const _INVALID_SQRT_PRICE_LIMIT_DIRECTION: (a: number) => void;
|
|
108
|
+
export const _INVALID_RANGE_BOUNDS: (a: number) => void;
|
|
103
109
|
export const _ZERO_TRADABLE_AMOUNT: (a: number) => void;
|
|
104
110
|
export const _INVALID_TIMESTAMP: (a: number) => void;
|
|
105
111
|
export const _INVALID_TRANSFER_FEE: (a: number) => void;
|
|
@@ -107,6 +113,12 @@ export const _INVALID_SLIPPAGE_TOLERANCE: (a: number) => void;
|
|
|
107
113
|
export const _TICK_INDEX_NOT_IN_ARRAY: (a: number) => void;
|
|
108
114
|
export const _INVALID_TICK_ARRAY_SEQUENCE: (a: number) => void;
|
|
109
115
|
export const _LIMIT_ORDER_AND_POOL_ARE_OUT_OF_SYNC: (a: number) => void;
|
|
116
|
+
export const decreaseLiquidityQuote: (a: number, b: bigint, c: bigint, d: number, e: bigint, f: bigint, g: number, h: number, i: number, j: number) => void;
|
|
117
|
+
export const decreaseLiquidityQuoteA: (a: number, b: bigint, c: number, d: bigint, e: bigint, f: number, g: number, h: number, i: number) => void;
|
|
118
|
+
export const decreaseLiquidityQuoteB: (a: number, b: bigint, c: number, d: bigint, e: bigint, f: number, g: number, h: number, i: number) => void;
|
|
119
|
+
export const increaseLiquidityQuote: (a: number, b: bigint, c: bigint, d: number, e: bigint, f: bigint, g: number, h: number, i: number, j: number) => void;
|
|
120
|
+
export const increaseLiquidityQuoteA: (a: number, b: bigint, c: number, d: bigint, e: bigint, f: number, g: number, h: number, i: number) => void;
|
|
121
|
+
export const increaseLiquidityQuoteB: (a: number, b: bigint, c: number, d: bigint, e: bigint, f: number, g: number, h: number, i: number) => void;
|
|
110
122
|
export const _POSITION_BUNDLE_SIZE: () => number;
|
|
111
123
|
export const _FEE_RATE_MUL_VALUE: () => number;
|
|
112
124
|
export const _MAX_PROTOCOL_FEE_RATE: () => number;
|
|
@@ -129,27 +141,16 @@ export const getFullRangeTickIndexes: (a: number) => number;
|
|
|
129
141
|
export const orderTickIndexes: (a: number, b: number) => number;
|
|
130
142
|
export const isFullRangeOnly: (a: number) => number;
|
|
131
143
|
export const getTickIndexInArray: (a: number, b: number, c: number, d: number) => void;
|
|
132
|
-
export const collectFeesQuote: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
133
|
-
export const limitOrderFee: (a: number) => number;
|
|
134
|
-
export const firstUnoccupiedPositionInBundle: (a: number, b: number) => number;
|
|
135
|
-
export const isPositionBundleFull: (a: number, b: number) => number;
|
|
136
|
-
export const isPositionBundleEmpty: (a: number, b: number) => number;
|
|
137
|
-
export const isPositionInRange: (a: bigint, b: bigint, c: number, d: number) => number;
|
|
138
|
-
export const positionStatus: (a: bigint, b: bigint, c: number, d: number) => number;
|
|
139
|
-
export const positionRatioX64: (a: bigint, b: bigint, c: number, d: number) => number;
|
|
140
|
-
export const priceToSqrtPrice: (a: number, b: number, c: number, d: number) => void;
|
|
141
|
-
export const sqrtPriceToPrice: (a: bigint, b: bigint, c: number, d: number) => number;
|
|
142
|
-
export const invertPrice: (a: number, b: number, c: number) => number;
|
|
143
|
-
export const tickIndexToPrice: (a: number, b: number, c: number) => number;
|
|
144
|
-
export const priceToTickIndex: (a: number, b: number, c: number) => number;
|
|
145
144
|
export const limitOrderQuoteByInputToken: (a: number, b: bigint, c: number, d: number, e: number) => void;
|
|
146
145
|
export const limitOrderQuoteByOutputToken: (a: number, b: bigint, c: number, d: number, e: number) => void;
|
|
147
146
|
export const limitOrderRewardByOutputToken: (a: number, b: bigint, c: number, d: number) => void;
|
|
148
147
|
export const decreaseLimitOrderQuote: (a: number, b: number, c: number, d: number, e: bigint, f: number, g: number) => void;
|
|
149
|
-
export const
|
|
150
|
-
export const
|
|
151
|
-
export const
|
|
152
|
-
export const
|
|
148
|
+
export const collectFeesQuote: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
149
|
+
export const limitOrderFee: (a: number) => number;
|
|
150
|
+
export const __wasm_bindgen_func_elem_3153: (a: number, b: number) => void;
|
|
151
|
+
export const __wasm_bindgen_func_elem_3149: (a: number, b: number) => void;
|
|
152
|
+
export const __wasm_bindgen_func_elem_3259: (a: number, b: number, c: number) => void;
|
|
153
|
+
export const __wasm_bindgen_func_elem_3232: (a: number, b: number) => void;
|
|
153
154
|
export const __wasm_bindgen_func_elem_494: (a: number, b: number, c: number, d: number) => void;
|
|
154
155
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
155
156
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
@@ -263,28 +263,154 @@ export function increaseLiquidityQuoteA(token_amount_a: bigint, slippage_toleran
|
|
|
263
263
|
* - An IncreaseLiquidityQuote struct containing the estimated token amounts
|
|
264
264
|
*/
|
|
265
265
|
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
266
|
/**
|
|
273
|
-
*
|
|
267
|
+
* Get the first unoccupied position in a bundle
|
|
274
268
|
*
|
|
275
|
-
* #
|
|
276
|
-
*
|
|
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
|
|
269
|
+
* # Arguments
|
|
270
|
+
* * `bundle` - The bundle to check
|
|
282
271
|
*
|
|
283
272
|
* # Returns
|
|
284
|
-
*
|
|
273
|
+
* * `u32` - The first unoccupied position (None if full)
|
|
285
274
|
*/
|
|
286
|
-
export function
|
|
287
|
-
|
|
275
|
+
export function firstUnoccupiedPositionInBundle(bitmap: Uint8Array): number | undefined;
|
|
276
|
+
/**
|
|
277
|
+
* Check whether a position bundle is full
|
|
278
|
+
* A position bundle can contain 256 positions
|
|
279
|
+
*
|
|
280
|
+
* # Arguments
|
|
281
|
+
* * `bundle` - The bundle to check
|
|
282
|
+
*
|
|
283
|
+
* # Returns
|
|
284
|
+
* * `bool` - Whether the bundle is full
|
|
285
|
+
*/
|
|
286
|
+
export function isPositionBundleFull(bitmap: Uint8Array): boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Check whether a position bundle is empty
|
|
289
|
+
*
|
|
290
|
+
* # Arguments
|
|
291
|
+
* * `bundle` - The bundle to check
|
|
292
|
+
*
|
|
293
|
+
* # Returns
|
|
294
|
+
* * `bool` - Whether the bundle is empty
|
|
295
|
+
*/
|
|
296
|
+
export function isPositionBundleEmpty(bitmap: Uint8Array): boolean;
|
|
297
|
+
/**
|
|
298
|
+
* Check if a position is in range.
|
|
299
|
+
* When a position is in range it is earning fees and rewards
|
|
300
|
+
*
|
|
301
|
+
* # Parameters
|
|
302
|
+
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
303
|
+
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
304
|
+
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
305
|
+
*
|
|
306
|
+
* # Returns
|
|
307
|
+
* - A boolean value indicating if the position is in range
|
|
308
|
+
*/
|
|
309
|
+
export function isPositionInRange(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): boolean;
|
|
310
|
+
/**
|
|
311
|
+
* Calculate the status of a position
|
|
312
|
+
* The status can be one of three values:
|
|
313
|
+
* - InRange: The position is in range
|
|
314
|
+
* - BelowRange: The position is below the range
|
|
315
|
+
* - AboveRange: The position is above the range
|
|
316
|
+
*
|
|
317
|
+
* # Parameters
|
|
318
|
+
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
319
|
+
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
320
|
+
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
321
|
+
*
|
|
322
|
+
* # Returns
|
|
323
|
+
* - A PositionStatus enum value indicating the status of the position
|
|
324
|
+
*/
|
|
325
|
+
export function positionStatus(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): PositionStatus;
|
|
326
|
+
/**
|
|
327
|
+
* Calculate the token_a / token_b ratio of a (ficticious) position
|
|
328
|
+
*
|
|
329
|
+
* # Parameters
|
|
330
|
+
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
331
|
+
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
332
|
+
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
333
|
+
*
|
|
334
|
+
* # Returns
|
|
335
|
+
* - A PositionRatio struct containing the ratio of token_a and token_b
|
|
336
|
+
*/
|
|
337
|
+
export function positionRatioX64(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): PositionRatio;
|
|
338
|
+
/**
|
|
339
|
+
* Convert a price into a sqrt priceX64
|
|
340
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
341
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
342
|
+
*
|
|
343
|
+
* # Parameters
|
|
344
|
+
* * `price` - The price to convert
|
|
345
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
346
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
347
|
+
*
|
|
348
|
+
* # Returns
|
|
349
|
+
* * `u128` - The sqrt priceX64
|
|
350
|
+
*/
|
|
351
|
+
export function priceToSqrtPrice(price: number, decimals_a: number, decimals_b: number): bigint;
|
|
352
|
+
/**
|
|
353
|
+
* Convert a sqrt priceX64 into a tick index
|
|
354
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
355
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
356
|
+
*
|
|
357
|
+
* # Parameters
|
|
358
|
+
* * `sqrt_price` - The sqrt priceX64 to convert
|
|
359
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
360
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
361
|
+
*
|
|
362
|
+
* # Returns
|
|
363
|
+
* * `f64` - The decimal price
|
|
364
|
+
*/
|
|
365
|
+
export function sqrtPriceToPrice(sqrt_price: bigint, decimals_a: number, decimals_b: number): number;
|
|
366
|
+
/**
|
|
367
|
+
* Invert a price
|
|
368
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
369
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
370
|
+
*
|
|
371
|
+
* # Parameters
|
|
372
|
+
* * `price` - The price to invert
|
|
373
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
374
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
375
|
+
*
|
|
376
|
+
* # Returns
|
|
377
|
+
* * `f64` - The inverted price
|
|
378
|
+
*/
|
|
379
|
+
export function invertPrice(price: number, decimals_a: number, decimals_b: number): number;
|
|
380
|
+
/**
|
|
381
|
+
* Convert a tick index into a price
|
|
382
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
383
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
384
|
+
*
|
|
385
|
+
* # Parameters
|
|
386
|
+
* * `tick_index` - The tick index to convert
|
|
387
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
388
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
389
|
+
*
|
|
390
|
+
* # Returns
|
|
391
|
+
* * `f64` - The decimal price
|
|
392
|
+
*/
|
|
393
|
+
export function tickIndexToPrice(tick_index: number, decimals_a: number, decimals_b: number): number;
|
|
394
|
+
/**
|
|
395
|
+
* Convert a price into a tick index
|
|
396
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
397
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
398
|
+
*
|
|
399
|
+
* # Parameters
|
|
400
|
+
* * `price` - The price to convert
|
|
401
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
402
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
403
|
+
*
|
|
404
|
+
* # Returns
|
|
405
|
+
* * `i32` - The tick index
|
|
406
|
+
*/
|
|
407
|
+
export function priceToTickIndex(price: number, decimals_a: number, decimals_b: number): number;
|
|
408
|
+
export function getLiquidityFromAmountA(amount_a: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint): bigint;
|
|
409
|
+
export function getLiquidityFromAmountB(amount_b: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint): bigint;
|
|
410
|
+
export function getAmountAFromLiquidity(liquidity: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint, round_up: boolean): bigint;
|
|
411
|
+
export function getAmountBFromLiquidity(liquidity: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint, round_up: boolean): bigint;
|
|
412
|
+
export function getAmountsFromLiquidity(liquidity: bigint, sqrt_price: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint, round_up: boolean): TokenPair;
|
|
413
|
+
export function getLiquidityFromAmounts(sqrt_price: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint, amount_a: bigint, amount_b: bigint): bigint;
|
|
288
414
|
/**
|
|
289
415
|
* Calculate the amount A delta between two sqrt_prices
|
|
290
416
|
*
|
|
@@ -442,147 +568,21 @@ 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
|
-
*
|
|
446
|
-
*
|
|
447
|
-
* # Arguments
|
|
448
|
-
* * `bundle` - The bundle to check
|
|
449
|
-
*
|
|
450
|
-
* # Returns
|
|
451
|
-
* * `u32` - The first unoccupied position (None if full)
|
|
452
|
-
*/
|
|
453
|
-
export function firstUnoccupiedPositionInBundle(bitmap: Uint8Array): number | undefined;
|
|
454
|
-
/**
|
|
455
|
-
* Check whether a position bundle is full
|
|
456
|
-
* A position bundle can contain 256 positions
|
|
457
|
-
*
|
|
458
|
-
* # Arguments
|
|
459
|
-
* * `bundle` - The bundle to check
|
|
460
|
-
*
|
|
461
|
-
* # Returns
|
|
462
|
-
* * `bool` - Whether the bundle is full
|
|
463
|
-
*/
|
|
464
|
-
export function isPositionBundleFull(bitmap: Uint8Array): boolean;
|
|
465
|
-
/**
|
|
466
|
-
* Check whether a position bundle is empty
|
|
467
|
-
*
|
|
468
|
-
* # Arguments
|
|
469
|
-
* * `bundle` - The bundle to check
|
|
470
|
-
*
|
|
471
|
-
* # Returns
|
|
472
|
-
* * `bool` - Whether the bundle is empty
|
|
473
|
-
*/
|
|
474
|
-
export function isPositionBundleEmpty(bitmap: Uint8Array): boolean;
|
|
475
|
-
/**
|
|
476
|
-
* Check if a position is in range.
|
|
477
|
-
* When a position is in range it is earning fees and rewards
|
|
478
|
-
*
|
|
479
|
-
* # Parameters
|
|
480
|
-
* - `sqrt_price` - A u128 integer representing the sqrt price of the pool
|
|
481
|
-
* - `tick_index_1` - A i32 integer representing the first tick index of the position
|
|
482
|
-
* - `tick_index_2` - A i32 integer representing the second tick index of the position
|
|
483
|
-
*
|
|
484
|
-
* # Returns
|
|
485
|
-
* - A boolean value indicating if the position is in range
|
|
486
|
-
*/
|
|
487
|
-
export function isPositionInRange(current_sqrt_price: bigint, tick_index_1: number, tick_index_2: number): boolean;
|
|
488
|
-
/**
|
|
489
|
-
* Calculate the status of a position
|
|
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.
|
|
571
|
+
* Calculate fees owed for a position
|
|
576
572
|
*
|
|
577
|
-
* #
|
|
578
|
-
*
|
|
579
|
-
*
|
|
580
|
-
*
|
|
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
|
|
581
580
|
*
|
|
582
581
|
* # Returns
|
|
583
|
-
*
|
|
582
|
+
* - `CollectFeesQuote`: The fees owed for token A and token B
|
|
584
583
|
*/
|
|
585
|
-
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
586
|
export function _TICK_ARRAY_NOT_EVENLY_SPACED(): string;
|
|
587
587
|
export function _TICK_INDEX_OUT_OF_BOUNDS(): string;
|
|
588
588
|
export function _INVALID_TICK_INDEX(): string;
|
|
@@ -593,6 +593,7 @@ export function _SQRT_PRICE_OUT_OF_BOUNDS(): string;
|
|
|
593
593
|
export function _TICK_SEQUENCE_EMPTY(): string;
|
|
594
594
|
export function _SQRT_PRICE_LIMIT_OUT_OF_BOUNDS(): string;
|
|
595
595
|
export function _INVALID_SQRT_PRICE_LIMIT_DIRECTION(): string;
|
|
596
|
+
export function _INVALID_RANGE_BOUNDS(): string;
|
|
596
597
|
export function _ZERO_TRADABLE_AMOUNT(): string;
|
|
597
598
|
export function _INVALID_TIMESTAMP(): string;
|
|
598
599
|
export function _INVALID_TRANSFER_FEE(): string;
|
|
@@ -734,20 +735,44 @@ export function _JUPITER_SWAP_INSTRUCTIONS_REQUEST_ERROR(): string;
|
|
|
734
735
|
* Initialize Javascript logging and panic handler
|
|
735
736
|
*/
|
|
736
737
|
export function solana_program_init(): void;
|
|
737
|
-
export interface
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
nextSqrtPrice: bigint;
|
|
738
|
+
export interface LimitOrderDecreaseQuote {
|
|
739
|
+
amountOutA: bigint;
|
|
740
|
+
amountOutB: bigint;
|
|
741
|
+
rewardA: bigint;
|
|
742
|
+
rewardB: bigint;
|
|
743
743
|
}
|
|
744
744
|
|
|
745
|
-
export interface
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
745
|
+
export interface LimitOrderFacade {
|
|
746
|
+
tickIndex: number;
|
|
747
|
+
amount: bigint;
|
|
748
|
+
aToB: boolean;
|
|
749
|
+
age: bigint;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
export interface TransferFee {
|
|
753
|
+
feeBps: number;
|
|
754
|
+
maxFee: bigint;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
export interface IncreaseLiquidityQuote {
|
|
758
|
+
liquidityDelta: bigint;
|
|
759
|
+
tokenEstA: bigint;
|
|
760
|
+
tokenEstB: bigint;
|
|
761
|
+
tokenMaxA: bigint;
|
|
762
|
+
tokenMaxB: bigint;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
export interface DecreaseLiquidityQuote {
|
|
766
|
+
liquidityDelta: bigint;
|
|
767
|
+
tokenEstA: bigint;
|
|
768
|
+
tokenEstB: bigint;
|
|
769
|
+
tokenMinA: bigint;
|
|
770
|
+
tokenMinB: bigint;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
export interface CollectFeesQuote {
|
|
774
|
+
feeOwedA: bigint;
|
|
775
|
+
feeOwedB: bigint;
|
|
751
776
|
}
|
|
752
777
|
|
|
753
778
|
export interface FusionPoolFacade {
|
|
@@ -767,35 +792,11 @@ export interface FusionPoolFacade {
|
|
|
767
792
|
olpFeeOwedB: bigint;
|
|
768
793
|
}
|
|
769
794
|
|
|
770
|
-
export interface CollectFeesQuote {
|
|
771
|
-
feeOwedA: bigint;
|
|
772
|
-
feeOwedB: bigint;
|
|
773
|
-
}
|
|
774
|
-
|
|
775
795
|
export interface TokenPair {
|
|
776
796
|
a: bigint;
|
|
777
797
|
b: bigint;
|
|
778
798
|
}
|
|
779
799
|
|
|
780
|
-
export interface LimitOrderDecreaseQuote {
|
|
781
|
-
amountOutA: bigint;
|
|
782
|
-
amountOutB: bigint;
|
|
783
|
-
rewardA: bigint;
|
|
784
|
-
rewardB: bigint;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
export interface LimitOrderFacade {
|
|
788
|
-
tickIndex: number;
|
|
789
|
-
amount: bigint;
|
|
790
|
-
aToB: boolean;
|
|
791
|
-
age: bigint;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
export interface TransferFee {
|
|
795
|
-
feeBps: number;
|
|
796
|
-
maxFee: bigint;
|
|
797
|
-
}
|
|
798
|
-
|
|
799
800
|
export interface PositionFacade {
|
|
800
801
|
liquidity: bigint;
|
|
801
802
|
tickLowerIndex: number;
|
|
@@ -813,20 +814,20 @@ export interface PositionRatio {
|
|
|
813
814
|
ratioB: bigint;
|
|
814
815
|
}
|
|
815
816
|
|
|
816
|
-
export interface
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
817
|
+
export interface ExactOutSwapQuote {
|
|
818
|
+
tokenOut: bigint;
|
|
819
|
+
tokenEstIn: bigint;
|
|
820
|
+
tokenMaxIn: bigint;
|
|
821
|
+
tradeFee: bigint;
|
|
822
|
+
nextSqrtPrice: bigint;
|
|
822
823
|
}
|
|
823
824
|
|
|
824
|
-
export interface
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
825
|
+
export interface ExactInSwapQuote {
|
|
826
|
+
tokenIn: bigint;
|
|
827
|
+
tokenEstOut: bigint;
|
|
828
|
+
tokenMinOut: bigint;
|
|
829
|
+
tradeFee: bigint;
|
|
830
|
+
nextSqrtPrice: bigint;
|
|
830
831
|
}
|
|
831
832
|
|
|
832
833
|
export interface TickArrayFacade {
|