Files
api/packages/api
2018-05-02 14:15:16 +00:00
..
2018-04-24 10:53:18 +02:00
2018-01-04 08:46:12 +01:00
2018-05-02 14:15:16 +00:00
2017-12-16 11:46:16 +01:00

polkadotjs isc style npm travis maintainability coverage dependency devDependency

@polkadot/api

Warning - currently this does not actually do all that much, it is an attempt to put into code some thoughts about how to maintain the endpoints. This library provides a clean wrapper around all the methods exposed by a Polkadot network client.

Methods are auto-generated for the JsonRPC interface definitions, containing a full list of all sections and the methods cotained within.

Usage

Installation -

npm install --save @polkadot/api

Initialisation -

import Api from '@polkadot/api';
import HttpProvider from '@polkadot/api-provider/http';

const provider = new HttpProvider('http://127.0.0.1:9933');
const api = new Api(provider);

Making calls -

api.chain
  .getHeader('0x1234567890')
  .then((header) => console.log(header))
  .catch((error) => console.error(error));