Struct polymesh_api_client::client::Client
source · pub struct Client { /* private fields */ }
Implementations§
source§impl Client
impl Client
pub async fn new(url: &str) -> Result<Self>
pub fn get_transaction_version(&self) -> i64
pub fn get_metadata(&self) -> &RuntimeMetadataPrefixed
pub fn get_signed_extra(&self) -> AdditionalSigned
sourcepub async fn get_system_properties(&self) -> Result<SystemProperties>
pub async fn get_system_properties(&self) -> Result<SystemProperties>
Get the SystemProperties
of the chain.
pub async fn get_storage_by_key<T: Decode>( &self, key: StorageKey, at: Option<BlockHash> ) -> Result<Option<T>>
pub async fn get_storage_data_by_key( &self, key: StorageKey, at: Option<BlockHash> ) -> Result<Option<StorageData>>
sourcepub async fn subscribe_blocks(&self) -> Result<Subscription<Header>>
pub async fn subscribe_blocks(&self) -> Result<Subscription<Header>>
Subscribe to new blocks.
sourcepub async fn subscribe_finalized_blocks(&self) -> Result<Subscription<Header>>
pub async fn subscribe_finalized_blocks(&self) -> Result<Subscription<Header>>
Subscribe to new finalized blocks.
sourcepub async fn submit_and_watch(
&self,
tx_hex: String
) -> Result<Subscription<TransactionStatus>>
pub async fn submit_and_watch( &self, tx_hex: String ) -> Result<Subscription<TransactionStatus>>
Submit and watch a transaction.
sourcepub async fn request<'a, R>(
&self,
method: &'a str,
params: Option<ParamsSer<'a>>
) -> Result<R>where
R: DeserializeOwned,
pub async fn request<'a, R>( &self, method: &'a str, params: Option<ParamsSer<'a>> ) -> Result<R>where R: DeserializeOwned,
Make a RPC request to the node.
sourcepub async fn batch_request<'a, R>(
&self,
batch: Vec<(&'a str, Option<ParamsSer<'a>>)>
) -> Result<Vec<R>>where
R: DeserializeOwned + Default + Clone,
pub async fn batch_request<'a, R>( &self, batch: Vec<(&'a str, Option<ParamsSer<'a>>)> ) -> Result<Vec<R>>where R: DeserializeOwned + Default + Clone,
Make a batch of RPC requests to the node.
sourcepub async fn subscribe<'a, Notif>(
&self,
subscribe_method: &'a str,
params: Option<ParamsSer<'a>>,
unsubscribe_method: &'a str
) -> Result<Subscription<Notif>>where
Notif: DeserializeOwned,
pub async fn subscribe<'a, Notif>( &self, subscribe_method: &'a str, params: Option<ParamsSer<'a>>, unsubscribe_method: &'a str ) -> Result<Subscription<Notif>>where Notif: DeserializeOwned,
Subscribe to RPC updates.
sourcepub async fn get_finalized_block(&self) -> Result<BlockHash>
pub async fn get_finalized_block(&self) -> Result<BlockHash>
Get the current finalized block hash.
sourcepub async fn get_signed_block(
&self,
block: Option<BlockHash>
) -> Result<Option<SignedBlock>>
pub async fn get_signed_block( &self, block: Option<BlockHash> ) -> Result<Option<SignedBlock>>
Get a block.
sourcepub async fn find_extrinsic_block_index(
&self,
block: BlockHash,
tx_hash: TxHash
) -> Result<Option<usize>>
pub async fn find_extrinsic_block_index( &self, block: BlockHash, tx_hash: TxHash ) -> Result<Option<usize>>
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<BlockHash>
) -> Result<Option<Header>>
pub async fn get_block_header( &self, block: Option<BlockHash> ) -> Result<Option<Header>>
Get the header of a block.
sourcepub async fn get_block_hash(
&self,
block_number: u32
) -> Result<Option<BlockHash>>
pub async fn get_block_hash( &self, block_number: u32 ) -> Result<Option<BlockHash>>
Get the block hash for a block_number
.
sourcepub async fn subscribe_runtime_version(
&self
) -> Result<Subscription<RuntimeVersion>>
pub async fn subscribe_runtime_version( &self ) -> Result<Subscription<RuntimeVersion>>
Subscribe to RuntimeVersion updates.
sourcepub async fn get_block_runtime_version(
&self,
block: Option<BlockHash>
) -> Result<Option<RuntimeVersion>>
pub async fn get_block_runtime_version( &self, block: Option<BlockHash> ) -> Result<Option<RuntimeVersion>>
Get the RuntimeVersion of a block.
sourcepub async fn get_block_metadata(
&self,
block: Option<BlockHash>
) -> Result<Option<RuntimeMetadataPrefixed>>
pub async fn get_block_metadata( &self, block: Option<BlockHash> ) -> Result<Option<RuntimeMetadataPrefixed>>
Get the RuntimeMetadata of a block.
Trait Implementations§
Auto Trait Implementations§
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.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, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
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<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 Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.source§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.