• Calculates the winning bids for an auction based on clearing price and token allocation.

    This function determines which bids win tokens in the auction by:

    1. Finding all bids at or above the clearing price
    2. Sorting them by price (highest first) and bid number (earliest first for ties)
    3. Allocating tokens until the supply is exhausted

    Returns

    Array of winning bids in order of priority

    Example

    const tree = await fetchAuctionAVLTreeV1(umi, treePda);
    const clearingPrice = lamportsToMicroLamports(500_000_000); // 0.5 SOL
    const tokenSupply = 1_000_000n;
    const winners = calculateAuctionWinners(tree, clearingPrice, tokenSupply);

    Parameters

    • tree: AuctionAVLTreeV1

      The auction AVL tree containing all bids

    • clearingPriceULamports: bigint

      The clearing price in micro-lamports

    • tokenAllocation: bigint

      The total number of tokens available for distribution

    Returns TreeBid[]

Generated using TypeDoc