Skip to content

Commit

Permalink
chore: bump starknet-types-core dependency version (#267)
Browse files Browse the repository at this point in the history
* chore: bump starknet-types-core dependency version

Signed-off-by: Dori Medini <[email protected]>

* chore: implement felt! for all uint types

Signed-off-by: Dori Medini <[email protected]>
  • Loading branch information
dorimedini-starkware authored Jun 4, 2024
1 parent 059376a commit 3256ea2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand Down
20 changes: 15 additions & 5 deletions src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,23 @@ pub trait TryIntoFelt<V> {
fn to_felt_unchecked(v: V) -> Felt;
}

#[cfg(any(feature = "testing", test))]
impl TryIntoFelt<u128> 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 {
Expand Down

0 comments on commit 3256ea2

Please sign in to comment.