Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal JSON-RPC error On the ios metamask app #6585

Closed
morelearn1990 opened this issue Nov 10, 2023 · 8 comments
Closed

Internal JSON-RPC error On the ios metamask app #6585

morelearn1990 opened this issue Nov 10, 2023 · 8 comments
Labels
4.x 4.0 related Bug Addressing a bug

Comments

@morelearn1990
Copy link

I encountered the same problem #7043

Expected behavior

Actual behavior

Steps to reproduce the behavior

  // @ts-expect-error
  if (window.ethereum) {
    // @ts-expect-error
    const web3 = new Web3(window.ethereum);
    const _accounts = await web3.eth.requestAccounts();
    console.log("_accounts", _accounts)
    const erc20 = new web3.eth.Contract(ERC20_ABI, VITE_USDT);
    const balance = await erc20.methods.balanceOf("0x8747E0366aacCeae04c756B471D86d36567c2C5c").call();
    console.log("balance", balance)
  }

balanceOf operation will report an error

Logs

{"name":"ResponseError","code":100,"message":"Returned error: Internal JSON-RPC error.","innerError":{"code":-32603,"message":"Internal JSON-RPC error.","data":{"code":-32000,"message":"execution reverted"}},"data":{"code":-32000,"message":"execution reverted"},"request":null}

Environment

web3.js 4.2.2
metamask ios 7.10.0

@morelearn1990
Copy link
Author

In this issue, switching web3. js to version 1. x is not a problem

@morelearn1990
Copy link
Author

When I compared the parameters passed in to the request, I found that 4. x used input to pass in the parameters, while 1. x used data to pass in the parameters, resulting in an error on the iOS metamask application.

@morelearn1990
Copy link
Author

related #21467

@luu-alex
Copy link
Contributor

Hi there. thanks for submitting this i'll take a look. are u only using metmask through ios?

@luu-alex luu-alex added Bug Addressing a bug 4.x 4.0 related labels Nov 10, 2023
@mconnelly8
Copy link

Hey @morelearn1990, are you only using metamask through ios?

@tauseedzaman
Copy link

Hi there. thanks for submitting this i'll take a look. are u only using metmask through ios?

i am getting the same error on bsc testnet
image

@morelearn1990
Copy link
Author

> Hey @morelearn1990, are you only using metamask through ios?

Yes, then I set the value of input and data to be the same together with the metamask to solve this problem, I do not know whether it will cause other problems, at least now no problem!

@mconnelly8
Copy link

Hey @morelearn1990, please check out our latest 4.4.0 release - https://www.npmjs.com/package/web3/v/4.4.0

This issue should already be fixed there. If for some reason you are still seeing this in 4.4.0, please reopen this issue. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related Bug Addressing a bug
Projects
None yet
Development

No branches or pull requests

5 participants
@morelearn1990 @luu-alex @tauseedzaman @mconnelly8 and others