export declare const FORMAT_VERSION_CONDITIONS = 9; export declare const FORMULA_CODE_CONDITIONS = 7; export declare const MAGIC: Buffer; export declare const ODDS_SCALE = 1000n; export declare const FIXED_SCALE = 10000n; export declare const MAX_LEGS = 8; export declare const MIN_ODDS_MILLI = 1001; export declare const MAX_ODDS_MILLI = 1000000; export declare const WINNERS_MODE_ALL_HIT_PRORATA = 0; export declare const TERM_SINGLE = 0; export declare const TERM_BINARY = 1; export declare const OP_NONE = 0; export declare const OP_ADD = 1; export declare const OP_SUBTRACT = 2; export declare const CMP_GT = 0; export declare const CMP_LT = 1; export declare const CMP_EQ = 2; export declare const NO_LINE = -2147483648; export type LegCommit = { termKind: number; statKeyA: number; statKeyB: number; op: number; comparison: number; threshold: number; lineX2: number; oddsMilli: number; }; export type ScoreStat = { statKey: number; value: number; }; export type ConditionsFixture = { fixtureId: number; eventStatRoot: Buffer; stats: ScoreStat[]; }; export type ConditionsEntrant = { wallet: Buffer; tier: bigint; enteredAt: bigint; legs: LegCommit[]; fixtureIndex: number[]; }; export type ConditionsArtifact = { formatVersion: number; formulaCode: number; winnersMode: number; fixtures: ConditionsFixture[]; entrants: ConditionsEntrant[]; }; export type LegResult = "hit" | "miss" | "void" | "pending"; export type SlipScore = { settled: boolean; allHit: boolean; voidCount: number; scoreFixed: bigint; }; export type RankedEntrant = { wallet: Buffer; enteredAt: bigint; scoreFixed: bigint; allHit: boolean; voidCount: number; settled: boolean; }; export declare function sortLegs(legs: LegCommit[]): LegCommit[]; /** slip_hash = sha256(borsh(EntryCommit{wallet, tier, sorted legs})). */ export declare function slipHash(wallet: Buffer, tier: bigint, legs: LegCommit[]): Buffer; export declare function buildConditionsArtifact(fixtures: ConditionsFixture[], entrants: ConditionsEntrant[]): Buffer; export declare function parseConditionsArtifact(bytes: Buffer): ConditionsArtifact; export declare function evalLeg(leg: LegCommit, facts: ScoreStat[]): LegResult; export declare function coefficientFixed(oddsMilli: number[]): bigint | null; export declare function scoreSlip(legs: LegCommit[], factsByLeg: ScoreStat[][]): SlipScore; export declare function rankRound(entrants: RankedEntrant[]): RankedEntrant[]; /** Replay: recompute per-entrant S from the committed artifact, then rank. */ export declare function resolveConditionsArtifact(a: ConditionsArtifact): RankedEntrant[]; /** Structural validity of a leg (tags in range, odds within band). Mirrors Rust `validate_leg`. */ export declare function validateLeg(l: LegCommit): boolean; /** * Structural + overflow validity. Mirrors Rust `ConditionsArtifact::validate`, including the * overflow guard: an entrant is rejected unless its WORST-CASE coefficient (all legs hit, * i.e. `coefficientFixed(all leg odds)`) is finite. Since void legs only shrink the product, * a passing worst case guarantees every effective subset also fits — so `scoreSlip` never hits * the `?? 0n` fallback (closes the "all_hit with S=0 on overflow" wart). */ export declare function validateConditionsArtifact(a: ConditionsArtifact): boolean; /** ΣS over winning (all_hit) entrants — the pro-rata denominator (u128, exact bigint). */ export declare function winningScoreSum(ranked: RankedEntrant[]): bigint; /** * `winners_digest = sha256(Σ wallet ‖ score_fixed_le_u64)` over ranked all_hit entrants, in * ranked order. Byte-identical to `resolve_conditions.rs`. Pass the output of * `resolveConditionsArtifact` (already ranked). */ export declare function winnersDigest(ranked: RankedEntrant[]): Buffer; /** `facts_ref_root = sha256(Σ event_stat_root)` over fixtures in order. Mirrors on-chain. */ export declare function factsRefRoot(a: ConditionsArtifact): Buffer; //# sourceMappingURL=conditions.d.ts.map