import { Connection, Keypair, PublicKey, TransactionInstruction } from "@solana/web3.js"; /** Maturity tag for the sortition path (canonical on devnet). */ export declare const SORTITION_MATURITY: "canonical-devnet"; /** * Maturity tag for the Unicorn-G entropy path: canonical but opt-in. The default * entropy source remains SlotHashes; Unicorn-G is selected explicitly per draw * and relies on a Groth16 trusted setup (devnet RSA modulus). */ export declare const UNICORN_G_MATURITY: "canonical-opt-in"; /** Sortition standard version (v1.4.0). */ export declare const SORTITION_STANDARD_VERSION: "1.4.0"; /** Sortition economics standard version (v1.4.1). */ export declare const SORTITION_ECONOMICS_VERSION: "1.4.1"; /** Canonical devnet program id that carries the full protocol. */ export declare const CANONICAL_PROGRAM_ID = "6QtLot4uztCfjUuPreoiYPc3e1gH2fg6pq8hKYyvCP6B"; /** Default program id for sortition builders (canonical). */ export declare const SORTITION_PROGRAM_ID = "6QtLot4uztCfjUuPreoiYPc3e1gH2fg6pq8hKYyvCP6B"; /** fee_mode bitflags (mirror programs/outcome state/sortition.rs). */ export declare const SORTITION_FEE_ENTRY: number; export declare const SORTITION_FEE_CLOSE_SKIM: number; export declare function sha256(...parts: Array): Buffer; export declare function deriveSortitionDrawPda(programId: PublicKey, drawId: Buffer): PublicKey; export declare function deriveSortitionTicketPda(programId: PublicKey, drawId: Buffer, ticketId: Buffer): PublicKey; export declare function deriveProgramConfigPda(programId: PublicKey): PublicKey; /** commitment = sha256(secret || ticket_id || draw_id). */ export declare function sortitionCommitment(secret: Buffer, ticketId: Buffer, drawId: Buffer): Buffer; /** Winning predicate: sha256(secret || omega) < threshold (big-endian). */ export declare function sortitionWins(secret: Buffer, omega: Buffer, threshold: Buffer): boolean; /** threshold = floor(2^256 * numerator / denominator), as a 32-byte big-endian value. */ export declare function sortitionThresholdFromProbability(numerator: bigint, denominator: bigint): Buffer; export interface CreateSortitionDrawParams { programId?: PublicKey | string; authority: PublicKey | string; drawId: Buffer | Uint8Array | number[]; threshold: Buffer | Uint8Array | number[]; registrationDurationSlots: bigint | number; claimDurationSlots: bigint | number; unclaimedRule?: number; } /** Build a `create_sortition_draw` instruction. */ export declare function buildCreateSortitionDrawInstruction(params: CreateSortitionDrawParams): TransactionInstruction; export interface RegisterSortitionTicketParams { programId?: PublicKey | string; participant: PublicKey | string; drawId: Buffer | Uint8Array | number[]; ticketId: Buffer | Uint8Array | number[]; commitment: Buffer | Uint8Array | number[]; } /** Build a `register_sortition_ticket` instruction (no entry fee). */ export declare function buildRegisterSortitionTicketInstruction(params: RegisterSortitionTicketParams): TransactionInstruction; export interface RegisterSortitionTicketPaidParams extends RegisterSortitionTicketParams { treasury: PublicKey | string; } /** Build a `register_sortition_ticket_paid` instruction (economics, v1.4.1). */ export declare function buildRegisterSortitionTicketPaidInstruction(params: RegisterSortitionTicketPaidParams): TransactionInstruction; export interface SealSortitionDrawParams { programId?: PublicKey | string; sealer: PublicKey | string; drawId: Buffer | Uint8Array | number[]; } /** Build a `seal_sortition_draw` instruction. */ export declare function buildSealSortitionDrawInstruction(params: SealSortitionDrawParams): TransactionInstruction; export interface ClaimSortitionTicketParams { programId?: PublicKey | string; participant: PublicKey | string; drawId: Buffer | Uint8Array | number[]; ticketId: Buffer | Uint8Array | number[]; secret: Buffer | Uint8Array | number[]; } /** Build a `claim_sortition_ticket` instruction. */ export declare function buildClaimSortitionTicketInstruction(params: ClaimSortitionTicketParams): TransactionInstruction; export interface CloseSortitionTicketParams { programId?: PublicKey | string; caller: PublicKey | string; owner: PublicKey | string; treasury: PublicKey | string; drawId: Buffer | Uint8Array | number[]; ticketId: Buffer | Uint8Array | number[]; } /** Build a `close_sortition_ticket` instruction. */ export declare function buildCloseSortitionTicketInstruction(params: CloseSortitionTicketParams): TransactionInstruction; export interface SweepSortitionTicketsParams { programId?: PublicKey | string; caller: PublicKey | string; treasury: PublicKey | string; drawId: Buffer | Uint8Array | number[]; } /** Build a `sweep_sortition_tickets` instruction. */ export declare function buildSweepSortitionTicketsInstruction(params: SweepSortitionTicketsParams): TransactionInstruction; export interface InitSortitionEconomicsParams { programId?: PublicKey | string; authority: PublicKey | string; drawId: Buffer | Uint8Array | number[]; feeMode: number; entryFeeLamports: bigint | number; closeSkimBps: number; } /** Build an `init_sortition_economics` instruction (v1.4.1). */ export declare function buildInitSortitionEconomicsInstruction(params: InitSortitionEconomicsParams): TransactionInstruction; /** Load an operator keypair for the sortition routes. */ export declare function loadSortitionKeypair(walletPath: string): Keypair; export interface SortitionClientConfig { rpcUrl: string; walletPath: string; programId?: string; } export interface SortitionClient { connection: Connection; payer: Keypair; programId: PublicKey; } /** Build a sortition client bound to the canonical program id (overridable). */ export declare function createSortitionClient(config: SortitionClientConfig): SortitionClient; /** Create a draw and return the signature + PDA. */ export declare function sortitionCreateDrawInline(client: SortitionClient, params: Omit): Promise<{ signature: string; drawPda: string; maturity: typeof SORTITION_MATURITY; }>; /** Register a ticket and return the signature + ticket PDA. */ export declare function sortitionRegisterTicketInline(client: SortitionClient, params: Omit): Promise<{ signature: string; ticketPda: string; maturity: typeof SORTITION_MATURITY; }>; /** Seal a draw. */ export declare function sortitionSealDrawInline(client: SortitionClient, params: Omit): Promise<{ signature: string; maturity: typeof SORTITION_MATURITY; }>; /** Claim a ticket. */ export declare function sortitionClaimTicketInline(client: SortitionClient, params: Omit): Promise<{ signature: string; maturity: typeof SORTITION_MATURITY; }>; //# sourceMappingURL=sortition.d.ts.map