Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement felt to bigint functions #23

Merged
merged 11 commits into from
Dec 20, 2023

Conversation

pefontana
Copy link
Collaborator

@pefontana pefontana commented Dec 11, 2023

Implement felt to bigint functions

Since various crates have to work with BigInts and BigUints operations, here we implement some Felt to BigInt and Biguint conversions.

  • pub fn felt_to_biguint(felt: Felt) -> BigUint
  • pub fn felt_to_bigint(felt: Felt) -> BigInt
  • pub fn biguint_to_felt(biguint: &BigUint) -> Felt
  • pub fn bigint_to_felt(bigint: &BigInt) -> Felt

Does this introduce a breaking change?

No

crates/starknet-types-core/src/felt.rs Outdated Show resolved Hide resolved
crates/starknet-types-core/src/felt.rs Outdated Show resolved Hide resolved
crates/starknet-types-core/src/felt.rs Outdated Show resolved Hide resolved
@Oppen
Copy link
Contributor

Oppen commented Dec 18, 2023

Since we now have the types in the same crate, would it make sense to implement the From<Felt> for BigUint and the like?

@0xLucqs
Copy link
Collaborator

0xLucqs commented Dec 18, 2023

Maybe something like From<Felt> for BigUint && BigInt and a function implemented on the felt struct to_biguint idk, i don't really like this kind of helper functions, or maybe in a utils crate

@pefontana
Copy link
Collaborator Author

Maybe something like From<Felt> for BigUint && BigInt and a function implemented on the felt struct to_biguint idk, i don't really like this kind of helper functions, or maybe in a utils crate

Sure @LucasLvy !
Done!

@0xLucqs 0xLucqs merged commit 4eda108 into starknet-io:main Dec 20, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants