Skip to main content

Class: SettlementLayerRegistry<L>

Defined in: packages/overcast-core/src/protocol/settlement-layer.ts:133

The set of settlement layers a chain implements, keyed by type. Built by the chain's ProtocolFactory (which layers exist is a per-chain fact) and surfaced to consumers as app.settlement.

Constructed from an exhaustive map keyed by SettlementKey whose values are each layer's OvercastSettlementLayer typed to that layer's config (layers[K] is OvercastSettlementLayer<L, SettlementConfig<L, K>>), so the compiler guarantees the registry covers every layer the chain's OvercastLayer declares — and, because SettlementConfigMap always carries the KnownSettlementLayer subset, that it covers physical / oracle too. A chain cannot build its app without them.

Type Parameters​

Type ParameterDescription
L extends OvercastLayerthe OvercastLayer describing this settlement layer.

Constructors​

Constructor​

new SettlementLayerRegistry<L>(layers, defaultType): SettlementLayerRegistry<L>;

Defined in: packages/overcast-core/src/protocol/settlement-layer.ts:134

Parameters​

ParameterType
layers{ [K in string]: OvercastSettlementLayer<L, SettlementConfig<L, K>> }
defaultTypeSettlementKey<L>

Returns​

SettlementLayerRegistry<L>

Methods​

default()​

default(): OvercastSettlementLayer<L, SettlementConfig<L, SettlementKey<L>>>;

Defined in: packages/overcast-core/src/protocol/settlement-layer.ts:149

The chain's default layer, used when a caller doesn't pick one. Its config type is the union over all layers (the concrete kind isn't known until runtime); resolve with an explicit key narrows it.

Returns​

OvercastSettlementLayer<L, SettlementConfig<L, SettlementKey<L>>>


defaultConfig()​

defaultConfig(details?): Promise<Bytes32>;

Defined in: packages/overcast-core/src/protocol/settlement-layer.ts:161

The chain's default layer config id — the one value a caller pinning a settlement layer into an offer needs, so the two derivations it takes (OvercastSettlementLayer.defaultConfig then OvercastSettlementLayer.configId) are done here rather than at every call site. Reach for the layer itself when the config is wanted too, e.g. to deploy it.

Parameters​

ParameterType
details?Partial<OptionDetails>

Returns​

Promise<Bytes32>


has()​

has(type): boolean;

Defined in: packages/overcast-core/src/protocol/settlement-layer.ts:172

Whether this chain implements the given layer type.

Parameters​

ParameterType
typestring

Returns​

boolean


resolve()​

resolve<K>(selection?): OvercastSettlementLayer<L, SettlementConfig<L, K>>;

Defined in: packages/overcast-core/src/protocol/settlement-layer.ts:184

Resolve a SettlementSelection (or undefined → the chain default) to its OvercastSettlementLayer logic. Generic over the picked key K, so resolve("oracle") returns a layer typed to the oracle config and resolve("oracle").read(id) needs no cast. Throws with the available layers if the type isn't implemented — a runtime guard for untyped callers; typed call sites can't reach it.

Type Parameters​

Type Parameter
K extends string

Parameters​

ParameterType
selection?SettlementSelection<L, K>

Returns​

OvercastSettlementLayer<L, SettlementConfig<L, K>>


types()​

types(): SettlementKey<L>[];

Defined in: packages/overcast-core/src/protocol/settlement-layer.ts:167

The type keys of the layers this chain implements.

Returns​

SettlementKey<L>[]