starknet-io / starknet.js

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

Gateway Error, #769

Closed mbzdg closed 11 months ago

mbzdg commented 11 months ago

After argentx wallet upgrade I started to get this error, every contract call.

"GatewayError: Execution was reverted; failure reason: [0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473]."

It's a simple NFT approve call.

      const devnetPrivateKey = element.key;
      const devnetAccount0Address = element.adress;
      const account = new Account(provider, devnetAccount0Address, devnetPrivateKey); 

      const multiCallMySwap = await account.execute(                        
          {
            contractAddress: "0x02d679a171589777bc996fb27767ff9a2e44c7e07967760dea3df31704ab398a",
            entrypoint: "ApprovalForAll",
            calldata: CallData.compile({
              owner : devnetAccount0Address,
              operator : "0x578a25fe5fe8f4749651be751dff8fc68d8f3d16b175d3e6ae4f99645a7d100",
              approved: "1",                                                
            })
          }           
      )
      console.log(multiCallMySwap.transaction_hash);
      console.log(element);                        
      await provider.waitForTransaction(multiCallMySwap.transaction_hash);  
penovicp commented 11 months ago

When reporting bugs it is best to adhere to the bug report template.

I'm guessing you are running a forked devnet, and the account from the code snippet is the upgraded one. If so, with the wallet upgrade the Cairo version of the account changed, it doesn't match the default "0" and needs to be set to "1", e.g. new Account(provider, devnetAccount0Address, devnetPrivateKey, "1"). This will be automated in the upcoming version but needs to be explicitly set for now.

If you run into any more issues you can also check the starknet.js Discord channel, a bunch of people have been going through the upgrade so decent chance someone else has encountered it before.

mbzdg commented 11 months ago

Thank you sir, you are awesome. @penovicp