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

[BUG] calling web3.eth.ens.getName and web3.eth.ens.getText throws error AbiError: Parameter decoding error #6992

Closed
Muhammad-Altabba opened this issue Apr 20, 2024 · 0 comments
Assignees
Labels
4.x 4.0 related Bug Addressing a bug

Comments

@Muhammad-Altabba
Copy link
Contributor

Steps to reproduce the behavior

import { Web3 } from 'web3';

async function main() {
  const web3 = new Web3('https://eth.llamarpc.com');

  const address = await web3.eth.ens.getAddress('mike.eth'); // works
  console.log('address', address);

  const name = await web3.eth.ens.getName( // throws error
    '0x1a5cdcfba600e0c669795e0b65c344d5a37a4d5a',
  );
  console.log('name', name);

  const avatar = await web3.eth.ens.getText(  // throws error
    '0x1a5cdcfba600e0c669795e0b65c344d5a37a4d5a', // works only if this is an ENS name like 'ethereum.eth'
    'avatar',
  );
  console.log('avatar', avatar);
}
main();

Logs

.../node_modules/web3-eth-abi/lib/commonjs/api/parameters_api.js:103
        throw new web3_errors_1.AbiError(`Parameter decoding error: ${err.message}`, {
              ^

AbiError: Parameter decoding error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.
    at decodeParametersWith (/home/maltabba/repos/experiments/simple-typescript-starter-v4.x-ens/node_modules/web3-eth-abi/lib/commonjs/api/parameters_api.js:103:15)
    at decodeParameters (/home/maltabba/repos/experiments/simple-typescript-starter-v4.x-ens/node_modules/web3-eth-abi/lib/commonjs/api/parameters_api.js:213:75)
    at decodeMethodReturn (/home/maltabba/repos/experiments/simple-typescript-starter-v4.x-ens/node_modules/web3-eth-contract/lib/commonjs/encoding.js:136:56)
    at Contract.<anonymous> (/home/maltabba/repos/experiments/simple-typescript-starter-v4.x-ens/node_modules/web3-eth-contract/lib/commonjs/contract.js:773:61)
    at Generator.next (<anonymous>)
    at fulfilled (/home/maltabba/repos/experiments/simple-typescript-starter-v4.x-ens/node_modules/web3-eth-contract/lib/commonjs/contract.js:21:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  innerError: undefined,
  code: 205,
  props: {
    internalErr: AbiError: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.
        at decodeParametersWith (/home/maltabba/repos/experiments/simple-typescript-starter-v4.x-ens/node_modules/web3-eth-abi/lib/commonjs/api/parameters_api.js:94:19)
        at decodeParameters (/home/maltabba/repos/experiments/simple-typescript-starter-v4.x-ens/node_modules/web3-eth-abi/lib/commonjs/api/parameters_api.js:213:75)
        at decodeMethodReturn (/home/maltabba/repos/experiments/simple-typescript-starter-v4.x-ens/node_modules/web3-eth-contract/lib/commonjs/encoding.js:136:56)
        at Contract.<anonymous> (/home/maltabba/repos/experiments/simple-typescript-starter-v4.x-ens/node_modules/web3-eth-contract/lib/commonjs/contract.js:773:61)
        at Generator.next (<anonymous>)
        at fulfilled (/home/maltabba/repos/experiments/simple-typescript-starter-v4.x-ens/node_modules/web3-eth-contract/lib/commonjs/contract.js:21:58)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
      innerError: undefined,
      code: 205,
      props: {}
    }
  }
}

Environment

Node.js v21.4.0
web3.js v4 (4.8.0)

@Muhammad-Altabba Muhammad-Altabba added Bug Addressing a bug 4.x 4.0 related labels Apr 20, 2024
@jdevcs jdevcs self-assigned this May 13, 2024
@jdevcs jdevcs removed the Estimate label May 17, 2024
@jdevcs jdevcs closed this as completed May 24, 2024
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

3 participants