0.0.11 • Published 6 years ago

@aeternity/id-manager-provider v0.0.11

Weekly downloads
12
License
ISC
Repository
github
Last release
6 years ago

Æternity ID Manager provider

This basically is a dummy web3 provider which sends its requests to the ID Manager instead of handling them itself. The communication is handled with postMessage calls and callbacks. For security all Dapps using this must run under the following url scheme http(s)://.aepps.(com|dev)

import IdManagerProvider from '@aeternity/id-manager-provider'
// ...
function initWeb3() {
	let web3;
	let idManager = new IdManagerProvider({
		skipSecurity: process.env.NODE_ENV === 'development'
	})
	idManager.checkIdManager().then( (idManagerPresent) => {
		if (idManagerPresent) {
			// optional if you want the provider to poll current blocks
			idManager.startPolling()
			web3 = new Web3(idManager.provider)
		} else if (typeof window.web3 !== 'undefined') { // Metamask
			web3 = new Web3(window.web3.currentProvider);
		} else {
			web3 = null;
		}

		if (web3) {
			// Ready
		} else {
			// Not Ready
		}

	})
}
0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago