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

Commit 9c8bbe9

Browse files
authored
Impl from_hex_string for ClassHash (#1230)
1 parent 15a1e6e commit 9c8bbe9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/utils.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ impl PartialEq<[u8; 32]> for ClassHash {
7979
}
8080
}
8181

82+
impl ClassHash {
83+
pub fn from_hex_string(hex_string: String) -> Option<Self> {
84+
Some(Self(hex::decode(hex_string).ok()?.try_into().ok()?))
85+
}
86+
}
87+
8288
pub type CompiledClassHash = ClassHash;
8389

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

0 commit comments

Comments
 (0)