import { GalaChainContext } from "@gala-chain/chaincode"; import BigNumber from "bignumber.js"; import { Pool, SwapState, TickData } from "../../api/"; /** * Processes swap steps through liquidity ticks until the swap is complete or hits price limits. * * This function implements the core logic for executing token swaps in a concentrated liquidity pool. * It iterates through price ticks, computing swap amounts at each step while respecting: * - Available liquidity at each tick * - Protocol and liquidity provider fees * - Price impact and slippage limits * - Exact input vs exact output semantics * * The implementation uses async recursion with setImmediate to yield control back to the * Node.js event loop periodically, preventing CPU starvation during large swaps that may * cross many ticks. The chunk size parameter controls how many steps are processed before * each yield. * * @param ctx - The GalaChain context for blockchain operations (null for offline mode) * @param state - Current swap state including price, liquidity, and remaining amounts * @param pool - The liquidity pool being traded against * @param sqrtPriceLimit - Maximum price impact allowed (slippage protection) * @param exactInput - Whether this is an exact input (true) or exact output (false) swap * @param zeroForOne - Swap direction: token0→token1 (true) or token1→token0 (false) * @param tickDataMap - Optional map of tick data for offline calculations * @param chunkSize - Number of steps to process before yielding (default: 1) * @returns Updated swap state after processing all possible steps * @throws ConflictError when insufficient liquidity is available */ export declare function processSwapSteps(ctx: GalaChainContext | null, state: SwapState, pool: Pool, sqrtPriceLimit: BigNumber, exactInput: boolean, zeroForOne: boolean, tickDataMap?: Record, chunkSize?: number): Promise; //# sourceMappingURL=swap.helper.d.ts.map