• Calculates the complete swap result including fees for a bonding curve swap.

    Returns

    An object containing the actual input amount, fee, and output amount

    Throws

    Error if the bucket has insufficient reserves or calculation errors occur

    Parameters

    • bucket: BondingCurveBucketV1

      The bonding curve bucket

    • amountIn: bigint

      The input amount (before fees)

    • swapDirection: SwapDirection

      The swap direction (Buy = SOL in, tokens out; Sell = tokens in, SOL out)

    Returns {
        amountIn: bigint;
        amountOut: bigint;
        fee: bigint;
    }

    • amountIn: bigint
    • amountOut: bigint
    • fee: bigint

Generated using TypeDoc