Skip to content

Commit

Permalink
feat: Add Token::into_tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
oblique authored and vkgnosis committed Jun 27, 2022
1 parent faf512d commit 6215662
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ The format is based on [Keep a Changelog].

[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/

## Unreleased
### Added
- Add `Token::into_tuple`

## [17.1.0] - 2022-06-15
### Added
- Add Serialize trait to Token, Log, LogParams.
Expand Down
8 changes: 8 additions & 0 deletions ethabi/src/token/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ impl Token {
}
}

/// Converts token to...
pub fn into_tuple(self) -> Option<Vec<Token>> {
match self {
Token::Tuple(tuple) => Some(tuple),
_ => None,
}
}

/// Check if all the types of the tokens match the given parameter types.
pub fn types_check(tokens: &[Token], param_types: &[ParamType]) -> bool {
param_types.len() == tokens.len() && {
Expand Down

0 comments on commit 6215662

Please sign in to comment.