Skip to content
docs

WalletAccountReadOnlyEvm

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

An EVM address without a key: balances, allowances, fee quotes, simulation, receipts and signature checks. Hand it to code that should only read or quote.

  • IWalletAccountReadOnly

new WalletAccountReadOnlyEvm(address, config?): WalletAccountReadOnlyEvm

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

string

EvmConfig = {}

WalletAccountReadOnlyEvm

protected readonly _client: { } | undefined

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


protected readonly _config: EvmConfig

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


readonly address: `0x${string}`

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

Checksummed address.

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

IWalletAccountReadOnly.chain

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


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>


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>


getAddress(): Promise<string>

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

The checksummed address.

Promise<string>

IWalletAccountReadOnly.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>


getBalance(): Promise<bigint>

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

Native balance in wei.

Promise<bigint>

IWalletAccountReadOnly.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>


getFeeRate(): Promise<bigint>

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

Current fee rate: maxFeePerGas, falling back to gasPrice.

Promise<bigint>


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>

IWalletAccountReadOnly.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>>


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>

IWalletAccountReadOnly.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<{ } | { } | { } | { } | { }>


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>

IWalletAccountReadOnly.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; }>

IWalletAccountReadOnly.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; }>

IWalletAccountReadOnly.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


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>


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>

IWalletAccountReadOnly.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>