[][src]Struct ethcontract::contract::Instance

pub struct Instance<T: Transport> {
    pub defaults: MethodDefaults,
    // some fields omitted
}

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 matchin Abi is actually deployed at the given address.

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]

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.

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 method<S, P, R>(
    &self,
    name: S,
    params: P
) -> AbiResult<MethodBuilder<T, R>> where
    S: AsRef<str>,
    P: Tokenize
[src]

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<S, P, R>(
    &self,
    name: S,
    params: P
) -> AbiResult<ViewMethodBuilder<T, R>> where
    S: AsRef<str>,
    P: Tokenize,
    R: Detokenize
[src]

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 event<S>(&self, name: S) -> AbiResult<LogStream<T>> where
    S: AsRef<str>, 
[src]

Returns a log stream for the specified event that emits a new log for every new event emitted after the stream was created.

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.

impl<T: Transport> FromNetwork<T> for Instance<T>[src]

type Context = Deployments

Context passed to the Deployments.

Auto Trait Implementations

impl<T> RefUnwindSafe for Instance<T> where
    T: RefUnwindSafe

impl<T> Send for Instance<T> where
    T: Send

impl<T> Sync for Instance<T> where
    T: Sync

impl<T> Unpin for Instance<T> where
    T: Unpin

impl<T> UnwindSafe for Instance<T> where
    T: UnwindSafe

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> 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<T> Typeable for T where
    T: Any

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