import type { FetchSignaturesConsensusResponse } from './types/crossbar.js'; /** * Surge update response structure from Switchboard Surge */ export interface SurgeRawGatewayResponse { type: string; feed_bundle_id?: string; feed_values?: Array<{ value: string; feed_hash: string; symbol?: string; source?: string; }>; oracle_response?: { oracle_pubkey: string; eth_address: string; signature: string; checksum: string; recovery_id: number; oracle_idx: number; timestamp: number; timestamp_ms?: number; recent_hash: string; slot: number; ed25519_enclave_signer?: string; }; source_ts_ms: number; seen_at_ts_ms: number; triggered_on_price_change: boolean; message?: string; } export declare class EVMUtils { /** * Convert fetch signatures consensus response to EVM-compatible bytes * * IMPORTANT: This function uses feed-level ECDSA signatures, NOT consensus signatures. * - Consensus signatures (oracle.signature) are used for the consensus protocol * - Feed signatures (oracle.feed_responses[].signature) are used for EVM verification * * Format expected by EVM contract parseFeedUpdateData: * - Timestamp (8 bytes) * - Feed count (1 byte) * - For each feed (49 bytes each): * - Feed ID (32 bytes) * - Value (16 bytes, int128) * - Min oracle samples (1 byte) * - Signature count (1 byte) * - For each signature (65 bytes each): * - Signature data (65 bytes: r + s + v) */ static convertToEVMUpdateData(response: FetchSignaturesConsensusResponse): { updateData: string; feedCount: number; signatureCount: number; totalBytes: number; }; /** * Convert hex string to bytes */ private static hexToBytes; /** * Convert BigInt to bytes with specified length */ private static bigIntToBytes; /** * Convert a Surge update to EVM encoded format * Format: slot(8) + timestamp(8) + numFeeds(1) + numSigs(1) + feeds(49*n) + sigs(65*m) * @param surgeUpdate - The SurgeUpdate from Switchboard Surge * @param options - Optional parameters including minOracleSamples, an unscaled oracle-sample quorum * @returns Hex-encoded string in EVM format */ static convertSurgeUpdateToEvmFormat(surgeUpdate: SurgeRawGatewayResponse, options?: { minOracleSamples?: number; }): string; /** * Encode int128 to 16 bytes (big-endian, two's complement) */ private static encodeInt128; /** * Convert base64 string to bytes */ private static base64ToBytes; /** * Convert bytes to hex string */ private static bytesToHex; /** * Utility function to create EVM update data from consensus response * This can be used in other parts of your application */ static createEVMUpdateDataFromConsensus(response: FetchSignaturesConsensusResponse): { updateData: string; feedCount: number; signatureCount: number; totalBytes: number; }; } //# sourceMappingURL=evm-utils.d.ts.map