import type { KeyringController } from "@toruslabs/ethereum-controllers"; import type { SignatureRequestContext } from "../../keyring"; import type { PollOpts } from "../remote-signing"; import type { EVMTypedData } from "./EVMTypedData"; /** * Chain-typed signing surface for EVM. Implemented by both `EvmByokAdapter` * (signs in-process via toruslabs `KeyringController`) and `EvmServerAdapter` * (submits to mimir + polls + returns the signature on terminal `SIGNED`). * * Wallet clients reach this interface via the `evmSigner` helper exported * from `@metamask/fox-sdk/wallets/evm` — passing a keyring (BYOK or server) * yields the namespace-narrowed adapter typed as `EvmSigner`, so signing * calls don't branch on keyring mode. * * The optional `ctx: SignatureRequestContext` is consumed by the server * adapter (and by server-backed BYOK) for the mimir request envelope. Pure-local * BYOK ignores it. * * The optional `opts: PollOpts` is consumed when the adapter waits for a * remote signing job to reach terminal status (server mode and server-backed * BYOK). Pure-local BYOK signs in-process and ignores it. */ export interface EvmSigner { /** Sign a message with `eth_sign` semantics (raw hash). */ signMessage(message: string, address: string, ctx?: SignatureRequestContext, opts?: PollOpts): Promise; /** Sign a message with EIP-191 (`personal_sign`) semantics. */ signPersonalMessage(message: string, address: string, ctx?: SignatureRequestContext, opts?: PollOpts): Promise; /** Sign EIP-712 typed data. */ signTypedData(typedData: EVMTypedData, address: string, ctx?: SignatureRequestContext, opts?: PollOpts): Promise; /** Sign an EIP-7702 authorization tuple. BYOK-mode only today; server-mode throws. */ signEip7702Authorization(...args: Parameters): ReturnType; /** * Sign a transaction. BYOK mode returns the typed signed tx; server mode * does not expose a detached "sign only" path (use `sendTransaction` on * the wallet client or `submitTransaction` on the server adapter instead). */ signTransaction(tx: T, address: string): Promise; }