Skip to main content

ContractRunner

Trait ContractRunner 

Source
pub trait ContractRunner {
    type PublicClient;
    type TransactionReceipt;
    type BatchRunner: BatchRun;
    type Error;

    // Required methods
    fn address(&self) -> Option<Address>;
    fn public_client(&self) -> &Self::PublicClient;
    fn init<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn estimate_gas<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tx: &'life1 TransactionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn call<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tx: &'life1 TransactionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn resolve_name<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Address>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn send_transaction<'life0, 'async_trait>(
        &'life0 self,
        txs: Vec<TransactionRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Self::TransactionReceipt, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_batch_transaction(&self) -> Option<Self::BatchRunner>;
}
Expand description

Contract runner trait for executing blockchain operations This is the base trait that all contract runners must implement

Required Associated Types§

Source

type PublicClient

Public client type - using generic to avoid specific dependencies

Source

type TransactionReceipt

Transaction receipt type

Source

type BatchRunner: BatchRun

Batch runner type

Source

type Error

Error type for operations

Required Methods§

Source

fn address(&self) -> Option<Address>

The address of the account (if available)

Source

fn public_client(&self) -> &Self::PublicClient

The public client for reading blockchain state

Source

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

Initialize the runner

Source

fn estimate_gas<'life0, 'life1, 'async_trait>( &'life0 self, tx: &'life1 TransactionRequest, ) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Estimate gas for a transaction

Source

fn call<'life0, 'life1, 'async_trait>( &'life0 self, tx: &'life1 TransactionRequest, ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Call a contract (read-only)

Source

fn resolve_name<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Address>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve an ENS name to an address

Source

fn send_transaction<'life0, 'async_trait>( &'life0 self, txs: Vec<TransactionRequest>, ) -> Pin<Box<dyn Future<Output = Result<Self::TransactionReceipt, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send one or more transactions Safe: batches all transactions atomically and returns single TransactionReceipt

Source

fn send_batch_transaction(&self) -> Option<Self::BatchRunner>

Create a batch transaction runner (if supported) This allows multiple transactions to be executed atomically in a single on-chain transaction Typically used with Safe multisig or other smart contract wallets

Returns a BatchRun instance for adding transactions and executing them as a batch

Implementors§