1 | [![polkadotjs](https://img.shields.io/badge/polkadot-js-orange.svg?style=flat-square)](https://polkadot.js.org)
|
2 | ![isc](https://img.shields.io/badge/license-ISC-lightgrey.svg?style=flat-square)
|
3 | [![style](https://img.shields.io/badge/code%20style-semistandard-lightgrey.svg?style=flat-square)](https://github.com/Flet/semistandard)
|
4 | [![npm](https://img.shields.io/npm/v/@polkadot/api-provider.svg?style=flat-square)](https://www.npmjs.com/package/@polkadot/api-provider)
|
5 | [![travis](https://img.shields.io/travis/polkadot-js/api.svg?style=flat-square)](https://travis-ci.org/polkadot-js/api)
|
6 | [![maintainability](https://img.shields.io/codeclimate/maintainability/polkadot-js/api.svg?style=flat-square)](https://codeclimate.com/github/polkadot-js/api/maintainability)
|
7 | [![coverage](https://img.shields.io/coveralls/polkadot-js/api.svg?style=flat-square)](https://coveralls.io/github/polkadot-js/api?branch=master)
|
8 | [![dependency](https://david-dm.org/polkadot-js/api.svg?style=flat-square&path=packages/api-provider)](https://david-dm.org/polkadot-js/api?path=packages/api-provider)
|
9 | [![devDependency](https://david-dm.org/polkadot-js/api/dev-status.svg?style=flat-square&path=packages/api-provider)](https://david-dm.org/polkadot-js/api?path=packages/api-provider#info=devDependencies)
|
10 |
|
11 | # @polkadot/api-provider
|
12 |
|
13 | Generic transport providers to handle the transport of method calls to and from Polkadot clients from applications interacting with it. Generally, unless you are operating at a low-level and taking care of encoding and decoding of parameters/results, it won't be directly used. API interfaces building on top these providers can support various transports with the same underlying interfaces.
|
14 |
|
15 | ## Usage
|
16 |
|
17 | Installation -
|
18 |
|
19 | ```
|
20 | npm install --save @polkadot/api-provider
|
21 | ```
|
22 |
|
23 | Initialisation -
|
24 |
|
25 | ```js
|
26 | import HttpProvider from '@polkadot/api-provider/http';
|
27 |
|
28 | const provider = new HttpProvider('http://127.0.0.1:9933');
|
29 | const version = await provider.send('client_version', []);
|
30 |
|
31 | console.log('clientVersion', version);
|
32 | ```
|