Struct ethers_core::abi::Contract
source · pub struct Contract {
pub constructor: Option<Constructor>,
pub functions: BTreeMap<String, Vec<Function, Global>, Global>,
pub events: BTreeMap<String, Vec<Event, Global>, Global>,
pub errors: BTreeMap<String, Vec<Error, Global>, Global>,
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, Global>, Global>
Contract functions.
events: BTreeMap<String, Vec<Event, Global>, Global>
Contract events, maps signature to event.
errors: BTreeMap<String, Vec<Error, Global>, Global>
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 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, Global>, Error>
pub fn events_by_name(&self, name: &str) -> Result<&Vec<Event, Global>, Error>
Get all contract events named name
.
sourcepub fn functions_by_name(
&self,
name: &str
) -> Result<&Vec<Function, Global>, Error>
pub fn functions_by_name(
&self,
name: &str
) -> Result<&Vec<Function, Global>, Error>
Get all functions named name
.
sourcepub fn errors_by_name(&self, name: &str) -> Result<&Vec<Error, Global>, Error>
pub fn errors_by_name(&self, name: &str) -> Result<&Vec<Error, Global>, 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
impl<'a> Deserialize<'a> for Contract
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 Serialize for Contract
impl Serialize for Contract
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