3.0.1 • Published 3 years ago

@zapjs/provider v3.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
3 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

3 years ago

3.0.0

3 years ago

2.2.3

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.0.25

5 years ago

2.0.24

5 years ago

2.0.23

5 years ago

2.0.22

5 years ago

2.0.21

5 years ago

2.0.20

5 years ago

2.0.19

5 years ago

2.0.18

5 years ago

2.0.17

6 years ago

2.0.16

6 years ago

2.0.15

6 years ago

2.0.14

6 years ago

2.0.13

6 years ago

2.0.12

6 years ago

2.0.11

6 years ago

2.0.10

6 years ago

2.0.9

6 years ago

2.0.8

6 years ago

2.0.7

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago