/** * Serialization and deserialization utilities for WASM interop. * Handles conversion between SDK types (camelCase) and WASM boundary types. * Note: WASM types use mixed naming conventions (snake_case for some fields, camelCase for others). * * @remarks * Most helpers in this file validate that required fields exist and that hex strings are well-formed. * These validations intentionally throw early to avoid passing malformed values into WASM. */ import { AggregationTreeState, BurnArtifacts, ChainEvents, ChainLocalTeleportProofs, EventsWithEligibility, GlobalTeleportProofWithEvent, HubEntryConfig, IndexedEvent, LocalTeleportProof, SecretAndTweak, SeparatedChainEvents, TokenEntryConfig } from "../types.js"; export type NumericValue = number | string | bigint; export interface RawSecretAndTweak { secret: string; tweak: string; } export interface RawGeneralRecipient { chainId: number | string | bigint; address: string; tweak: string; fr: string; u256: string; } export interface RawBurnArtifacts { burnAddress: string; fullBurnAddress: string; secret: string; tweak?: string; generalRecipient: RawGeneralRecipient; } export interface RawHubEntry { hub_address: string; chain_id: NumericValue; rpc_urls: string[]; } export interface RawTokenEntry { label: string; token_address: string; verifier_address: string; minter_address?: string; chain_id: NumericValue; deployed_block_number: NumericValue; rpc_urls: string[]; legacy_tx: boolean; } export interface RawAggregationTreeState { latestAggSeq: NumericValue; aggregationRoot: string; snapshot: string[]; transferTreeIndices: NumericValue[]; chainIds: NumericValue[]; } export interface RawIndexedEvent { event_index: NumericValue; from: string; to: string; value: string; eth_block_number: NumericValue; } export interface RawChainEvents { chainId: NumericValue; events: RawIndexedEvent[]; } export interface RawEventsWithEligibility { eligible: RawIndexedEvent[]; ineligible: RawIndexedEvent[]; } export interface RawSeparatedChainEvents { chainId: NumericValue; events: RawEventsWithEligibility; } export interface RawLocalTeleportProof { treeIndex: NumericValue; event: RawIndexedEvent; siblings: string[]; } export interface RawChainLocalTeleportProofs { chainId: NumericValue; proofs: RawLocalTeleportProof[]; } export interface RawGlobalTeleportProof { event: RawIndexedEvent; siblings: string[]; leafIndex: NumericValue; } export declare function asSecretAndTweak(value: unknown): SecretAndTweak; /** * Convert an unknown WASM payload into {@link BurnArtifacts}. * @throws If the payload shape is missing required fields. */ export declare function asBurnArtifacts(value: unknown): BurnArtifacts; export declare function copyRpcUrls(urls: readonly string[], label: string): string[]; export declare function serializeHubEntry(entry: HubEntryConfig): RawHubEntry; /** * Serialize a token entry for WASM/indexer boundary calls. * @remarks `legacyTx` defaults to `false` when omitted. */ export declare function serializeTokenEntry(entry: TokenEntryConfig): RawTokenEntry; export declare function serializeAggregationTreeState(state: AggregationTreeState): RawAggregationTreeState; /** * Serialize an indexed event for WASM/indexer boundary calls. */ export declare function serializeIndexedEvent(event: IndexedEvent): RawIndexedEvent; export declare function serializeChainEvents(entry: ChainEvents): RawChainEvents; export declare function serializeLocalTeleportProof(proof: LocalTeleportProof): RawLocalTeleportProof; export declare function serializeChainLocalTeleportProofs(entry: ChainLocalTeleportProofs): RawChainLocalTeleportProofs; export declare function deserializeAggregationTreeState(raw: RawAggregationTreeState): AggregationTreeState; export declare function deserializeIndexedEvent(raw: RawIndexedEvent): IndexedEvent; export declare function deserializeChainEvents(raw: RawChainEvents): ChainEvents; export declare function deserializeEventsWithEligibility(raw: RawEventsWithEligibility): EventsWithEligibility; export declare function deserializeSeparatedChainEvents(raw: RawSeparatedChainEvents): SeparatedChainEvents; export declare function deserializeLocalTeleportProof(raw: RawLocalTeleportProof): LocalTeleportProof; export declare function deserializeGlobalTeleportProof(raw: RawGlobalTeleportProof): GlobalTeleportProofWithEvent; //# sourceMappingURL=serialization.d.ts.map