@web4/unichain-promisifier

1.0.1 • Public • Published

unichain-promisifier

A wrapper that provides conversion to/from callback/promise interfaces in Unichain and RemoteUnichain.

Installation

npm i @web4/unichain-promisifier

Usage

const unichain = require('@web4/unichain')
const ram = require('random-access-memory')
const { toPromises } = require('@web4/unichain-promisifier')

const chain = unichain(ram)

// A promisified Unichain interface
const wrapper = toPromises(chain)

API

The API supports two methods, each one returning a compatibilty wrapper around Unichain.

const { toCallbacks, toPromises, unwrap } = require('@web4/unichain-promisifier')

toCallbacks(chain) takes a Unichain-like object with a Promises API, and returns a wrapper with a callbacks interfaced.

toPromises(chain) takes a Unichain-like object with a callbacks API, and returns a wrapper with a Promises interface.

unwrap(chain) takes either a wrapper object, or a normal Unichain, and returns a normal (callbacks API) Unichain.

License

MIT

Dependencies (2)

Dev Dependencies (5)

Package Sidebar

Install

npm i @web4/unichain-promisifier

Weekly Downloads

8

Version

1.0.1

License

MIT

Unpacked Size

11.3 kB

Total Files

6

Last publish

Collaborators

  • neothawreww