Struct polymesh_api::Client
source · pub struct Client { /* private fields */ }
Implementations§
source§impl Client
impl Client
pub async fn new(url: &str) -> impl Future<Output = Result<Client, Error>>
pub fn get_transaction_version(&self) -> i64
pub fn get_genesis_hash(&self) -> H256
pub fn get_signed_extra(&self) -> (u32, u32, H256, H256, (), (), ())
sourcepub async fn get_system_properties(
&self
) -> impl Future<Output = Result<SystemProperties, Error>>
pub async fn get_system_properties( &self ) -> impl Future<Output = Result<SystemProperties, Error>>
Get the SystemProperties
of the chain.
pub async fn get_storage_by_key<T>( &self, key: StorageKey, at: Option<H256> ) -> impl Future<Output = Result<Option<T>, Error>>where T: Decode,
pub async fn get_storage_data_by_key( &self, key: StorageKey, at: Option<H256> ) -> impl Future<Output = Result<Option<StorageData>, Error>>
sourcepub async fn subscribe_blocks(
&self
) -> impl Future<Output = Result<Subscription<Header>, Error>>
pub async fn subscribe_blocks( &self ) -> impl Future<Output = Result<Subscription<Header>, Error>>
Subscribe to new blocks.
sourcepub async fn subscribe_finalized_blocks(
&self
) -> impl Future<Output = Result<Subscription<Header>, Error>>
pub async fn subscribe_finalized_blocks( &self ) -> impl Future<Output = Result<Subscription<Header>, Error>>
Subscribe to new finalized blocks.
sourcepub async fn submit_and_watch(
&self,
tx_hex: String
) -> impl Future<Output = Result<Subscription<TransactionStatus>, Error>>
pub async fn submit_and_watch( &self, tx_hex: String ) -> impl Future<Output = Result<Subscription<TransactionStatus>, Error>>
Submit and watch a transaction.
sourcepub async fn request<R, 'a>(
&self,
method: &'a str,
params: ArrayParams
) -> impl Future<Output = Result<R, Error>>where
R: DeserializeOwned,
pub async fn request<R, 'a>( &self, method: &'a str, params: ArrayParams ) -> impl Future<Output = Result<R, Error>>where R: DeserializeOwned,
Make a RPC request to the node.
sourcepub async fn batch_request<'a, R>(
&self,
batch: BatchRequestBuilder<'a>
) -> impl Future<Output = Result<BatchResponse<'a, R>, Error>>where
R: DeserializeOwned + Default + Clone + Debug + 'a,
pub async fn batch_request<'a, R>( &self, batch: BatchRequestBuilder<'a> ) -> impl Future<Output = Result<BatchResponse<'a, R>, Error>>where R: DeserializeOwned + Default + Clone + Debug + 'a,
Make a batch of RPC requests to the node.
sourcepub async fn subscribe<Notif, 'a>(
&self,
subscribe_method: &'a str,
params: ArrayParams,
unsubscribe_method: &'a str
) -> impl Future<Output = Result<Subscription<Notif>, Error>>where
Notif: DeserializeOwned,
pub async fn subscribe<Notif, 'a>( &self, subscribe_method: &'a str, params: ArrayParams, unsubscribe_method: &'a str ) -> impl Future<Output = Result<Subscription<Notif>, Error>>where Notif: DeserializeOwned,
Subscribe to RPC updates.
sourcepub async fn get_finalized_block(
&self
) -> impl Future<Output = Result<H256, Error>>
pub async fn get_finalized_block( &self ) -> impl Future<Output = Result<H256, Error>>
Get the current finalized block hash.
sourcepub async fn get_signed_block(
&self,
block: Option<H256>
) -> impl Future<Output = Result<Option<SignedBlock>, Error>>
pub async fn get_signed_block( &self, block: Option<H256> ) -> impl Future<Output = Result<Option<SignedBlock>, Error>>
Get a block.
sourcepub async fn get_block(
&self,
block: Option<H256>
) -> impl Future<Output = Result<Option<Block>, Error>>
pub async fn get_block( &self, block: Option<H256> ) -> impl Future<Output = Result<Option<Block>, Error>>
Get a block.
sourcepub async fn find_extrinsic_block_index(
&self,
block: H256,
tx_hash: H256
) -> impl Future<Output = Result<Option<usize>, Error>>
pub async fn find_extrinsic_block_index( &self, block: H256, tx_hash: H256 ) -> impl Future<Output = 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>
) -> impl Future<Output = Result<Option<Header>, Error>>
pub async fn get_block_header( &self, block: Option<H256> ) -> impl Future<Output = Result<Option<Header>, Error>>
Get the header of a block.
sourcepub async fn get_block_hash(
&self,
block_number: u32
) -> impl Future<Output = Result<Option<H256>, Error>>
pub async fn get_block_hash( &self, block_number: u32 ) -> impl Future<Output = Result<Option<H256>, Error>>
Get the block hash for a block_number
.
sourcepub async fn subscribe_runtime_version(
&self
) -> impl Future<Output = Result<Subscription<RuntimeVersion>, Error>>
pub async fn subscribe_runtime_version( &self ) -> impl Future<Output = Result<Subscription<RuntimeVersion>, Error>>
Subscribe to RuntimeVersion updates.
sourcepub async fn get_block_runtime_version(
&self,
block: Option<H256>
) -> impl Future<Output = Result<Option<RuntimeVersion>, Error>>
pub async fn get_block_runtime_version( &self, block: Option<H256> ) -> impl Future<Output = Result<Option<RuntimeVersion>, Error>>
Get the RuntimeVersion 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
§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self>where Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where Self: TryInto<T>,
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> 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 more§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
§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
.