[−][src]Struct ethcontract::contract::Instance
Represents a contract instance at an address. Provides methods for contract interaction.
Fields
defaults: MethodDefaults
Default method parameters to use when sending method transactions or querying method calls.
Methods
impl<T: Transport> Instance<T>
[src]
pub fn at(web3: Web3<T>, abi: Abi, address: Address) -> Self
[src]
Creates a new contract instance with the specified web3
provider with
the given Abi
at the given Address
.
Note that this does not verify that a contract with a matching Abi
is
actually deployed at the given address.
pub fn with_transaction(
web3: Web3<T>,
abi: Abi,
address: Address,
transaction_hash: Option<H256>
) -> Self
[src]
web3: Web3<T>,
abi: Abi,
address: Address,
transaction_hash: Option<H256>
) -> Self
Creates a new contract instance with the specified web3
provider with
the given Abi
at the given Address
and an optional transaction hash.
This hash is used to retrieve contract related information such as the
creation block (which is useful for fetching all historic events).
Note that this does not verify that a contract with a matching Abi
is
actually deployed at the given address nor that the transaction hash,
when provided, is actually for this contract deployment.
pub fn deployed(web3: Web3<T>, artifact: Artifact) -> DeployedFuture<T, Self>
[src]
Locates a deployed contract based on the current network ID reported by
the web3
provider from the given Artifact
's ABI and networks.
Note that this does not verify that a contract with a matchin Abi
is
actually deployed at the given address.
pub fn builder<P>(
web3: Web3<T>,
artifact: Artifact,
params: P
) -> Result<DeployBuilder<T, Self>, DeployError> where
P: Tokenize,
[src]
web3: Web3<T>,
artifact: Artifact,
params: P
) -> Result<DeployBuilder<T, Self>, DeployError> where
P: Tokenize,
Creates a contract builder with the specified web3
provider and the
given Artifact
byte code. This allows the contract deployment
transaction to be configured before deploying the contract.
pub fn link_and_deploy<'a, P, I>(
web3: Web3<T>,
artifact: Artifact,
params: P,
libraries: I
) -> Result<DeployBuilder<T, Self>, DeployError> where
P: Tokenize,
I: Iterator<Item = (&'a str, Address)>,
[src]
web3: Web3<T>,
artifact: Artifact,
params: P,
libraries: I
) -> Result<DeployBuilder<T, Self>, DeployError> where
P: Tokenize,
I: Iterator<Item = (&'a str, Address)>,
Deploys a contract with the specified web3
provider with the given
Artifact
byte code and linking libraries.
pub fn web3(&self) -> Web3<T>
[src]
Retrieve the underlying web3 provider used by this contract instance.
pub fn abi(&self) -> &Abi
[src]
Retrieves the contract ABI for this instance.
pub fn address(&self) -> Address
[src]
Returns the contract address being used by this instance.
pub fn transaction_hash(&self) -> Option<H256>
[src]
Returns the hash for the transaction that deployed the contract if it is
known, None
otherwise.
pub fn method<P, R>(
&self,
signature: H32,
params: P
) -> AbiResult<MethodBuilder<T, R>> where
P: Tokenize,
R: Detokenizable,
[src]
&self,
signature: H32,
params: P
) -> AbiResult<MethodBuilder<T, R>> where
P: Tokenize,
R: Detokenizable,
Returns a method builder to setup a call or transaction on a smart contract method. Note that calls just get evaluated on a node but do not actually commit anything to the block chain.
pub fn view_method<P, R>(
&self,
signature: H32,
params: P
) -> AbiResult<ViewMethodBuilder<T, R>> where
P: Tokenize,
R: Detokenizable,
[src]
&self,
signature: H32,
params: P
) -> AbiResult<ViewMethodBuilder<T, R>> where
P: Tokenize,
R: Detokenizable,
Returns a view method builder to setup a call to a smart contract. View method builders can't actually send transactions and only query contract state.
pub fn fallback<D>(&self, data: D) -> AbiResult<MethodBuilder<T, Void>> where
D: Into<Vec<u8>>,
[src]
D: Into<Vec<u8>>,
Returns a method builder to setup a call to a smart contract's fallback function.
This method will error if the ABI does not contain an entry for a fallback function.
pub fn event<E>(&self, signature: H256) -> AbiResult<EventBuilder<T, E>> where
E: Detokenize,
[src]
E: Detokenize,
Returns a event builder to setup an event stream for a smart contract that emits events for the specified Solidity event by name.
pub fn all_events(&self) -> AllEventsBuilder<T, RawLog>
[src]
Returns a log stream that emits a log for every new event emitted after the stream was created for this contract instance.
Trait Implementations
impl<T: Clone + Transport> Clone for Instance<T>
[src]
impl<T: Debug + Transport> Debug for Instance<T>
[src]
impl<T: Transport> Deploy<T> for Instance<T>
[src]
type Context = Linker
The type of the contract instance being created.
fn abi(cx: &Self::Context) -> &Abi
[src]
fn bytecode(cx: &Self::Context) -> &Bytecode
[src]
fn from_deployment(
web3: Web3<T>,
address: Address,
transaction_hash: H256,
cx: Self::Context
) -> Self
[src]
web3: Web3<T>,
address: Address,
transaction_hash: H256,
cx: Self::Context
) -> Self
impl<T: Transport> FromNetwork<T> for Instance<T>
[src]
type Context = Deployments
Context passed to the Deployments
.
fn from_network(
web3: Web3<T>,
network_id: &str,
cx: Self::Context
) -> Option<Self>
[src]
web3: Web3<T>,
network_id: &str,
cx: Self::Context
) -> Option<Self>
Auto Trait Implementations
impl<T> RefUnwindSafe for Instance<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Instance<T> where
T: Send,
T: Send,
impl<T> Sync for Instance<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Instance<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Instance<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,