Overview
The @polkadot/extension-dapp package provides an extractor that manipulates the window.injectedWeb3
to retrieve all the providers added to the page. It has a number of utilities
web3Enable(dappName: string): Promise<InjectedExtension[]>
- to be called before anything else, retrieves the list of all injected extensions/providersweb3Accounts(): Promise<InjectedAccountWithMeta[]>
- returns a list of all the injected accounts, across all extensions (source in meta)web3AccountsSubscribe(cb: (accounts: InjectedAccountWithMeta[]) => any): Promise<Unsubcall>
- subscribes to the accounts across all extensions, returning a full list as changes are madeweb3FromAddress(address: string): Promise<InjectedExtension>
- Retrieves a provider for a specific addressweb3FromSource(name: string): Promise<InjectedExtension>
- Retrieves a provider identified by the nameisWeb3Injected: boolean
- boolean to indicate ifinjectedWeb3
was found on the pageweb3EnablePromise: Promise<InjectedExtension[]> | null
-null
or the promise as a result of the last call toweb3Enable
To get started, follow the installation and usage walk through.