open-index/open-npm huggingface dataset:
npm package: @soul-wallet/extension-base
Description: Functions, classes and other utilities used in @soul-wallet/extension
Author: Buns Enchantress
Latest version: 1.0.13

# @soul-wallet/extension-base

Functions, classes and other utilities used in `@soul-wallet/extension`. These include:
- background script handlers,
- message passing,
- scripts injected inside pages.

They are primarily meant to be used in `@soul-wallet/extension`, and can be broken without any notice to cater for `@soul-wallet/extension`'s needs.

They are exported here if you wish to use part of them in the development of your own extension. Don't forget to add `process.env.EXTENSION_PREFIX` to separate ports and stores from the current extension's ones.
npm package: @soul-wallet/extension-inject
Description: A generic injector (usable to any extension), that populates the base exposed interfaces to be used by dapps.
Author: Buns Enchantress
Latest version: 1.0.1

# @soul-wallet/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 `@soul-wallet/extension-dapp` package;

## Usage

```js
import { injectExtension } from '@soul-wallet/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' });
```