ghost-keychain/packages/extension-inject
Antoine Estienne b9e7c37944
Allow ethereum format for ethereum chains (#776)
* allow ethereum format for ethereum chains

* remove logs

* remove load event

* lint

* add ethereum and handle ethereum format

* Moves onChangeNetwork outside of rendering

* Restore window load event

* Lint

* Updates create account test

Co-authored-by: Crystalin <alan@purestake.com>
2021-08-22 20:33:00 +02:00
..
src Allow ethereum format for ethereum chains (#776) 2021-08-22 20:33:00 +02:00
LICENSE extension-inject (no direct globals for extension/dapp) (#75) 2019-07-12 21:22:06 +02:00
package.json [CI Skip] release/beta 0.39.4-2 2021-08-17 07:40:52 +00:00
README.md Add address encoding option to web3Accounts (#437) 2020-09-11 16:09:02 +02:00

@polkadot/extension-inject

This is a basic extension injector that manages access to the global objects available. As an extension developer, you don't need to manage access to the window object manually, by just calling enable here, the global object is setup and managed properly. From here any dapp can access it with the @polkadot/extension-dapp package;

Usage

import { injectExtension } from '@polkadot/extension-inject';

// this a the function that will be exposed to be callable by the dapp. It resolves a promise
// with the injected interface, (see `Injected`) when the dapp at `originName` (url) is allowed
// to access functionality
function enableFn (originName: string): Promise<Injected> {
  ...
}

// injects the extension into the page
injectExtension(enableFn, { name: 'myExtension', version: '1.0.1' });