• Calculate the input amount needed to receive a desired output amount on a bonding curve. This function determines how much of the input asset you need to provide to get a specific output amount. This function does not take into account fees.

    Returns

    The input amount required to achieve the desired output

    Throws

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

    Parameters

    • bucket: BondingCurveBucketV1

      The bonding curve bucket containing reserves and parameters

    • amountOut: bigint

      The desired output amount to receive

    • direction: SwapDirection

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

    Returns bigint

Generated using TypeDoc