Skip to main content

Class: OvercastUtilsRegistry

Defined in: packages/overcast-core/src/protocol/utils.ts:142

Every settlement layer's OvercastUtils, keyed by the protocol domain separator — OptionDetails.domain, the same domain an indexed event and every projection row carries.

A single OvercastUtils is the right shape for an app, which is pinned to one chain. It is the wrong shape for anything that stores protocol data: a store is fed by an indexer, an indexer scans whatever domains it is pointed at, and so a store's rows span chains even when the process that queries it cares about one. Curating all of them through a single boundary is what this type exists to stop — the domain is on the row, so the layer that owns the row is knowable, per row.

A domain nothing is registered for falls back to hexUtils (overridable via the constructor), so a store is always able to answer: unknown domains come back in canonical hex with their asset metadata unresolved, rather than throwing or being formatted as some other chain's address.

This is one half of an OvercastCurator — the other being the AssetRegistry, keyed by domain the same way — and a store takes the pair rather than either alone:

const utils = new OvercastUtilsRegistry([
[1, solanaFactory.utils],
[8453, baseFactory.utils],
]);
new MemoryStore(new OvercastCurator(utils, assets)); // likewise `PostgresStore`

Constructors

Constructor

new OvercastUtilsRegistry(utils?, fallback?): OvercastUtilsRegistry;

Defined in: packages/overcast-core/src/protocol/utils.ts:152

Parameters

ParameterTypeDefault value
utilsIterable<readonly [number, OvercastUtils]>[]
fallbackOvercastUtilshexUtils

Returns

OvercastUtilsRegistry

Properties

fallback

readonly fallback: OvercastUtils;

Defined in: packages/overcast-core/src/protocol/utils.ts:150

The boundary used for a domain no layer was registered for. hexUtils unless the caller passed another one — a deployment that would rather see a hard failure than a hex address can supply a throwing implementation here.

Methods

domains()

domains(): number[];

Defined in: packages/overcast-core/src/protocol/utils.ts:182

The domains with a registered layer, in insertion order.

Returns

number[]


get()

get(domain): OvercastUtils;

Defined in: packages/overcast-core/src/protocol/utils.ts:171

The boundary for domain, or fallback when none is registered — including for a row whose domain is missing altogether, which is why a nullish domain is accepted rather than rejected.

Parameters

ParameterType
domainnumber | null | undefined

Returns

OvercastUtils


has()

has(domain): boolean;

Defined in: packages/overcast-core/src/protocol/utils.ts:177

Whether domain has a layer of its own (i.e. get won't fall back).

Parameters

ParameterType
domainnumber

Returns

boolean


register()

register(domain, utils): this;

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

Add (or replace) the boundary for one domain.

Parameters

ParameterType
domainnumber
utilsOvercastUtils

Returns

this