diff --git a/Cargo.toml b/Cargo.toml index c04daf2..cb653f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "starknet_api" -version = "0.13.0-dev.1" +version = "0.13.0-dev.2" edition = "2021" repository = "https://github.com/starkware-libs/starknet-api" license = "Apache-2.0" @@ -23,7 +23,7 @@ serde = { version = "1.0.130", features = ["derive", "rc"] } serde_json = "1.0.81" sha3 = "0.10.8" starknet-crypto = "0.5.1" -starknet-types-core = { version = "0.0.11", features = ["hash"] } +starknet-types-core = { version = "0.1.2", features = ["hash"] } strum = "0.24.1" strum_macros = "0.24.3" thiserror = "1.0.31" diff --git a/src/hash.rs b/src/hash.rs index c3be938..c87c4b4 100644 --- a/src/hash.rs +++ b/src/hash.rs @@ -26,13 +26,23 @@ pub trait TryIntoFelt { fn to_felt_unchecked(v: V) -> Felt; } -#[cfg(any(feature = "testing", test))] -impl TryIntoFelt for FeltConverter { - fn to_felt_unchecked(v: u128) -> Felt { - Felt::from(v) - } +macro_rules! impl_try_into_felt { + ($type:ty) => { + #[cfg(any(feature = "testing", test))] + impl TryIntoFelt<$type> for FeltConverter { + fn to_felt_unchecked(v: $type) -> Felt { + Felt::from(v) + } + } + }; } +impl_try_into_felt!(u128); +impl_try_into_felt!(u64); +impl_try_into_felt!(u32); +impl_try_into_felt!(u16); +impl_try_into_felt!(u8); + #[cfg(any(feature = "testing", test))] impl TryIntoFelt<&str> for FeltConverter { fn to_felt_unchecked(v: &str) -> Felt {