ChainReadAccountOperations

Trait ChainReadAccountOperations 

Source
pub trait ChainReadAccountOperations {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn stream_accounts<'a, 'async_trait>(
        &'a self,
        selector: AccountSelector,
    ) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, AccountEntry>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
    fn count_accounts<'life0, 'async_trait>(
        &'life0 self,
        selector: AccountSelector,
    ) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn await_key_binding<'life0, 'life1, 'async_trait>(
        &'life0 self,
        offchain_key: &'life1 OffchainPublicKey,
        timeout: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<AccountEntry, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Chain operations that read on-chain node accounts.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

fn stream_accounts<'a, 'async_trait>( &'a self, selector: AccountSelector, ) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, AccountEntry>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Returns on-chain node accounts with the given AccountSelector.

Source

fn count_accounts<'life0, 'async_trait>( &'life0 self, selector: AccountSelector, ) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Counts the accounts with the given AccountSelector.

This is potentially done more effectively than counting more elements of the stream returned by ChainReadAccountOperations::stream_accounts.

Source

fn await_key_binding<'life0, 'life1, 'async_trait>( &'life0 self, offchain_key: &'life1 OffchainPublicKey, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<AccountEntry, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Waits for the account with the key-binding on the offchain_key to appear on-chain or the timeout expires.

Implementations on Foreign Types§

Source§

impl<'b, T: 'b + ChainReadAccountOperations + ?Sized> ChainReadAccountOperations for &'b T

Source§

type Error = <T as ChainReadAccountOperations>::Error

Source§

fn stream_accounts<'a, 'async_trait>( &'a self, selector: AccountSelector, ) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, AccountEntry>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Source§

fn count_accounts<'life0, 'async_trait>( &'life0 self, selector: AccountSelector, ) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn await_key_binding<'life0, 'life1, 'async_trait>( &'life0 self, offchain_key: &'life1 OffchainPublicKey, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<AccountEntry, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl<T: ChainReadAccountOperations + ?Sized> ChainReadAccountOperations for Box<T>

Source§

type Error = <T as ChainReadAccountOperations>::Error

Source§

fn stream_accounts<'a, 'async_trait>( &'a self, selector: AccountSelector, ) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, AccountEntry>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Source§

fn count_accounts<'life0, 'async_trait>( &'life0 self, selector: AccountSelector, ) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn await_key_binding<'life0, 'life1, 'async_trait>( &'life0 self, offchain_key: &'life1 OffchainPublicKey, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<AccountEntry, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl<T: ChainReadAccountOperations + ?Sized> ChainReadAccountOperations for Arc<T>

Source§

type Error = <T as ChainReadAccountOperations>::Error

Source§

fn stream_accounts<'a, 'async_trait>( &'a self, selector: AccountSelector, ) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, AccountEntry>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Source§

fn count_accounts<'life0, 'async_trait>( &'life0 self, selector: AccountSelector, ) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn await_key_binding<'life0, 'life1, 'async_trait>( &'life0 self, offchain_key: &'life1 OffchainPublicKey, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<AccountEntry, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§