Struct polymesh_api::Client

source ·
pub struct Client { /* private fields */ }

Implementations§

source§

impl Client

source

pub async fn new(url: &str) -> impl Future<Output = Result<Client, Error>>

source

pub fn get_transaction_version(&self) -> i64

source

pub fn get_metadata(&self) -> &RuntimeMetadataPrefixed

source

pub fn get_signed_extra(&self) -> (u32, u32, H256, H256, (), (), ())

source

pub async fn get_system_properties( &self ) -> impl Future<Output = Result<SystemProperties, Error>>

Get the SystemProperties of the chain.

source

pub async fn get_storage_by_key<T>( &self, key: StorageKey, at: Option<H256> ) -> impl Future<Output = Result<Option<T>, Error>>where T: Decode,

source

pub async fn get_storage_data_by_key( &self, key: StorageKey, at: Option<H256> ) -> impl Future<Output = Result<Option<StorageData>, Error>>

source

pub async fn subscribe_blocks( &self ) -> impl Future<Output = Result<Subscription<Header>, Error>>

Subscribe to new blocks.

source

pub async fn subscribe_finalized_blocks( &self ) -> impl Future<Output = Result<Subscription<Header>, Error>>

Subscribe to new finalized blocks.

source

pub async fn submit_and_watch( &self, tx_hex: String ) -> impl Future<Output = Result<Subscription<TransactionStatus>, Error>>

Submit and watch a transaction.

source

pub async fn request<R, 'a>( &self, method: &'a str, params: Option<ParamsSer<'a>> ) -> impl Future<Output = Result<R, Error>>where R: DeserializeOwned,

Make a RPC request to the node.

source

pub async fn batch_request<R, 'a>( &self, batch: Vec<(&'a str, Option<ParamsSer<'a>>), Global> ) -> impl Future<Output = Result<Vec<R, Global>, Error>>where R: DeserializeOwned + Default + Clone,

Make a batch of RPC requests to the node.

source

pub async fn get_finalized_block( &self ) -> impl Future<Output = Result<H256, Error>>

Get the current finalized block hash.

source

pub async fn get_signed_block( &self, block: Option<H256> ) -> impl Future<Output = Result<Option<SignedBlock>, Error>>

Get a block.

source

pub async fn get_block( &self, block: Option<H256> ) -> impl Future<Output = Result<Option<Block>, Error>>

Get a block.

source

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.

source

pub async fn get_block_header( &self, block: Option<H256> ) -> impl Future<Output = Result<Option<Header>, Error>>

Get the header of a block.

source

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.

source

pub async fn subscribe_runtime_version( &self ) -> impl Future<Output = Result<Subscription<RuntimeVersion>, Error>>

Subscribe to RuntimeVersion updates.

source

pub async fn get_block_runtime_version( &self, block: Option<H256> ) -> impl Future<Output = Result<Option<RuntimeVersion>, Error>>

Get the RuntimeVersion of a block.

source

pub async fn get_block_metadata( &self, block: Option<H256> ) -> impl Future<Output = Result<Option<RuntimeMetadataPrefixed>, Error>>

Get the RuntimeMetadata of a block.

Trait Implementations§

source§

impl Debug for Client

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CheckedConversion for T

§

fn checked_from<T>(t: T) -> Option<Self>where Self: TryFrom<T>,

Convert from a value of T into an equivalent instance of Option<Self>. Read more
§

fn checked_into<T>(self) -> Option<T>where Self: TryInto<T>,

Consume self to return Some equivalent value of Option<T>. Read more
§

impl<T> Downcast for Twhere T: Any,

§

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>

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)

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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T, Global>) -> Arc<dyn Any + Sync + Send, Global>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,

§

fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

§

fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatedConversion for T

source§

fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,

Convert from a value of T into an equivalent instance of Self. Read more
source§

fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,

Consume self to return an equivalent value of T. Read more
source§

impl<T> SaturatedConversion for T

source§

fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,

Convert from a value of T into an equivalent instance of Self. Read more
source§

fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,

Consume self to return an equivalent value of T. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,

§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
source§

impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,

source§

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>,

source§

fn unique_saturated_into(self) -> T

Consume self to return an equivalent value of T.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> MaybeDebug for Twhere T: Debug,

§

impl<T> MaybeDebug for Twhere T: Debug,

§

impl<T> MaybeSend for Twhere T: Send,