Struct alloy_contract::Interface
source · pub struct Interface { /* private fields */ }
Expand description
A smart contract interface.
Implementations§
source§impl Interface
impl Interface
sourcepub fn encode_input(&self, name: &str, args: &[DynSolValue]) -> Result<Vec<u8>>
pub fn encode_input(&self, name: &str, args: &[DynSolValue]) -> Result<Vec<u8>>
Returns the ABI encoded data (including the selector) for the provided function and arguments.
§Note
If the function exists multiple times and you want to use one of the overloaded versions,
consider using Self::encode_input_with_selector
.
sourcepub fn encode_input_with_selector(
&self,
selector: &Selector,
args: &[DynSolValue],
) -> Result<Vec<u8>>
pub fn encode_input_with_selector( &self, selector: &Selector, args: &[DynSolValue], ) -> Result<Vec<u8>>
Returns the ABI encoded data (including the selector) for the function with the provided selector and arguments.
sourcepub fn decode_input(
&self,
name: &str,
data: &[u8],
validate: bool,
) -> Result<Vec<DynSolValue>>
pub fn decode_input( &self, name: &str, data: &[u8], validate: bool, ) -> Result<Vec<DynSolValue>>
ABI-decodes the given data according to the function’s types.
§Note
If the function exists multiple times and you want to use one of the overloaded versions,
consider using Self::decode_input_with_selector
.
sourcepub fn decode_input_with_selector(
&self,
selector: &Selector,
data: &[u8],
validate: bool,
) -> Result<Vec<DynSolValue>>
pub fn decode_input_with_selector( &self, selector: &Selector, data: &[u8], validate: bool, ) -> Result<Vec<DynSolValue>>
Decode the provided ABI encoded bytes as the input of the provided function selector.
sourcepub fn decode_output(
&self,
name: &str,
data: &[u8],
validate: bool,
) -> Result<Vec<DynSolValue>>
pub fn decode_output( &self, name: &str, data: &[u8], validate: bool, ) -> Result<Vec<DynSolValue>>
Decode the provided ABI encoded bytes as the output of the first function with the given name.
§Note
If there are multiple functions with the same name, consider using
Self::decode_output_with_selector
sourcepub fn decode_output_with_selector(
&self,
selector: &Selector,
data: &[u8],
validate: bool,
) -> Result<Vec<DynSolValue>>
pub fn decode_output_with_selector( &self, selector: &Selector, data: &[u8], validate: bool, ) -> Result<Vec<DynSolValue>>
Decode the provided ABI encoded bytes as the output of the provided function selector.
sourcepub const fn connect<T, P, N>(
self,
address: Address,
provider: P,
) -> ContractInstance<T, P, N>
pub const fn connect<T, P, N>( self, address: Address, provider: P, ) -> ContractInstance<T, P, N>
Create a ContractInstance
from this ABI for a contract at the given address.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Interface
impl RefUnwindSafe for Interface
impl Send for Interface
impl Sync for Interface
impl Unpin for Interface
impl UnwindSafe for Interface
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more