Skip to content

Commit

Permalink
feat: reexport signature functions (#248)
Browse files Browse the repository at this point in the history
make signature functions available
  • Loading branch information
mattsse authored Dec 11, 2021
1 parent 48d10ad commit 6f54c6a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions ethabi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pub use crate::{
log::{Log, LogFilter, LogParam, ParseLog, RawLog},
param::Param,
param_type::ParamType,
signature::{long_signature, short_signature},
state_mutability::StateMutability,
token::Token,
};
Expand Down
2 changes: 2 additions & 0 deletions ethabi/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ use crate::{
Hash,
};

/// Returns the first four bytes of the Keccak-256 hash of the signature of the given params
pub fn short_signature(name: &str, params: &[ParamType]) -> [u8; 4] {
let mut result = [0u8; 4];
fill_signature(name, params, &mut result);
result
}

/// Returns the full Keccak-256 hash of the signature of the given params
pub fn long_signature(name: &str, params: &[ParamType]) -> Hash {
let mut result = [0u8; 32];
fill_signature(name, params, &mut result);
Expand Down

0 comments on commit 6f54c6a

Please sign in to comment.