Class: EvmProvider
Defined in: evm-client/src/provider.ts:77
Everything an EvmConfig says about how to reach the chain, resolved once and shared: the Chain the clients are bound to, the Transport they speak over, the read-only PublicClient the reader / writer / indexer all run on, and — only when the config carries something to sign with — the Account and WalletClient the EvmChainSigner submits through.
Why reads and writes are separate clients here
On Solana the connection lives inside the chain signer, because Anchor needs
a Provider (connection + wallet) before it can build a Program at all, so
even a keyless app constructs a signer just to hold the connection. Nothing on
EVM works that way: EvmReader, EvmWriter and EvmIndexerClient take a
bare PublicClient and never sign, so the read path is genuinely
account-free and belongs in its own object. That is what makes the keyless case
honest rather than a signer with its signing half disabled — a read-only
EvmProvider simply has no walletClient.
Every layer is overridable
Each step defers to the config before building anything, so a caller can enter
at whatever level they already have: a whole EvmConfig.publicClient or
EvmConfig.walletClient, just an EvmConfig.account, just a
EvmConfig.rpcTransport, just an EvmConfig.chain, or nothing but
an rpcUrl.
Constructors
Constructor
new EvmProvider(config): EvmProvider;
Defined in: evm-client/src/provider.ts:103
Parameters
| Parameter | Type |
|---|---|
config | EvmConfig<string> |
Returns
EvmProvider
Properties
account?
readonly optional account?: Account;
Defined in: evm-client/src/provider.ts:98
The account that will sign and pay, or undefined for a read-only provider.
See resolveEvmAccount for the order the config is consulted in.
chain
readonly chain: Chain;
Defined in: evm-client/src/provider.ts:79
The chain the clients are bound to. See resolveEvmChain.
config
readonly config: EvmConfig<string>;
Defined in: evm-client/src/provider.ts:103
publicClient
readonly publicClient: object;
Defined in: evm-client/src/provider.ts:89
The shared read client. Account-free by construction: every read in this
package is an eth_call / eth_getLogs / eth_getBlock*, and transaction
building is offline, so a read-only app is fully functional on this alone.
subscriptionClient?
readonly optional subscriptionClient?: object;
Defined in: evm-client/src/provider.ts:92
Client on EvmConfig.wsUrl, only for log subscriptions.
transport
readonly transport: Transport;
Defined in: evm-client/src/provider.ts:82
How the clients reach the node. Defaults to http(config.rpcUrl).
Accessors
canSign
Get Signature
get canSign(): boolean;
Defined in: evm-client/src/provider.ts:128
Whether this provider can submit — i.e. whether the config carried key
material (an account, a walletClient with one, or a privateKey). What
decides between a signing and a read-only app; see
EvmFactory.createChainSigner.
Returns
boolean
walletClient
Get Signature
get walletClient():
| {
}
| undefined;
Defined in: evm-client/src/provider.ts:141
The submission client, or undefined when there is nothing to sign with.
Built lazily and cached, so a read-only flow never constructs one. The
client is deliberately not pre-bound to an account: the account and chain
are passed on every sendTransaction, which keeps a caller-supplied
EvmConfig.walletClient (whose generics we do not control) usable
without re-wrapping it — see EvmChainSigner.submit.
Returns
| {
}
| undefined