2.6 KiB
name: Api
summary: The API may use a HTTP or WebSockets provider.
description: It allows for querying a Polkadot Client Node.
example:
import Api from '@polkadot/api';
import WsProvider from '@polkadot/api-provider/ws';
const provider = new WsProvider('http://127.0.0.1:9944');
const api = new Api(provider);
Hierarchy
Api
Implements
object
Constructors
constructor
⊕ new Api(provider: ProviderInterface): Api
Defined in index.ts:36
constructor: Default constructor for the Api Object
Parameters:
| Param | Type | Description |
|---|---|---|
| provider | ProviderInterface |
An API provider using HTTP or WebSocket |
Returns: Api
Properties
author
● author: ApiInterface$Section
Defined in index.ts:33
chain
● chain: ApiInterface$Section
Defined in index.ts:34
state
● state: ApiInterface$Section
Defined in index.ts:35
system
● system: ApiInterface$Section
Defined in index.ts:36
Methods
<Static> signature
▸ signature(__namedParameters: object): string
Defined in index.ts:69
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/Api';
Api.signature({ name: 'test_method', params: [ { name: 'dest', type: 'Address' } ], type: 'Address' }); // => test_method (dest: Address): Address
Parameters:
| Param | Type |
|---|---|
| __namedParameters | object |
Returns: string