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.
Extended by
Section titled “Extended by”Implements
Section titled “Implements”IWalletAccountReadOnly
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WalletAccountReadOnlyEvm(
address,config?):WalletAccountReadOnlyEvm
Defined in: wallet-evm/src/read-only-account.ts:132
Parameters
Section titled “Parameters”address
Section titled “address”string
config?
Section titled “config?”EvmConfig = {}
Returns
Section titled “Returns”WalletAccountReadOnlyEvm
Properties
Section titled “Properties”_client
Section titled “_client”
protectedreadonly_client: { } |undefined
Defined in: wallet-evm/src/read-only-account.ts:129
_config
Section titled “_config”
protectedreadonly_config:EvmConfig
Defined in: wallet-evm/src/read-only-account.ts:128
address
Section titled “address”
readonlyaddress:`0x${string}`
Defined in: wallet-evm/src/read-only-account.ts:127
Checksummed address.
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”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).
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.chain
Methods
Section titled “Methods”callParams()
Section titled “callParams()”
protectedcallParams(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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”object
account
Section titled “account”account:
`0x${string}`
authorizationList?
Section titled “authorizationList?”
optionalauthorizationList?:undefined
optionaldata?:`0x${string}`
optionalto?:`0x${string}`
value?
Section titled “value?”
optionalvalue?:bigint
feeFields()
Section titled “feeFields()”
protectedfeeFields(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.
Parameters
Section titled “Parameters”chainId
Section titled “chainId”number
Returns
Section titled “Returns”Promise<FeeFields>
gasFor()
Section titled “gasFor()”
protectedgasFor(tx):Promise<bigint>
Defined in: wallet-evm/src/read-only-account.ts:255
Gas limit: the tx’s own, else one estimate.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<bigint>
getAddress()
Section titled “getAddress()”getAddress():
Promise<string>
Defined in: wallet-evm/src/read-only-account.ts:151
The checksummed address.
Returns
Section titled “Returns”Promise<string>
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.getAddress
getAllowance()
Section titled “getAllowance()”getAllowance(
token,spender):Promise<bigint>
Defined in: wallet-evm/src/read-only-account.ts:181
ERC-20 allowance(owner, spender) in base units.
Parameters
Section titled “Parameters”string
spender
Section titled “spender”string
Returns
Section titled “Returns”Promise<bigint>
getBalance()
Section titled “getBalance()”getBalance():
Promise<bigint>
Defined in: wallet-evm/src/read-only-account.ts:162
Native balance in wei.
Returns
Section titled “Returns”Promise<bigint>
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.getBalance
getChainId()
Section titled “getChainId()”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.
Returns
Section titled “Returns”Promise<number>
getFeeRate()
Section titled “getFeeRate()”getFeeRate():
Promise<bigint>
Defined in: wallet-evm/src/read-only-account.ts:230
Current fee rate: maxFeePerGas, falling back to gasPrice.
Returns
Section titled “Returns”Promise<bigint>
getTokenBalance()
Section titled “getTokenBalance()”getTokenBalance(
token):Promise<bigint>
Defined in: wallet-evm/src/read-only-account.ts:167
ERC-20 balanceOf in the token’s base units.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<bigint>
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.getTokenBalance
getTokenBalances()
Section titled “getTokenBalances()”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.
Parameters
Section titled “Parameters”tokens
Section titled “tokens”string[]
Returns
Section titled “Returns”Promise<Record<string, bigint>>
getTokenInfo()
Section titled “getTokenInfo()”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).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<TokenInfo>
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.getTokenInfo
getTransactionByHash()
Section titled “getTransactionByHash()”getTransactionByHash(
hash):Promise<{ } | { } | { } | { } | { }>
Defined in: wallet-evm/src/read-only-account.ts:359
The transaction as the RPC returns it (viem shape).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<{ } | { } | { } | { } | { }>
getTransactionReceipt()
Section titled “getTransactionReceipt()”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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<EvmReceipt | undefined>
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.getTransactionReceipt
quoteSendTransaction()
Section titled “quoteSendTransaction()”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).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<{ fee: bigint; }>
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.quoteSendTransaction
quoteTransfer()
Section titled “quoteTransfer()”quoteTransfer(
options):Promise<{fee:bigint; }>
Defined in: wallet-evm/src/read-only-account.ts:339
Network fee of a transfer, in wei.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Promise<{ fee: bigint; }>
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.quoteTransfer
requireClient()
Section titled “requireClient()”
protectedrequireClient(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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”object
simulateTransaction()
Section titled “simulateTransaction()”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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<SimulationResult>
verify()
Section titled “verify()”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.
Parameters
Section titled “Parameters”message
Section titled “message”string | Uint8Array<ArrayBufferLike>
signature
Section titled “signature”string
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.verify
verifyTypedData()
Section titled “verifyTypedData()”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.
Parameters
Section titled “Parameters”signature
Section titled “signature”string
Returns
Section titled “Returns”Promise<boolean>