@crypticdot/defituna-core 3.4.2 → 3.4.4

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.
@@ -1,7 +1,7 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const getLpPositionLiquidationPrices: (a: number, b: number, c: number, d: number, e: bigint, f: bigint, g: bigint, h: bigint, i: number) => void;
4
+ export const getLpPositionLiquidationPrices: (a: number, b: number, c: number, d: bigint, e: bigint, f: bigint, g: bigint, h: bigint, i: bigint, j: number) => void;
5
5
  export const getIncreaseLpPositionQuote: (a: number, b: number) => void;
6
6
  export const _INVALID_ARGUMENTS: (a: number) => void;
7
7
  export const _JUPITER_QUOTE_REQUEST_ERROR: (a: number) => void;
@@ -10,7 +10,7 @@ export const _HUNDRED_PERCENT: () => number;
10
10
  export const _COMPUTED_AMOUNT: () => bigint;
11
11
  export const getIncreaseSpotPositionQuote: (a: bigint, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => number;
12
12
  export const getDecreaseSpotPositionQuote: (a: bigint, b: number, c: number, d: number, e: number, f: bigint, g: bigint, h: number, i: number, j: number, k: number) => number;
13
- export const getSpotPositionLiquidationPrice: (a: number, b: number, c: number, d: number, e: number) => void;
13
+ export const getSpotPositionLiquidationPrice: (a: number, b: number, c: bigint, d: bigint, e: number) => void;
14
14
  export const getTradableAmount: (a: number, b: number, c: bigint, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number) => void;
15
15
  export const calculateTunaSpotPositionProtocolFee: (a: number, b: number, c: bigint, d: bigint, e: number, f: number) => number;
16
16
  export const calculateTunaProtocolFee: (a: bigint, b: bigint, c: number, d: number) => bigint;
@@ -62,21 +62,22 @@ export const hash_constructor: (a: number, b: number) => void;
62
62
  export const hash_toString: (a: number, b: number) => void;
63
63
  export const hash_equals: (a: number, b: number) => number;
64
64
  export const hash_toBytes: (a: number, b: number) => void;
65
- export const decreaseLiquidityQuote: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
66
- export const decreaseLiquidityQuoteA: (a: number, b: bigint, c: number, d: number, e: number, f: number, g: number, h: number) => void;
67
- export const decreaseLiquidityQuoteB: (a: number, b: bigint, c: number, d: number, e: number, f: number, g: number, h: number) => void;
68
- export const increaseLiquidityQuote: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
69
- export const increaseLiquidityQuoteA: (a: number, b: bigint, c: number, d: number, e: number, f: number, g: number, h: number) => void;
70
- export const increaseLiquidityQuoteB: (a: number, b: bigint, c: number, d: number, e: number, f: number, g: number, h: number) => void;
65
+ export const decreaseLiquidityQuote: (a: number, b: bigint, c: bigint, d: number, e: bigint, f: bigint, g: number, h: number, i: number, j: number) => void;
66
+ export const decreaseLiquidityQuoteA: (a: number, b: bigint, c: number, d: bigint, e: bigint, f: number, g: number, h: number, i: number) => void;
67
+ export const decreaseLiquidityQuoteB: (a: number, b: bigint, c: number, d: bigint, e: bigint, f: number, g: number, h: number, i: number) => void;
68
+ export const increaseLiquidityQuote: (a: number, b: bigint, c: bigint, d: number, e: bigint, f: bigint, g: number, h: number, i: number, j: number) => void;
69
+ export const increaseLiquidityQuoteA: (a: number, b: bigint, c: number, d: bigint, e: bigint, f: number, g: number, h: number, i: number) => void;
70
+ export const increaseLiquidityQuoteB: (a: number, b: bigint, c: number, d: bigint, e: bigint, f: number, g: number, h: number, i: number) => void;
71
71
  export const tryGetLiquidityFromA: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint) => void;
72
72
  export const tryGetTokenAFromLiquidity: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: number) => void;
73
73
  export const tryGetLiquidityFromB: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint) => void;
74
74
  export const tryGetTokenBFromLiquidity: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: number) => void;
75
- export const tryGetTokenEstimatesFromLiquidity: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: number, g: number, h: number) => void;
76
- export const tryGetAmountDeltaA: (a: number, b: number, c: number, d: number, e: number) => void;
77
- export const tryGetAmountDeltaB: (a: number, b: number, c: number, d: number, e: number) => void;
78
- export const tryGetNextSqrtPriceFromA: (a: number, b: number, c: number, d: bigint, e: number) => void;
79
- export const tryGetNextSqrtPriceFromB: (a: number, b: number, c: number, d: bigint, e: number) => void;
75
+ export const tryGetAmountsFromLiquidity: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: number, g: number, h: number) => void;
76
+ export const tryGetLiquidityFromAmounts: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: bigint, i: bigint) => void;
77
+ export const tryGetAmountDeltaA: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: number) => void;
78
+ export const tryGetAmountDeltaB: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: bigint, h: number) => void;
79
+ export const tryGetNextSqrtPriceFromA: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: number) => void;
80
+ export const tryGetNextSqrtPriceFromB: (a: number, b: bigint, c: bigint, d: bigint, e: bigint, f: bigint, g: number) => void;
80
81
  export const tryApplyTransferFee: (a: number, b: bigint, c: number) => void;
81
82
  export const tryReverseApplyTransferFee: (a: number, b: bigint, c: number) => void;
82
83
  export const tryGetMaxAmountWithSlippageTolerance: (a: number, b: bigint, c: number) => void;
@@ -85,11 +86,6 @@ export const tryApplySwapFee: (a: number, b: bigint, c: number) => void;
85
86
  export const tryReverseApplySwapFee: (a: number, b: bigint, c: number) => void;
86
87
  export const swapQuoteByInputToken: (a: number, b: bigint, c: number, d: number, e: number, f: number, g: number, h: number) => void;
87
88
  export const swapQuoteByOutputToken: (a: number, b: bigint, c: number, d: number, e: number, f: number, g: number, h: number) => void;
88
- export const limitOrderQuoteByInputToken: (a: number, b: bigint, c: number, d: number, e: number) => void;
89
- export const limitOrderQuoteByOutputToken: (a: number, b: bigint, c: number, d: number, e: number) => void;
90
- export const limitOrderRewardByOutputToken: (a: number, b: bigint, c: number, d: number) => void;
91
- export const decreaseLimitOrderQuote: (a: number, b: number, c: number, d: number, e: bigint, f: number, g: number) => void;
92
- export const _POSITION_BUNDLE_SIZE: () => number;
93
89
  export const _TICK_ARRAY_NOT_EVENLY_SPACED: (a: number) => void;
94
90
  export const _TICK_INDEX_OUT_OF_BOUNDS: (a: number) => void;
95
91
  export const _INVALID_TICK_INDEX: (a: number) => void;
@@ -107,19 +103,7 @@ export const _INVALID_SLIPPAGE_TOLERANCE: (a: number) => void;
107
103
  export const _TICK_INDEX_NOT_IN_ARRAY: (a: number) => void;
108
104
  export const _INVALID_TICK_ARRAY_SEQUENCE: (a: number) => void;
109
105
  export const _LIMIT_ORDER_AND_POOL_ARE_OUT_OF_SYNC: (a: number) => void;
110
- export const firstUnoccupiedPositionInBundle: (a: number, b: number) => number;
111
- export const isPositionBundleFull: (a: number, b: number) => number;
112
- export const isPositionBundleEmpty: (a: number, b: number) => number;
113
- export const isPositionInRange: (a: number, b: number, c: number) => number;
114
- export const positionStatus: (a: number, b: number, c: number) => number;
115
- export const positionRatioX64: (a: number, b: number, c: number) => number;
116
- export const priceToSqrtPrice: (a: number, b: number, c: number) => number;
117
- export const sqrtPriceToPrice: (a: number, b: number, c: number) => number;
118
- export const invertPrice: (a: number, b: number, c: number) => number;
119
- export const tickIndexToPrice: (a: number, b: number, c: number) => number;
120
- export const priceToTickIndex: (a: number, b: number, c: number) => number;
121
- export const collectFeesQuote: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
122
- export const limitOrderFee: (a: number) => number;
106
+ export const _POSITION_BUNDLE_SIZE: () => number;
123
107
  export const _FEE_RATE_MUL_VALUE: () => number;
124
108
  export const _MAX_PROTOCOL_FEE_RATE: () => number;
125
109
  export const _PROTOCOL_FEE_RATE_MUL_VALUE: () => number;
@@ -128,23 +112,40 @@ export const _FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD: () => number;
128
112
  export const _MIN_TICK_INDEX: () => number;
129
113
  export const _MAX_TICK_INDEX: () => number;
130
114
  export const getTickArrayStartTickIndex: (a: number, b: number) => number;
131
- export const tickIndexToSqrtPrice: (a: number) => number;
132
- export const sqrtPriceToTickIndex: (a: number) => number;
115
+ export const tickIndexToSqrtPrice: (a: number, b: number) => void;
116
+ export const sqrtPriceToTickIndex: (a: bigint, b: bigint) => number;
133
117
  export const getInitializableTickIndex: (a: number, b: number, c: number) => number;
134
118
  export const getPrevInitializableTickIndex: (a: number, b: number) => number;
135
119
  export const getNextInitializableTickIndex: (a: number, b: number) => number;
136
120
  export const isTickIndexInBounds: (a: number) => number;
137
121
  export const isTickInitializable: (a: number, b: number) => number;
138
122
  export const invertTickIndex: (a: number) => number;
139
- export const invertSqrtPrice: (a: number) => number;
123
+ export const invertSqrtPrice: (a: number, b: bigint, c: bigint) => void;
140
124
  export const getFullRangeTickIndexes: (a: number) => number;
141
125
  export const orderTickIndexes: (a: number, b: number) => number;
142
126
  export const isFullRangeOnly: (a: number) => number;
143
127
  export const getTickIndexInArray: (a: number, b: number, c: number, d: number) => void;
144
- export const __wasm_bindgen_func_elem_2635: (a: number, b: number, c: number) => void;
145
- export const __wasm_bindgen_func_elem_2654: (a: number, b: number) => void;
146
- export const __wasm_bindgen_func_elem_3208: (a: number, b: number) => void;
147
- export const __wasm_bindgen_func_elem_3204: (a: number, b: number) => void;
128
+ export const collectFeesQuote: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
129
+ export const limitOrderFee: (a: number) => number;
130
+ export const firstUnoccupiedPositionInBundle: (a: number, b: number) => number;
131
+ export const isPositionBundleFull: (a: number, b: number) => number;
132
+ export const isPositionBundleEmpty: (a: number, b: number) => number;
133
+ export const isPositionInRange: (a: bigint, b: bigint, c: number, d: number) => number;
134
+ export const positionStatus: (a: bigint, b: bigint, c: number, d: number) => number;
135
+ export const positionRatioX64: (a: bigint, b: bigint, c: number, d: number) => number;
136
+ export const priceToSqrtPrice: (a: number, b: number, c: number, d: number) => void;
137
+ export const sqrtPriceToPrice: (a: bigint, b: bigint, c: number, d: number) => number;
138
+ export const invertPrice: (a: number, b: number, c: number) => number;
139
+ export const tickIndexToPrice: (a: number, b: number, c: number) => number;
140
+ export const priceToTickIndex: (a: number, b: number, c: number) => number;
141
+ export const limitOrderQuoteByInputToken: (a: number, b: bigint, c: number, d: number, e: number) => void;
142
+ export const limitOrderQuoteByOutputToken: (a: number, b: bigint, c: number, d: number, e: number) => void;
143
+ export const limitOrderRewardByOutputToken: (a: number, b: bigint, c: number, d: number) => void;
144
+ export const decreaseLimitOrderQuote: (a: number, b: number, c: number, d: number, e: bigint, f: number, g: number) => void;
145
+ export const __wasm_bindgen_func_elem_2634: (a: number, b: number, c: number) => void;
146
+ export const __wasm_bindgen_func_elem_2653: (a: number, b: number) => void;
147
+ export const __wasm_bindgen_func_elem_3207: (a: number, b: number) => void;
148
+ export const __wasm_bindgen_func_elem_3203: (a: number, b: number) => void;
148
149
  export const __wasm_bindgen_func_elem_495: (a: number, b: number, c: number, d: number) => void;
149
150
  export const __wbindgen_export: (a: number, b: number) => number;
150
151
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
@@ -1,133 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Calculate the amount A delta between two sqrt_prices
5
- *
6
- * # Parameters
7
- * - `sqrt_price_1`: The first square root price
8
- * - `sqrt_price_2`: The second square root price
9
- * - `liquidity`: The liquidity
10
- * - `round_up`: Whether to round up or not
11
- *
12
- * # Returns
13
- * - `u64`: The amount delta
14
- */
15
- export function tryGetAmountDeltaA(sqrt_price_1: bigint, sqrt_price_2: bigint, liquidity: bigint, round_up: boolean): bigint;
16
- /**
17
- * Calculate the amount B delta between two sqrt_prices
18
- *
19
- * # Parameters
20
- * - `sqrt_price_1`: The first square root price
21
- * - `sqrt_price_2`: The second square root price
22
- * - `liquidity`: The liquidity
23
- * - `round_up`: Whether to round up or not
24
- *
25
- * # Returns
26
- * - `u64`: The amount delta
27
- */
28
- export function tryGetAmountDeltaB(sqrt_price_1: bigint, sqrt_price_2: bigint, liquidity: bigint, round_up: boolean): bigint;
29
- /**
30
- * Calculate the next square root price
31
- *
32
- * # Parameters
33
- * - `current_sqrt_price`: The current square root price
34
- * - `current_liquidity`: The current liquidity
35
- * - `amount`: The amount
36
- * - `specified_input`: Whether the input is specified
37
- *
38
- * # Returns
39
- * - `u128`: The next square root price
40
- */
41
- export function tryGetNextSqrtPriceFromA(current_sqrt_price: bigint, current_liquidity: bigint, amount: bigint, specified_input: boolean): bigint;
42
- /**
43
- * Calculate the next square root price
44
- *
45
- * # Parameters
46
- * - `current_sqrt_price`: The current square root price
47
- * - `current_liquidity`: The current liquidity
48
- * - `amount`: The amount
49
- * - `specified_input`: Whether the input is specified
50
- *
51
- * # Returns
52
- * - `u128`: The next square root price
53
- */
54
- export function tryGetNextSqrtPriceFromB(current_sqrt_price: bigint, current_liquidity: bigint, amount: bigint, specified_input: boolean): bigint;
55
- /**
56
- * Apply a transfer fee to an amount
57
- * e.g. You send 10000 amount with 100 fee rate. The fee amount will be 100.
58
- * So the amount after fee will be 9900.
59
- *
60
- * # Parameters
61
- * - `amount`: The amount to apply the fee to
62
- * - `transfer_fee`: The transfer fee to apply
63
- *
64
- * # Returns
65
- * - `u64`: The amount after the fee has been applied
66
- */
67
- export function tryApplyTransferFee(amount: bigint, transfer_fee: TransferFee): bigint;
68
- /**
69
- * Reverse the application of a transfer fee to an amount
70
- * e.g. You received 9900 amount with 100 fee rate. The fee amount will be 100.
71
- * So the amount before fee will be 10000.
72
- *
73
- * # Parameters
74
- * - `amount`: The amount to reverse the fee from
75
- * - `transfer_fee`: The transfer fee to reverse
76
- *
77
- * # Returns
78
- * - `u64`: The amount before the fee has been applied
79
- */
80
- export function tryReverseApplyTransferFee(amount: bigint, transfer_fee: TransferFee): bigint;
81
- /**
82
- * Get the maximum amount with a slippage tolerance
83
- * e.g. Your estimated amount you send is 10000 with 100 slippage tolerance. The max you send will be 10100.
84
- *
85
- * # Parameters
86
- * - `amount`: The amount to apply the fee to
87
- * - `slippage_tolerance_bps`: The slippage tolerance in bps (should be in range 0..BPS_DENOMINATOR)
88
- *
89
- * # Returns
90
- * - `u64`: The maximum amount
91
- */
92
- export function tryGetMaxAmountWithSlippageTolerance(amount: bigint, slippage_tolerance_bps: number): bigint;
93
- /**
94
- * Get the minimum amount with a slippage tolerance
95
- * e.g. Your estimated amount you receive is 10000 with 100 slippage tolerance. The min amount you receive will be 9900.
96
- *
97
- * # Parameters
98
- * - `amount`: The amount to apply the fee to
99
- * - `slippage_tolerance_bps`: The slippage tolerance in bps (should be in range 0..BPS_DENOMINATOR)
100
- *
101
- * # Returns
102
- * - `u64`: The minimum amount
103
- */
104
- export function tryGetMinAmountWithSlippageTolerance(amount: bigint, slippage_tolerance_bps: number): bigint;
105
- /**
106
- * Apply a swap fee to an amount
107
- * e.g. You send 10000 amount with 10000 fee rate. The fee amount will be 100.
108
- * So the amount after fee will be 9900.
109
- *
110
- * # Parameters
111
- * - `amount`: The amount to apply the fee to
112
- * - `fee_rate`: The fee rate to apply denominated in 1e6
113
- *
114
- * # Returns
115
- * - `u64`: The amount after the fee has been applied
116
- */
117
- export function tryApplySwapFee(amount: bigint, fee_rate: number): bigint;
118
- /**
119
- * Reverse the application of a swap fee to an amount
120
- * e.g. You received 9900 amount with 10000 fee rate. The fee amount will be 100.
121
- * So the amount before fee will be 10000.
122
- *
123
- * # Parameters
124
- * - `amount`: The amount to reverse the fee from
125
- * - `fee_rate`: The fee rate to reverse denominated in 1e6
126
- *
127
- * # Returns
128
- * - `u64`: The amount before the fee has been applied
129
- */
130
- export function tryReverseApplySwapFee(amount: bigint, fee_rate: number): bigint;
3
+ export function _POSITION_BUNDLE_SIZE(): number;
131
4
  export function _FEE_RATE_MUL_VALUE(): number;
132
5
  export function _MAX_PROTOCOL_FEE_RATE(): number;
133
6
  export function _PROTOCOL_FEE_RATE_MUL_VALUE(): number;
@@ -394,7 +267,8 @@ export function tryGetLiquidityFromA(token_delta_a: bigint, sqrt_price_lower: bi
394
267
  export function tryGetTokenAFromLiquidity(liquidity_delta: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint, round_up: boolean): bigint;
395
268
  export function tryGetLiquidityFromB(token_delta_b: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint): bigint;
396
269
  export function tryGetTokenBFromLiquidity(liquidity_delta: bigint, sqrt_price_lower: bigint, sqrt_price_upper: bigint, round_up: boolean): bigint;
397
- export function tryGetTokenEstimatesFromLiquidity(liquidity_delta: bigint, current_sqrt_price: bigint, tick_lower_index: number, tick_upper_index: number, round_up: boolean): TokenPair;
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;
398
272
  /**
399
273
  * Calculate fees owed for a position
400
274
  *
@@ -411,6 +285,134 @@ export function tryGetTokenEstimatesFromLiquidity(liquidity_delta: bigint, curre
411
285
  */
412
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;
413
287
  export function limitOrderFee(fusion_pool: FusionPoolFacade): number;
288
+ /**
289
+ * Calculate the amount A delta between two sqrt_prices
290
+ *
291
+ * # Parameters
292
+ * - `sqrt_price_1`: The first square root price
293
+ * - `sqrt_price_2`: The second square root price
294
+ * - `liquidity`: The liquidity
295
+ * - `round_up`: Whether to round up or not
296
+ *
297
+ * # Returns
298
+ * - `u64`: The amount delta
299
+ */
300
+ export function tryGetAmountDeltaA(sqrt_price_1: bigint, sqrt_price_2: bigint, liquidity: bigint, round_up: boolean): bigint;
301
+ /**
302
+ * Calculate the amount B delta between two sqrt_prices
303
+ *
304
+ * # Parameters
305
+ * - `sqrt_price_1`: The first square root price
306
+ * - `sqrt_price_2`: The second square root price
307
+ * - `liquidity`: The liquidity
308
+ * - `round_up`: Whether to round up or not
309
+ *
310
+ * # Returns
311
+ * - `u64`: The amount delta
312
+ */
313
+ export function tryGetAmountDeltaB(sqrt_price_1: bigint, sqrt_price_2: bigint, liquidity: bigint, round_up: boolean): bigint;
314
+ /**
315
+ * Calculate the next square root price
316
+ *
317
+ * # Parameters
318
+ * - `current_sqrt_price`: The current square root price
319
+ * - `current_liquidity`: The current liquidity
320
+ * - `amount`: The amount
321
+ * - `specified_input`: Whether the input is specified
322
+ *
323
+ * # Returns
324
+ * - `u128`: The next square root price
325
+ */
326
+ export function tryGetNextSqrtPriceFromA(current_sqrt_price: bigint, current_liquidity: bigint, amount: bigint, specified_input: boolean): bigint;
327
+ /**
328
+ * Calculate the next square root price
329
+ *
330
+ * # Parameters
331
+ * - `current_sqrt_price`: The current square root price
332
+ * - `current_liquidity`: The current liquidity
333
+ * - `amount`: The amount
334
+ * - `specified_input`: Whether the input is specified
335
+ *
336
+ * # Returns
337
+ * - `u128`: The next square root price
338
+ */
339
+ export function tryGetNextSqrtPriceFromB(current_sqrt_price: bigint, current_liquidity: bigint, amount: bigint, specified_input: boolean): bigint;
340
+ /**
341
+ * Apply a transfer fee to an amount
342
+ * e.g. You send 10000 amount with 100 fee rate. The fee amount will be 100.
343
+ * So the amount after fee will be 9900.
344
+ *
345
+ * # Parameters
346
+ * - `amount`: The amount to apply the fee to
347
+ * - `transfer_fee`: The transfer fee to apply
348
+ *
349
+ * # Returns
350
+ * - `u64`: The amount after the fee has been applied
351
+ */
352
+ export function tryApplyTransferFee(amount: bigint, transfer_fee: TransferFee): bigint;
353
+ /**
354
+ * Reverse the application of a transfer fee to an amount
355
+ * e.g. You received 9900 amount with 100 fee rate. The fee amount will be 100.
356
+ * So the amount before fee will be 10000.
357
+ *
358
+ * # Parameters
359
+ * - `amount`: The amount to reverse the fee from
360
+ * - `transfer_fee`: The transfer fee to reverse
361
+ *
362
+ * # Returns
363
+ * - `u64`: The amount before the fee has been applied
364
+ */
365
+ export function tryReverseApplyTransferFee(amount: bigint, transfer_fee: TransferFee): bigint;
366
+ /**
367
+ * Get the maximum amount with a slippage tolerance
368
+ * e.g. Your estimated amount you send is 10000 with 100 slippage tolerance. The max you send will be 10100.
369
+ *
370
+ * # Parameters
371
+ * - `amount`: The amount to apply the fee to
372
+ * - `slippage_tolerance_bps`: The slippage tolerance in bps (should be in range 0..BPS_DENOMINATOR)
373
+ *
374
+ * # Returns
375
+ * - `u64`: The maximum amount
376
+ */
377
+ export function tryGetMaxAmountWithSlippageTolerance(amount: bigint, slippage_tolerance_bps: number): bigint;
378
+ /**
379
+ * Get the minimum amount with a slippage tolerance
380
+ * e.g. Your estimated amount you receive is 10000 with 100 slippage tolerance. The min amount you receive will be 9900.
381
+ *
382
+ * # Parameters
383
+ * - `amount`: The amount to apply the fee to
384
+ * - `slippage_tolerance_bps`: The slippage tolerance in bps (should be in range 0..BPS_DENOMINATOR)
385
+ *
386
+ * # Returns
387
+ * - `u64`: The minimum amount
388
+ */
389
+ export function tryGetMinAmountWithSlippageTolerance(amount: bigint, slippage_tolerance_bps: number): bigint;
390
+ /**
391
+ * Apply a swap fee to an amount
392
+ * e.g. You send 10000 amount with 10000 fee rate. The fee amount will be 100.
393
+ * So the amount after fee will be 9900.
394
+ *
395
+ * # Parameters
396
+ * - `amount`: The amount to apply the fee to
397
+ * - `fee_rate`: The fee rate to apply denominated in 1e6
398
+ *
399
+ * # Returns
400
+ * - `u64`: The amount after the fee has been applied
401
+ */
402
+ export function tryApplySwapFee(amount: bigint, fee_rate: number): bigint;
403
+ /**
404
+ * Reverse the application of a swap fee to an amount
405
+ * e.g. You received 9900 amount with 10000 fee rate. The fee amount will be 100.
406
+ * So the amount before fee will be 10000.
407
+ *
408
+ * # Parameters
409
+ * - `amount`: The amount to reverse the fee from
410
+ * - `fee_rate`: The fee rate to reverse denominated in 1e6
411
+ *
412
+ * # Returns
413
+ * - `u64`: The amount before the fee has been applied
414
+ */
415
+ export function tryReverseApplySwapFee(amount: bigint, fee_rate: number): bigint;
414
416
  /**
415
417
  * Computes the limit order output amount by input amount.
416
418
  * ### Parameters
@@ -439,24 +441,6 @@ export function limitOrderQuoteByOutputToken(amount_out: bigint, a_to_b_order: b
439
441
  */
440
442
  export function limitOrderRewardByOutputToken(amount_out: bigint, fee_rate: number, protocol_fee_rate: number): bigint;
441
443
  export function decreaseLimitOrderQuote(fusion_pool: FusionPoolFacade, limit_order: LimitOrderFacade, tick: TickFacade, amount: bigint, transfer_fee_a?: TransferFee | null, transfer_fee_b?: TransferFee | null): LimitOrderDecreaseQuote;
442
- export function _POSITION_BUNDLE_SIZE(): number;
443
- export function _TICK_ARRAY_NOT_EVENLY_SPACED(): string;
444
- export function _TICK_INDEX_OUT_OF_BOUNDS(): string;
445
- export function _INVALID_TICK_INDEX(): string;
446
- export function _ARITHMETIC_OVERFLOW(): string;
447
- export function _AMOUNT_EXCEEDS_MAX_U64(): string;
448
- export function _AMOUNT_EXCEEDS_LIMIT_ORDER_INPUT_AMOUNT(): string;
449
- export function _SQRT_PRICE_OUT_OF_BOUNDS(): string;
450
- export function _TICK_SEQUENCE_EMPTY(): string;
451
- export function _SQRT_PRICE_LIMIT_OUT_OF_BOUNDS(): string;
452
- export function _INVALID_SQRT_PRICE_LIMIT_DIRECTION(): string;
453
- export function _ZERO_TRADABLE_AMOUNT(): string;
454
- export function _INVALID_TIMESTAMP(): string;
455
- export function _INVALID_TRANSFER_FEE(): string;
456
- export function _INVALID_SLIPPAGE_TOLERANCE(): string;
457
- export function _TICK_INDEX_NOT_IN_ARRAY(): string;
458
- export function _INVALID_TICK_ARRAY_SEQUENCE(): string;
459
- export function _LIMIT_ORDER_AND_POOL_ARE_OUT_OF_SYNC(): string;
460
444
  /**
461
445
  * Get the first unoccupied position in a bundle
462
446
  *
@@ -599,6 +583,23 @@ export function tickIndexToPrice(tick_index: number, decimals_a: number, decimal
599
583
  * * `i32` - The tick index
600
584
  */
601
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;
602
603
  /**
603
604
  * Computes the exact input or output amount for a swap transaction.
604
605
  *
@@ -694,14 +695,14 @@ export function getDecreaseSpotPositionQuote(decrease_amount: bigint, collateral
694
695
  *
695
696
  * # Parameters
696
697
  * - `position_token`: Token of the position
697
- * - `amount`: Position total size (decimal)
698
- * - `debt`: Position total debt (decimal)
699
- * - `liquidation_threshold`: Liquidation threshold of the market (decimal)
698
+ * - `amount`: Position total size
699
+ * - `debt`: Position total debt
700
+ * - `liquidation_threshold`: Liquidation threshold of a market
700
701
  *
701
702
  * # Returns
702
703
  * - `f64`: Decimal liquidation price
703
704
  */
704
- export function getSpotPositionLiquidationPrice(position_token: number, amount: number, debt: number, liquidation_threshold: number): number;
705
+ export function getSpotPositionLiquidationPrice(position_token: number, amount: bigint, debt: bigint, liquidation_threshold: number): number;
705
706
  /**
706
707
  * Calculates the maximum tradable amount in the collateral token.
707
708
  *
@@ -762,6 +763,16 @@ export interface FusionPoolFacade {
762
763
  olpFeeOwedB: bigint;
763
764
  }
764
765
 
766
+ export interface CollectFeesQuote {
767
+ feeOwedA: bigint;
768
+ feeOwedB: bigint;
769
+ }
770
+
771
+ export interface TokenPair {
772
+ a: bigint;
773
+ b: bigint;
774
+ }
775
+
765
776
  export interface LimitOrderDecreaseQuote {
766
777
  amountOutA: bigint;
767
778
  amountOutB: bigint;
@@ -776,9 +787,9 @@ export interface LimitOrderFacade {
776
787
  age: bigint;
777
788
  }
778
789
 
779
- export interface TokenPair {
780
- a: bigint;
781
- b: bigint;
790
+ export interface TransferFee {
791
+ feeBps: number;
792
+ maxFee: bigint;
782
793
  }
783
794
 
784
795
  export interface PositionFacade {
@@ -798,6 +809,22 @@ export interface PositionRatio {
798
809
  ratioB: bigint;
799
810
  }
800
811
 
812
+ export interface IncreaseLiquidityQuote {
813
+ liquidityDelta: bigint;
814
+ tokenEstA: bigint;
815
+ tokenEstB: bigint;
816
+ tokenMaxA: bigint;
817
+ tokenMaxB: bigint;
818
+ }
819
+
820
+ export interface DecreaseLiquidityQuote {
821
+ liquidityDelta: bigint;
822
+ tokenEstA: bigint;
823
+ tokenEstB: bigint;
824
+ tokenMinA: bigint;
825
+ tokenMinB: bigint;
826
+ }
827
+
801
828
  export interface TickArrayFacade {
802
829
  startTickIndex: number;
803
830
  ticks: TickFacade[];
@@ -822,32 +849,6 @@ export interface TickRange {
822
849
  tickUpperIndex: number;
823
850
  }
824
851
 
825
- export interface IncreaseLiquidityQuote {
826
- liquidityDelta: bigint;
827
- tokenEstA: bigint;
828
- tokenEstB: bigint;
829
- tokenMaxA: bigint;
830
- tokenMaxB: bigint;
831
- }
832
-
833
- export interface DecreaseLiquidityQuote {
834
- liquidityDelta: bigint;
835
- tokenEstA: bigint;
836
- tokenEstB: bigint;
837
- tokenMinA: bigint;
838
- tokenMinB: bigint;
839
- }
840
-
841
- export interface CollectFeesQuote {
842
- feeOwedA: bigint;
843
- feeOwedB: bigint;
844
- }
845
-
846
- export interface TransferFee {
847
- feeBps: number;
848
- maxFee: bigint;
849
- }
850
-
851
852
  export interface IncreaseLpPositionQuoteResult {
852
853
  collateralA: bigint;
853
854
  collateralB: bigint;
@@ -864,6 +865,8 @@ export interface IncreaseLpPositionQuoteResult {
864
865
  swapAToB: boolean;
865
866
  protocolFeeA: bigint;
866
867
  protocolFeeB: bigint;
868
+ liquidationLowerPrice: number;
869
+ liquidationUpperPrice: number;
867
870
  }
868
871
 
869
872
  export interface IncreaseLpPositionQuoteArgs {
@@ -878,6 +881,7 @@ export interface IncreaseLpPositionQuoteArgs {
878
881
  tickLowerIndex: number;
879
882
  tickUpperIndex: number;
880
883
  maxAmountSlippage: number;
884
+ liquidationThreshold: number;
881
885
  }
882
886
 
883
887
  export interface LiquidationPrices {