/** * Type definitions for receive operations. */ import type { TokenEntry } from "../../registry/tokens.js"; import type { AggregationTreeState, BurnArtifacts, EventsWithEligibility, GlobalTeleportProofWithEvent, LocalTeleportProof, SeparatedChainEvents } from "../../types.js"; import type { HttpDeciderClient } from "../../decider/prover.js"; import type { TeleportProofClient } from "../teleportProof.js"; /** * Minimal readable verifier contract shape used by receive operations. * @remarks This matches contracts created by `viem.getContract(...)` or similar helpers * in other libraries that expose a `.read` namespace. */ export type ReadableVerifierContract = { read: { totalTeleported: (args: readonly [string]) => Promise; }; }; /** * Minimal legacy verifier contract shape used by older callers. * @remarks This matches an "ethers-like" contract with direct methods. */ export type LegacyVerifierContract = { totalTeleported: (recipientFr: string) => Promise; }; /** * Union type accepted by receive operations for verifier contracts. */ export type VerifierContractLike = ReadableVerifierContract | LegacyVerifierContract; /** * Per-chain breakdown for redeem context. */ export interface RedeemChainContext { /** Chain id for the token/network. */ chainId: bigint; /** Token entry corresponding to this chain. */ token: TokenEntry; /** Transfer events split by eligibility against the aggregation tree state. */ events: EventsWithEligibility; /** Global teleport proofs generated for eligible events on this chain. */ globalProofs: GlobalTeleportProofWithEvent[]; /** Local teleport proofs (Merkle proofs) for eligible events on this chain. */ eligibleProofs: LocalTeleportProof[]; /** Sum of values from eligible events. */ totalEligibleValue: bigint; /** Sum of values from ineligible (pending/indexer-not-yet-aggregated) events. */ totalPendingValue: bigint; /** `totalEligibleValue + totalPendingValue`. */ totalIndexedValue: bigint; } /** * Combined redeem context across all configured chains for a burn recipient. * @remarks * This output is typically used to: * - Display pending vs eligible amounts * - Construct redeem/teleport proofs * - Compare indexed totals with on-chain `totalTeleported` */ export interface RedeemContext { /** Primary token entry (matching `burn.generalRecipient.chainId`). */ token: TokenEntry; /** Aggregation tree state for the primary chain. */ aggregationState: AggregationTreeState; /** Combined events across all chains. */ events: EventsWithEligibility; /** Combined global proofs across all chains. */ globalProofs: GlobalTeleportProofWithEvent[]; /** Combined eligible local proofs across all chains. */ eligibleProofs: LocalTeleportProof[]; /** Sum of values from all eligible events. */ totalEligibleValue: bigint; /** Sum of values from all ineligible events. */ totalPendingValue: bigint; /** `totalEligibleValue + totalPendingValue`. */ totalIndexedValue: bigint; /** On-chain total teleported amount (verifier contract). */ totalTeleported: bigint; /** Per-chain breakdown used to build proofs and display totals. */ chains: RedeemChainContext[]; } /** * Parameters for `collectRedeemContext`. */ export interface RedeemContextParams { /** Burn artifact bundle produced by the sender side. */ burn: BurnArtifacts; /** Tokens to include when scanning the indexer. */ tokens: readonly TokenEntry[]; /** Hub configuration for aggregation tree state reads. */ hub: import("../../registry/tokens.js").HubEntry; /** Verifier contract used to read `totalTeleported(recipientFr)`. */ verifierContract: VerifierContractLike; /** Base URL for the indexer service. */ indexerUrl: string; /** Max number of indexer events to fetch per request. Defaults to `DEFAULT_INDEXER_FETCH_LIMIT`. */ indexerFetchLimit?: number; /** Optional block span used when fetching aggregation tree state (performance tuning). */ eventBlockSpan?: bigint | number; } /** * Summary status for announcements for a burn recipient. */ export interface AnnouncementStatus { /** Primary token entry (matching `burn.generalRecipient.chainId`). */ token: TokenEntry; /** Aggregation tree state for the primary chain. */ aggregationState: AggregationTreeState; /** Combined events across all chains. */ events: EventsWithEligibility; /** Per-chain separated events used to compute totals. */ chains: SeparatedChainEvents[]; /** Sum of values from all eligible events. */ totalEligibleValue: bigint; /** Sum of values from all ineligible events. */ totalPendingValue: bigint; /** `totalEligibleValue + totalPendingValue`. */ totalIndexedValue: bigint; /** On-chain total teleported amount (verifier contract). */ totalTeleported: bigint; } /** * Parameters for `getAnnouncementStatus`. */ export interface AnnouncementStatusParams { /** Burn artifact bundle produced by the sender side. */ burn: BurnArtifacts; /** Tokens to include when scanning the indexer. */ tokens: readonly TokenEntry[]; /** Hub configuration for aggregation tree state reads. */ hub: import("../../registry/tokens.js").HubEntry; /** Verifier contract used to read `totalTeleported(recipientFr)`. */ verifierContract: VerifierContractLike; /** Base URL for the indexer service. */ indexerUrl: string; /** Max number of indexer events to fetch per request. Defaults to `DEFAULT_INDEXER_FETCH_LIMIT`. */ indexerFetchLimit?: number; /** Optional block span used when fetching aggregation tree state (performance tuning). */ eventBlockSpan?: bigint | number; /** * Optional cache TTL for aggregation tree state reads (in milliseconds). * @remarks Only effective when `cacheManager` is also provided. Without a cache manager, this value is ignored and aggregation state is fetched directly every time. */ cacheTtlMs?: number; /** Optional cache manager for aggregation tree state. When provided, `cacheTtlMs` controls TTL-based invalidation. */ cacheManager?: import("./cache.js").AggregationStateCacheManager; } /** * On-chain GeneralRecipient struct matching the Verifier contract ABI. */ export interface OnChainGeneralRecipient { /** Destination chain id (uint64). */ chainId: bigint; /** Recipient address padded to bytes32. */ recipient: string; /** Recipient tweak (bytes32). */ tweak: string; } /** * Relayer fee authorization passed to the Verifier relay-redeem overloads. */ export interface RelayerFeeAuthorization { /** Fee that the relayer may keep from the redeemed value. */ relayerFee: bigint; /** User-specified upper bound for the relayer fee. */ maxFee: bigint; /** Expiration timestamp for the authorization. */ deadline: bigint; /** EIP-712 signature authorizing the relayer fee. */ signature: string; } /** * Contract call arguments for the Verifier redeem methods. */ export type RedeemTransactionArgs = readonly [boolean, bigint, OnChainGeneralRecipient, string] | readonly [boolean, bigint, OnChainGeneralRecipient, string, RelayerFeeAuthorization]; /** * Prepared redeem transaction data ready to be submitted via `writeContract`. * * @remarks * The SDK does not depend on wagmi/wallet — callers use these fields * to construct the actual `writeContract` call themselves. */ export interface RedeemTransaction { /** Whether this is a single or batch redeem. */ mode: "single" | "batch"; /** Verifier contract address (normalized, `0x`-prefixed). */ address: `0x${string}`; /** Verifier contract ABI. */ abi: typeof import("../../onchain/contracts.js").VerifierArtifact.abi; /** Contract function to call. */ functionName: "singleTeleport" | "teleport"; /** * Contract call arguments: * - standard redeem: `[isValid, latestAggSeq, generalRecipient, proof]` * - relayer redeem: `[isValid, latestAggSeq, generalRecipient, proof, feeAuth]` */ args: RedeemTransactionArgs; } /** * Parameters for {@link prepareRedeemTransaction}. */ export interface PrepareRedeemTransactionParams { /** Redeem context produced by `collectRedeemContext`. */ redeemContext: RedeemContext; /** Burn artifacts for the recipient. */ burn: BurnArtifacts; /** Teleport proof client for single/batch proof generation. */ teleportProofClient: TeleportProofClient; /** Decider client (required for batch redeems). */ decider?: HttpDeciderClient; /** Optional relayer fee authorization for relay redeem. */ relayerFeeAuth?: RelayerFeeAuthorization; } //# sourceMappingURL=types.d.ts.map