* Make a start * Intro * Installation * Flatten * Move METHODS_*.md to substrate/*.md * Basics * Apply suggestions from code review Co-Authored-By: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * Substrate links * Create * api.consts * Typo * Typo, ms -> md * types.basics (SIP) * Type basics * api.consts jumps to api.query * Start to api.query * Basic queries * Point starting to actual overview * api.rpc * Derive detour * Query subs & query multi * Apply suggestions from code review Co-Authored-By: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * typo * Query extras * Basic transactions * Misplaced , * keyring WIP * Keyring wrap-up * Subs SIP * tx subs more WIP * tx subs * Small types cleanups * Apply suggested changes from @JoshOrndorff * Clarify naked await * tx wrapping WIP * Wrap api.wrap * TS placeholder * [WIP] markers for not-started * Clarifying comments * Additional clarifications * types.extend... well, extended... * Remove *nix * Warp up TypeScript... it is it (for now) * Some small text clarifications * Some cleanups * Cleanups, typos * keyring cleanups * Cleanups * Wrap * api.wrap wrapped... hopefully * typos * Registration typos * typescript typos, hope I caught most...
4.3 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. The RPCs are provided by Substrate itself.
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
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