pub struct Client { /* private fields */ }
Implementations§
Source§impl Client
impl Client
pub async fn new(url: &str) -> Result<Client, Error>
pub fn get_transaction_version(&self) -> i64
pub fn get_genesis_hash(&self) -> H256
pub async fn get_additional_signed( &self, lifetime: Option<u64>, ) -> Result<(AdditionalSigned, Era), Error>
Sourcepub async fn get_system_properties(&self) -> Result<SystemProperties, Error>
pub async fn get_system_properties(&self) -> Result<SystemProperties, Error>
Get the SystemProperties
of the chain.
pub async fn get_storage_keys_paged( &self, prefix: &StorageKey, count: usize, start_key: Option<&StorageKey>, at: Option<H256>, ) -> Result<Vec<StorageKey>, Error>
pub async fn get_storage_by_key<T>(
&self,
key: StorageKey,
at: Option<H256>,
) -> Result<Option<T>, Error>where
T: Decode,
pub async fn get_storage_data_by_key( &self, key: StorageKey, at: Option<H256>, ) -> Result<Option<StorageData>, Error>
Sourcepub async fn subscribe_blocks(&self) -> Result<Subscription<Header>, Error>
pub async fn subscribe_blocks(&self) -> Result<Subscription<Header>, Error>
Subscribe to new blocks.
Sourcepub async fn subscribe_finalized_blocks(
&self,
) -> Result<Subscription<Header>, Error>
pub async fn subscribe_finalized_blocks( &self, ) -> Result<Subscription<Header>, Error>
Subscribe to new finalized blocks.
Sourcepub async fn submit_and_watch(
&self,
tx_hex: String,
) -> Result<Subscription<TransactionStatus>, Error>
pub async fn submit_and_watch( &self, tx_hex: String, ) -> Result<Subscription<TransactionStatus>, Error>
Submit and watch a transaction.
Sourcepub async fn request<'a, R>(
&self,
method: &'a str,
params: ArrayParams,
) -> Result<R, Error>where
R: DeserializeOwned,
pub async fn request<'a, R>(
&self,
method: &'a str,
params: ArrayParams,
) -> Result<R, Error>where
R: DeserializeOwned,
Make a RPC request to the node.
Sourcepub async fn batch_request<'a, R>(
&self,
batch: BatchRequestBuilder<'a>,
) -> Result<BatchResponse<'a, R>, Error>
pub async fn batch_request<'a, R>( &self, batch: BatchRequestBuilder<'a>, ) -> Result<BatchResponse<'a, R>, Error>
Make a batch of RPC requests to the node.
Sourcepub async fn subscribe<'a, Notif>(
&self,
subscribe_method: &'a str,
params: ArrayParams,
unsubscribe_method: &'a str,
) -> Result<Subscription<Notif>, Error>where
Notif: DeserializeOwned,
pub async fn subscribe<'a, Notif>(
&self,
subscribe_method: &'a str,
params: ArrayParams,
unsubscribe_method: &'a str,
) -> Result<Subscription<Notif>, Error>where
Notif: DeserializeOwned,
Subscribe to RPC updates.
Sourcepub async fn get_finalized_block(&self) -> Result<H256, Error>
pub async fn get_finalized_block(&self) -> Result<H256, Error>
Get the current finalized block hash.
Sourcepub async fn get_signed_block(
&self,
block: Option<H256>,
) -> Result<Option<SignedBlock>, Error>
pub async fn get_signed_block( &self, block: Option<H256>, ) -> Result<Option<SignedBlock>, Error>
Get a block.
Sourcepub async fn get_block(
&self,
block: Option<H256>,
) -> Result<Option<Block>, Error>
pub async fn get_block( &self, block: Option<H256>, ) -> Result<Option<Block>, Error>
Get a block.
Sourcepub async fn find_extrinsic_block_index(
&self,
block: H256,
tx_hash: H256,
) -> Result<Option<usize>, Error>
pub async fn find_extrinsic_block_index( &self, block: H256, tx_hash: H256, ) -> Result<Option<usize>, Error>
Get find extrinsic index in block. The extrinsic index is used to filter the block events for that extrinsic.
Sourcepub async fn get_block_header(
&self,
block: Option<H256>,
) -> Result<Option<Header>, Error>
pub async fn get_block_header( &self, block: Option<H256>, ) -> Result<Option<Header>, Error>
Get the header of a block.
Sourcepub async fn get_block_hash(
&self,
block_number: u32,
) -> Result<Option<H256>, Error>
pub async fn get_block_hash( &self, block_number: u32, ) -> Result<Option<H256>, Error>
Get the block hash for a block_number
.
Sourcepub async fn subscribe_runtime_version(
&self,
) -> Result<Subscription<RuntimeVersion>, Error>
pub async fn subscribe_runtime_version( &self, ) -> Result<Subscription<RuntimeVersion>, Error>
Subscribe to RuntimeVersion updates.
Sourcepub async fn get_block_runtime_version(
&self,
block: Option<H256>,
) -> Result<Option<RuntimeVersion>, Error>
pub async fn get_block_runtime_version( &self, block: Option<H256>, ) -> Result<Option<RuntimeVersion>, Error>
Get the RuntimeVersion of a block.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
Source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T
. Read moreSource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.