Skip to content

Commit

Permalink
fix(felt): remove bugged function + add from hex
Browse files Browse the repository at this point in the history
  • Loading branch information
0xLucqs committed Feb 6, 2024
1 parent 2332613 commit 30e9dc0
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions crates/starknet-types-core/src/felt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ pub struct FromBytesError;

impl Felt {
/// [Felt] constant that's equal to 0.
pub const ZERO: Self = Self(FieldElement::<Stark252PrimeField>::const_from_raw(
UnsignedInteger::from_u64(0),
));
pub const ZERO: Self = Self(FieldElement::<Stark252PrimeField>::from_hex_unchecked("0"));

/// [Felt] constant that's equal to 1.
pub const ONE: Self = Self(FieldElement::<Stark252PrimeField>::from_hex_unchecked("1"));
Expand Down Expand Up @@ -135,10 +133,8 @@ impl Felt {
))
}

pub const fn from_u64(val: u64) -> Self {
Self(FieldElement::<Stark252PrimeField>::const_from_raw(
UnsignedInteger::from_u64(val),
))
pub const fn from_hex_unchecked(val: &str) -> Self {
Self(FieldElement::<Stark252PrimeField>::from_hex_unchecked(val))
}

// pub const fn from_hex_const(hex_string: &str) -> Felt {}
Expand Down

0 comments on commit 30e9dc0

Please sign in to comment.