ConnectedAccount

Trait ConnectedAccount 

Source
pub trait ConnectedAccount: Account {
    type Provider: Provider + Sync;

    // Required method
    fn provider(&self) -> &Self::Provider;

    // Provided methods
    fn block_id(&self) -> BlockId { ... }
    fn get_nonce<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Felt, ProviderError>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

An Account implementation that also comes with a Provider. Functionalities that require a connection to the sequencer or node are offloaded to this trait to keep the base Account clean and flexible.

Required Associated Types§

Source

type Provider: Provider + Sync

The Provider type attached to this account.

Required Methods§

Source

fn provider(&self) -> &Self::Provider

Gets a reference to the attached Provider instance.

Provided Methods§

Source

fn block_id(&self) -> BlockId

Gets block ID to use when checking nonce and estimating fees.

Source

fn get_nonce<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Felt, ProviderError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Gets the next available nonce to be used.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<A> ConnectedAccount for &A

Source§

type Provider = <A as ConnectedAccount>::Provider

Source§

fn provider(&self) -> &Self::Provider

Source§

fn block_id(&self) -> BlockId

Source§

fn get_nonce<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Felt, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl<A> ConnectedAccount for Box<A>
where A: ConnectedAccount + Sync + Send,

Source§

type Provider = <A as ConnectedAccount>::Provider

Source§

fn provider(&self) -> &Self::Provider

Source§

fn block_id(&self) -> BlockId

Source§

fn get_nonce<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Felt, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl<A> ConnectedAccount for Arc<A>
where A: ConnectedAccount + Sync + Send,

Source§

type Provider = <A as ConnectedAccount>::Provider

Source§

fn provider(&self) -> &Self::Provider

Source§

fn block_id(&self) -> BlockId

Source§

fn get_nonce<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Felt, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§