import { type Balance, type EvmChain, type LoggerConfig, type Signature, type ToolBase, WalletClientBase } from "../../../core"; import type { PollOpts, RemoteRequestOpts } from "../remote-signing"; import type { EVMReadRequest, EVMReadResult, EVMTransaction, EVMTypedData, Token } from "../types"; import type { SignTypedDataRequestOptions } from "./signTypedDataRequestOptions"; export type ApproveParameters = { tokenAddress: `0x${string}`; spender: `0x${string}`; amount: string; }; export type GetTokenAllowanceParameters = { tokenAddress: `0x${string}`; owner: `0x${string}`; spender: `0x${string}`; }; export type TransferFromParameters = { tokenAddress: `0x${string}`; from: `0x${string}`; to: `0x${string}`; amount: string; }; export type EVMWalletClientCtorParams = LoggerConfig & { tokens?: Token[]; enableSend?: boolean; }; export declare abstract class EVMWalletClient extends WalletClientBase { protected tokens: Token[]; protected enableSend: boolean; constructor({ tokens, enableSend, logLevel }?: EVMWalletClientCtorParams); balanceOf(address: string, tokenAddress?: `0x${string}`): Promise; /** * Register a token at runtime. The new entry takes precedence over any * existing token with the same `symbol` (case-insensitive) so callers can * override registry defaults without re-instantiating the wallet client. * * Backs `mm token add` in the CLI: the user-registered custom token list * is merged in here, and `getTokenInfoByTicker` / `balanceOf` pick it up * immediately. */ addToken(token: Token): void; /** * Drop a token from the in-memory registry. Match is case-insensitive on * symbol. Returns `true` if a token was removed, `false` otherwise — let * the caller decide whether a missing token is an error. * * Backs `mm token remove`. Note this only mutates the live wallet's * registry; persistence is the CLI's job. */ removeToken(symbol: string): boolean; /** Read-only snapshot of the current token registry. */ getTokens(): Token[]; getTokenInfoByTicker(ticker: string): Promise<{ symbol: string; contractAddress: string; decimals: number; name: string; }>; /** * Fetch on-chain ERC-20 metadata (`name`, `symbol`, `decimals`) for * `tokenAddress` in a single round-trip (three reads in parallel). * Backs `mm token add` when the user omits `--symbol` / `--decimals`. * * Throws if any of the three calls fails or returns `undefined` — a fully * standards-compliant ERC-20 implements all three, and partial reads * should fail loud rather than silently producing a half-populated `Token`. */ getTokenMetadata(tokenAddress: `0x${string}`): Promise<{ name: string; symbol: string; decimals: number; }>; _getTokenDecimals(tokenAddress?: `0x${string}`): Promise; convertToBaseUnits(params: { amount: string; tokenAddress?: `0x${string}`; }): Promise; convertFromBaseUnits(params: { amount: string; tokenAddress?: `0x${string}`; }): Promise; sendToken(params: { recipient: `0x${string}`; amountInBaseUnits: string; tokenAddress?: `0x${string}`; }): Promise<{ hash: string; }>; getTokenAllowance(params: GetTokenAllowanceParameters): Promise; approve(params: ApproveParameters): Promise<{ hash: string; }>; revokeApproval(params: { tokenAddress: `0x${string}`; spender: `0x${string}`; }): Promise<{ hash: string; }>; getCoreTools(): ToolBase[]; /** * Cheap ERC-20 balance pre-flight: a single `eth_call` to `balanceOf`, * deliberately *not* using {@link balanceOf} (which fetches `name` + * `symbol` + `decimals` alongside, costing 4 calls). The error carries * raw `bigint`s + token address; the catcher formats with cached * metadata if it wants user-facing units. */ private assertSufficientErc20Balance; /** * `intent` and `opts.requestId` are honored only in server (remote-signing) * mode and ignored by in-process implementations (e.g. BYOK). */ abstract signMessage(message: string, intent?: string, opts?: RemoteRequestOpts): Promise; abstract sendTransaction(transaction: EVMTransaction, intent?: string, opts?: RemoteRequestOpts): Promise<{ hash: string; }>; abstract read(request: EVMReadRequest): Promise; abstract getNativeBalance(): Promise; /** * `request` (intent, protocol, protocolPayload) is honored only in server * (remote-signing) mode and ignored by in-process implementations (e.g. BYOK). */ abstract signTypedData(data: EVMTypedData, request?: SignTypedDataRequestOptions, opts?: PollOpts): Promise; abstract getChain(): EvmChain; }