How to use @polkadot/extension-inject - 1 common examples

To help you get started, we’ve selected a few @polkadot/extension-inject examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github polkadot-js / extension / packages / extension / src / page / index.ts View on Github external
// setup a response listener (events created by the loader for extension responses)
window.addEventListener('message', ({ data, source }): void => {
  // only allow messages from our window, by the loader
  if (source !== window || data.origin !== 'content') {
    return;
  }

  if (data.id) {
    handleResponse(data);
  } else {
    console.error('Missing id for response.');
  }
});

injectExtension(enable, {
  name: 'polkadot-js',
  version: process.env.PKG_VERSION as string
});

@polkadot/extension-inject

A generic injector (usable to any extension), that populates the base exposed interfaces to be used by dapps.

Apache-2.0
Latest version published 9 days ago

Package Health Score

81 / 100
Full package analysis

Popular @polkadot/extension-inject functions

Similar packages