pub trait Account: ExecutionEncoder + Sized {
    type SignError: Error + Send + Sync;

    // Required methods
    fn address(&self) -> FieldElement;
    fn chain_id(&self) -> FieldElement;
    fn sign_execution<'life0, 'life1, 'async_trait>(
        &'life0 self,
        execution: &'life1 RawExecution,
        query_only: bool
    ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn sign_declaration<'life0, 'life1, 'async_trait>(
        &'life0 self,
        declaration: &'life1 RawDeclaration,
        query_only: bool
    ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn sign_legacy_declaration<'life0, 'life1, 'async_trait>(
        &'life0 self,
        legacy_declaration: &'life1 RawLegacyDeclaration,
        query_only: bool
    ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn execute(&self, calls: Vec<Call>) -> Execution<'_, Self> { ... }
    fn declare(
        &self,
        contract_class: Arc<FlattenedSierraClass>,
        compiled_class_hash: FieldElement
    ) -> Declaration<'_, Self> { ... }
    fn declare_legacy(
        &self,
        contract_class: Arc<LegacyContractClass>
    ) -> LegacyDeclaration<'_, Self> { ... }
}
Expand description

The standard Starknet account contract interface. It makes no assumption about the underlying signer or provider. Account implementations that come with an active connection to the network should also implement ConnectedAccount for useful functionalities like estimating fees and sending transactions.

Required Associated Types§

Required Methods§

source

fn address(&self) -> FieldElement

source

fn chain_id(&self) -> FieldElement

source

fn sign_execution<'life0, 'life1, 'async_trait>( &'life0 self, execution: &'life1 RawExecution, query_only: bool ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn sign_declaration<'life0, 'life1, 'async_trait>( &'life0 self, declaration: &'life1 RawDeclaration, query_only: bool ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn sign_legacy_declaration<'life0, 'life1, 'async_trait>( &'life0 self, legacy_declaration: &'life1 RawLegacyDeclaration, query_only: bool ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

source

fn execute(&self, calls: Vec<Call>) -> Execution<'_, Self>

source

fn declare( &self, contract_class: Arc<FlattenedSierraClass>, compiled_class_hash: FieldElement ) -> Declaration<'_, Self>

source

fn declare_legacy( &self, contract_class: Arc<LegacyContractClass> ) -> LegacyDeclaration<'_, Self>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<A> Account for &A
where A: Account + Sync,

§

type SignError = <A as Account>::SignError

source§

fn address(&self) -> FieldElement

source§

fn chain_id(&self) -> FieldElement

source§

fn sign_execution<'life0, 'life1, 'async_trait>( &'life0 self, execution: &'life1 RawExecution, query_only: bool ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn sign_declaration<'life0, 'life1, 'async_trait>( &'life0 self, declaration: &'life1 RawDeclaration, query_only: bool ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn sign_legacy_declaration<'life0, 'life1, 'async_trait>( &'life0 self, legacy_declaration: &'life1 RawLegacyDeclaration, query_only: bool ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

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

§

type SignError = <A as Account>::SignError

source§

fn address(&self) -> FieldElement

source§

fn chain_id(&self) -> FieldElement

source§

fn sign_execution<'life0, 'life1, 'async_trait>( &'life0 self, execution: &'life1 RawExecution, query_only: bool ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn sign_declaration<'life0, 'life1, 'async_trait>( &'life0 self, declaration: &'life1 RawDeclaration, query_only: bool ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn sign_legacy_declaration<'life0, 'life1, 'async_trait>( &'life0 self, legacy_declaration: &'life1 RawLegacyDeclaration, query_only: bool ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

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

§

type SignError = <A as Account>::SignError

source§

fn address(&self) -> FieldElement

source§

fn chain_id(&self) -> FieldElement

source§

fn sign_execution<'life0, 'life1, 'async_trait>( &'life0 self, execution: &'life1 RawExecution, query_only: bool ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn sign_declaration<'life0, 'life1, 'async_trait>( &'life0 self, declaration: &'life1 RawDeclaration, query_only: bool ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn sign_legacy_declaration<'life0, 'life1, 'async_trait>( &'life0 self, legacy_declaration: &'life1 RawLegacyDeclaration, query_only: bool ) -> Pin<Box<dyn Future<Output = Result<Vec<FieldElement>, Self::SignError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§

source§

impl<P, S> Account for SingleOwnerAccount<P, S>
where P: Provider + Sync + Send, S: Signer + Sync + Send,