Adding eip155 prefix on changing network breaks Web3Modal

I have been using Web3Modal to make a dapp, but recent MetaMask version adds eip155: prefix on chainId when sending chainId information to walletconnect server.

Is there a reason why eip155 prefix had to be added when other wallets just pass chainId?

Here are the logs I see when I use MetaMask 10.28.2.

request which is sent to server

geturl.js?f90c:48          POST https://rpc.walletconnect.com/v1/?chainId=eip155:1313161554&projectId=<PROJECT_ID>
```

Error:
`
Error: bad response (status=400, headers={"content-length":"128","content-type":"application/json"}, body="{\"status\":\"FAILED\",\"reasons\":[{\"field\":\"chainId\",\"description\":\"We don't support the chainId you provided: eip155:1313161554\"}]}", requestBody="{\"method\":\"eth_getBalance\",\"params\":[\"0xddfc269955f0224996665d3fc2b5af3e374c67ce\",\"latest\"],\"id\":42,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="https://rpc.walletconnect.com/v1/?chainId=eip155:1313161554&projectId=0fc84e4f32cc63e35dc9ae87ff121201", code=SERVER_ERROR, 
`

hi @hskang9 ,

I could find this in the MetaMask docs here. Will try to dig further on this too:

networkChanged (DEPRECATED)

WARNING

Use chainChanged instead.

Like chainChanged, but with the networkId instead. Network IDs are insecure, and were effectively deprecated in favor of chain IDs by EIP-155 (opens new window). Avoid using them unless you know what you are doing.

https://docs.metamask.io/guide/ethereum-provider.html#legacy-events

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.