Files
api/docs/rpc-core/classes/_index_.rpc.md
T
2019-01-16 09:11:25 +00:00

3.6 KiB

name: Rpc

summary: The API may use a HTTP or WebSockets provider.

description: It allows for querying a Polkadot Client Node. WebSockets provider is recommended since HTTP provider only supports basic querying.

graph LR;
  A[Api] --> |WebSockets| B[WsProvider];
  B --> |endpoint| C[ws://127.0.0.1:9944]

example:

import Api from '@polkadot/rpc-core';
import WsProvider from '@polkadot/rpc-provider/ws';

const provider = new WsProvider('ws://127.0.0.1:9944');
const api = new Api(provider);

Hierarchy

Rpc

Implements

Constructors

constructor

⊕ new Rpc(provider?: ProviderInterface): Rpc

Defined in index.ts:46

constructor: Default constructor for the Api Object

Parameters:

Name Type Default value Description
Default value provider ProviderInterface new WsProvider() An API provider using HTTP or WebSocket

Returns: Rpc


Properties

_provider

● _provider: ProviderInterface

Defined in index.ts:42


author

● author: RpcInterface$Section

Implementation of RpcInterface.author

Defined in index.ts:43


chain

● chain: RpcInterface$Section

Implementation of RpcInterface.chain

Defined in index.ts:44


state

● state: RpcInterface$Section

Implementation of RpcInterface.state

Defined in index.ts:45


system

● system: RpcInterface$Section

Implementation of RpcInterface.system

Defined in index.ts:46


Methods

<Static> signature

▸ signature(__namedParameters: object): string

Defined in index.ts:79

name: signature

summary: Returns a string representation of the method with inputs and outputs.

description: Formats the name, inputs and outputs into a human-readable string. This contains the input parameter names input types and output type.

example:

import Api from '@polkadot/rpc-core';

Api.signature({ name: 'test_method', params: [ { name: 'dest', type: 'Address' } ], type: 'Address' }); // => test_method (dest: Address): Address

Parameters:

Name Type
__namedParameters object

Returns: string