diff --git a/crates/starknet-types-core/src/felt/num_traits_impl.rs b/crates/starknet-types-core/src/felt/num_traits_impl.rs index 886f13b..23fd52d 100644 --- a/crates/starknet-types-core/src/felt/num_traits_impl.rs +++ b/crates/starknet-types-core/src/felt/num_traits_impl.rs @@ -1,6 +1,25 @@ use super::Felt; +use num_bigint::{ToBigInt, ToBigUint}; use num_traits::{FromPrimitive, Inv, One, Pow, ToPrimitive, Zero}; +impl ToBigInt for Felt { + /// Converts the value of `self` to a [`BigInt`]. + /// + /// Safe to unwrap, will always return `Some`. + fn to_bigint(&self) -> Option { + Some(self.to_bigint()) + } +} + +impl ToBigUint for Felt { + /// Converts the value of `self` to a [`BigUint`]. + /// + /// Safe to unwrap, will always return `Some`. + fn to_biguint(&self) -> Option { + Some(self.to_biguint()) + } +} + impl FromPrimitive for Felt { fn from_i64(value: i64) -> Option { Some(value.into())