pub struct EvmCallDecoder { /* private fields */ }Expand description
EVM function-call decoder.
Accepts an ABI JSON string (standard Ethereum ABI JSON format) and decodes
raw calldata into structured DecodedCall or DecodedConstructor results.
Implementations§
Source§impl EvmCallDecoder
impl EvmCallDecoder
Sourcepub fn from_abi_json(abi_json: &str) -> Result<Self, DecodeError>
pub fn from_abi_json(abi_json: &str) -> Result<Self, DecodeError>
Create a decoder from a standard Ethereum ABI JSON string.
§Errors
Returns DecodeError if the JSON is not valid ABI JSON.
Sourcepub fn decode_call(
&self,
calldata: &[u8],
function_name: Option<&str>,
) -> Result<DecodedCall, DecodeError>
pub fn decode_call( &self, calldata: &[u8], function_name: Option<&str>, ) -> Result<DecodedCall, DecodeError>
Decode a function call from raw calldata bytes.
If function_name is provided, the selector is validated against that
function. Otherwise the selector is matched against all functions in the ABI.
§Arguments
calldata- full calldata including the 4-byte selector prefixfunction_name- optional hint to match a specific function
Sourcepub fn decode_constructor(
&self,
calldata: &[u8],
) -> Result<DecodedConstructor, DecodeError>
pub fn decode_constructor( &self, calldata: &[u8], ) -> Result<DecodedConstructor, DecodeError>
Decode constructor calldata (no selector prefix).
§Arguments
calldata- raw constructor arguments (ABI-encoded, no 4-byte prefix)
Sourcepub fn function_names(&self) -> Vec<&str>
pub fn function_names(&self) -> Vec<&str>
Returns all function names in this ABI.
Auto Trait Implementations§
impl Freeze for EvmCallDecoder
impl RefUnwindSafe for EvmCallDecoder
impl Send for EvmCallDecoder
impl Sync for EvmCallDecoder
impl Unpin for EvmCallDecoder
impl UnsafeUnpin for EvmCallDecoder
impl UnwindSafe for EvmCallDecoder
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
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>
Converts
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>
Converts
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