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

#[must_use = "contract calls do nothing unless you `send` or `call` them"]pub struct ContractCall<'a, P, S, 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<'a, P, S, D: Detokenize> ContractCall<'a, P, S, 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<'a, P, S, D> ContractCall<'a, P, S, D> where
    S: Signer,
    P: JsonRpcClient,
    D: Detokenize
[src]

pub async fn call<'_>(&'_ self) -> Result<D, ContractError>[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<'a, P>, ContractError>[src]

Signs and broadcasts the provided transaction

Trait Implementations

impl<'a, P: Clone, S: Clone, D: Clone> Clone for ContractCall<'a, P, S, D>[src]

impl<'a, P: Debug, S: Debug, D: Debug> Debug for ContractCall<'a, P, S, D>[src]

Auto Trait Implementations

impl<'a, P, S, D> RefUnwindSafe for ContractCall<'a, P, S, D> where
    D: RefUnwindSafe,
    P: RefUnwindSafe,
    S: RefUnwindSafe

impl<'a, P, S, D> Send for ContractCall<'a, P, S, D> where
    D: Send,
    P: Sync,
    S: Sync

impl<'a, P, S, D> Sync for ContractCall<'a, P, S, D> where
    D: Sync,
    P: Sync,
    S: Sync

impl<'a, P, S, D> Unpin for ContractCall<'a, P, S, D> where
    D: Unpin

impl<'a, P, S, D> UnwindSafe for ContractCall<'a, P, S, D> where
    D: UnwindSafe,
    P: RefUnwindSafe,
    S: 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> From<T> for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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>,