pub struct Contract<T: Transport> { /* private fields */ }
Expand description
Ethereum Contract Interface
Implementations§
Source§impl<T: Transport> Contract<T>
impl<T: Transport> Contract<T>
Sourcepub async fn signed_call(
&self,
func: &str,
params: impl Tokenize,
options: Options,
key: impl Key,
) -> Result<H256>
pub async fn signed_call( &self, func: &str, params: impl Tokenize, options: Options, key: impl Key, ) -> Result<H256>
Submit contract call transaction to the transaction pool.
Note this function DOES NOT wait for any confirmations, so there is no guarantees that the call is actually executed.
If you’d rather wait for block inclusion, please use [signed_call_with_confirmations
] instead.
Sourcepub async fn signed_call_with_confirmations(
&self,
func: &str,
params: impl Tokenize,
options: Options,
confirmations: usize,
key: impl Key,
) -> Result<TransactionReceipt>
pub async fn signed_call_with_confirmations( &self, func: &str, params: impl Tokenize, options: Options, confirmations: usize, key: impl Key, ) -> Result<TransactionReceipt>
Submit contract call transaction to the transaction pool and wait for the transaction to be included in a block.
This function will wait for block inclusion of the transaction before returning.
Source§impl<T: Transport> Contract<T>
impl<T: Transport> Contract<T>
Sourcepub fn new(eth: Eth<T>, address: Address, abi: Contract) -> Self
pub fn new(eth: Eth<T>, address: Address, abi: Contract) -> Self
Creates new Contract Interface given blockchain address and ABI
Sourcepub fn from_json(eth: Eth<T>, address: Address, json: &[u8]) -> Result<Self>
pub fn from_json(eth: Eth<T>, address: Address, json: &[u8]) -> Result<Self>
Creates new Contract Interface given blockchain address and JSON containing ABI
Sourcepub async fn call<P>(
&self,
func: &str,
params: P,
from: Address,
options: Options,
) -> Result<H256>where
P: Tokenize,
pub async fn call<P>(
&self,
func: &str,
params: P,
from: Address,
options: Options,
) -> Result<H256>where
P: Tokenize,
Execute a contract function
Sourcepub async fn call_with_confirmations(
&self,
func: &str,
params: impl Tokenize,
from: Address,
options: Options,
confirmations: usize,
) -> Result<TransactionReceipt>
pub async fn call_with_confirmations( &self, func: &str, params: impl Tokenize, from: Address, options: Options, confirmations: usize, ) -> Result<TransactionReceipt>
Execute a contract function and wait for confirmations
Sourcepub async fn estimate_gas<P>(
&self,
func: &str,
params: P,
from: Address,
options: Options,
) -> Result<U256>where
P: Tokenize,
pub async fn estimate_gas<P>(
&self,
func: &str,
params: P,
from: Address,
options: Options,
) -> Result<U256>where
P: Tokenize,
Estimate gas required for this function call.