Files
extension/packages/extension-dapp
Jaco Greeff 73733dc8bc Add @polkadot/extension-dapp (#28)
* Add @polkadot/extension-dapp

* Add skeleton READMEs

* Extend with additional helpers

* Adapdt for new name-less interface

* Additional comments

* Readability

* Flatter promise

* Naming consistency

* Readability
2019-05-24 11:13:06 +02:00
..
2019-05-24 11:13:06 +02:00
2019-05-24 11:13:06 +02:00
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...)