Skip to main content

Class: EvmFactory<N>

Defined in: evm-client/src/factory.ts:53

The EVM ProtocolFactory: a single EvmConfig is all the SDK needs to build every per-layer piece — the EvmProvider the clients run on, the calldata-encoding EvmWriter, the EvmReader, the EvmIndexerClient and (when there is key material) the EvmChainSigner. Hand it to OvercastApp.create and the rest of the SDK stays chain-agnostic. Protocol-payload signing is chain-agnostic and lives in core — see createProtocolSigner.

The EvmProvider is built once and shared, so the reader, writer and indexer all read through the same PublicClient — one transport, one batching/caching policy, one place a caller's override takes effect — and the signer submits over the same chain definition they read from.

// Read-only: no key material, so `createChainSigner` yields nothing.
const app = await OvercastApp.create({
factory: new EvmFactory({ chain: sepolia, owner }),
});

// Signing, from a local key.
const app = await OvercastApp.create({
factory: new EvmFactory({ chain: sepolia, privateKey: process.env.PRIVATE_KEY }),
});

// Signing, through a wallet this package could not build (browser, relayer).
const app = await OvercastApp.create({
factory: new EvmFactory({ chain: sepolia, walletClient }),
});

Extends​

Type Parameters​

Type Parameter
N extends ChainName

Constructors​

Constructor​

new EvmFactory<N>(config): EvmFactory<N>;

Defined in: evm-client/src/factory.ts:66

Parameters​

ParameterType
configInputConfig<EvmConfig<N>, N>

Returns​

EvmFactory<N>

Overrides​

ProtocolFactory<
N,
EvmLayer
>.constructor

Properties​

config​

readonly config: EvmConfig<string> & OvercastConfig<N>;

Defined in: overcast-core/dist/layer/factory.d.ts:47

The config this factory was built with, with its chainName narrowed to the literal N — so factory.config.chainName is "base", not string.

Inherited from​

ProtocolFactory.config

name​

readonly name: N;

Defined in: overcast-core/dist/layer/factory.d.ts:35

The chain this factory builds for, at its literal type — the runtime value of config's chainName, surfaced separately because this is the one place N is inferrable from. A MultiOvercastApp keys its chains by it, which is what makes multi.get("base") resolve to this factory's layer rather than a union over every chain passed.

Inherited from​

ProtocolFactory.name

protocol​

readonly protocol: "evm" = EvmFactory.protocol;

Defined in: evm-client/src/factory.ts:60

Which settlement-layer protocol this factory speaks — "evm", "svm".

Mirrored as a static on each implementation, so a host can key a table by it before it has an instance to ask.

Overrides​

ProtocolFactory.protocol

protocol​

readonly static protocol: "evm" = "evm";

Defined in: evm-client/src/factory.ts:58

See ProtocolFactory.protocol.

Accessors​

settlementLayers​

Get Signature​

get settlementLayers(): SettlementLayerRegistry<EvmLayer>;

Defined in: evm-client/src/factory.ts:122

The settlement layers EVM implements. The exhaustive map over keyof EvmLayer["settlements"] makes the compiler enforce every declared layer is registered.

Both layers read through the shared PublicClient — deriving a layer address is an eth_call on its factory (see settlement-layer.ts), so they inherit whatever batching and caching the provider was built with. The oracle layer additionally takes the chain id, which is what selects the built-in Chainlink feed table chainlinkFeeds overrides.

Returns​

SettlementLayerRegistry<EvmLayer>

Overrides​

ProtocolFactory.settlementLayers

utils​

Get Signature​

get utils(): OvercastUtils;

Defined in: evm-client/src/factory.ts:107

The EVM address boundary — stateless, so a shared instance is reused.

Returns​

OvercastUtils

Overrides​

ProtocolFactory.utils

Methods​

createChainSigner()​

createChainSigner(): Promise<EvmChainSigner | undefined>;

Defined in: evm-client/src/factory.ts:79

The chain signer, or undefined when the config carries no key material (no account, no walletClient, no privateKey) — which is what makes the app read-only.

Nothing is withheld by returning undefined here, unlike on Solana where the signer also owns the connection: the EvmProvider holds everything the reader, writer and indexer need, and none of it involves an account.

Returns​

Promise<EvmChainSigner | undefined>

Overrides​

ProtocolFactory.createChainSigner

createIndexerClient()​

createIndexerClient(): Promise<OvercastIndexerClient>;

Defined in: evm-client/src/factory.ts:101

Returns​

Promise<OvercastIndexerClient>

Overrides​

ProtocolFactory.createIndexerClient

createReader()​

createReader(): Promise<OvercastReader>;

Defined in: evm-client/src/factory.ts:94

Returns​

Promise<OvercastReader>

Overrides​

ProtocolFactory.createReader

createWriter()​

createWriter(): Promise<OvercastWriter<EvmLayer, TransactionRequest & object>>;

Defined in: evm-client/src/factory.ts:85

Returns​

Promise<OvercastWriter<EvmLayer, TransactionRequest & object>>

Overrides​

ProtocolFactory.createWriter

provider()​

provider(): EvmProvider;

Defined in: evm-client/src/factory.ts:154

The shared chain provider (chain, transport, read client, optional wallet), built once on first use.

Returns​

EvmProvider


withConfig()​

withConfig(config): ProtocolFactory<N, EvmLayer>;

Defined in: evm-client/src/factory.ts:158

Returns a new factory based on the config that is passed

Parameters​

ParameterTypeDescription
configPartial<EvmConfig<N>>-

Returns​

ProtocolFactory<N, EvmLayer>

Overrides​

ProtocolFactory.withConfig