pub struct Contract {
pub constructor: Option<Constructor>,
pub functions: BTreeMap<String, Vec<Function>>,
pub events: BTreeMap<String, Vec<Event>>,
pub errors: BTreeMap<String, Vec<AbiError>>,
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<AbiError>>
Contract errors, maps signature to error.
receive: bool
Contract has receive function.
fallback: bool
Contract has fallback function.
Implementations
sourceimpl 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>
pub fn function(&self, name: &str) -> Result<&Function>
Get the function named name
, the first if there are overloaded
versions of the same function.
sourcepub fn event(&self, name: &str) -> Result<&Event>
pub fn event(&self, name: &str) -> Result<&Event>
Get the contract event named name
, the first if there are multiple.
sourcepub fn error(&self, name: &str) -> Result<&AbiError>
pub fn error(&self, name: &str) -> Result<&AbiError>
Get the contract error named name
, the first if there are multiple.
sourcepub fn events_by_name(&self, name: &str) -> Result<&Vec<Event>>
pub fn events_by_name(&self, name: &str) -> Result<&Vec<Event>>
Get all contract events named name
.
sourcepub fn functions_by_name(&self, name: &str) -> Result<&Vec<Function>>
pub fn functions_by_name(&self, name: &str) -> Result<&Vec<Function>>
Get all functions named name
.
sourcepub fn functions(&self) -> Functions<'_> ⓘ
pub fn functions(&self) -> Functions<'_> ⓘ
Iterate over all functions of the contract in arbitrary order.
Trait Implementations
sourceimpl<'a> Deserialize<'a> for Contract
impl<'a> Deserialize<'a> for Contract
sourcefn deserialize<D>(deserializer: D) -> Result<Contract, D::Error>where
D: Deserializer<'a>,
fn deserialize<D>(deserializer: D) -> Result<Contract, D::Error>where
D: Deserializer<'a>,
Deserialize this value from the given Serde deserializer. 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more