Files
api/docs/rpc-core/classes/_index_.rpc.md
T
2018-10-12 13:44:40 +00:00

2.9 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

  • RpcInterface

Constructors

constructor

⊕ new Rpc(provider?: ProviderInterface): Rpc

Defined in index.ts:45

constructor: Default constructor for the Api Object

Parameters:

Param 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:41


author

● author: RpcInterface$Section

Defined in index.ts:42


chain

● chain: RpcInterface$Section

Defined in index.ts:43


state

● state: RpcInterface$Section

Defined in index.ts:44


system

● system: RpcInterface$Section

Defined in index.ts:45


Methods

<Static> signature

▸ signature(__namedParameters: object): string

Defined in index.ts:78

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:

Param Type
__namedParameters object

Returns: string