Struct ethers_core::abi::Contract
source · pub struct Contract {
pub constructor: Option<Constructor>,
pub functions: BTreeMap<String, Vec<Function>>,
pub events: BTreeMap<String, Vec<Event>>,
pub errors: BTreeMap<String, Vec<Error>>,
pub receive: bool,
pub fallback: bool,
}
Expand description
API building calls to contracts ABI.
Fields§
§constructor: Option<Constructor>
Contract constructor.
functions: BTreeMap<String, Vec<Function>>
Contract functions.
events: BTreeMap<String, Vec<Event>>
Contract events, maps signature to event.
errors: BTreeMap<String, Vec<Error>>
Contract errors, maps signature to error.
receive: bool
Contract has receive function.
fallback: bool
Contract has fallback function.
Implementations§
source§impl Contract
impl Contract
sourcepub fn load<T>(reader: T) -> Result<Contract, Error>where
T: Read,
Available on crate feature full-serde
only.
pub fn load<T>(reader: T) -> Result<Contract, Error>where
T: Read,
full-serde
only.Loads contract from json.
sourcepub fn constructor(&self) -> Option<&Constructor>
pub fn constructor(&self) -> Option<&Constructor>
Creates constructor call builder.
sourcepub fn function(&self, name: &str) -> Result<&Function, Error>
pub fn function(&self, name: &str) -> Result<&Function, Error>
Get the function named name
, the first if there are overloaded
versions of the same function.
sourcepub fn event(&self, name: &str) -> Result<&Event, Error>
pub fn event(&self, name: &str) -> Result<&Event, Error>
Get the contract event named name
, the first if there are multiple.
sourcepub fn error(&self, name: &str) -> Result<&Error, Error>
pub fn error(&self, name: &str) -> Result<&Error, Error>
Get the contract error named name
, the first if there are multiple.
sourcepub fn events_by_name(&self, name: &str) -> Result<&Vec<Event>, Error>
pub fn events_by_name(&self, name: &str) -> Result<&Vec<Event>, Error>
Get all contract events named name
.
sourcepub fn functions_by_name(&self, name: &str) -> Result<&Vec<Function>, Error>
pub fn functions_by_name(&self, name: &str) -> Result<&Vec<Function>, Error>
Get all functions named name
.
sourcepub fn errors_by_name(&self, name: &str) -> Result<&Vec<Error>, Error>
pub fn errors_by_name(&self, name: &str) -> Result<&Vec<Error>, Error>
Get all errors named name
.
sourcepub fn functions(&self) -> Functions<'_> ⓘ
pub fn functions(&self) -> Functions<'_> ⓘ
Iterate over all functions of the contract in arbitrary order.
Trait Implementations§
source§impl<'a> Deserialize<'a> for Contract
Available on crate feature serde
only.
impl<'a> Deserialize<'a> for Contract
Available on crate feature
serde
only.source§fn deserialize<D>(
deserializer: D
) -> Result<Contract, <D as Deserializer<'a>>::Error>where
D: Deserializer<'a>,
fn deserialize<D>(
deserializer: D
) -> Result<Contract, <D as Deserializer<'a>>::Error>where
D: Deserializer<'a>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Contract
impl PartialEq for Contract
source§impl Serialize for Contract
Available on crate feature serde
only.
impl Serialize for Contract
Available on crate feature
serde
only.source§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Contract
Auto Trait Implementations§
impl RefUnwindSafe for Contract
impl Send for Contract
impl Sync for Contract
impl Unpin for Contract
impl UnwindSafe for Contract
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more