diff --git a/crates/starknet-types-core/src/felt/mod.rs b/crates/starknet-types-core/src/felt/mod.rs index 7974ee9..c1dc448 100644 --- a/crates/starknet-types-core/src/felt/mod.rs +++ b/crates/starknet-types-core/src/felt/mod.rs @@ -574,13 +574,7 @@ impl From<&BigInt> for Felt { impl From for Felt { fn from(bigint: BigInt) -> Felt { - let (sign, bytes) = bigint.to_bytes_le(); - let felt = Felt::from_bytes_le_slice(&bytes); - if sign == Sign::Minus { - felt.neg() - } else { - felt - } + Self::from(&bigint) } } impl From<&BigUint> for Felt { @@ -591,7 +585,7 @@ impl From<&BigUint> for Felt { impl From for Felt { fn from(biguint: BigUint) -> Felt { - Felt::from_bytes_le_slice(&biguint.to_bytes_le()) + Self::from(&biguint) } }