Skip to main content

Type Reference

These TypeScript interfaces mirror the on-chain account structures from the CCA V2 program IDL. Import them from @runner-protocol/sdk.

AuctionConfig

The immutable configuration for an auction, set at initialization.

interface AuctionConfig {
authority: PublicKey; // Admin authority that created the auction
auctionId: bigint; // Sequential auction ID (u64)
baseMint: PublicKey; // Token being auctioned (base token)
quoteMint: PublicKey; // Currency used for bidding (quote token)
totalSupply: bigint; // Total base tokens available (u64)
floorPrice: bigint; // Minimum clearing price, Q96-encoded (u128)
maxBidPrice: bigint; // Maximum allowed bid price, Q96-encoded (u128)
tickSpacing: number; // Minimum price increment between ticks (u32)
startSlot: bigint; // Solana slot when auction begins (u64)
endSlot: bigint; // Solana slot when auction ends (u64)
claimSlot: bigint; // Slot after which tokens can be claimed (u64)
requiredCurrencyRaised: bigint; // Currency threshold for graduation, Q96-encoded (u128)
fundsRecipient: PublicKey; // Receives auction proceeds after settlement
tokensRecipient: PublicKey; // Receives unsold tokens after settlement
supplyScheduleAccount: PublicKey; // Associated supply schedule PDA
auctionBlockInterval: bigint; // Slots per auction block (u64)
minBidAmount: bigint; // Minimum bid size in quote currency (u64)
minNewTickAmount: bigint; // Minimum amount to create a new tick (u64)
maxTicks: number; // Maximum number of tick accounts (u32)
tokensReceived: boolean; // Whether base tokens have been deposited
graduated: boolean; // Whether the auction has graduated
bump: number; // PDA bump seed (u8)
reserved: Uint8Array; // Reserved space for future upgrades [u8; 40]
}

AuctionState

Mutable auction state that updates as bids are placed and checkpoints resolve.

interface AuctionState {
auctionConfig: PublicKey; // Parent auction config
clearingPrice: bigint; // Current clearing price, Q96-encoded (u128)
sumCurrencyDemandAboveClearing: Uint8Array; // Total demand above clearing (U256 as [u8; 32])
nextActiveTickPrice: bigint; // Next tick price in the linked list (u128)
currentStepIndex: number; // Current supply schedule step index (u32)
cumulativeMps: number; // Cumulative milli-basis points unlocked (u32)
currencyRaisedQ96X7: Uint8Array; // Currency raised in Q96*7 precision (U256 as [u8; 32])
currencyRaised: Uint8Array; // Total currency raised (U256 as [u8; 32])
currencyRaisedAtClearingPrice: Uint8Array; // Currency raised at clearing price (U256 as [u8; 32])
latestCheckpointSlot: bigint; // Slot of most recent checkpoint (u64)
latestCheckpointAuctionBlock: bigint; // Auction block of most recent checkpoint (u64)
checkpointCount: bigint; // Total checkpoints created (u64)
totalBids: bigint; // Total bids placed (u64)
totalTicks: number; // Total tick accounts created (u32)
totalClearedQ96X7: Uint8Array; // Total tokens cleared in Q96*7 (U256 as [u8; 32])
currencySwept: boolean; // Whether currency has been swept from the vault
tokensSwept: boolean; // Whether tokens have been swept from the vault
bump: number; // PDA bump seed (u8)
reserved: Uint8Array; // Reserved space [u8; 64]
}
note

Fields typed as Uint8Array with [u8; 32] are U256 values stored in little-endian byte order. Use decodeU256 from the SDK to convert them to bigint.

SupplySchedule

Defines how tokens are released over time during the auction.

interface SupplySchedule {
auctionConfig: PublicKey; // Parent auction config
numSteps: number; // Number of supply steps (u16)
totalBlocks: bigint; // Total auction blocks across all steps (u64)
steps: SupplyStep[]; // Array of supply release steps
bump: number; // PDA bump seed (u8)
reserved: Uint8Array; // Reserved space [u8; 32]
}

SupplyStep

A single step in the supply schedule.

interface SupplyStep {
mps: number; // Milli-basis points of supply released per block (u32)
blockDelta: bigint; // Duration of this step in auction blocks (u64)
startBlock: bigint; // First auction block of this step (u64)
endBlock: bigint; // Last auction block of this step (u64)
}

SupplyStepInput

Input format for creating supply steps (without computed start/end blocks).

interface SupplyStepInput {
mps: number; // Milli-basis points per block (u32)
blockDelta: bigint; // Duration in auction blocks (u64)
}

Tick

Represents a price level in the auction's tick linked list.

interface Tick {
auctionConfig: PublicKey; // Parent auction config
price: bigint; // This tick's price, Q96-encoded (u128)
currencyDemandQ96: Uint8Array; // Total demand at this price level (U256 as [u8; 32])
nextTickPrice: bigint; // Price of the next tick in the linked list (u128)
isInitialized: boolean; // Whether this tick has been activated
bump: number; // PDA bump seed (u8)
reserved: Uint8Array; // Reserved space [u8; 32]
}

CheckpointStatus

Enum representing the lifecycle state of a checkpoint.

enum CheckpointStatus {
Uninitialized = 0, // Checkpoint has not been created
Resolving = 1, // Checkpoint is being resolved (tick iteration in progress)
Finalized = 2, // Checkpoint is fully resolved
}

Checkpoint

A snapshot of auction state at a specific auction block boundary.

interface Checkpoint {
auctionConfig: PublicKey; // Parent auction config
auctionBlock: bigint; // The auction block this checkpoint covers (u64)
slot: bigint; // Solana slot when this checkpoint was created (u64)
clearingPrice: bigint; // Clearing price at this auction block, Q96-encoded (u128)
cumulativeMps: number; // Cumulative supply unlocked at this block (u32)
cumulativeMpsPerPrice: Uint8Array; // (U256 as [u8; 32])
currencyRaisedAtClearingPriceQ96X7: Uint8Array; // (U256 as [u8; 32])
prevCheckpointAuctionBlock: bigint; // Previous checkpoint's auction block (u64)
nextCheckpointAuctionBlock: bigint; // Next checkpoint's auction block (u64)
status: CheckpointStatus; // Current status (Uninitialized/Resolving/Finalized)
deltaMpsApplied: boolean; // Whether supply delta has been applied
resolvingSumDemandAbove: Uint8Array; // Working state during resolution (U256 as [u8; 32])
resolvingNextActiveTick: bigint; // Working state during resolution (u128)
isInitialized: boolean; // Whether the checkpoint account exists
bump: number; // PDA bump seed (u8)
resolvingLastTickPrice: bigint; // Working state during resolution (u128)
resolvingLastTickDemand: Uint8Array; // Working state during resolution (U256 as [u8; 32])
reserved: Uint8Array; // Reserved space [u8; 16]
}

Bid

Represents a single bid in an auction.

interface Bid {
auctionConfig: PublicKey; // Parent auction config
bidId: bigint; // Sequential bid ID within the auction (u64)
owner: PublicKey; // Wallet that placed the bid
maxPrice: bigint; // Maximum price willing to pay, Q96-encoded (u128)
amountQ96: Uint8Array; // Bid amount in Q96 precision (U256 as [u8; 32])
rawAmount: bigint; // Original bid amount in atomic units (u64)
startSlot: bigint; // Solana slot when bid was placed (u64)
startAuctionBlock: bigint; // Auction block when bid was placed (u64)
startCumulativeMps: number; // Cumulative MPS at time of bid (u32)
exitedSlot: bigint; // Slot when bid was exited, 0 if still active (u64)
tokensFilled: bigint; // Base tokens filled for this bid (u64)
currencySpent: bigint; // Quote currency spent by this bid (u64)
bump: number; // PDA bump seed (u8)
reserved: Uint8Array; // Reserved space [u8; 32]
}
tip

To check if a bid is still active, verify exitedSlot === 0n. To check if it has been filled, check tokensFilled > 0n.