pub struct Contract<T: Transport> { /* private fields */ }
Expand description
Ethereum Contract Interface
Implementations§
Source§impl<T: Transport> Contract<T>
impl<T: Transport> Contract<T>
pub async fn sign( &self, func: &str, params: impl Tokenize, options: Options, from: String, key_info: KeyInfo, chain_id: u64, ) -> Result<SignedTransaction>
Sourcepub async fn signed_call(
&self,
func: &str,
params: impl Tokenize,
options: Options,
from: String,
key_info: KeyInfo,
chain_id: u64,
) -> Result<H256>
pub async fn signed_call( &self, func: &str, params: impl Tokenize, options: Options, from: String, key_info: KeyInfo, chain_id: u64, ) -> 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.
pub async fn signed_call_with_confirmations( &self, func: &str, params: impl Tokenize, options: Options, from: String, confirmations: usize, key_info: KeyInfo, chain_id: u64, ) -> Result<TransactionReceipt>
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.
pub async fn _estimate_gas( &self, from: Address, tx: &TransactionParameters, call_options: CallOptions, ) -> Result<U256>
Sourcepub fn query<R, A, B, P>(
&self,
func: &str,
params: P,
from: A,
options: Options,
block: B,
) -> impl Future<Output = Result<R>> + '_
pub fn query<R, A, B, P>( &self, func: &str, params: P, from: A, options: Options, block: B, ) -> impl Future<Output = Result<R>> + '_
Call constant function
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Contract<T>where
T: Freeze,
impl<T> RefUnwindSafe for Contract<T>where
T: RefUnwindSafe,
impl<T> Send for Contract<T>where
T: Send,
impl<T> Sync for Contract<T>where
T: Sync,
impl<T> Unpin for Contract<T>where
T: Unpin,
impl<T> UnwindSafe for Contract<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more