Struct ethers_contract::builders::ContractCall[][src]

#[must_use = "contract calls do nothing unless you `send` or `call` them"]pub struct ContractCall<M, D> {
    pub tx: TransactionRequest,
    pub function: Function,
    pub block: Option<BlockNumber>,
    // some fields omitted
}

Helper for managing a transaction before submitting it to a node

Fields

tx: TransactionRequest

The raw transaction object

function: Function

The ABI of the function being called

block: Option<BlockNumber>

Optional block number to be used when calculating the transaction’s gas and nonce

Implementations

impl<M, D: Detokenize> ContractCall<M, D>[src]

pub fn from<T: Into<Address>>(self, from: T) -> Self[src]

Sets the from field in the transaction to the provided value

pub fn gas<T: Into<U256>>(self, gas: T) -> Self[src]

Sets the gas field in the transaction to the provided value

pub fn gas_price<T: Into<U256>>(self, gas_price: T) -> Self[src]

Sets the gas_price field in the transaction to the provided value

pub fn value<T: Into<U256>>(self, value: T) -> Self[src]

Sets the value field in the transaction to the provided value

pub fn block<T: Into<BlockNumber>>(self, block: T) -> Self[src]

Sets the block field for sending the tx to the chain

impl<M, D> ContractCall<M, D> where
    M: Middleware,
    D: Detokenize
[src]

pub fn calldata(&self) -> Option<Bytes>[src]

Returns the underlying transaction’s ABI encoded data

pub async fn estimate_gas(&self) -> Result<U256, ContractError<M>>[src]

Returns the estimated gas cost for the underlying transaction to be executed

pub async fn call(&self) -> Result<D, ContractError<M>>[src]

Queries the blockchain via an eth_call for the provided transaction.

If executed on a non-state mutating smart contract function (i.e. view, pure) then it will return the raw data from the chain.

If executed on a mutating smart contract function, it will do a “dry run” of the call and return the return type of the transaction without mutating the state

Note: this function does not send a transaction from your account

pub async fn send(
    &self
) -> Result<PendingTransaction<'_, M::Provider>, ContractError<M>>
[src]

Signs and broadcasts the provided transaction

Trait Implementations

impl<M: Clone, D: Clone> Clone for ContractCall<M, D>[src]

impl<M: Debug, D: Debug> Debug for ContractCall<M, D>[src]

Auto Trait Implementations

impl<M, D> RefUnwindSafe for ContractCall<M, D> where
    D: RefUnwindSafe,
    M: RefUnwindSafe

impl<M, D> Send for ContractCall<M, D> where
    D: Send,
    M: Send + Sync

impl<M, D> Sync for ContractCall<M, D> where
    D: Sync,
    M: Send + Sync

impl<M, D> Unpin for ContractCall<M, D> where
    D: Unpin

impl<M, D> UnwindSafe for ContractCall<M, D> where
    D: UnwindSafe,
    M: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,