Documentation / @etherfold/browser / IndexerProvider
Type Alias: IndexerProvider ​
IndexerProvider =
RequestProvider|MessagePort| (() =>MessagePort)
Defined in: packages/browser/src/host/provider.ts:23
THE CHAIN, AS A TAB HANDS IT TO A HOST IN ANOTHER CONTEXT.
A provider is an object with methods, so it cannot be structured-cloned into a worker; a MessagePort can be TRANSFERRED into one. So what crosses is always a port, speaking @eip-1193/over-port, and what a tab may hand over is one of three things:
- a provider object (a wallet's
window.ethereum, a viem transport's provider): the port serves it on a freshMessageChannelitself, and every request the host makes passes through this tab as a message (the work stays in the worker); - a
MessagePortwhose other end is already served elsewhere, typically by a worker running a node (webevm): requests then go worker to worker and this tab relays nothing. A port can be transferred ONCE, so a host that dies and is restarted cannot be handed it again; see the factory form; - a function returning such a port, called once per host the port obtains (the first one, and every restart), which is the form that survives a restart for the provider-in-another-worker case.