Skip to content
docs

WalletAccountEvm

Defined in: wallet-evm/src/account.ts:87

An EVM account with a signer: signs messages, typed data, permits and transactions, and sends transfers and approvals. Before signing it checks the chain id and simulates the transaction (when a provider is configured), and refuses value sent to the zero address.

  • IWalletAccount

new WalletAccountEvm(signer, publicKey, path, config?): WalletAccountEvm

Defined in: wallet-evm/src/account.ts:118

publicKey is the signer’s compressed secp256k1 key (33 bytes); it is needed synchronously for the address.

Signer

Uint8Array

string

EvmConfig = {}

WalletAccountEvm

WalletAccountReadOnlyEvm.constructor

protected readonly _client: { } | undefined

Defined in: wallet-evm/src/read-only-account.ts:129

WalletAccountReadOnlyEvm._client


protected readonly _config: EvmConfig

Defined in: wallet-evm/src/read-only-account.ts:128

WalletAccountReadOnlyEvm._config


readonly address: `0x${string}`

Defined in: wallet-evm/src/read-only-account.ts:127

Checksummed address.

WalletAccountReadOnlyEvm.address


readonly needsNetwork: false = false

Defined in: wallet-evm/src/account.ts:88

True when signTransaction itself needs the network (TON seqno, Solana blockhash, BTC UTXOs, Tron ref block). EVM signs offline.

IWalletAccount.needsNetwork


readonly path: string

Defined in: wallet-evm/src/account.ts:90

Derivation path, or external for an external signer.


readonly publicKey: Uint8Array

Defined in: wallet-evm/src/account.ts:92

Compressed secp256k1 public key (33 bytes).


readonly signerKind: "external" | "key" | "seed"

Defined in: wallet-evm/src/account.ts:100

What holds the key: seed, key (one imported key) or external.

get chain(): string

Defined in: wallet-evm/src/read-only-account.ts:140

CAIP-2 id; “eip155:unknown” until the chain id is known (offline wallet without chainId).

string

IWalletAccount.chain

WalletAccountReadOnlyEvm.chain


get index(): number | undefined

Defined in: wallet-evm/src/account.ts:132

Account index when the path is the standard m/44’/60’/0’/0/i, else undefined.

number | undefined

approve(options, writeOptions?): Promise<TransferResult>

Defined in: wallet-evm/src/account.ts:474

ERC-20 approve. Mainnet USDT non-zero → non-zero is refused or auto-reset (autoResetAllowance). writeOptions.maxFee (and transactionMaxFee) holds for each transaction signed, the reset too.

ApproveOptions

WriteOptions = {}

Promise<TransferResult>


protected callParams(tx): object

Defined in: wallet-evm/src/read-only-account.ts:243

Calldata/value/to in the shape viem’s call / estimateGas take — with an EIP-7702 transaction’s authorizations, so the dry run executes the delegate’s code, not the account’s.

EvmTransaction

object

account: `0x${string}`

optional authorizationList?: undefined

optional data?: `0x${string}`

optional to?: `0x${string}`

optional value?: bigint

WalletAccountReadOnlyEvm.callParams


dispose(): void

Defined in: wallet-evm/src/account.ts:519

Dispose the signer (zeroizes a local key). Idempotent.

void

IWalletAccount.dispose


protected feeFields(tx, chainId): Promise<FeeFields>

Defined in: wallet-evm/src/read-only-account.ts:265

The fee fields a send signs: the transaction’s own where it sets them, the network’s for the rest. One function for the quote and the signature, so a cap checked on the quote holds for what is signed.

EvmTransaction

number

Promise<FeeFields>

WalletAccountReadOnlyEvm.feeFields


protected gasFor(tx): Promise<bigint>

Defined in: wallet-evm/src/read-only-account.ts:255

Gas limit: the tx’s own, else one estimate.

EvmTransaction

Promise<bigint>

WalletAccountReadOnlyEvm.gasFor


getAddress(): Promise<string>

Defined in: wallet-evm/src/read-only-account.ts:151

The checksummed address.

Promise<string>

IWalletAccount.getAddress

WalletAccountReadOnlyEvm.getAddress


getAllowance(token, spender): Promise<bigint>

Defined in: wallet-evm/src/read-only-account.ts:181

ERC-20 allowance(owner, spender) in base units.

string

string

Promise<bigint>

WalletAccountReadOnlyEvm.getAllowance


getBalance(): Promise<bigint>

Defined in: wallet-evm/src/read-only-account.ts:162

Native balance in wei.

Promise<bigint>

IWalletAccount.getBalance

WalletAccountReadOnlyEvm.getBalance


getChainId(): Promise<number>

Defined in: wallet-evm/src/read-only-account.ts:156

Chain id from the config, or asked from the RPC once and cached.

Promise<number>

WalletAccountReadOnlyEvm.getChainId


getFeeRate(): Promise<bigint>

Defined in: wallet-evm/src/read-only-account.ts:230

Current fee rate: maxFeePerGas, falling back to gasPrice.

Promise<bigint>

WalletAccountReadOnlyEvm.getFeeRate


getPermitInfo(token): Promise<PermitInfo>

Defined in: wallet-evm/src/account.ts:419

Does token implement EIP-2612 permit, and with which domain? Supported only when the domain separator we rebuild from name/version/chainId/ verifyingContract equals the contract’s own — so a signature we produce is one the contract will accept. DAI’s legacy permit(holder, spender, nonce, expiry, allowed) is NOT recognised.

string

Promise<PermitInfo>


getTokenBalance(token): Promise<bigint>

Defined in: wallet-evm/src/read-only-account.ts:167

ERC-20 balanceOf in the token’s base units.

string

Promise<bigint>

IWalletAccount.getTokenBalance

WalletAccountReadOnlyEvm.getTokenBalance


getTokenBalances(tokens): Promise<Record<string, bigint>>

Defined in: wallet-evm/src/read-only-account.ts:174

Several ERC-20 balances in parallel, keyed by the token addresses as given.

string[]

Promise<Record<string, bigint>>

WalletAccountReadOnlyEvm.getTokenBalances


getTokenInfo(token): Promise<TokenInfo>

Defined in: wallet-evm/src/read-only-account.ts:193

An ERC-20’s decimals, symbol, name and total supply, read from the contract, and upgradeable when it sits behind an EIP-1967 / EIP-1822 / beacon / ZeppelinOS proxy. bytes32 symbols (MKR style) are decoded. Throws NotATokenError when there is no contract at the address or it has no decimals() (an NFT, a wallet, a plain contract).

string

Promise<TokenInfo>

IWalletAccount.getTokenInfo

WalletAccountReadOnlyEvm.getTokenInfo


getTransactionByHash(hash): Promise<{ } | { } | { } | { } | { }>

Defined in: wallet-evm/src/read-only-account.ts:359

The transaction as the RPC returns it (viem shape).

string

Promise<{ } | { } | { } | { } | { }>

WalletAccountReadOnlyEvm.getTransactionByHash


getTransactionReceipt(hash): Promise<EvmReceipt | undefined>

Defined in: wallet-evm/src/read-only-account.ts:344

The receipt, or undefined while the transaction is not mined.

string

Promise<EvmReceipt | undefined>

IWalletAccount.getTransactionReceipt

WalletAccountReadOnlyEvm.getTransactionReceipt


quoteSendTransaction(tx): Promise<{ fee: bigint; }>

Defined in: wallet-evm/src/read-only-account.ts:293

Upper-bound fee in wei: gas × fee cap, with the cap the transaction would be signed with — its own gasPrice / maxFeePerGas when it sets one, else the network’s (gasPrice on chains without EIP-1559).

EvmTransaction

Promise<{ fee: bigint; }>

IWalletAccount.quoteSendTransaction

WalletAccountReadOnlyEvm.quoteSendTransaction


quoteTransfer(options): Promise<{ fee: bigint; }>

Defined in: wallet-evm/src/read-only-account.ts:339

Network fee of a transfer, in wei.

EvmTransferOptions

Promise<{ fee: bigint; }>

IWalletAccount.quoteTransfer

WalletAccountReadOnlyEvm.quoteTransfer


protected requireClient(what): object

Defined in: wallet-evm/src/read-only-account.ts:145

The RPC client, or a NetworkError naming the action when the wallet is offline.

string

object

WalletAccountReadOnlyEvm.requireClient


sendTransaction(tx, options?): Promise<TransferResult>

Defined in: wallet-evm/src/account.ts:402

Sign and broadcast; options.maxFee caps the signed fee on top of transactionMaxFee.

EvmTransaction

WriteOptions = {}

Promise<TransferResult>

IWalletAccount.sendTransaction


sign(message): Promise<string>

Defined in: wallet-evm/src/account.ts:151

EIP-191 personal_sign; returns 65-byte hex with v ∈ {27, 28} (ethers encoding).

string | Uint8Array<ArrayBufferLike>

Promise<string>

IWalletAccount.sign


signPermit(options): Promise<SignedPermit>

Defined in: wallet-evm/src/account.ts:448

Sign an EIP-2612 permit for spender. Nothing is broadcast; the spender submits it.

PermitOptions

Promise<SignedPermit>


signTransaction(tx, options?): Promise<string>

Defined in: wallet-evm/src/account.ts:284

Sign WITHOUT broadcasting. Fully-specified EIP-1559 / legacy txs sign offline; the chain and zero-address refusals still apply. Simulation is NOT run here (nothing is sent) — sendTransaction runs it.

EvmTransaction

WriteOptions = {}

Promise<string>

IWalletAccount.signTransaction


signTypedData(typed): Promise<string>

Defined in: wallet-evm/src/account.ts:193

EIP-712. Accepts {domain, types, message}; primaryType is inferred when absent.

TypedDataInput

Promise<string>


simulateTransaction(tx): Promise<SimulationResult>

Defined in: wallet-evm/src/read-only-account.ts:316

Dry-run the transaction from this account (eth_call + gas estimate). A revert comes back as {ok: false, reason} with the decoded Error(string), Panic(uint256) or custom-error selector; only transport failures throw.

EvmTransaction

Promise<SimulationResult>

WalletAccountReadOnlyEvm.simulateTransaction


toReadOnlyAccount(): IWalletAccountReadOnly

Defined in: wallet-evm/src/account.ts:513

The same address as a WalletAccountReadOnlyEvm.

IWalletAccountReadOnly

IWalletAccount.toReadOnlyAccount


transfer(options, writeOptions?): Promise<TransferResult>

Defined in: wallet-evm/src/account.ts:406

Native or token transfer; the account builds the transaction.

EvmTransferOptions

WriteOptions = {}

Promise<TransferResult>

IWalletAccount.transfer


verify(message, signature): Promise<boolean>

Defined in: wallet-evm/src/read-only-account.ts:364

True when signature is this address’s EIP-191 signature of message.

string | Uint8Array<ArrayBufferLike>

string

Promise<boolean>

IWalletAccount.verify

WalletAccountReadOnlyEvm.verify


verifyTypedData(typed, signature): Promise<boolean>

Defined in: wallet-evm/src/read-only-account.ts:373

True when signature is this address’s EIP-712 signature of typed.

TypedDataInput

string

Promise<boolean>

WalletAccountReadOnlyEvm.verifyTypedData


static fromPrivateKey(privateKey, publicKey, path, config?): WalletAccountEvm

Defined in: wallet-evm/src/account.ts:127

Back-compat: wrap a raw derived key in a LocalSigner (the account takes ownership; it cannot derive).

Uint8Array

Uint8Array

string

EvmConfig = {}

WalletAccountEvm