import { BlockHash, Option } from '@dedot/codecs'; import { Callback, GenericJsonRpcApis, Unsub } from '@dedot/types'; import { HexString } from '@dedot/utils'; import { FollowEvent, MethodResponse, StorageQuery } from '../types/index.js'; /** * chainHead-prefixed JSON-RPC methods. * * @version v1 */ export interface ChainHeadV1 extends GenericJsonRpcApis { /** * Track the state of the head of the chain: the finalized, non-finalized, and best blocks. * * @pubsub chainHead_v1_followEvent, chainHead_v1_follow, chainHead_v1_unfollow * @version v1 */ chainHead_v1_follow(with_runtime: boolean, callback: Callback): Promise; /** * Retrieves the body (list of transactions) of a pinned block. * This method should be seen as a complement to `chainHead_v1_follow`, * allowing the JSON-RPC client to retrieve more information about a block * that has been reported. * * Use `archive_unstable_body` if instead you want to retrieve the body of an arbitrary block. * * @rpcname chainHead_v1_body * @version v1 */ chainHead_v1_body(subscriptionId: string, blockHash: BlockHash): Promise; /** * Retrieves the header of a pinned block. * * This method should be seen as a complement to `chainHead_v1_follow`, * allowing the JSON-RPC client to retrieve more information about a block * that has been reported. * * Use `archive_unstable_header` if instead you want to retrieve the header of an arbitrary * block. * * @rpcname chainHead_v1_header * @param subscriptionId * @param blockHash * @version v1 */ chainHead_v1_header(subscriptionId: string, blockHash: BlockHash): Promise>; /** * Returns storage entries at a specific block's state. * * @rpcname chainHead_v1_storage * @param subscriptionId * @param blockHash * @param items * @param childTrie * @version v1 */ chainHead_v1_storage(subscriptionId: string, blockHash: BlockHash, items: Array, childTrie?: string | null): Promise; /** * Call into the Runtime API at a specified block's state. * * @rpcname chainHead_v1_call * @param subscriptionId * @param blockHash * @param func * @param params * @version v1 */ chainHead_v1_call(subscriptionId: string, blockHash: BlockHash, func: string, params: string): Promise; /** * Unpin a block or multiple blocks reported by the `follow` method. * * Ongoing operations that require the provided block * will continue normally. * * When this method returns an error, it is guaranteed that no blocks have been unpinned. * * @rpcname chainHead_v1_unpin * @param subscriptionId * @param hashes * @version v1 */ chainHead_v1_unpin(subscriptionId: string, hashes: BlockHash | BlockHash[]): Promise; /** * Resumes a storage fetch started with `chainHead_storage` after it has generated an * `operationWaitingForContinue` event. * * @rpcname chainHead_v1_continue * @param subscriptionId * @param operationId * @version v1 */ chainHead_v1_continue(subscriptionId: string, operationId: string): Promise; /** * Stops an operation started with chainHead_v1_body, chainHead_v1_call, or * chainHead_v1_storage. If the operation was still in progress, this interrupts it. If * the operation was already finished, this call has no effect. * * @rpcname chainHead_v1_stopOperation * @param subscriptionId * @param operationId * @version v1 */ chainHead_v1_stopOperation(subscriptionId: string, operationId: string): Promise; }