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

Commit

Permalink
Impl from_hex_string for ClassHash (#1230)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoletta authored Feb 7, 2024
1 parent 15a1e6e commit 9c8bbe9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ impl PartialEq<[u8; 32]> for ClassHash {
}
}

impl ClassHash {
pub fn from_hex_string(hex_string: String) -> Option<Self> {
Some(Self(hex::decode(hex_string).ok()?.try_into().ok()?))
}
}

pub type CompiledClassHash = ClassHash;

#[cfg(feature = "cairo-native")]
Expand Down

0 comments on commit 9c8bbe9

Please sign in to comment.