1

How do I create a ContractAddress from a hex value like 0x06D98dC7ea54CF77eeD141F423f6007Dd61fbd2b6bD429Facdf5d4803353063f?

let addr : ContractAddress = 0x06D98dC7ea54CF77eeD141F423f6007Dd61fbd2b6bD429Facdf5d4803353063f; is throwing an exception stating that 0x06D98dC7ea54CF77eeD141F423f6007Dd61fbd2b6bD429Facdf5d4803353063f is considered a felt252.

What's the helper function to convert that Hex into a ContractAddress?

cybersam
  • 63,203
  • 6
  • 53
  • 76
Mathe Eliel
  • 658
  • 2
  • 6
  • 16

1 Answers1

0

This is the library file for that: https://github.com/starkware-libs/cairo/blob/main/corelib/src/starknet/contract_address.cairo

I believe the function Felt252TryIntoContractAddress would be useful.

cybersam
  • 63,203
  • 6
  • 53
  • 76
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 17 '23 at 04:16