import type { Chain, PublicClient, Transport } from 'viem'; import { type L2ChainConfigResult } from './read.js'; /** Minimal external OP AnchorStateRegistry ABI — exported for tests */ export declare const ANCHOR_STATE_REGISTRY_ABI: readonly [{ readonly type: "function"; readonly name: "anchors"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly name: "gameType"; readonly type: "uint32"; }]; readonly outputs: readonly [{ readonly name: "root"; readonly type: "bytes32"; }, { readonly name: "l2BlockNumber"; readonly type: "uint256"; }]; }]; /** Current rollup anchor: output root + the L2 block it commits to */ export interface AnchorState { root: `0x${string}`; l2BlockNumber: bigint; } /** OP Stack v0 output-root preimage (field order matters — it is what gets hashed) */ export interface OutputRootPreimage { version: `0x${string}`; stateRoot: `0x${string}`; messagePasserStorageRoot: `0x${string}`; latestBlockhash: `0x${string}`; } /** Complete proof bundle for `TrustL2Reader.proveL2UsdDelta` */ export interface L2UsdDeltaProof { chainId: bigint; account0: `0x${string}`; account1: `0x${string}`; /** exactly 128 bytes: abi.encode(version, stateRoot, msgPasserRoot, blockHash) */ stateRootProof: `0x${string}`; /** eth_getProof(...).accountProof verbatim */ accountProof: `0x${string}`[]; /** eth_getProof(...).storageProof[0].proof verbatim */ storageProof: `0x${string}`[]; anchor: AnchorState; outputRootPreimage: OutputRootPreimage; slot: `0x${string}`; baseSlot: bigint; /** eth_getStorageAt(module, slot, anchorBlock) */ rawSlotValue: `0x${string}`; /** int256; positive = account0 net-paid account1 (18-dec USD WAD) */ usdDelta: bigint; } export interface BuildL2UsdDeltaProofParams { /** L2 chain id, e.g. 84532n */ chainId: bigint; /** any order — builder canonicalizes */ accountA: `0x${string}`; accountB: `0x${string}`; } /** Pre-flight for proof building: reader chain config + baseSlot * (runtime `TRANSFER_DELTA_USD_BASE_SLOT()` — never hardcoded) + current anchor. * * @throws CONTRACT_ERROR when the chain is unregistered or inactive, * INVALID_INPUT for non-OP-Stack rollups, * PROOF_INVALID (`reason: 'MISSING_ANCHOR'`) when no usable anchor exists. */ export declare function getAnchorState(l1Client: PublicClient, readerAddress: `0x${string}`, chainId: bigint): Promise<{ config: L2ChainConfigResult; baseSlot: bigint; anchor: AnchorState; }>; /** Build a complete, format-exact proof bundle for * `transferDeltaUSD[account0][account1]` at the current rollup anchor. * * All L2 reads (block header, message-passer proof, account/storage proof) target * exactly the anchor's `l2BlockNumber` (~7 days old) — never `latest` — so the * `l2ArchiveClient` must be a true archive endpoint serving `eth_getProof` that far back. * * NOTE (current deployment): the live reader's `TRANSFER_DELTA_USD_BASE_SLOT()` is 6 * while the deployed module's `transferDeltaUSD` lives at slot 5, so real-data proofs * revert `InvalidProof` until the reader is redeployed. This builder reads the base * slot at runtime and works unchanged after the redeploy. */ export declare function buildL2UsdDeltaProof(l1Client: PublicClient, l2ArchiveClient: PublicClient, readerAddress: `0x${string}`, params: BuildL2UsdDeltaProofParams): Promise; //# sourceMappingURL=proof-builder.d.ts.map