Skip to main content

RpcClient

Trait RpcClient 

Source
pub trait RpcClient: SubscriptionClientT {
Show 30 methods // Provided methods fn parameters( &self, ) -> impl Future<Output = Result<VersionedParameters, Error>> + Send { ... } fn best_block( &self, ) -> impl Future<Output = Result<BlockDesc, Error>> + Send { ... } fn finalized_block( &self, ) -> impl Future<Output = Result<BlockDesc, Error>> + Send { ... } fn parent( &self, header_hash: HeaderHash, ) -> impl Future<Output = Result<BlockDesc, Error>> + Send { ... } fn state_root( &self, header_hash: HeaderHash, ) -> impl Future<Output = Result<StateRootHash, Error>> + Send { ... } fn beefy_root( &self, header_hash: HeaderHash, ) -> impl Future<Output = Result<MmrPeakHash, Error>> + Send { ... } fn statistics( &self, header_hash: HeaderHash, ) -> impl Future<Output = Result<AnyBytes, Error>> + Send { ... } fn service_data( &self, header_hash: HeaderHash, id: ServiceId, ) -> impl Future<Output = Result<Option<AnyBytes>, Error>> + Send { ... } fn service_value( &self, header_hash: HeaderHash, id: ServiceId, key: AnyVec, ) -> impl Future<Output = Result<Option<AnyBytes>, Error>> + Send { ... } fn service_preimage( &self, header_hash: HeaderHash, id: ServiceId, hash: AnyHash, ) -> impl Future<Output = Result<Option<AnyBytes>, Error>> + Send { ... } fn service_preimage_len( &self, header_hash: HeaderHash, id: ServiceId, hash: AnyHash, ) -> impl Future<Output = Result<Option<u32>, Error>> + Send { ... } fn service_request( &self, header_hash: HeaderHash, id: ServiceId, hash: AnyHash, len: u32, ) -> impl Future<Output = Result<Option<Vec<Slot>>, Error>> + Send { ... } fn work_report( &self, hash: WorkReportHash, ) -> impl Future<Output = Result<AnyBytes, Error>> + Send { ... } fn submit_work_package( &self, core: CoreIndex, package: AnyBytes, extrinsics: Vec<AnyBytes>, ) -> impl Future<Output = Result<(), Error>> + Send { ... } fn submit_work_package_bundle( &self, core: CoreIndex, bundle: AnyBytes, ) -> impl Future<Output = Result<(), Error>> + Send { ... } fn work_package_status( &self, header_hash: HeaderHash, hash: WorkPackageHash, anchor: HeaderHash, ) -> impl Future<Output = Result<WorkPackageStatus, Error>> + Send { ... } fn submit_preimage( &self, requester: ServiceId, preimage: AnyBytes, ) -> impl Future<Output = Result<(), Error>> + Send { ... } fn list_services( &self, header_hash: HeaderHash, ) -> impl Future<Output = Result<Vec<ServiceId>, Error>> + Send { ... } fn fetch_work_package_segments( &self, wp_hash: WorkPackageHash, indices: Vec<u16>, ) -> impl Future<Output = Result<Vec<SegmentBytes>, Error>> + Send { ... } fn fetch_segments( &self, segment_root: SegmentTreeRoot, indices: Vec<u16>, ) -> impl Future<Output = Result<Vec<SegmentBytes>, Error>> + Send { ... } fn sync_state( &self, ) -> impl Future<Output = Result<SyncState, Error>> + Send { ... } fn subscribe_best_block( &self, ) -> impl Future<Output = Result<Subscription<BlockDesc>, Error>> + Send { ... } fn subscribe_finalized_block( &self, ) -> impl Future<Output = Result<Subscription<BlockDesc>, Error>> + Send { ... } fn subscribe_statistics( &self, finalized: bool, ) -> impl Future<Output = Result<Subscription<ChainSubUpdate<AnyBytes>>, Error>> + Send { ... } fn subscribe_service_data( &self, id: ServiceId, finalized: bool, ) -> impl Future<Output = Result<Subscription<ChainSubUpdate<Option<AnyBytes>>>, Error>> + Send { ... } fn subscribe_service_value( &self, id: ServiceId, key: AnyVec, finalized: bool, ) -> impl Future<Output = Result<Subscription<ChainSubUpdate<Option<AnyBytes>>>, Error>> + Send { ... } fn subscribe_service_preimage( &self, id: ServiceId, hash: AnyHash, finalized: bool, ) -> impl Future<Output = Result<Subscription<ChainSubUpdate<Option<AnyBytes>>>, Error>> + Send { ... } fn subscribe_service_request( &self, id: ServiceId, hash: AnyHash, len: u32, finalized: bool, ) -> impl Future<Output = Result<Subscription<ChainSubUpdate<Option<Vec<Slot>>>>, Error>> + Send { ... } fn subscribe_work_package_status( &self, hash: WorkPackageHash, anchor: HeaderHash, finalized: bool, ) -> impl Future<Output = Result<Subscription<ChainSubUpdate<WorkPackageStatus>>, Error>> + Send { ... } fn subscribe_sync_status( &self, ) -> impl Future<Output = Result<Subscription<SyncStatus>, Error>> + Send { ... }
}
Expand description

Client implementation for the Rpc RPC API.

Provided Methods§

Source

fn parameters( &self, ) -> impl Future<Output = Result<VersionedParameters, Error>> + Send

Returns the chain parameters.

Source

fn best_block(&self) -> impl Future<Output = Result<BlockDesc, Error>> + Send

Returns the header hash and slot of the head of the “best” chain.

Source

fn finalized_block( &self, ) -> impl Future<Output = Result<BlockDesc, Error>> + Send

Returns the header hash and slot of the latest finalized block.

Source

fn parent( &self, header_hash: HeaderHash, ) -> impl Future<Output = Result<BlockDesc, Error>> + Send

Returns the header hash and slot of the parent of the block with the given header hash.

Source

fn state_root( &self, header_hash: HeaderHash, ) -> impl Future<Output = Result<StateRootHash, Error>> + Send

Returns the posterior state root of the block with the given header hash.

Source

fn beefy_root( &self, header_hash: HeaderHash, ) -> impl Future<Output = Result<MmrPeakHash, Error>> + Send

Returns the BEEFY root of the block with the given header hash.

Source

fn statistics( &self, header_hash: HeaderHash, ) -> impl Future<Output = Result<AnyBytes, Error>> + Send

Returns the activity statistics stored in the posterior state of the block with the given header hash.

The statistics are encoded as per the GP.

Source

fn service_data( &self, header_hash: HeaderHash, id: ServiceId, ) -> impl Future<Output = Result<Option<AnyBytes>, Error>> + Send

Returns the storage data for the service with the given ID.

The data are encoded as per the GP. None is returned if there is no service with the given ID.

Source

fn service_value( &self, header_hash: HeaderHash, id: ServiceId, key: AnyVec, ) -> impl Future<Output = Result<Option<AnyBytes>, Error>> + Send

Returns the value associated with the given service ID and key in the posterior state of the block with the given header hash.

None is returned if there is no value associated with the given service ID and key.

This method can be used to query arbitrary key-value pairs set by service accumulation logic.

Source

fn service_preimage( &self, header_hash: HeaderHash, id: ServiceId, hash: AnyHash, ) -> impl Future<Output = Result<Option<AnyBytes>, Error>> + Send

Returns the preimage of the given hash, if it has been provided to the given service in the posterior state of the block with the given header hash.

None is returned if the preimage has not been provided to the given service.

Source

fn service_preimage_len( &self, header_hash: HeaderHash, id: ServiceId, hash: AnyHash, ) -> impl Future<Output = Result<Option<u32>, Error>> + Send

Same as service_preimage but only returns the length of the preimage.

Source

fn service_request( &self, header_hash: HeaderHash, id: ServiceId, hash: AnyHash, len: u32, ) -> impl Future<Output = Result<Option<Vec<Slot>>, Error>> + Send

Returns the preimage request associated with the given service ID and hash/length in the posterior state of the block with the given header hash.

None is returned if the preimage with the given hash/length has neither been requested by nor provided to the given service. An empty list is returned if the preimage has been requested, but not yet provided. A non-empty list means that the preimage has been provided; the meaning of the slots in the list is as follows:

  • The first slot is the slot in which the preimage was provided.
  • The second slot, if present, is the slot in which the preimage was “forgotten”.
  • The third slot, if present, is the slot in which the preimage was requested again.
Source

fn work_report( &self, hash: WorkReportHash, ) -> impl Future<Output = Result<AnyBytes, Error>> + Send

Returns the work-report with the given hash.

The work-report is encoded as per the GP.

Source

fn submit_work_package( &self, core: CoreIndex, package: AnyBytes, extrinsics: Vec<AnyBytes>, ) -> impl Future<Output = Result<(), Error>> + Send

Submit a work-package to the guarantors currently assigned to the given core.

Source

fn submit_work_package_bundle( &self, core: CoreIndex, bundle: AnyBytes, ) -> impl Future<Output = Result<(), Error>> + Send

Submit a work-package bundle to the guarantors currently assigned to the given core.

Source

fn work_package_status( &self, header_hash: HeaderHash, hash: WorkPackageHash, anchor: HeaderHash, ) -> impl Future<Output = Result<WorkPackageStatus, Error>> + Send

Returns the status of the given work-package following execution of the block with the given header hash.

If anchor does not match the anchor of the work-package then an error or an incorrect status may be returned. An error may be returned if anchor is too old.

Source

fn submit_preimage( &self, requester: ServiceId, preimage: AnyBytes, ) -> impl Future<Output = Result<(), Error>> + Send

Submit a preimage which is being requested by the given service.

Note that this method does not wait for the preimage to be distributed or integrated on-chain; it returns immediately.

Source

fn list_services( &self, header_hash: HeaderHash, ) -> impl Future<Output = Result<Vec<ServiceId>, Error>> + Send

Returns a list of all services currently known to be on JAM.

This is a best-effort list and may not reflect the true state. Nodes could e.g. reasonably hide services which are not recently active from this list.

Source

fn fetch_work_package_segments( &self, wp_hash: WorkPackageHash, indices: Vec<u16>, ) -> impl Future<Output = Result<Vec<SegmentBytes>, Error>> + Send

Fetches a list of segments from the DA layer, exported by the work-package with the given hash.

Source

fn fetch_segments( &self, segment_root: SegmentTreeRoot, indices: Vec<u16>, ) -> impl Future<Output = Result<Vec<SegmentBytes>, Error>> + Send

Fetches a list of segments from the DA layer, exported by a work-package with the given segment root hash.

Source

fn sync_state(&self) -> impl Future<Output = Result<SyncState, Error>> + Send

Returns the sync status of the node.

Source

fn subscribe_best_block( &self, ) -> impl Future<Output = Result<Subscription<BlockDesc>, Error>> + Send

Subscribe to updates of the head of the “best” chain, as returned by bestBlock.

Source

fn subscribe_finalized_block( &self, ) -> impl Future<Output = Result<Subscription<BlockDesc>, Error>> + Send

Subscribe to updates of the latest finalized block, as returned by finalizedBlock.

Source

fn subscribe_statistics( &self, finalized: bool, ) -> impl Future<Output = Result<Subscription<ChainSubUpdate<AnyBytes>>, Error>> + Send

Subscribe to updates of the activity statistics stored in chain state.

The statistics are encoded as per the GP.

Source

fn subscribe_service_data( &self, id: ServiceId, finalized: bool, ) -> impl Future<Output = Result<Subscription<ChainSubUpdate<Option<AnyBytes>>>, Error>> + Send

Subscribe to updates of the storage data for the service with the given ID.

The value field of updates will contain service data encoded as per the GP. It will be None when there is no service with the given ID.

Source

fn subscribe_service_value( &self, id: ServiceId, key: AnyVec, finalized: bool, ) -> impl Future<Output = Result<Subscription<ChainSubUpdate<Option<AnyBytes>>>, Error>> + Send

Subscribe to updates of the value associated with the given service ID and key.

The value field of updates will be None when there is no value associated with the given service ID and key.

Source

fn subscribe_service_preimage( &self, id: ServiceId, hash: AnyHash, finalized: bool, ) -> impl Future<Output = Result<Subscription<ChainSubUpdate<Option<AnyBytes>>>, Error>> + Send

Subscribe to updates of the preimage associated with the given service ID and hash.

The value field of updates will be None if the preimage has not been provided to the service. Otherwise, it will be the preimage of the given hash.

Source

fn subscribe_service_request( &self, id: ServiceId, hash: AnyHash, len: u32, finalized: bool, ) -> impl Future<Output = Result<Subscription<ChainSubUpdate<Option<Vec<Slot>>>>, Error>> + Send

Subscribe to updates of the preimage request associated with the given service ID and hash/length.

The value field of updates will either be None or a list of slots, with the same semantics as serviceRequest return values.

Source

fn subscribe_work_package_status( &self, hash: WorkPackageHash, anchor: HeaderHash, finalized: bool, ) -> impl Future<Output = Result<Subscription<ChainSubUpdate<WorkPackageStatus>>, Error>> + Send

Subscribe to status updates for the given work-package.

If anchor does not match the anchor of the work-package then the subscription may fail or yield incorrect statuses. The subscription may fail if anchor is too old.

Source

fn subscribe_sync_status( &self, ) -> impl Future<Output = Result<Subscription<SyncStatus>, Error>> + Send

Subscribe to changes in sync status.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<TypeJsonRpseeInternal> RpcClient for TypeJsonRpseeInternal
where TypeJsonRpseeInternal: SubscriptionClientT,