ghost-keychain/packages/extension-dapp
2019-05-24 16:29:32 +02:00
..
src Undefined check 2019-05-24 16:29:32 +02:00
LICENSE Add @polkadot/extension-dapp (#28) 2019-05-24 11:13:06 +02:00
package.json [CI Skip] 0.1.1-beta.4 2019-05-24 10:57:09 +00:00
README.md Add @polkadot/extension-dapp (#28) 2019-05-24 11:13:06 +02:00

@polkadot/extension-dapp

A basic injected that manipulates the window.injectedWeb3 to extract all the providers added to the page.

Usage

import { web3Accounts, web3Enable, web3FromAddress } from '@polkadot/extension-dapp';

// returns an array of all the injected sources
// (this needs to be called first, before other requests)
const allInjected = await web3Enable(...my dapp name...);

// returns an array of { address, meta: { name, source } }
const allAccounts = await web3Accounts();

// finds an injector for an address
const injector = await web3FromAddress(...address...)