JSPM

  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q88574F
  • License Apache-2.0

RPC server for a Polkadot client

Package Exports

  • @polkadot/client-rpc
  • @polkadot/client-rpc/defaults
  • @polkadot/client-rpc/index

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@polkadot/client-rpc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@polkadot/client-rpc

An RPC server with configurable handlers. It is intended to be used in network clients to spin up a JsonRPC server with minimal configuration and boilerplate.

Usage

npm install --save @polkadot/client-rpc

The by using the library -

const Provider = require('@polkadot/rpc-provider/http');
const Server = require('@polkadot/client-rpc');

const server = new Server({ port: 9901 }, {
  'client_version': () => 'Polka/0.0.1'
});

new Provider('http://localhost:9901')
  .send('client_version', [])
  .then((version) => {
    console.log('The server is running', version;)
  });