4.9 KiB
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
(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