AccountFactory

Trait AccountFactory 

Source
pub trait AccountFactory: Sized {
    type Provider: Provider + Sync;
    type SignError: Error + Send + Sync;

    // Required methods
    fn class_hash(&self) -> Felt;
    fn calldata(&self) -> Vec<Felt>;
    fn chain_id(&self) -> Felt;
    fn provider(&self) -> &Self::Provider;
    fn is_signer_interactive(&self) -> bool;
    fn sign_deployment_v3<'life0, 'life1, 'async_trait>(
        &'life0 self,
        deployment: &'life1 RawAccountDeploymentV3,
        query_only: bool,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Felt>, Self::SignError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn block_id(&self) -> BlockId { ... }
    fn deploy_v3(&self, salt: Felt) -> AccountDeploymentV3<'_, Self> { ... }
    fn deploy(&self, salt: Felt) -> AccountDeploymentV3<'_, Self> { ... }
}
Expand description

Abstraction over different ways of deploying account contracts using the DEPLOY_ACCOUNT transaction type.

Required Associated Types§

Source

type Provider: Provider + Sync

The Provider type attached to this account factory.

Source

type SignError: Error + Send + Sync

Possible errors for signing transactions.

Required Methods§

Source

fn class_hash(&self) -> Felt

Gets the class hash of the account contract.

Source

fn calldata(&self) -> Vec<Felt>

Gets the constructor calldata for the deployment transaction.

Source

fn chain_id(&self) -> Felt

Gets the chain ID of the target network.

Source

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

Gets a reference to the attached Provider instance.

Source

fn is_signer_interactive(&self) -> bool

Whether the underlying signer implementation is interactive, such as a hardware wallet. Implementations should return true if the signing operation is very expensive, even if not strictly “interactive” as in requiring human input.

This affects how an account factory makes decision on whether to request a real signature for estimation/simulation purposes.

Source

fn sign_deployment_v3<'life0, 'life1, 'async_trait>( &'life0 self, deployment: &'life1 RawAccountDeploymentV3, query_only: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<Felt>, Self::SignError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Signs an execution request to authorize an DEPLOY_ACCOUNT v3 transaction that pays transaction fees in STRK.

If query_only is true, the commitment must be constructed in a way that a real state- changing transaction cannot be authenticated. This is to prevent replay attacks.

Provided Methods§

Source

fn block_id(&self) -> BlockId

Block ID to use when estimating fees.

Source

fn deploy_v3(&self, salt: Felt) -> AccountDeploymentV3<'_, Self>

Generates an instance of AccountDeploymentV3 for sending DEPLOY_ACCOUNT v3 transactions. Pays transaction fees in STRK.

Source

fn deploy(&self, salt: Felt) -> AccountDeploymentV3<'_, Self>

👎Deprecated: transaction version used might change unexpectedly; use deploy_v3 instead

Generates an instance of AccountDeploymentV3 for sending DEPLOY_ACCOUNT v3 transactions. Pays transaction fees in STRK.

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.

Implementors§