Struct ethcontract::contract::ViewMethodBuilder
source · pub struct ViewMethodBuilder<T: Transport, R: Tokenize> {
pub m: MethodBuilder<T, R>,
pub block: Option<BlockId>,
}Expand description
Data used for building a contract method call. The view method builder can’t directly send transactions and is for read only method calls.
Fields§
§m: MethodBuilder<T, R>method parameters
block: Option<BlockId>optional block number
Implementations§
source§impl<T: Transport, R: Tokenize> ViewMethodBuilder<T, R>
impl<T: Transport, R: Tokenize> ViewMethodBuilder<T, R>
sourcepub fn from_method(method: MethodBuilder<T, R>) -> Self
pub fn from_method(method: MethodBuilder<T, R>) -> Self
Create a new ViewMethodBuilder by demoting a MethodBuilder.
sourcepub fn with_defaults(self, defaults: &MethodDefaults) -> Self
pub fn with_defaults(self, defaults: &MethodDefaults) -> Self
Apply method defaults to this builder.
sourcepub fn function(&self) -> &Function
pub fn function(&self) -> &Function
Returns a reference to the underling ABI function for this call.
sourcepub fn from(self, value: Address) -> Self
pub fn from(self, value: Address) -> Self
Specify the account the transaction is being sent from.
sourcepub fn gas(self, value: U256) -> Self
pub fn gas(self, value: U256) -> Self
Secify amount of gas to use, if not specified then a gas estimate will be used.
sourcepub fn gas_price(self, value: GasPrice) -> Self
pub fn gas_price(self, value: GasPrice) -> Self
Specify the gas price to use, if not specified then the estimated gas price will be used.
sourcepub fn value(self, value: U256) -> Self
pub fn value(self, value: U256) -> Self
Specify what how much ETH to transfer with the transaction, if not specified then no ETH will be sent.
sourcepub fn nonce(self, value: U256) -> Self
pub fn nonce(self, value: U256) -> Self
Specify the nonce for the transation, if not specified will use the current transaction count for the signing account.
sourcepub fn access_list(self, value: AccessList) -> Self
pub fn access_list(self, value: AccessList) -> Self
Specify the access list for the transaction, if not specified no access list will be used.
source§impl<T: Transport, R: Tokenize> ViewMethodBuilder<T, R>
impl<T: Transport, R: Tokenize> ViewMethodBuilder<T, R>
sourcepub async fn call(self) -> Result<R, MethodError>
pub async fn call(self) -> Result<R, MethodError>
Call a contract method. Contract calls do not modify the blockchain and as such do not require gas or signing.
sourcepub fn batch_call<B: BatchTransport>(
self,
batch: &mut CallBatch<B>
) -> impl Future<Output = Result<R, MethodError>>
pub fn batch_call<B: BatchTransport>( self, batch: &mut CallBatch<B> ) -> impl Future<Output = Result<R, MethodError>>
Adds this view method to a batch. Allows execution with other contract calls in one roundtrip
The returned future only resolve once batch is resolved. Panics, if batch is dropped before
executing