Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (49 sloc) 1.99 KB

@zapjs/bondage

This package provides an interface to the Zap bondage contract. This package enables subscribers to bond and unbond Zap and Dots from registered oracles.

Prerequisites

- Nodejs and npm>=6.1.11
- Typescript

Usage

Using Zap Arbiter to listen to subscriptions events
npm install --save `@zapjs/bondage`
import {ZapBondage} from '@zapjs/bondage';

let myZapBondage = new ZapBondage();

Custom configuration

let myZapBondage = new ZapBondage({networkId,networkProvider,coordinator})

Methods

Get methods

const zapBound = await myZapBondage.getZapBound({provider,endpoint});
const dotsBound = await myZapBondage.getBoundDots({subscriber,provider,endpoint});
const gotsIssued = await myZapBondage.getDotsIssued({provider,endpoint});
const currentCostOfDots  = await myZapBondage.currentCostOfDots({provider,ednpoint,dots});
const bondRate = await myZapBondage.calcBondRate({provider,endpoint,zapNum});
const zapRequired = await myZapBondate.calcZapForDots({provider,endpoint,dots});

Listen to events

myZapBondate.listenBound(filters,callback);
myZapBondate.listenUnbound(filters,callback);
myZapBondate.listenEscrowed(filters,callback);
myZapBondate.listenRelease(filters,callback);

Listen to all events

myZapBondate.listen(callback);

See more Usages of each packages