Trait linera_sdk::ethereum::EthereumQueries
source · pub trait EthereumQueries {
type Error;
// Required methods
fn get_accounts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_block_number<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
block_number: u64,
) -> Pin<Box<dyn Future<Output = Result<Uint<256, 4>, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn read_events<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
contract_address: &'life1 str,
event_name_expanded: &'life2 str,
from_block: u64,
to_block: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<EthereumEvent>, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn non_executive_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
contract_address: &'life1 str,
data: Bytes,
from: &'life2 str,
block: u64,
) -> Pin<Box<dyn Future<Output = Result<Bytes, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
}
Expand description
The basic Ethereum queries that can be used from a smart contract and do not require gas to be executed.
Required Associated Types§
Required Methods§
sourcefn get_accounts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_accounts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Lists all the accounts of the Ethereum node.
sourcefn get_block_number<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_block_number<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Gets the latest block number of the Ethereum node.
sourcefn get_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
block_number: u64,
) -> Pin<Box<dyn Future<Output = Result<Uint<256, 4>, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
block_number: u64,
) -> Pin<Box<dyn Future<Output = Result<Uint<256, 4>, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Gets the balance of the specified address at the specified block number. if no block number is specified then the balance of the latest block is returned.
sourcefn read_events<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
contract_address: &'life1 str,
event_name_expanded: &'life2 str,
from_block: u64,
to_block: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<EthereumEvent>, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn read_events<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
contract_address: &'life1 str,
event_name_expanded: &'life2 str,
from_block: u64,
to_block: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<EthereumEvent>, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Reads the events of the smart contract.
This is done from a specified contract_address
and event_name_expanded
.
That is one should have MyEvent(type1 indexed,type2)
instead
of the usual MyEvent(type1,type2)
The from_block
is inclusive.
The to_block
is exclusive (contrary to Ethereum where it is inclusive)
sourcefn non_executive_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
contract_address: &'life1 str,
data: Bytes,
from: &'life2 str,
block: u64,
) -> Pin<Box<dyn Future<Output = Result<Bytes, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn non_executive_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
contract_address: &'life1 str,
data: Bytes,
from: &'life2 str,
block: u64,
) -> Pin<Box<dyn Future<Output = Result<Bytes, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
The operation done with eth_call
on Ethereum returns
a result but are not committed to the blockchain. This can be useful for example
for executing function that are const and allow to inspect
the contract without modifying it.