import { ChainNamespace, type KeyringWalletRef, type ServerChainAdapter } from "."; import { ServerKeyringHttp } from "./ServerKeyringHttp"; /** * Descriptor for a wallet held by the remote signing service. Mirrors the * backend's `WalletSummaryDto`. */ export type ServerWalletInfo = { address: string; name?: string; deviceInfo?: string; /** Optional namespace tag for future multi-chain server wallets. */ namespace?: ChainNamespace; }; /** * Function that constructs a `ServerChainAdapter` given the shared HTTP client * and project id the keyring owns. The factory pattern keeps the adapter * constructor signatures honest (deps are required, not stitched together * post-construction). */ export type ServerChainAdapterFactory = (deps: { http: ServerKeyringHttp; projectId: string; }) => ServerChainAdapter; export type ServerKeyringCreateOpts = { baseUrl: string; authToken: string; projectId: string; wallets: ServerWalletInfo[]; adapters: ServerChainAdapterFactory[]; }; /** * Server-managed keyring (the mimir-proxied HSM). Owns the wallet roster and * the HTTP client to the remote signing service; each registered chain * adapter owns the shape of its own request/response bodies and its own * routes. * * Chain-typed submission methods (e.g. `submitTransaction`, * `submitPersonalSign`) live on the per-chain adapter. Wallet clients reach * them through a per-chain helper exported from the chain's module — * `evmSigner(keyring)`, `solanaSigner(keyring)`, … — which narrows * `getAdapter(namespace)` to the concrete adapter type in one place. The * helpers let wallet clients call signing methods without keyring-mode * branching. */ export declare class ServerKeyring { #private; readonly kind: "server"; constructor(opts: ServerKeyringCreateOpts); getAdapter(namespace: N): ServerChainAdapter; getWallets(): ServerWalletInfo[]; /** * Persistable roster snapshot. Kind-agnostic counterpart to * `ByokKeyring.snapshot()` — callers that hold an `IFoxKeyring` can * serialize without branching on `kind`. Same shape as {@link getWallets} * today; kept as a separate method so future server-only state (e.g. * cached MFA approvals) is not accidentally surfaced through the * generic roster getter. */ snapshot(): ServerWalletInfo[]; getAccounts(): string[]; getWallet(ref: KeyringWalletRef): ServerWalletInfo | undefined; /** * Register a wallet on the in-memory roster. Idempotent on namespace+address: * if the wallet is already present (e.g. boot hydration + backend refresh * collide), the existing entry is returned. */ addWallet(info: ServerWalletInfo): ServerWalletInfo; /** * Create a remote-managed wallet. Returns both the new wallet and the * post-create roster so callers can persist in one step regardless of * keyring kind (parity with `ByokKeyring.createWallet`). */ createWallet(opts?: { name?: string; deviceInfo?: string; namespace?: ChainNamespace; }): Promise<{ wallet: ServerWalletInfo; wallets: ServerWalletInfo[]; }>; listWalletsRemote(): Promise; getWalletRemote(address: string): Promise; }