Files
api/docs/substrate/rpc.md
T
2019-09-16 09:54:08 +00:00

176 lines
4.9 KiB
Markdown

## JSON-RPC
The following sections contain RPC methods that are Remote Calls available by default and allow you to interact with the actual node, query, and submit.
- **[account](#account)**
- **[author](#author)**
- **[chain](#chain)**
- **[contracts](#contracts)**
- **[rpc](#rpc)**
- **[state](#state)**
- **[system](#system)**
___
### account
_(Optional) Methods that retrieves account-specific information_
▸ **nextIndex**(accountId: `AccountId`): `Index`
- **summary**: Retrieves the next accountIndex as available on the node
___
### author
_Authoring of network items_
▸ **insertKey**(keyType: `Text`, suri: `Text`, publicKey: `Bytes`): `Bytes`
- **summary**: Insert a key into the keystore.
▸ **pendingExtrinsics**(): `Vec<Extrinsic>`
- **summary**: Returns all pending extrinsics, potentially grouped by sender
▸ **removeExtrinsic**(bytesOrHash: `Vec<ExtrinsicOrHash>`): `Vec<Hash>`
- **summary**: Remove given extrinsic from the pool and temporarily ban it to prevent reimporting
▸ **rotateKeys**(): `Bytes`
- **summary**: Generate new session keys and returns the corresponding public keys
▸ **submitAndWatchExtrinsic**(extrinsic: `Extrinsic`): `ExtrinsicStatus`
- **summary**: Submit and subscribe to watch an extrinsic until unsubscribed
▸ **submitExtrinsic**(extrinsic: `Extrinsic`): `Hash`
- **summary**: Submit a fully formatted extrinsic for block inclusion
___
### chain
_Retrieval of chain data_
▸ **getBlock**(hash?: `Hash`): `SignedBlock`
- **summary**: Get header and body of a relay chain block
▸ **getBlockHash**(blockNumber?: `BlockNumber`): `Hash`
- **summary**: Get the block hash for a specific block
▸ **getFinalizedHead**(): `Hash`
- **summary**: Get hash of the last finalized block in the canon chain
▸ **getHeader**(hash?: `Hash`): `Header`
- **summary**: Retrieves the header for a specific block
▸ **subscribeFinalizedHeads**(): `Header`
- **summary**: Retrieves the best finalized header via subscription
▸ **subscribeNewHeads**(): `Header`
- **summary**: Retrieves the best header via subscription
___
### contracts
_(Optional) Methods that performs actions on contracts_
▸ **call**(callRequest: `ContractCallRequest`, at?: `Hash`): `ContractExecResult`
- **summary**: Executes a call to a contract
___
### rpc
_Retrieves information about the RPC endpoints_
▸ **methods**(): `RpcMethods`
- **summary**: Retrieves the list of RPC methods that are exposed by the node
___
### state
_Query of state_
▸ **call**(method: `Text`, data: `Bytes`, block?: `Hash`): `Bytes`
- **summary**: Perform a call to a builtin on the chain
▸ **getChildKeys**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `Vec<StorageKey>`
- **summary**: Retrieves the keys with prefix of a specific child storage
▸ **getChildStorage**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `StorageData`
- **summary**: Retrieves the child storage for a key
▸ **getChildStorageHash**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `Hash`
- **summary**: Retrieves the child storage hash
▸ **getChildStorageSize**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `u64`
- **summary**: Retrieves the child storage size
▸ **getKeys**(key: `StorageKey`, block?: `Hash`): `Vec<StorageKey>`
- **summary**: Retrieves the keys with a certain prefix
▸ **getMetadata**(block?: `Hash`): `Metadata`
- **summary**: Returns the runtime metadata
▸ **getRuntimeVersion**(hash?: `Hash`): `RuntimeVersion`
- **summary**: Get the runtime version
▸ **getStorage**(key: `StorageKey`, block?: `Hash`): `StorageData`
- **summary**: Retrieves the storage for a key
▸ **getStorageHash**(key: `StorageKey`, block?: `Hash`): `Hash`
- **summary**: Retrieves the storage hash
▸ **getStorageSize**(key: `StorageKey`, block?: `Hash`): `u64`
- **summary**: Retrieves the storage size
▸ **queryStorage**(keys: `Vec<StorageKey>`, startBlock: `Hash`, block?: `Hash`): `Vec<StorageChangeSet>`
- **summary**: Query historical storage entries (by key) starting from a start block
▸ **subscribeRuntimeVersion**(): `RuntimeVersion`
- **summary**: Retrieves the runtime version via subscription
▸ **subscribeStorage**(keys: `Vec<StorageKey>`): `StorageChangeSet`
- **summary**: Subscribes to storage changes for the provided keys
___
### system
_Calls to retrieve system info_
▸ **chain**(): `Text`
- **summary**: Retrieves the chain
▸ **health**(): `Health`
- **summary**: Return health status of the node
▸ **name**(): `Text`
- **summary**: Retrieves the node name
▸ **networkState**(): `NetworkState`
- **summary**: Returns current state of the network
▸ **peers**(): `Vec<PeerInfo>`
- **summary**: Returns the currently connected peers
▸ **properties**(): `ChainProperties`
- **summary**: Get a custom set of properties as a JSON object, defined in the chain spec
▸ **version**(): `Text`
- **summary**: Retrieves the version of the node