getProvider()
Returns a chain provider for the selected chain.
Info
Each provider instance is created once per network, thus 2 chain providers from the same network on the same page share the same underlying reference.
Type
getProvider(chain): ChainProvider
Parameters
Name | Type | Description |
---|---|---|
chain | "constellation" | "ethereum" | Chain name. |
Return Type
ChainProvider
- The selected chain provider. An error is thrown if chain
is invalid.
Example
TypeScript
window.stargazer.getProvider("constellation");
// ChainProvider