While deploying code I get the error

I am using starknet.js and I try upload I get this a big cairo contract -->normalize_address() cannot be used with the current constants

11 Likes

I haven’t been able to figure out exactly what causes this error, but I got it when I was trying to deploy a contract whose .json artifact was minified (whitespaces removed). So, deploying the unminified version worked well for me.

Btw, what network are you deploying to? Starknet-devnet? Alpha-goerli?

9 Likes

Can you post the contract and the error here as well?

9 Likes

Ok hopefully this helps someone. But its fixed now. If you do a direct import like below for some contracts and not all and use it deploy a contract, it will not work, especially if it has uin256 (I think*, not sure)

import * as ricksompiledcontract from β€œβ€¦/…/compiledcairo/RICKS.json”;

What I had to do was something like below

  ricks: fs.readFileSync(fullRicksPath).toString("ascii"),

and then
const ricksresponse = await getStarknet().provider.deployContract({
contract: json.parse(props.ricks),
constructorCalldata: callDatahash
});

where json.parse is from Starknet.js not the regular JSON.parse

Tom Brand also mentioned in Telegram it might be something related to decimal number formatting in contract as opposed to hex. Hope this helps

8 Likes