fix: add decode_hex to models

This commit is contained in:
royvardhan
2025-02-20 21:52:46 +05:30
parent dc38f108c3
commit 7dd59dbe34
2 changed files with 13 additions and 14 deletions

View File

@@ -120,10 +120,3 @@ pub fn get_static_attribute(swap: &Swap, attribute_name: &str) -> Result<Vec<u8>
})?
.to_vec())
}
/// Decodes a hex string to a `Bytes` object.
pub fn decode_hex(hex_str: &str, err_msg: &str) -> Result<Bytes, EncodingError> {
Ok(Bytes::from(
hex::decode(hex_str).map_err(|_| EncodingError::FatalError(err_msg.to_string()))?,
))
}