• Applies a slippage tolerance to an expected output amount to derive a minAmountOutScaled value suitable for the V2 swap instruction.

    Returns

    The minimum acceptable output amount

    Example

    const quote = getSwapResult(bucket, 1_000_000n, SwapDirection.Buy);
    const minOut = applySlippage(quote.amountOut, 200); // 2% slippage

    Parameters

    • expectedAmountOut: bigint

      The expected output from getSwapResult

    • slippageBps: number

      Slippage tolerance in basis points (e.g. 50 = 0.5%, 200 = 2%)

    Returns bigint

Generated using TypeDoc