import type { ChainNamespace, DeriveByokWalletOpts, DerivedByokWallet } from "./wallet"; /** * Per-namespace adapter for the BYOK (mnemonic-backed) keyring. The keyring * owns roster management and the mnemonic; adapters own derivation and * chain-specific signing primitives (EVM signs EIP-191 / EIP-712 / EIP-7702; * Solana signs ed25519 messages, etc). * * Only the chain-agnostic surface the keyring itself depends on is declared * here. Chain-typed signing methods (`signTypedData`, `signEip7702Authorization`, * …) live on per-chain signer interfaces (e.g. `EvmSigner`) that the concrete * adapter implements. Wallet clients reach those methods via a small helper * exported from each chain's module — `evmSigner(keyring)`, * `solanaSigner(keyring)`, etc. — which does the typed lookup in one place. */ export interface ByokChainAdapter { namespace: N; derivationPath(index: number): string; normalizeAddress(address: string): string; derive(opts: DeriveByokWalletOpts): Promise>; /** * Import a derived key into the in-process signer, returning the imported * address. MUST be idempotent: re-importing an already-present key returns * the existing address rather than throwing. The keyring relies on this — * when a later step (e.g. server registration) fails, `createWallet` is * retried, re-deriving the same index and re-importing the same key before * the wallet ever enters the roster. */ importDerivedKey(derived: DerivedByokWallet): Promise<{ address: string; }>; } /** * Per-namespace adapter for the server keyring. The keyring owns the HTTP * client and namespace-agnostic routes; adapters shape chain-specific request * payloads and parse chain-specific responses. Each implementation is * constructed by the keyring at registration time with the shared HTTP * client + projectId. */ export interface ServerChainAdapter { namespace: N; normalizeAddress(address: string): string; }