Skip to main content

Abstract Class: ProtocolFactory<N, L>

Defined in: packages/overcast-core/src/layer/factory.ts:28

The single chain-specific entry point: builds every per-layer piece the SDK composes into an OvercastApp — the on-chain OvercastReader, the transaction-building OvercastWriter, the OvercastChainSigner and the OvercastIndexerClient. A settlement layer implements this one factory (e.g. a Solana factory) and is good to go; the rest of the SDK stays chain-agnostic.

Type Parameters

Type ParameterDescription
N extends ChainNamethe ChainName this factory is filed under, as a literal on a configured factory (ProtocolFactory<"base", EvmLayer>). It appears only on name and config, so nothing else in a chain package has to thread it: the reader, writer, signer and indexer a factory builds are all name-agnostic, and so is the OvercastLayer itself — which is why L is not parameterized by N. The literal is re-applied here, on config, and nowhere else.
L extends OvercastLayerthe OvercastLayer describing this settlement layer.

Constructors

Constructor

new ProtocolFactory<N, L>(config): ProtocolFactory<N, L>;

Defined in: packages/overcast-core/src/layer/factory.ts:55

Parameters

ParameterType
configL["config"] & OvercastConfig<N>

Returns

ProtocolFactory<N, L>

Properties

config

readonly config: L["config"] & OvercastConfig<N>;

Defined in: packages/overcast-core/src/layer/factory.ts:53

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


name

readonly name: N;

Defined in: packages/overcast-core/src/layer/factory.ts:39

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.


protocol

abstract readonly protocol: string;

Defined in: packages/overcast-core/src/layer/factory.ts:47

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.

Accessors

settlementLayers

Get Signature

get abstract settlementLayers(): SettlementLayers<L>;

Defined in: packages/overcast-core/src/layer/factory.ts:82

The settlement layers this chain implements, keyed by type. Which layers exist is a per-chain fact, so it lives on the factory alongside utils. A caller-side helper (surfaced as app.settlement) for picking the config an offer commits to — the writer never consults it.

Returns

SettlementLayers<L>


utils

Get Signature

get abstract utils(): OvercastUtils;

Defined in: packages/overcast-core/src/layer/factory.ts:74

The layer's OvercastUtils (address validation etc.). Stateless and connection-free, so — unlike the create* methods — it is resolved synchronously.

Returns

OvercastUtils

Methods

createChainSigner()

abstract createChainSigner(): Promise<OvercastChainSigner<L> | undefined>;

Defined in: packages/overcast-core/src/layer/factory.ts:66

The layer's transaction signer (build → sign → submit). This might be undefined, in that case, its a pure read App.

Returns

Promise<OvercastChainSigner<L> | undefined>


createIndexerClient()

abstract createIndexerClient(): Promise<OvercastIndexerClient>;

Defined in: packages/overcast-core/src/layer/factory.ts:67

Returns

Promise<OvercastIndexerClient>


createReader()

abstract createReader(): Promise<OvercastReader>;

Defined in: packages/overcast-core/src/layer/factory.ts:60

Returns

Promise<OvercastReader>


createWriter()

abstract createWriter(): Promise<OvercastWriter<L, L["tx"]>>;

Defined in: packages/overcast-core/src/layer/factory.ts:61

Returns

Promise<OvercastWriter<L, L["tx"]>>


withConfig()

abstract withConfig(config): ProtocolFactory<N, L>;

Defined in: packages/overcast-core/src/layer/factory.ts:88

Returns a new factory based on the config that is passed

Parameters

ParameterTypeDescription
configPartial<L["config"]>-

Returns

ProtocolFactory<N, L>