Trait sc_rpc_api::state::StateApi[][src]

pub trait StateApi<Hash>: Sized + Send + Sync + 'static {
    type Metadata: PubSubMetadata;
    fn call(
        &self,
        name: String,
        bytes: Bytes,
        hash: Option<Hash>
    ) -> FutureResult<Bytes>;
fn storage_keys(
        &self,
        prefix: StorageKey,
        hash: Option<Hash>
    ) -> FutureResult<Vec<StorageKey>>;
fn storage_pairs(
        &self,
        prefix: StorageKey,
        hash: Option<Hash>
    ) -> FutureResult<Vec<(StorageKey, StorageData)>>;
fn storage_keys_paged(
        &self,
        prefix: Option<StorageKey>,
        count: u32,
        start_key: Option<StorageKey>,
        hash: Option<Hash>
    ) -> FutureResult<Vec<StorageKey>>;
fn storage(
        &self,
        key: StorageKey,
        hash: Option<Hash>
    ) -> FutureResult<Option<StorageData>>;
fn storage_hash(
        &self,
        key: StorageKey,
        hash: Option<Hash>
    ) -> FutureResult<Option<Hash>>;
fn storage_size(
        &self,
        key: StorageKey,
        hash: Option<Hash>
    ) -> FutureResult<Option<u64>>;
fn metadata(&self, hash: Option<Hash>) -> FutureResult<Bytes>;
fn runtime_version(
        &self,
        hash: Option<Hash>
    ) -> FutureResult<RuntimeVersion>;
fn query_storage(
        &self,
        keys: Vec<StorageKey>,
        block: Hash,
        hash: Option<Hash>
    ) -> FutureResult<Vec<StorageChangeSet<Hash>>>;
fn query_storage_at(
        &self,
        keys: Vec<StorageKey>,
        at: Option<Hash>
    ) -> FutureResult<Vec<StorageChangeSet<Hash>>>;
fn read_proof(
        &self,
        keys: Vec<StorageKey>,
        hash: Option<Hash>
    ) -> FutureResult<ReadProof<Hash>>;
fn subscribe_runtime_version(
        &self,
        metadata: Self::Metadata,
        subscriber: Subscriber<RuntimeVersion>
    );
fn unsubscribe_runtime_version(
        &self,
        metadata: Option<Self::Metadata>,
        id: SubscriptionId
    ) -> RpcResult<bool>;
fn subscribe_storage(
        &self,
        metadata: Self::Metadata,
        subscriber: Subscriber<StorageChangeSet<Hash>>,
        keys: Option<Vec<StorageKey>>
    );
fn unsubscribe_storage(
        &self,
        metadata: Option<Self::Metadata>,
        id: SubscriptionId
    ) -> RpcResult<bool>; fn to_delegate(self) -> IoDelegate<Self, Self::Metadata>
    where
        Hash: Send + Sync + 'static + Serialize + DeserializeOwned
, { ... } }

Substrate state API

Associated Types

type Metadata: PubSubMetadata[src]

RPC Metadata

Loading content...

Required methods

fn call(
    &self,
    name: String,
    bytes: Bytes,
    hash: Option<Hash>
) -> FutureResult<Bytes>
[src]

Call a contract at a block’s state.

fn storage_keys(
    &self,
    prefix: StorageKey,
    hash: Option<Hash>
) -> FutureResult<Vec<StorageKey>>
[src]

DEPRECATED: Please use state_getKeysPaged with proper paging support. Returns the keys with prefix, leave empty to get all the keys.

fn storage_pairs(
    &self,
    prefix: StorageKey,
    hash: Option<Hash>
) -> FutureResult<Vec<(StorageKey, StorageData)>>
[src]

Returns the keys with prefix, leave empty to get all the keys

fn storage_keys_paged(
    &self,
    prefix: Option<StorageKey>,
    count: u32,
    start_key: Option<StorageKey>,
    hash: Option<Hash>
) -> FutureResult<Vec<StorageKey>>
[src]

Returns the keys with prefix with pagination support. Up to count keys will be returned. If start_key is passed, return next keys in storage in lexicographic order.

fn storage(
    &self,
    key: StorageKey,
    hash: Option<Hash>
) -> FutureResult<Option<StorageData>>
[src]

Returns a storage entry at a specific block’s state.

fn storage_hash(
    &self,
    key: StorageKey,
    hash: Option<Hash>
) -> FutureResult<Option<Hash>>
[src]

Returns the hash of a storage entry at a block’s state.

fn storage_size(
    &self,
    key: StorageKey,
    hash: Option<Hash>
) -> FutureResult<Option<u64>>
[src]

Returns the size of a storage entry at a block’s state.

fn metadata(&self, hash: Option<Hash>) -> FutureResult<Bytes>[src]

Returns the runtime metadata as an opaque blob.

fn runtime_version(&self, hash: Option<Hash>) -> FutureResult<RuntimeVersion>[src]

Get the runtime version.

fn query_storage(
    &self,
    keys: Vec<StorageKey>,
    block: Hash,
    hash: Option<Hash>
) -> FutureResult<Vec<StorageChangeSet<Hash>>>
[src]

Query historical storage entries (by key) starting from a block given as the second parameter.

NOTE This first returned result contains the initial state of storage for all keys. Subsequent values in the vector represent changes to the previous state (diffs).

fn query_storage_at(
    &self,
    keys: Vec<StorageKey>,
    at: Option<Hash>
) -> FutureResult<Vec<StorageChangeSet<Hash>>>
[src]

Query storage entries (by key) starting at block hash given as the second parameter.

fn read_proof(
    &self,
    keys: Vec<StorageKey>,
    hash: Option<Hash>
) -> FutureResult<ReadProof<Hash>>
[src]

Returns proof of storage entries at a specific block’s state.

fn subscribe_runtime_version(
    &self,
    metadata: Self::Metadata,
    subscriber: Subscriber<RuntimeVersion>
)
[src]

New runtime version subscription

fn unsubscribe_runtime_version(
    &self,
    metadata: Option<Self::Metadata>,
    id: SubscriptionId
) -> RpcResult<bool>
[src]

Unsubscribe from runtime version subscription

fn subscribe_storage(
    &self,
    metadata: Self::Metadata,
    subscriber: Subscriber<StorageChangeSet<Hash>>,
    keys: Option<Vec<StorageKey>>
)
[src]

New storage subscription

fn unsubscribe_storage(
    &self,
    metadata: Option<Self::Metadata>,
    id: SubscriptionId
) -> RpcResult<bool>
[src]

Unsubscribe from storage subscription

Loading content...

Provided methods

fn to_delegate(self) -> IoDelegate<Self, Self::Metadata> where
    Hash: Send + Sync + 'static + Serialize + DeserializeOwned
[src]

Create an IoDelegate, wiring rpc calls to the trait methods.

Loading content...

Implementors

Loading content...