diff --git a/crates/starknet-types-core/src/felt/mod.rs b/crates/starknet-types-core/src/felt/mod.rs index 11d99b9..3b8e6d8 100644 --- a/crates/starknet-types-core/src/felt/mod.rs +++ b/crates/starknet-types-core/src/felt/mod.rs @@ -549,15 +549,10 @@ 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 { fn from(biguint: &BigUint) -> Felt { Felt::from_bytes_le_slice(&biguint.to_bytes_le()) @@ -566,7 +561,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) } }