Files
common/packages/util
Jaco Greeff 2aba82e569 Schnorrkel support (#297)
* Initial schnorrkel support

* Start conversion of actual keyring

* Wrap encoding/decoding (needs another check)

* Manage encoding version & types with passthrough

* Update to version with working sign

* Cleanup pair interface (with seed)

* Fix failing tests

* Align naclSign signature

* Update tests for nacl (with TS conversion)

* Bump version with CHANGELOG

* Remove unneeded dep

* Use KeyringOptions instead of PairType

* Do isNumber check on addressPrefix
2019-02-13 16:46:33 +01:00
..
2019-01-04 14:50:50 +01:00
2018-11-21 12:26:38 +01:00
2019-02-13 16:46:33 +01:00

@polkadot/util

Various useful utility functions that are used across all projects in the @polkadot 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.

import { isHex } from '@polkadot/util';

Documentation and Available Utilities

Below is a list of currently exposed methods published at the Polkadot-JS Common Documentation Portal.

Utility methods for this package are split into groups, some of which are included in the list below:

Below is information about some of the available methods:

Assert

  • Checks for a valid test, if not ExtError is thrown

Logger

  • Creates a consistent log interface for messages that has .log, .error, .warn and .debug (controlled with environment DEBUG=typeA,typeB) methods.

Promisify

  • Wraps a supplied asynchronous callback function into a Promise, passing supplied parameters. When error is set, the Promise is rejected, else the Promise resolves with the result value.

Syncify

  • This is currently for Node environments only.