[][src]Struct substrate_subxt::Client

pub struct Client<T: Runtime> { /* fields omitted */ }

Client to interface with a substrate node.

Implementations

impl<T: Runtime> Client<T>[src]

pub fn genesis(&self) -> &T::Hash[src]

Returns the genesis hash.

pub fn metadata(&self) -> &Metadata[src]

Returns the chain metadata.

pub async fn fetch_unhashed<V: Decode, '_>(
    &'_ self,
    key: StorageKey,
    hash: Option<T::Hash>
) -> Result<Option<V>, Error>
[src]

Fetch the value under an unhashed storage key

pub async fn fetch<F: Store<T>, '_, '_>(
    &'_ self,
    store: &'_ F,
    hash: Option<T::Hash>
) -> Result<Option<F::Returns>, Error>
[src]

Fetch a StorageKey with an optional block hash.

pub async fn fetch_or_default<F: Store<T>, '_, '_>(
    &'_ self,
    store: &'_ F,
    hash: Option<T::Hash>
) -> Result<F::Returns, Error>
[src]

Fetch a StorageKey that has a default value with an optional block hash.

pub async fn iter<F: Store<T>, '_>(
    &'_ self,
    hash: Option<T::Hash>
) -> Result<KeyIter<T, F>, Error>
[src]

Returns an iterator of key value pairs.

pub async fn fetch_keys<F: Store<T>, '_>(
    &'_ self,
    count: u32,
    start_key: Option<StorageKey>,
    hash: Option<T::Hash>
) -> Result<Vec<StorageKey>, Error>
[src]

Fetch up to count keys for a storage map in lexicographic order.

Supports pagination by passing a value to start_key.

pub async fn query_storage<'_>(
    &'_ self,
    keys: Vec<StorageKey>,
    from: T::Hash,
    to: Option<T::Hash>
) -> Result<Vec<StorageChangeSet<<T as System>::Hash>>, Error>
[src]

Query historical storage entries

pub async fn header<H, '_>(
    &'_ self,
    hash: Option<H>
) -> Result<Option<T::Header>, Error> where
    H: Into<T::Hash> + 'static, 
[src]

Get a header

pub async fn block_hash<'_>(
    &'_ self,
    block_number: Option<BlockNumber>
) -> Result<Option<T::Hash>, Error>
[src]

Get a block hash. By default returns the latest block hash

pub async fn finalized_head<'_>(&'_ self) -> Result<T::Hash, Error>[src]

Get a block hash of the latest finalized block

pub async fn block<H, '_>(
    &'_ self,
    hash: Option<H>
) -> Result<Option<SignedBlock<Block<<T as System>::Header, <T as System>::Extrinsic>>>, Error> where
    H: Into<T::Hash> + 'static, 
[src]

Get a block

pub async fn read_proof<H, '_>(
    &'_ self,
    keys: Vec<StorageKey>,
    hash: Option<H>
) -> Result<ReadProof<T::Hash>, Error> where
    H: Into<T::Hash> + 'static, 
[src]

Get proof of storage entries at a specific block's state.

pub async fn subscribe_events<'_>(
    &'_ self
) -> Result<Subscription<StorageChangeSet<T::Hash>>, Error>
[src]

Subscribe to events.

pub async fn subscribe_blocks<'_>(
    &'_ self
) -> Result<Subscription<T::Header>, Error>
[src]

Subscribe to new blocks.

pub async fn subscribe_finalized_blocks<'_>(
    &'_ self
) -> Result<Subscription<T::Header>, Error>
[src]

Subscribe to finalized blocks.

pub fn encode<C: Call<T>>(&self, call: C) -> Result<Encoded, Error>[src]

Encodes a call.

pub fn create_unsigned<C: Call<T> + Send + Sync>(
    &self,
    call: C
) -> Result<UncheckedExtrinsic<T>, Error>
[src]

Creates an unsigned extrinsic.

pub async fn create_signed<C: Call<T> + Send + Sync, '_, '_>(
    &'_ self,
    call: C,
    signer: &'_ (dyn Signer<T> + Send + Sync)
) -> Result<UncheckedExtrinsic<T>, Error> where
    <<T::Extra as SignedExtra<T>>::Extra as SignedExtension>::AdditionalSigned: Send + Sync
[src]

Creates a signed extrinsic.

pub fn events_decoder<C: Call<T>>(&self) -> EventsDecoder<T>[src]

Returns an events decoder for a call.

pub async fn submit_extrinsic<'_>(
    &'_ self,
    extrinsic: UncheckedExtrinsic<T>
) -> Result<T::Hash, Error>
[src]

Create and submit an extrinsic and return corresponding Hash if successful

pub async fn submit_and_watch_extrinsic<'_>(
    &'_ self,
    extrinsic: UncheckedExtrinsic<T>,
    decoder: EventsDecoder<T>
) -> Result<ExtrinsicSuccess<T>, Error>
[src]

Create and submit an extrinsic and return corresponding Event if successful

pub async fn submit<C: Call<T> + Send + Sync, '_, '_>(
    &'_ self,
    call: C,
    signer: &'_ (dyn Signer<T> + Send + Sync)
) -> Result<T::Hash, Error> where
    <<T::Extra as SignedExtra<T>>::Extra as SignedExtension>::AdditionalSigned: Send + Sync
[src]

Submits a transaction to the chain.

pub async fn watch<C: Call<T> + Send + Sync, '_, '_>(
    &'_ self,
    call: C,
    signer: &'_ (dyn Signer<T> + Send + Sync)
) -> Result<ExtrinsicSuccess<T>, Error> where
    <<T::Extra as SignedExtra<T>>::Extra as SignedExtension>::AdditionalSigned: Send + Sync
[src]

Submits transaction to the chain and watch for events.

pub async fn insert_key<'_>(
    &'_ self,
    key_type: String,
    suri: String,
    public: Bytes
) -> Result<(), Error>
[src]

Insert a key into the keystore.

pub async fn rotate_keys<'_>(&'_ self) -> Result<Bytes, Error>[src]

Generate new session keys and returns the corresponding public keys.

pub async fn has_session_keys<'_>(
    &'_ self,
    session_keys: Bytes
) -> Result<bool, Error>
[src]

Checks if the keystore has private keys for the given session public keys.

session_keys is the SCALE encoded session keys object from the runtime.

Returns true iff all private keys could be found.

pub async fn has_key<'_>(
    &'_ self,
    public_key: Bytes,
    key_type: String
) -> Result<bool, Error>
[src]

Checks if the keystore has private keys for the given public key and key type.

Returns true if a private key could be found.

Trait Implementations

impl<T: Runtime + System> AccountStoreExt<T> for Client<T>[src]

impl<T: Runtime + Contracts> CallCallExt<T> for Client<T> where
    <<T::Extra as SignedExtra<T>>::Extra as SignedExtension>::AdditionalSigned: Send + Sync
[src]

impl<T: Runtime> Clone for Client<T>[src]

impl<T: Runtime + Contracts> InstantiateCallExt<T> for Client<T> where
    <<T::Extra as SignedExtra<T>>::Extra as SignedExtension>::AdditionalSigned: Send + Sync
[src]

impl<T: Runtime + Contracts> PutCodeCallExt<T> for Client<T> where
    <<T::Extra as SignedExtra<T>>::Extra as SignedExtension>::AdditionalSigned: Send + Sync
[src]

impl<T: Runtime + System> SetCodeCallExt<T> for Client<T> where
    <<T::Extra as SignedExtra<T>>::Extra as SignedExtension>::AdditionalSigned: Send + Sync
[src]

impl<T: Runtime + Sudo> SudoCallExt<T> for Client<T> where
    <<T::Extra as SignedExtra<T>>::Extra as SignedExtension>::AdditionalSigned: Send + Sync
[src]

impl<T: Runtime + Balances> TotalIssuanceStoreExt<T> for Client<T>[src]

impl<T: Runtime + Balances> TransferCallExt<T> for Client<T> where
    <<T::Extra as SignedExtra<T>>::Extra as SignedExtension>::AdditionalSigned: Send + Sync
[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Client<T>

impl<T> Send for Client<T> where
    <T as Runtime>::Extra: Send,
    <T as System>::Hash: Send

impl<T> Sync for Client<T> where
    <T as Runtime>::Extra: Sync,
    <T as System>::Hash: Sync

impl<T> Unpin for Client<T> where
    T: Unpin,
    <T as Runtime>::Extra: Unpin,
    <T as System>::Hash: Unpin

impl<T> !UnwindSafe for Client<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IsType<T> for T[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    Outer: AsRef<T> + AsMut<T> + From<T>,
    T: From<Outer>, 
[src]

fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

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

Get a mutable reference to the inner from the outer.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatedConversion for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

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

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