Trait sc_rpc_api::state::StateApi
source · [−]pub trait StateApi<Hash>: Sized + Send + Sync + 'static {
type Metadata: PubSubMetadata;
Show 17 methods
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,
{ ... }
}
Expand description
Substrate state API
Associated Types
type Metadata: PubSubMetadata
type Metadata: PubSubMetadata
RPC Metadata
Required methods
Call a contract at a block’s state.
fn storage_keys(
&self,
prefix: StorageKey,
hash: Option<Hash>
) -> FutureResult<Vec<StorageKey>>
fn storage_keys(
&self,
prefix: StorageKey,
hash: Option<Hash>
) -> FutureResult<Vec<StorageKey>>
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)>>
fn storage_pairs(
&self,
prefix: StorageKey,
hash: Option<Hash>
) -> FutureResult<Vec<(StorageKey, StorageData)>>
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>>
fn storage_keys_paged(
&self,
prefix: Option<StorageKey>,
count: u32,
start_key: Option<StorageKey>,
hash: Option<Hash>
) -> FutureResult<Vec<StorageKey>>
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>>
fn storage(
&self,
key: StorageKey,
hash: Option<Hash>
) -> FutureResult<Option<StorageData>>
Returns a storage entry at a specific block’s state.
fn storage_hash(
&self,
key: StorageKey,
hash: Option<Hash>
) -> FutureResult<Option<Hash>>
fn storage_hash(
&self,
key: StorageKey,
hash: Option<Hash>
) -> FutureResult<Option<Hash>>
Returns the hash of a storage entry at a block’s state.
fn storage_size(
&self,
key: StorageKey,
hash: Option<Hash>
) -> FutureResult<Option<u64>>
fn storage_size(
&self,
key: StorageKey,
hash: Option<Hash>
) -> FutureResult<Option<u64>>
Returns the size of a storage entry at a block’s state.
fn metadata(&self, hash: Option<Hash>) -> FutureResult<Bytes>
fn metadata(&self, hash: Option<Hash>) -> FutureResult<Bytes>
Returns the runtime metadata as an opaque blob.
fn runtime_version(&self, hash: Option<Hash>) -> FutureResult<RuntimeVersion>
fn runtime_version(&self, hash: Option<Hash>) -> FutureResult<RuntimeVersion>
Get the runtime version.
fn query_storage(
&self,
keys: Vec<StorageKey>,
block: Hash,
hash: Option<Hash>
) -> FutureResult<Vec<StorageChangeSet<Hash>>>
fn query_storage(
&self,
keys: Vec<StorageKey>,
block: Hash,
hash: Option<Hash>
) -> FutureResult<Vec<StorageChangeSet<Hash>>>
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>>>
fn query_storage_at(
&self,
keys: Vec<StorageKey>,
at: Option<Hash>
) -> FutureResult<Vec<StorageChangeSet<Hash>>>
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>>
fn read_proof(
&self,
keys: Vec<StorageKey>,
hash: Option<Hash>
) -> FutureResult<ReadProof<Hash>>
Returns proof of storage entries at a specific block’s state.
fn subscribe_runtime_version(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<RuntimeVersion>
)
fn subscribe_runtime_version(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<RuntimeVersion>
)
New runtime version subscription
fn unsubscribe_runtime_version(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
) -> RpcResult<bool>
fn unsubscribe_runtime_version(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
) -> RpcResult<bool>
Unsubscribe from runtime version subscription
fn subscribe_storage(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<StorageChangeSet<Hash>>,
keys: Option<Vec<StorageKey>>
)
fn subscribe_storage(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<StorageChangeSet<Hash>>,
keys: Option<Vec<StorageKey>>
)
New storage subscription
fn unsubscribe_storage(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
) -> RpcResult<bool>
fn unsubscribe_storage(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
) -> RpcResult<bool>
Unsubscribe from storage subscription
Provided methods
fn to_delegate(self) -> IoDelegate<Self, Self::Metadata> where
Hash: Send + Sync + 'static + Serialize + DeserializeOwned,
fn to_delegate(self) -> IoDelegate<Self, Self::Metadata> where
Hash: Send + Sync + 'static + Serialize + DeserializeOwned,
Create an IoDelegate
, wiring rpc calls to the trait methods.