Struct polymesh_api::Client
source · 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<R, 'a>(
&self,
method: &'a str,
params: ArrayParams
) -> Result<R, Error>where
R: DeserializeOwned,
pub async fn request<R, 'a>(
&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<Notif, 'a>(
&self,
subscribe_method: &'a str,
params: ArrayParams,
unsubscribe_method: &'a str
) -> Result<Subscription<Notif>, Error>where
Notif: DeserializeOwned,
pub async fn subscribe<Notif, 'a>(
&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 !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>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§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 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 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
.