Skip to main content

Class: MultiOvercastApp<T>

Defined in: packages/overcast-core/src/multiapp.ts:147

One handle over several chains at once: hand it the factories and it builds each chain's OvercastApp, then hands any one of them back at its original type.

That round trip is the point. A factory arrives strictly typed (EvmFactory extends ProtocolFactory<EvmLayer>), and the multi-app keeps that type keyed by the factory's own literal name — so nothing is erased into a union on the way in, and nothing has to be re-narrowed or cast on the way out:

const multi = await MultiOvercastApp.create({
factories: [new EvmFactory({ chain: sepolia }), new SolanaFactory({})],
});

multi.get("evm"); // OvercastApp<EvmLayer>
multi.get("solana"); // OvercastApp<SolanaLayer>
multi.get("sui"); // compile error: not one of the factories passed

// Chain-agnostic sweep: reads carry no layer, so the union is enough.
const balances = await Promise.all(
multi.apps.map((app) => app.chain.balance(app.owner, asset)),
);

It is a registry, not a facade: there is no aggregated chain / api / rfq on it, because "the balance" or "the RFQ channel" across chains is a policy question (which chain, summed how, over whose socket) that belongs to the caller. Resolve a chain and you are back in the single-chain SDK, unchanged.

Type Parameters

Type ParameterDescription
T extends ProtocolFactoriesthe factory tuple, inferred at create. Carrying it on the class is what keeps the key set and every return type tied to the exact factories that were passed.

Accessors

apps

Get Signature

get apps(): MultiApp<T>[];

Defined in: packages/overcast-core/src/multiapp.ts:230

Every chain's app, for sweeps that read the same on every chain. See MultiApp for what the union permits without narrowing.

Returns

MultiApp<T>[]


names

Get Signature

get names(): FactoryNames<T>[];

Defined in: packages/overcast-core/src/multiapp.ts:220

The chains this app spans, in the order their factories were passed.

Returns

FactoryNames<T>[]

Methods

curator()

curator(): Promise<OvercastCurator>;

Defined in: packages/overcast-core/src/multiapp.ts:264

One OvercastCurator spanning every chain this app holds — the per-domain address boundaries and the union of the per-domain asset metadata.

This is the shape anything that stores protocol data needs, and the only place in the SDK where it can be assembled honestly: a store's rows span whatever domains its indexer scanned, and the domain→boundary and domain→assets relations both live on the individual apps.

new PostgresStore(db, await multi.curator());

Assets keep whatever Asset.domain the backend stamped on them. One that arrives without a domain is registered as a wildcard, answering for any domain with no asset of its own at that address — which is correct for a single-domain backend, and is why nothing here invents a domain the backend did not state. Two domains that use the same address for different tokens are only distinguishable once the backend stamps them; until then the last one registered wins.

Returns

Promise<OvercastCurator>


get()

get<N>(name): MultiApps<T>[N];

Defined in: packages/overcast-core/src/multiapp.ts:211

Chain name's app, at that chain's exact type — get("evm") is an OvercastApp<EvmLayer>, so its layer-typed writes are usable with no narrowing step. A name no factory supplied is a compile error.

Type Parameters

Type Parameter
N extends string

Parameters

ParameterType
nameN

Returns

MultiApps<T>[N]


has()

has(name): name is FactoryNames<T>;

Defined in: packages/overcast-core/src/multiapp.ts:238

Whether this app spans name, narrowing an arbitrary string (a --chain flag, a config key) into one get accepts.

Parameters

ParameterType
namestring

Returns

name is FactoryNames<T>


create()

static create<T>(__namedParameters): Promise<MultiOvercastApp<T>>;

Defined in: packages/overcast-core/src/multiapp.ts:178

Builds one OvercastApp per factory, concurrently, and files each under its factory's ProtocolFactory.name.

All-or-nothing: every chain goes through the same OvercastApp.create, so one chain missing an identity (or failing to reach its RPC) rejects the whole call rather than yielding a multi-app with a hole in it that only surfaces at the first get. A caller wanting per-chain tolerance should decide which chains it has and pass only those factories.

Type Parameters

Type Parameter
T extends ProtocolFactories

Parameters

ParameterType
__namedParametersMultiAppOptions<T>

Returns

Promise<MultiOvercastApp<T>>

Throws

when two factories share a name, when factories is empty, or when any one chain's OvercastApp.create throws.