starknet-io / starknet.js

JavaScript library for StarkNet
https://www.starknetjs.com
MIT License
1.21k stars 739 forks source link

Sending Uint256 Fail: AssertionError: normalize_address() cannot be used with the current constants #104

Closed FilipLaurentiu closed 2 years ago

FilipLaurentiu commented 2 years ago

version 2.5 More context: https://discordapp.com/channels/793094838509764618/927918707613786162/930855057568727141

Sending Uint256 end up with a REJECT transaction Same values send from starknet cli wor Screenshot from 2022-01-12 15-57-08 k

Error


/home/filip/.local/lib/python3.8/site-packages/starkware/starknet/common/storage.cairo:22:5: Error at pc=0:91:
    if is_small != 0:
    ^^
Got an exception while executing a hint.
Cairo traceback (most recent call last):
/path/to/my-project/contracts/utils/token/ERC20.cairo:19:6
func constructor{
     ^*********^
/path/to/my-project/contracts/utils/token/ERC20.cairo:29:5
    ERC20_initializer(name, symbol, initial_supply, recipient)
    ^********************************************************^
/path/to/my-project/contracts/utils/token/ERC20_base.cairo:54:5
    ERC20_mint(recipient, initial_supply)
    ^***********************************^
/path/to/my-project/contracts/utils/token/ERC20_base.cairo:135:30
    let (balance: Uint256) = ERC20_balances.read(account=recipient)
                             ^************************************^
autogen/starknet/storage_var/ERC20_balances/impl.cairo:16:30
        let (storage_addr) = addr(account)
                             ^***********^
autogen/starknet/storage_var/ERC20_balances/impl.cairo:10:21
        let (res) = normalize_address(addr=res)
                    ^*************************^

Traceback (most recent call last):
  File "<hint5>", line 5, in <module>
AssertionError: normalize_address() cannot be used with the current constants.
0xs34n commented 2 years ago

Apparently this solves it:

https://discord.com/channels/793094838509764618/927918707613786162/938005362777411615

cc @MilGard91 @janek26

0xs34n commented 2 years ago

Pasting the Discord solution for those that are facing a similar issue:

in argent x (web application instead of node) this is solved by using webpacks raw loader to import the compiled contract

Another solution:

 putting the json in a txt file and loading it with fs