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

How to migrate Contract Interaction Logic from v5 -> v6 #4895

Open
ValentineCodes opened this issue Dec 10, 2024 · 0 comments
Open

How to migrate Contract Interaction Logic from v5 -> v6 #4895

ValentineCodes opened this issue Dec 10, 2024 · 0 comments
Assignees
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6

Comments

@ValentineCodes
Copy link

Ethers Version

6.9.1

Search Terms

No response

Describe the Problem

This logic works in ethers v5 but not in v6

      const provider = new ethers.JsonRpcProvider(network.provider);

      // @ts-ignore
      const contract = new ethers.Contract(address, abi, provider);

      const result = await contract.functions[functionName](...(args || []), {
        from: account.address
      });

I've tried removing the functions method like this 👇

      const contractFunction = contract.getFunction(functionName)
const result = await contractFunction(...(args || []));

still fails!

Please HELP!🆘

Code Snippet

No response

Contract ABI

No response

Errors

[Error: could not decode result data (value="0x", info={ "method": "totalCounter", "signature": "totalCounter()" }, code=BAD_DATA, version=6.9.1)]

Environment

React Native/Expo/JavaScriptCore

Environment (Other)

No response

@ValentineCodes ValentineCodes added investigate Under investigation and may be a bug. v6 Issues regarding v6 labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6
Projects
None yet
Development

No branches or pull requests

2 participants