Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

feat(abi): add human readable tokenizer and parser #1234

Merged
merged 2 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ethers-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ thiserror = { version = "1.0.31", default-features = false }
bytes = { version = "1.1.0", features = ["serde"] }
hex = { version = "0.4.3", default-features = false, features = ["std"] }
once_cell = { version = "1.10.0", optional = true }
unicode-xid = "0.2.2"

# macros feature enabled dependencies
cargo_metadata = { version = "0.14.2", optional = true }
Expand Down
10 changes: 7 additions & 3 deletions ethers-core/src/abi/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Boilerplate error definitions.
use crate::abi::InvalidOutputType;
use crate::abi::{human_readable, InvalidOutputType};
use thiserror::Error;

/// A type alias for std's Result with the Error as our error type.
Expand All @@ -10,8 +10,12 @@ pub type Result<T, E = ParseError> = std::result::Result<T, E>;
pub enum ParseError {
#[error("{0}")]
Message(String),
// ethabi parser error
#[error(transparent)]
ParseError(#[from] super::Error),
ParseError(#[from] ethabi::Error),
// errors from human readable lexer
#[error(transparent)]
LexerError(#[from] human_readable::lexer::LexerError),
}

macro_rules! _format_err {
Expand All @@ -32,7 +36,7 @@ pub(crate) use _bail as bail;
pub enum AbiError {
/// Thrown when the ABI decoding fails
#[error(transparent)]
DecodingError(#[from] crate::abi::Error),
DecodingError(#[from] ethabi::Error),

/// Thrown when detokenizing an argument
#[error(transparent)]
Expand Down
Loading