/** * ClientEvmSigner - Used by x402 clients to sign payment authorizations * This is typically a LocalAccount or wallet that holds private keys * and can sign EIP-712 typed data for payment authorizations */ type ClientEvmSigner = { readonly address: `0x${string}`; signTypedData(message: { domain: Record; types: Record; primaryType: string; message: Record; }): Promise<`0x${string}`>; readContract(args: { address: `0x${string}`; abi: readonly unknown[]; functionName: string; args?: readonly unknown[]; }): Promise; sendTransaction(args: { to: `0x${string}`; data: `0x${string}`; }): Promise<`0x${string}`>; waitForTransactionReceipt(args: { hash: `0x${string}`; }): Promise<{ status: string; }>; }; /** * FacilitatorEvmSigner - Used by x402 facilitators to verify and settle payments * This is typically a viem PublicClient + WalletClient combination that can * read contract state, verify signatures, write transactions, and wait for receipts * * Supports multiple addresses for load balancing, key rotation, and high availability */ type FacilitatorEvmSigner = { /** * Get all addresses this facilitator can use for signing * Enables dynamic address selection for load balancing and key rotation */ getAddresses(): readonly `0x${string}`[]; readContract(args: { address: `0x${string}`; abi: readonly unknown[]; functionName: string; args?: readonly unknown[]; }): Promise; verifyTypedData(args: { address: `0x${string}`; domain: Record; types: Record; primaryType: string; message: Record; signature: `0x${string}`; }): Promise; writeContract(args: { address: `0x${string}`; abi: readonly unknown[]; functionName: string; args: readonly unknown[]; }): Promise<`0x${string}`>; sendTransaction(args: { to: `0x${string}`; data: `0x${string}`; }): Promise<`0x${string}`>; estimateGas(args: { account: `0x${string}`; to: `0x${string}`; data: `0x${string}`; }): Promise; waitForTransactionReceipt(args: { hash: `0x${string}`; }): Promise<{ status: string; }>; getCode(args: { address: `0x${string}`; }): Promise<`0x${string}` | undefined>; }; /** * Converts a signer to a ClientEvmSigner * * @param signer - The signer to convert to a ClientEvmSigner * @returns The converted signer */ declare function toClientEvmSigner(signer: ClientEvmSigner): ClientEvmSigner; /** * Converts a viem client with single address to a FacilitatorEvmSigner * Wraps the single address in a getAddresses() function for compatibility * * @param client - The client to convert (must have 'address' property) * @returns FacilitatorEvmSigner with getAddresses() support */ declare function toFacilitatorEvmSigner(client: Omit & { address: `0x${string}`; }): FacilitatorEvmSigner; export { type ClientEvmSigner as C, type FacilitatorEvmSigner as F, toFacilitatorEvmSigner as a, toClientEvmSigner as t };