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§
Sourcetype PublicClient
type PublicClient
Public client type - using generic to avoid specific dependencies
Sourcetype TransactionReceipt
type TransactionReceipt
Transaction receipt type
Sourcetype BatchRunner: BatchRun
type BatchRunner: BatchRun
Batch runner type
Required Methods§
Sourcefn public_client(&self) -> &Self::PublicClient
fn public_client(&self) -> &Self::PublicClient
The public client for reading blockchain state
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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)
Sourcefn 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 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
Sourcefn 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_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
Sourcefn send_batch_transaction(&self) -> Option<Self::BatchRunner>
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