open-index/open-npm huggingface dataset:
npm package: @polkadot/api-derive
Description: Common functions used across Polkadot, derived from RPC calls and storage queries.
Author: Jaco Greeff
Latest version: 16.5.6

# @polkadot/api-derive

Collection of high-level utility functions built on top of the @polkadot/api library. Designed to simplify the process of querying complex on-chain data by combining multiple RPC calls, storage queries, and runtime logic into a single, callable function.

Instead of manually fetching and processing blockchain data, developers can use `api.derive` methods to retrieve information.

## Available Derive Namespaces

The derive functions are categorized into namespaces based on different common Substrate modules. Accesible by calling `api.derive.NAMESPACE` (e.g. `api.derive.balances`). The available modules are as follows:

- [accounts](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/accounts)
- [alliance](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/alliance)
- [bagsList](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/bagsList)
- [balances](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/balances)
- [bounties](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/bounties)
- [chain](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/chain)
- [contracts](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/contracts)
- [council](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/council)
- [crowdloan](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/crowdloan)
- [democracy](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/democracy)
- [elections](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/elections)
- [imOnline](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/imOnline)
- [membership](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/membership)
- [parachains](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/parachains)
- [session](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/session)
- [society](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/society)
- [staking](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/staking)
- [technicalCommittee](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/technicalCommittee)
- [treasury](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/treasury)
- [tx](https://github.com/polkadot-js/api/tree/master/packages/api-derive/src/tx)
npm package: @polkadot/api-observable
Description: An Observable wrapper around the Polkadot JS API
Author: Jaco Greeff
Latest version: 0.36.3

# @polkadot/api-observable

A combination Observable wrapper around [@polkadot/rpc-rx](packages/rpc-rx), including both [JSON-RPC methods](https://polkadot.js.org/api/METHODS_RPC.html) and [Storage methods](https://polkadot.js.org/api/METHODS_STORAGE.html)
npm package: @polkadot/dev-react
Description: A collection of shared CI scripts and development environment used by @polkadot projects
Author: Jaco Greeff
Latest version: 0.34.2

# @polkadot/dev-react

A collection of shared CI scripts and development environment (configuration, dependencies) used by [@polkadot](https://polkadot.js.org) React projects. Included here -

- [style config](config/) Common configurations for [Babel](https://babeljs.io/), [ESLint](https://eslint.org/), [Jest](https://facebook.github.io/jest/) & [Stylelint](https://stylelint.io/).
- [flow definitions](flow-typed/) A collection of 3rd-party [flow](https://flow.org/) definitions used by libraries and projects.
- [config skeleton](skeleton/) Standard configurations that allow for project bootstrap, done via `yarn polkadot-dev-copy-skeleton`
npm package: @polkadot/dev-test
Description: A basic test-functions-as-global library on top of node:test
Author: Jaco Greeff
Latest version: 0.84.3

# @polkadot/dev-test

This is a very basic Jest-compatible environment that could be used alongside tests. The need for this came from replacing Jest with `node --test` without rewriting all assertions.

It provides the following -

1. Browser `window`, `document`, `navigator` (see usage for browser-specific path)
2. `jest` functions, specifically `spyOn` (not comprehensive, some will error, some witll noop)
3. `expect` functions (not comprehensive, caters for specific polkadot-js usage)


## Usage

On thing to note is that `node:test` is still rapidly evolving - this includes the APIs and features. As such this requires at least Node 18.14, however 18.15+ is recommended.

The entry points are different based on the environment you would like to operate in. For a browser-like environment,

```
node --require @polkadot/dev-test/browser ...
```

or for a basic describe/expect/jest-only global environment

```
node --require @polkadot/dev-test/node ...
```

The `...` above indicates any additional Node options, for instance a full command could be -

```
node --require @polkadot/dev-test/node --test something.test.js
```
npm package: @polkadot/example-react
Description: A very basic example with ui-* & react-* packages
Author: Jaco Greeff
Latest version: 0.86.2

# @polkadot/example-react

A versy basic React example with `@polkadot/ui-keyring`, `@polkadot/ui-settings` & `@polkadot/react-identicon`
npm package: @polkadot/example-vue
Description: A very basic example with ui-* & vue-* packages
Author: Jaco Greeff
Latest version: 0.86.2

# @polkadot/example-vue

A versy basic Vue.js example with `@polkadot/ui-keyring`, `@polkadot/ui-settings` & `@polkadot/vue-identicon`
npm package: @polkadot/extension-base
Description: Functions, classes and other utilities used in @polkadot/extension
Author: Jaco Greeff
Latest version: 0.63.1

# @polkadot/extension-base

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

They are primarily meant to be used in `@polkadot/extension`, and can be broken without any notice to cater for `@polkadot/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: @polkadot/extension-inject
Description: A generic injector (usable to any extension), that populates the base exposed interfaces to be used by dapps.
Author: Jaco Greeff
Latest version: 0.63.1

# @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

```js
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' });
```
npm package: @polkadot/json-serve
Description: A JSON API endpoint server
Author: Jaco Greeff
Latest version: 0.63.20

# @polkadot/json-serve

A simple tool that serves a limited subset of on-chain information as JSON output.

## Usage

```
yarn run:json-serve --ws ws://localhost:9944 --port 8181
```

Then just doing a get on `http://localhost:8181` should return something like

```
Error: Invalid query '?q=', expected '?q=<type>', one of 'bondedpercentage', 'totalbonded', 'totalcoins'
```

When passing a correctly formatted query, e.g. `http://localhost:8181?q=totalcoins` should return for the chain, e.g -

```
8168333.357737305935
```

If you are installing it globally -

```
$ yarn global add @polkadot/json-serve
$ polkadot-js-json-serve ...
```
npm package: @polkadot/keyring
Description: Keyring management
Author: Jaco Greeff
Latest version: 14.0.3

# @polkadot/keyring

Key management of user accounts including generation and retrieval of keyring pairs from a variety of input combinations.

## Usage

Installation -

```
yarn add @polkadot/keyring
```

Classes and Functions can be imported as follows:

```js
import Keyring from '@polkadot/keyring';
```
npm package: @polkadot/metadata-cmp
Description: Compares metadata from 2 sources
Author: Jaco Greeff
Latest version: 0.63.20

# @polkadot/metadata-cmp

A utility to compare metadata from 2 sources

## Usage

Commands are of the form,

```
yarn run:metadata <ws1> <ws2> [options]
```

Where `ws1` is the first websocket, and `ws2` is the second websocket. The `options` are as follows:

`--legacy`: Use of the legacy rpc method `api.rpc.state.getMetadata` for retrieving metadata. When this is false or empty the default `api.call.metadata.metadataAtVersion` will be used.
npm package: @polkadot/monitor-rpc
Description: A simple monitor via RPC
Author: Jaco Greeff
Latest version: 0.63.20

# @polkadot/monitor-rpc

A simple RPC monitor that provides output to both the console and via an HTTP interface.

## Usage

```
yarn run:monitor --ws ws://localhost:9944 --port 8181
```

Then just doing a get on `localhost:8181` should return something like

```
{"blockNumber":7030,"blockTimestamp":"2018-11-27T09:51:06.283Z","elapsed":1.828,"ok":true}
```

If you are installing it globally -

```
$ yarn global add @polkadot/monitor-rpc
$ polkadot-js-monitor ...
```
npm package: @polkadot/networks
Description: A list of all available Substrate networks and their applicable prefixes
Author: Jaco Greeff
Latest version: 14.0.3

# @polkadot/networks

A list of all available Substrate networks and their applicable prefixes.

This list is periodically checked against the master list available at https://github.com/paritytech/ss58-registry/blob/main/ss58-registry.json
npm package: @polkadot/phishing
Description: Simple phishing scripts from a central source
Author: Jaco Greeff
Latest version: 0.25.25

# @polkadot/phishing

To check for sites that are on the list -

```js
import { checkIfDenied } from '@polkadot/phishing';

const isOnDeny = await checkIfDenied(window.location.host);

console.log(`isOnDeny=${isOnDeny}`);
```

To check for addresses that are on the list -

```js
import { checkAddress } from '@polkadot/phishing';

const info = await checkAddress('1b....');

if (info) {
  console.log(`The address is reported as ${info}`);
} else {
  console.log('Not reported');
}
```
npm package: @polkadot/react-identicon
Description: Renders an SVG picture representing an address
Author: Jaco Greeff
Latest version: 3.16.7

# @polkadot/react-identicon

A generic identity icon that can render icons based on the theme, be it Substrate or Polkadot

## Usage Examples

To install the component, do `yarn add @polkadot/react-identicon`

Inside a React component, you can now render any account with the associated icon -

```javascript
import Identicon from '@polkadot/react-identicon';

...
render () {
  // address is an ss58-encoded address or publicKey (hex string or Uint8Array)
  const { address } = this.props;
  // size (optional) is a number, indicating the size (in pixels, 64 as default)
  const size = 32;
  // theme (optional), depicts the type of icon, one of
  // 'polkadot', 'substrate' (default), 'beachball' or 'jdenticon'
  const theme = 'polkadot';

  // standard className & style props are also available
  return (
    <Identicon
      value={address}
      size={size}
      theme={theme}
    />
  );
}
...
```
npm package: @polkadot/react-qr
Description: Generates and reads QR codes
Author: Jaco Greeff
Latest version: 3.16.7

# @polkadot/react-qr

A Qr-code component that allows for the transfer of addresses and transaction payloads to and from external readers. It implements the [Universal Offline Signatures](https://github.com/maciejhirsz/uos) specification to read and generated QR codes.
npm package: @polkadot/reactnative-identicon
Description: Renders an SVG picture representing an address
Author: Jaco Greeff
Latest version: 3.16.7

# @polkadot/reactnative-identicon

A generic identity icon that can render icons based on an address.

## Usage Examples

To install the component, do `yarn add @polkadot/reactnative-identicon`

Inside a React component, you can now render any account with the associated icon -

```javascript
import Identicon from '@polkadot/reactnative-identicon';

...
render () {
  // address is an ss58-encoded address or publicKey (hex string or Uint8Array)
  const { address } = this.props;
  // size (optional) is a number, indicating the size (in pixels, 64 as default)
  const size = 32;

  // standard className & style props are also available
  return (
    <Identicon
      value={address}
      size={size}
    />
  );
}
...
```
npm package: @polkadot/rpc-provider
Description: Transport providers for the API
Author: Jaco Greeff
Latest version: 16.5.6

# @polkadot/rpc-provider

Generic transport providers to handle the transport of method calls to and from Polkadot clients from applications interacting with it. It provides an interface to making RPC calls and is generally, unless you are operating at a low-level and taking care of encoding and decoding of parameters/results, it won't be directly used, rather only passed to a higher-level interface.

## Provider Selection

There are three flavours of the providers provided, one allowing for using HTTP as a transport mechanism, the other using WebSockets, and the third one uses substrate light-client through @substrate/connect. It is generally recommended to use the [[WsProvider]] since in addition to standard calls, it allows for subscriptions where all changes to state can be pushed from the node to the client.

All providers are usable (as is the API), in both browser-based and Node.js environments. Polyfills for unsupported functionality are automatically applied based on feature-detection.

## Usage

Installation -

```
yarn add @polkadot/rpc-provider
```

WebSocket Initialization -

```javascript
import { WsProvider } from '@polkadot/rpc-provider';

// this is the actual default endpoint
const provider = new WsProvider('ws://127.0.0.1:9944');
const version = await provider.send('client_version', []);

console.log('client version', version);
```

HTTP Initialization -

```javascript
import { HttpProvider } from '@polkadot/rpc-provider';

// this is the actual default endpoint
const provider = new HttpProvider('http://127.0.0.1:9933');
const version = await provider.send('chain_getBlockHash', []);

console.log('latest block Hash', hash);
```

@substrate/connect Initialization -

Instantiating a Provider for the Polkadot Relay Chain:
```javascript
import { ScProvider } from '@polkadot/rpc-provider';
import * as Sc from '@substrate/connect';

const provider = new ScProvider(Sc, Sc.WellKnownChain.polkadot);

await provider.connect();

const version = await provider.send('chain_getBlockHash', []);
```

Instantiating a Provider for a Polkadot parachain:
```javascript
import { ScProvider } from '@polkadot/rpc-provider';
import * as Sc from '@substrate/connect';

const polkadotProvider = new ScProvider(Sc, Sc.WellKnownChain.polkadot);
const parachainProvider = new ScProvider(Sc, parachainSpec, polkadotProvider);

await parachainProvider.connect();

const version = await parachainProvider.send('chain_getBlockHash', []);
```
npm package: @polkadot/signer-cli
Description: A commandline signer for offline signature generataion
Author: Jaco Greeff
Latest version: 0.63.20

# @polkadot/signer-cli

A simple CLI interface for offline signing. This can also be executed via the [docker image](../../README.md#docker).

## Create a transaction

To create a transaction, you need to use the API to connect to a chain, enabling the creation of a transaction using the chain's metadata. In a terminal, run the `submit` command with the following form:

`yarn run:signer submit --account <ss58> --ws <endpoint> <module.method> [param1] [...] [paramX]`

For instance, to make a transfer, we run the following command:

`yarn run:signer submit --account 5HNHXTw65dTNVGRdYkxFUpKcvmUYQMZHcDHmSKpuC8pvVEaN --ws wss://poc3-rpc.polkadot.io/ balances.transfer 5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo 123`

On execution, it will prompt us with:

```
Payload: 0x040300ff4a83f1...a8239139ff3ff7c3f6
Signature>
```

The `Payload` is the hex that needs to be signed. Pasting the hex signature (followed by `Enter`) submits it to the chain.

You can also use this command to submit pre-signed transactions, e.g. generated using the `sendOffline` command (see below).

The syntax is as follows:

`yarn run:signer submit --tx <signedTransaction> --ws <endpoint>`

## Sign a transaction

To sign, you do not need a network connection at all and this command does not use the API to make connections to a chain. In a terminal, run the `sign` command with the following form:

`yarn run:signer sign --account <ss58> --seed <suri> --type <ed25519|sr25519> <hex payload>`

For instance, to sign the transfer made above, we run:

`yarn run:signer sign --account 5HNHXTw65dTNVGRdYkxFUpKcvmUYQMZHcDHmSKpuC8pvVEaN --seed "leaf ... rude" --type sr25519 0x040300ff4a83f1...a8239139ff3ff7c3f6`

On execution, it will respond with:

```
Signature: 0xe6facf194a8e...413ce3155c2d1240b
```

Paste this signature into the submission in the first terminal, and off we go.

By default, `submit` will create a mortal extrinsic with a lifetime of 50 blocks. Assuming a six-second block time, you will have five minutes to go offline, sign the transaction, paste the signature, and submit the signed transaction.

## Send offline

This functionality lets you generate signed transactions for execution at a later time, on a different device or using other tools. It is intended to resemble MyEtherWallet's [`Send offline`](https://kb.myetherwallet.com/en/offline/offline_transaction/) feature.

The flow is similar to the `submit` command. First, run the `sendOffline` command on a computer with a network connection:

`yarn run:signer sendOffline --account 5HNHXTw65dTNVGRdYkxFUpKcvmUYQMZHcDHmSKpuC8pvVEaN --ws wss://poc3-rpc.polkadot.io/ balances.transfer 5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo 123`

This will give you a payload to sign. Use the `sign` command as per instructions above.

Once you've pasted the signature into the `sendOffline` terminal (and hit `Enter`), it will print the signed transaction that can be stored and submitted later (e.g. using the `submit` command).

Run `yarn run:signer --help` to learn about optional parameters.
npm package: @polkadot/ui-react-rx
Description: A collection of RxJs React components the Polkadot JS API
Author: Jaco Greeff
Latest version: 0.22.8

# @polkadot/ui-react-rx

A collection of RxJS enabled React components that operate with the [@polkadot/api-rx](https://github.com/polkadot-js/api) library. It automatically manages subscriptions on behalf of the developer, providing a number of unstyled components that can be used to construct UIs.

## usage

Basic usage entails creating a `ContextProvider` and just using the components. For instance, to display the current node time,

```js
import React from 'react';
import ReactDOM from 'react-dom';

import { Api, NodeTime } from '@polkadot/ui-react-rx';

...
ReactDOM.render(
  <Api>
    <NodeTime />
  </Api>,
  document.querySelector('#container')
);
...
```

All components are provided unstyled making no assumptions on the actual use, however they all support (optionally) the `label`, `className` and `style` attributes, that can be used to style to component.

```js
...
ReactDOM.render(
  <Api>
    <NodeTime className='rx-time' label='current node time:' />
  </Api>,
  document.querySelector('#container')
);
...
```
npm package: @polkadot/ui-settings
Description: Manages app settings
Author: Jaco Greeff
Latest version: 3.16.7

# @polkadot/ui-settings

Manages app settings including endpoints, themes and prefixes

## Usage Examples

User preferences are set as a settings object in the browser's local storage.

```js
import settings from '@polkadot/ui-settings';

render () {
  // get api endpoint for the selected chain
  const WS_URL = settings.apiUrl();

  // get the selected il8n language
  const language = settings.il8nLang();

  // get all available il8n languages
  const languages = settings.availableLanguages();

  // update settings
  const updatedSettings = {
    ...settings,
    i18nLang: 'Arabic'
  }
  settings.set(updatedSettings);

  // NOTE: API currently does not handle hot reconnecting properly,
  so you need to manually reload the page after updating settings.
  window.location.reload();
}
```

## Used by

Apps that currently use the settings package

* [polkadot-js/apps](https://www.github.com/polkadot-js/apps)
* [paritytech/substrate-light-ui](https://github.com/paritytech/substrate-light-ui)
npm package: @polkadot/util
Description: A collection of useful utilities for @polkadot
Author: Jaco Greeff
Latest version: 14.0.3

# @polkadot/util

Various useful utility functions that are used across all projects in the [@polkadot](https://polkadot.js.org) namespace. It provides utility functions with additional safety checks, allowing not only for consistent coding, but also reducing the general boilerplate.

## Usage

Installation -

```
yarn add @polkadot/util
```

Functions can be imported directly from the package, e.g.

```js
import { isHex } from '@polkadot/util';
```
npm package: @polkadot/util-crypto
Description: A collection of useful crypto utilities for @polkadot
Author: Jaco Greeff
Latest version: 14.0.3

# @polkadot/util-crypto

Various useful cyrpto utility functions that are used across all projects in the [@polkadot](https://polkadot.js.org) namespace. It provides utility functions with additional safety checks, allowing not only for consistent coding, but also reducing the general boilerplate.

## Usage

Installation -

```
yarn add @polkadot/util-crypto
```

Functions can be imported as follows:

```js
import { mnemonicGenerate } from '@polkadot/util-crypto';
```
npm package: @polkadot/vanitygen
Description: A vanity generator
Author: Jaco Greeff
Latest version: 0.63.20

# @polkadot/vanitygen

A cli vanity generator

## Usage

```
yarn run:vanity --match cook13 --mnemonic --network kusama --type ed25519
```

When using the `--mnemonic` option, the generation will be very slow since it needs to generate mnemonics and then test the resulting outputs.

As with all other cli utilities `--help` will return a list of the available options.

If you are installing it globally -

```
$ yarn global add @polkadot/vanitygen
$ polkadot-js-vanitygen ...
```
npm package: @polkadot/vue-identicon
Description: Renders an SVG picture representing an address
Author: Jaco Greeff
Latest version: 3.16.7

# @polkadot/vue-identicon

A generic identity icon that can render icons based on an address.

## Usage Examples

To install the component, do `yarn add @polkadot/vue-identicon` and then use it with `import Identicon from '@polkadot/vue-identicon';`

Inside a Vue component, you can now render any account with the associated icon, with associated props -

- `value` - the address you wish to display
- `size` (optional, defaults to `64`) - the size in pixels
- `theme` (optional, defaults to `substrate`) - the theme to use, one of
  - `polkadot` or
  - `substrate` (equivalent to `jdenticon`) or
  - `beachball` or
  - `empty` (displays nothing)

```
<template>
  <Identicon
    :size="128"
    :theme="'polkadot'"
    :value="'5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'"
  />
</template>

<script>
  import Identicon from '@polkadot/vue-identicon';

  export default {
    ...
    components: { Identicon }
    ...
  };
</script>
```
npm package: @polkadot/wasm-crypto
Description: A wasm interface layer for use by @polkadot/util-crypto
Author: Jaco Greeff
Latest version: 7.5.4

# @polkadot/wasm-crypto

Wrapper around crypto hashing functions

## Usage

Install the package (also requires `@polkadot/util` for `TextEncoder` polyfills - not included here as a dependency to keep the tree lean)

`yarn add @polkadot/wasm-crypto @polkadot/util`

Use it -

```js
import { u8aToHex } from '@polkadot/util';
import { bip39Generate, bip39ToSeed, waitReady } from '@polkadot/wasm-crypto';

// first wait until the WASM has been loaded (async init)
await waitReady();

// generate phrase
const phrase = bip39Generate(12);

// get ed25519 seed from phrase
const seed = bip39ToSeed(phrase, '');

// display
console.log('phrase:', phrase);
console.log('seed:', u8aToHex(seed));
```
npm package: @polkadot/wasm-schnorrkel
Description: A fork of [@parity/schnorrkel-js](https://github.com/polkadot-js/schnorrkel-js/tree/b1a1bf25be7397d3c21bba5ddde14286a58b269c) that allows proper operation against all the environments that the `@polkadot/api` supports. Changes from the base repo -
Latest version: 0.7.1

# @polkadot/wasm-schnorrkel

A fork of [@parity/schnorrkel-js](https://github.com/polkadot-js/schnorrkel-js/tree/b1a1bf25be7397d3c21bba5ddde14286a58b269c) that allows proper operation against all the environments that the `@polkadot/api` supports. Changes from the base repo -

- WASM initialisation is done async, via Promise (this allows for clear operation in webpack environments without additional workers)
- WASM outputs are optimised via `wasm-opt` from the [binaryen](https://github.com/WebAssembly/binaryen) project
- Output bundle is wrapped with camelCase names (not including the `__***` internal functions)
- Full named function definitions for TypeScript
- Requires for crypto is wrapped, removing the "on-demand-require" warnings in webpack-based environments
- WASM output is done via a base-64 encoded string, supporting both Node.js and browser environments
- Code cleanups and addition of functions required for all sr25519 operations
- Extended tests to cover Rust, wasm (via Node) and wasm (via jest), removed the (here unused) www test interfaces
- TextDecoder is polyfilled by using the version from `@polkadot/util` (consistent support, also on React Native)
- Polyfill for crypto functions that are not available in some environments (e.g. Jest & React Native)

## Usage

Install the package (also requires `@polkadot/util` for `TextEncoder` polyfills - not included here as a dependency to keep the tree lean)

`yarn add @polkadot/wasm-schnorrkel @polkadot/util`

Use it -

```js
const { u8aToHex } = require('@polkadot/util');
const { waitReady, keypairFromSeed } = require('@polkadot/wasm-schnorrkel');

async function main () {
  // first wait until the WASM has been loaded (async init)
  await waitReady();

  // generate keypair via all-0 seed
  const pair = keypairFromSeed(new Uint8Array(32));

  // extract the parts
  const secretKey = pair.subarray(0, 64);
  const publicKey = pair.subarray(64, 96);

  // display
  console.log('publicKey:', u8aToHex(publicKey));
  console.log('secretKey:', u8aToHex(secretKey));
}
```

## future work

Support asm.js for environments (like React Native) that doesn't have WASM support. Initial attempts made at this, but not active.
npm package: @polkadot/x-fetch
Description: A cross-environment fetch replacement
Author: Jaco Greeff
Latest version: 14.0.3

# @polkadot/x-fetch

A cross-environment fetch.

Install it via `yarn add @polkadot/x-fetch`

```js
import { fetch } from '@polkadot/x-fetch';

...
const response = await fetch('https://example.com/something.json');
const json = await response.json();
```
npm package: @polkadot/x-global
Description: A cross-environment global replacement
Author: Jaco Greeff
Latest version: 14.0.3

# @polkadot/x-global

A cross-environment global object. checks for global > self > window > this.

Install it via `yarn add @polkadot/x-global`

```js
import { xglobal } from '@polkadot/x-global';

console.log(typeof xglobal.TextEncoder);
```
npm package: @polkadot/x-textdecoder
Description: A TextDecoder replacement
Author: Jaco Greeff
Latest version: 14.0.3

# @polkadot/x-textdecoder

A cross-environment TextDecoder.

Install it via `yarn add @polkadot/x-textdecoder`

```js
import { TextDecoder } from '@polkadot/x-textdecoder';

...
const decoder = new TextDecoder('utf-8');
```
npm package: @polkadot/x-textencoder
Description: A TextDecoder replacement
Author: Jaco Greeff
Latest version: 14.0.3

# @polkadot/x-textencoder

A cross-environment TextEncoder.

Install it via `yarn add @polkadot/x-textencoder`

```js
import { TextEncoder } from '@polkadot/x-textencoder';

...
const encoder = new TextEncoder();
```
npm package: @polkadot/x-ws
Description: A cross-environment WebSocket replacement
Author: Jaco Greeff
Latest version: 14.0.3

# @polkadot/x-ws

A cross-environment WebSocket.

Install it via `yarn add @polkadot/x-ws`

```js
import { WebSocket } from '@polkadot/x-ws';

...
const ws = new WebSocket('wss://example.com');
```
npm package: @polkagate/apps-config
Description: This package contains the configuration and network metadata used across PolkaGate products. It can also be customized (via PR) to support additional chains and networks.
Latest version: 2.1.1

# @polkagate/apps-config

This package contains the configuration and network metadata used across PolkaGate products.
It can also be customized (via PR) to support additional chains and networks.



## Adding Support for a New Chain

To add a new chain to PolkaGate:
	
1.	Add the chain’s `genesis` hash, Edit `./networks/genesis.ts`
	
2.	Add network `metadata`, update `./networks/knownSubstrate.ts`
	
3.	Add your chain’s `endpoints` to the relevant file under
`./endpoints/{production, productionRelay, testing, testingRelay*` depending on your deployment.
	
4.	Add chain `logo and color`
	- Place the logo in ui/logos/chains or ui/logos/nodes (the latter is generally used).
	- Run yarn build:images to generate inline image assets.
	- In your endpoint config, set:
	    - ui.color — the chain’s primary color
	    - ui.logo — the imported logo reference


## Adding Support for a New Token

PolkaGate supports both Substrate-native tokens and ERC20 tokens.

### Substrate Tokens

To add a Substrate-based token:          
  - Add the token metadata to an existing supported chain, or    
  - Define a new chain configuration in the corresponding file under: 
  `./assets/substrate`

### ERC20 Tokens

To add an ERC20 token:     
  - Include the token metadata along with its contract address, and  
  - Add it to an existing supported chain, or define a new one in: 
  `./assets/evm`


### Naming Recommendation

It’s recommended to use distinct chain names for each relay network. For example:

	-	Acala — on Polkadot
	-	Karura — on Kusama
	-	Mandala (or Acala Testnet) — as the test network
npm package: @polkagate/snap
Description: A MetaMask Snap to interact with Polkadot ecosystem, a platform for cross-chain communication and scalability. Use your MetaMask wallet to access Polkadot dApps and tokens. No extra extension needed.
Latest version: 2.5.1

# Polkagate snap for MetaMask

 A MetaMask snap for seamless interaction with the Polkadot ecosystem, a prominent platform for cross-chain communication and scalability. Now you can use your MetaMask wallet to access Polkadot dApps and tokens effortlessly.

![Untitled](https://github.com/user-attachments/assets/256265e4-3e0d-4b58-9f22-48dca82e3d2b)


To integrate this snap into your dApp, you can easily upgrade your existing @polkadot/extension-dapp by replacing it with [@polkagate/extension-dapp](https://www.npmjs.com/package/@polkagate/extension-dapp).

⏬ Polkagate snap is now available on MetaMask Snap Directory for download: https://snaps.metamask.io/snap/npm/polkagate/snap/


## Polkagate Snap Security Audit Report

https://sayfer.io/audits/metamask-snap-audit-report-for-polkagate-snap/

---

For more detailed help, please refer to the [docs.polkagate.xyz](https://docs.polkagate.xyz).
npm package: @polkassembly/util
Description: Set of utility functions for Polkassembly and more.
Author: Parity Technologies
Latest version: 0.2.0

# @polkassembly/util

A set of utility functions used in [Polkassembly](https://polkassembly.io).

## Usage

Installation -

```
yarn add @polkssembly/util
```

Functions can be imported directly from the package, e.g.

```js
import { getPassingThreshold } from '@polkassembly/util';
```

## Utility functions
- `getPassingThreshold`: Get the amount of Aye needed for a referendum to pass.
- `newtonRaphson`: This is a fork of [scijs/newton-raphson-method](https://github.com/scijs/newton-raphson-method) that uses bn.js instances instead of plain javascript numbers. It has been simplified and requires to pass the function and its derivative as argument.
- `solveQuadraticEquation`: Get the roots of a polynomial function of degree 2  (`a*x^2 + b*x + c`) where the coeffiscients a, b and c are BN from bn.js.
npm package: @polkawallet/js-api
Description: Wrap `@polkadot-js/api` to provide APIs for polkawallet/sdk.
Author: Shawn yang
Latest version: 0.0.1

# js_api

Wrap `@polkadot-js/api` to provide APIs for polkawallet/sdk.

@polkadot-js/api: ^v1.29.1

## build & test

To build:

```bash
yarn install
yarn run build
```

To test:
open `./test/index.html` in chrome.
open chrome dev console and run `runTests().then(console.log)`