Files
pezkuwi-extension/packages/extension-inject
SatoshiQaziMuhammed 9f42356ac3 Release 0.62.28 (#32)
One version everywhere again: every package, the root and both browser
manifests move from 0.62.27 to 0.62.28, with the exact inter-package
versions. The published change is in @pezkuwi/extension-compat-metamask:
web3 is no longer a dependency (hashing goes through
@pezkuwi/util-crypto keccakAsHex, #31), which takes zod 3 out of every
tree that installs it. The other four packages differ from 0.62.27 only
in their version and inter-package dependency lines (tarballs compared
file by file).
2026-11-15 05:32:51 +04:00
..
2026-11-15 05:32:51 +04:00
2026-11-15 05:32:51 +04: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' });