/** * WITNESS: Decentralized Cryptographic Witness Network * * Any fact from any chain, witnessed and signed by 16 independent agents. * The world's first trustless notary across 100+ blockchains. * * @example * ```typescript * import { WitnessClient } from '@sequence0/sdk'; * * const witness = new WitnessClient({ baseUrl: 'http://agent:8080' }); * * // Request a witness attestation for a Bitcoin transaction * const result = await witness.requestWitness({ * sourceChain: 'bitcoin', * txHash: 'abc123...', * minConfirmations: 6, * }); * * // Use the attestation on Ethereum * const attestation = await witness.getAttestation(result.attestationId); * // Submit attestation.signature to Ethereum WitnessVerifier contract * ``` */ /** * High-level chain type classification for witness attestations. */ export type ChainType = 'evm' | 'bitcoin' | 'solana' | 'cosmos' | 'other'; /** * The type of on-chain result that was witnessed. */ export type ResultType = 'transfer' | 'contract_call' | 'state_read' | 'event_emission'; /** * Options for requesting a witness attestation. * The agent network will read the specified transaction from the source * chain, verify it has the required confirmations, and produce a * threshold-signed attestation of the result. */ export interface WitnessRequestOptions { /** Source blockchain where the transaction occurred */ sourceChain: string; /** Transaction hash to witness */ txHash: string; /** Minimum confirmations required before witnessing (default: 1) */ minConfirmations?: number; /** Timeout in milliseconds for the witness request (default: 60000) */ timeout?: number; } /** * A completed witness attestation — a threshold-signed proof that * a specific transaction occurred on a specific chain with the * attested result. */ export interface WitnessAttestation { /** Unique attestation identifier */ attestationId: string; /** Source chain where the transaction was witnessed */ sourceChain: string; /** High-level type of the source chain */ sourceChainType: ChainType; /** Transaction hash that was witnessed */ txHash: string; /** Block number containing the transaction */ blockNumber: number; /** Block hash containing the transaction */ blockHash: string; /** Number of confirmations at the time of witnessing */ confirmations: number; /** Type of result that was witnessed */ resultType: ResultType; /** Hex-encoded hash of the result data */ resultHash: string; /** Hex-encoded raw result data */ resultData: string; /** Unix timestamp of the attestation */ timestamp: number; /** Epoch number in which the attestation was produced */ epoch: number; /** Number of agents that participated in the witness */ witnessCount: number; /** Hex-encoded threshold signature from the witness committee */ signature: string; } /** * Status of an in-progress witness request. * * - `pending` — request received, agents are being coordinated * - `gathering` — agents are reading the source chain and collecting votes * - `attested` — threshold reached, attestation is finalized * - `failed` — attestation could not be completed * - `expired` — request timed out before threshold was reached */ export type WitnessStatus = 'pending' | 'gathering' | 'attested' | 'failed' | 'expired'; /** * Response for polling the status of a witness request. */ export interface WitnessStatusResponse { /** The witness request ID */ requestId: string; /** Current status of the witness process */ status: WitnessStatus; /** Number of agent votes received so far (only during 'gathering' status) */ votesReceived?: number; /** Number of agent votes needed for threshold (only during 'gathering' status) */ votesNeeded?: number; /** The completed attestation (only when status is 'attested') */ attestation?: WitnessAttestation; } /** * Client for the WITNESS decentralized cryptographic witness network. * * Communicates with witness endpoints on the agent node to request * attestations, poll status, and verify signatures locally. */ export declare class WitnessClient { private baseUrl; /** * Create a new WitnessClient. * * @param options - Client configuration * @param options.baseUrl - Agent node HTTP endpoint URL */ constructor(options: { baseUrl: string; }); /** * Request a witness attestation for a transaction on a source chain. * * Agents will read the transaction from the source chain, verify * it has the required confirmations, and coordinate a threshold * signing of the result. * * @param options - Witness request details * @returns The request ID for polling status * * @throws {Sequence0Error} If the request parameters are invalid * @throws {NetworkError} If the agent is unreachable */ requestWitness(options: WitnessRequestOptions): Promise<{ requestId: string; }>; /** * Get the current status of a witness request. * * @param requestId - The witness request ID * @returns Current status and, if attested, the attestation * * @throws {Sequence0Error} If the request ID is invalid * @throws {NetworkError} If the agent is unreachable */ getStatus(requestId: string): Promise; /** * Get a completed witness attestation by ID. * * @param attestationId - The attestation ID * @returns The attestation, or null if not found * * @throws {NetworkError} If the agent is unreachable */ getAttestation(attestationId: string): Promise; /** * Wait for a witness attestation to complete by polling. * * Polls the witness status endpoint at 2-second intervals until * the attestation is finalized or the timeout is exceeded. * * @param requestId - The witness request ID to wait for * @param timeout - Max time to wait in ms (default: 60000) * @returns The completed attestation * * @throws {TimeoutError} If the attestation is not completed within the timeout * @throws {Sequence0Error} If the witness request fails or expires * @throws {NetworkError} If the agent is unreachable */ waitForAttestation(requestId: string, timeout?: number): Promise; /** * Verify a witness attestation locally by checking its signature * structure and internal consistency. * * This performs basic structural verification: * - Attestation has all required fields * - Signature is present and non-empty * - Timestamp is reasonable * - Witness count meets minimum threshold * * For full cryptographic verification, submit the attestation to * the on-chain WitnessVerifier contract. * * @param attestation - The attestation to verify * @returns True if the attestation passes local verification */ verifyLocal(attestation: WitnessAttestation): Promise; private get; private post; private mapAttestationResponse; } //# sourceMappingURL=witness.d.ts.map