pub struct EvmErrorDecoder { /* private fields */ }Expand description
EVM error decoder with a bundled signature registry.
§Usage
use chainerrors_evm::EvmErrorDecoder;
use chainerrors_core::ErrorDecoder;
let decoder = EvmErrorDecoder::new();
let result = decoder.decode(&hex::decode("08c379a0...").unwrap(), None).unwrap();
println!("{result}");Implementations§
Source§impl EvmErrorDecoder
impl EvmErrorDecoder
Sourcepub fn with_registry(registry: Arc<dyn ErrorSignatureRegistry>) -> Self
pub fn with_registry(registry: Arc<dyn ErrorSignatureRegistry>) -> Self
Create a decoder with a custom registry (for testing or extension).
Sourcepub fn register_signature(&self, _sig: ErrorSignature)
pub fn register_signature(&self, _sig: ErrorSignature)
Register additional error signatures at runtime (e.g. from a project ABI).
Trait Implementations§
Source§impl Default for EvmErrorDecoder
impl Default for EvmErrorDecoder
Source§impl ErrorDecoder for EvmErrorDecoder
impl ErrorDecoder for EvmErrorDecoder
Source§fn chain_family(&self) -> &'static str
fn chain_family(&self) -> &'static str
Returns the chain family name this decoder handles (e.g.
"evm").Source§fn decode(
&self,
revert_data: &[u8],
ctx: Option<ErrorContext>,
) -> Result<DecodedError, DecodeErrorError>
fn decode( &self, revert_data: &[u8], ctx: Option<ErrorContext>, ) -> Result<DecodedError, DecodeErrorError>
Decode raw revert/error data from a failed transaction. Read more
Source§fn decode_hex(
&self,
hex_str: &str,
ctx: Option<ErrorContext>,
) -> Result<DecodedError, DecodeErrorError>
fn decode_hex( &self, hex_str: &str, ctx: Option<ErrorContext>, ) -> Result<DecodedError, DecodeErrorError>
Convenience: decode from a hex string (with or without
0x prefix).Auto Trait Implementations§
impl Freeze for EvmErrorDecoder
impl !RefUnwindSafe for EvmErrorDecoder
impl Send for EvmErrorDecoder
impl Sync for EvmErrorDecoder
impl Unpin for EvmErrorDecoder
impl UnsafeUnpin for EvmErrorDecoder
impl !UnwindSafe for EvmErrorDecoder
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