3.0.1 • Published 4 years ago

@zapjs/provider v3.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

@zapjs/provider

This package provides wrapper classes to onchain and offchains oracles on the Zap platform.

Prerequisites

What things you need to install the software and how to install them

- Node 12.20 <=14.15
- Typescript

Usage

Create and manage a Zap Provider
npm install `@zapjs/provider`
import {ZapProvider, ProviderHandler} from '@zapjs/provider';
let myZapProvider = new ZapProvider({owner:address});

Create Zap Provider

let myZapProvider = new zapProvider(owner)

With Custom configuration

let myZapProvider = new ZapProvider(owner,{networkId,networkProvider,coordinator});

Initiate in Registry and create Curve for an endpoint

await myZapProvider.initiateProvider({
    public_key:111,
    title: "testTitle",
    endpoint: "testEndpoint",
    endpoint_params : ["p1","p2"]
})

const thisConstants = []
const thisParts = []
const thisDividers = []
await myZapProvider.initiateProviderCurve({
    endpoint :"testEndpoint",
    constants : thisConstants,
    parts : thisParts,
    dividers : thisDividers
})

Get information about a provider

Get general information

const title = await myZapProvider.getTitle()
const pubkey = await myZapProvider.getPubkey()
TODO get next endpoint

Get endpoint specific information

const Curve = await myZapProvider.getCurve(endpoint);
const zapBound = await myZapProvider.getZapBoung(endpoint);
const zapRequired = await myZapProvider.getZapRequired({endpoint,dots});
const dots = await myZapProvider.calcDotsForZap({endpoint,zapAmount})

Listen to events belong to this provider

myZapProvider.listenSubscribes(filters,callback);
myZapProvider.listenUnsubscribes(filters,callback);
myZapProvider.listenQueries(filters,callback);

Respond to queries

await myZapProvider.respond({queryId,responseParams,dynamic}); //string, array, boolean

See more Usages of each packages :

3.0.1

4 years ago

3.0.0

4 years ago

2.2.3

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.0.25

6 years ago

2.0.24

6 years ago

2.0.23

6 years ago

2.0.22

6 years ago

2.0.21

6 years ago

2.0.20

6 years ago

2.0.19

6 years ago

2.0.18

7 years ago

2.0.17

7 years ago

2.0.16

7 years ago

2.0.15

7 years ago

2.0.14

7 years ago

2.0.13

7 years ago

2.0.12

7 years ago

2.0.11

7 years ago

2.0.10

7 years ago

2.0.9

7 years ago

2.0.8

7 years ago

2.0.7

7 years ago

2.0.6

7 years ago

2.0.5

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago