• Calculate the output amount for a given input amount on a bonding curve. This function determines how much of the output asset you'll receive for a given input amount. This function does not take into account fees.

    Returns

    The output amount you'll receive from the swap

    Throws

    Error if the bonding curve type is unsupported or calculation errors occur

    Parameters

    • bucket: BondingCurveBucketV1

      The bonding curve bucket containing reserves and parameters

    • amountIn: bigint

      The input amount to swap

    • direction: SwapDirection

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

    Returns bigint

Generated using TypeDoc