mirror of
https://github.com/pezkuwichain/pezkuwi-extension.git
synced 2026-10-29 06:49:48 +00:00
- extension-dapp and extension-inject had the manifest the build writes into build/ committed as their source manifest (main ./build/cjs/index.js, an exports map into ./build/). They are back in the source form of the upstream manifests; the build generates those fields itself. - Dependencies between the packages were workspace:*, and the build copies them into the published manifest as they are: @pezkuwi/extension-base 0.62.19 on npm depends on "@pezkuwi/extension-chains": "workspace:*" and cannot be installed. They are exact versions, as upstream has them; yarn still links the workspaces. - @pezkuwi/* common dependencies ^14.0.26 and api dependencies ^16.5.37. These carry wasm-crypto 7.5.20, where ed25519, secp256k1, derivation and bip39 are implemented; 7.5.18 shipped them as "not yet implemented" stubs. The root resolutions that forced 14.0.25, 16.5.36 and wasm-crypto 7.5.18 onto the tree are removed; every @pezkuwi package resolves to a single version without them. - @pezkuwi/dev ^0.85.12. - One version for everything: the packages were at 0.62.20, the extension package at 0.62.23, the root at 0.62.24 and the browser manifests at 0.62.26. All are 0.62.27, above every version on npm and in the stores.
@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' });