UNPKG

@flaunch/sdk

Version:

Flaunch SDK to easily interact with the Flaunch protocol

79 lines 2.93 kB
import { PoolKey } from "../types"; export declare const TickFinder: { MIN_TICK: number; MAX_TICK: number; }; export declare const Q96: bigint; export declare const Q192: bigint; export declare const TICK_SPACING = 60; export declare const getPoolId: (poolKey: PoolKey) => `0x${string}`; export declare const orderPoolKey: (poolKey: PoolKey) => { currency0: `0x${string}`; currency1: `0x${string}`; fee: number; tickSpacing: number; hooks: import("abitype").Address; }; export declare const getValidTick: ({ tick, tickSpacing, roundDown, }: { tick: number; tickSpacing: number; roundDown?: boolean; }) => number; export declare const getNearestUsableTick: ({ tick, tickSpacing, }: { tick: number; tickSpacing: number; }) => number; export declare const getSqrtPriceX96FromTick: (tick: number) => bigint; export declare const calculateUnderlyingTokenBalances: (liquidity: bigint, tickLower: number, tickUpper: number, tickCurrent: number) => { amount0: bigint; amount1: bigint; }; export declare const priceRatioToTick: ({ priceInput, isDirection1Per0, decimals0, decimals1, spacing, shouldGetNearestUsableTick, }: { priceInput: string; isDirection1Per0: boolean; decimals0: number; decimals1: number; spacing: number; shouldGetNearestUsableTick?: boolean; }) => number; /** * Accurate liquidity calculation using proper Uniswap v3/v4 math */ export declare const getLiquidityFromAmounts: (params: { currentTick: number; tickLower: number; tickUpper: number; amount0: bigint; amount1: bigint; }) => bigint; /** * Returns a precise maximum amount of liquidity received for a given amount of token 0 by dividing by Q64 instead of Q96 in the intermediate step, * and shifting the subtracted ratio left by 32 bits. * @param sqrtRatioAX96 The price at the lower boundary * @param sqrtRatioBX96 The price at the upper boundary * @param amount0 The token0 amount * @returns liquidity for amount0, precise */ export declare function maxLiquidityForAmount0Precise(sqrtRatioAX96: bigint, sqrtRatioBX96: bigint, amount0: bigint): bigint; /** * Computes the maximum amount of liquidity received for a given amount of token1 * @param sqrtRatioAX96 The price at the lower tick boundary * @param sqrtRatioBX96 The price at the upper tick boundary * @param amount1 The token1 amount * @returns liquidity for amount1 */ export declare function maxLiquidityForAmount1(sqrtRatioAX96: bigint, sqrtRatioBX96: bigint, amount1: bigint): bigint; /** * Calculate the actual amounts needed for a given liquidity * This prevents MaximumAmountExceeded errors by ensuring we provide sufficient maximums */ export declare const getAmountsForLiquidity: (params: { currentTick: number; tickLower: number; tickUpper: number; liquidity: bigint; }) => { amount0: bigint; amount1: bigint; }; //# sourceMappingURL=univ4.d.ts.map