Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

299
Views
Uncaught (in promise) Error: invalid address

how to fix this error when i call a smart contract function?

Uncaught (in promise) Error: invalid address (argument="address", value={"from":"0xaD1D30B476C195C23ef4CC9b7A3c53E7423B7690"}, code=INVALID_ARGUMENT, version=address/5.0.5) (argument="index", value={"from":"0xaD1D30B476C195C23ef4CC9b7A3c53E7423B7690"}, code=INVALID_ARGUMENT, version=abi/5.0.7)

it's my code:

enter: async function() {
    App.contracts["MyContract"].deployed().then(async(instance) =>{
      var a = web3.eth.getAccounts();
      let ticketsForPlayers  = await instance.getTicketsForPlayers({from: App.account});
      console.log(ticketsForPlayers);
    });
  }
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

The Problem

The error shows that you didn't set the address property correctly, it's may be the issue with your solidity implementation and it's not related to javascript snippet, as mentioned in the comments, you can ask about it on related sites, but there are some points with the above snippet that may help you. you are mixing two different implementations in enter method to handle a promise which is clearly incorrect and leads to the issues.

The Points

use async/await with try/catch block. more on MDN documentation:

enter: async function () {
  try {
    const instance = await App.contracts["MyContract"].deployed()
    
    const properNameForVariable = web3.eth.getAccounts();

    const ticketsForPlayers = await instance.getTicketsForPlayers({from: App.account})

    console.log(ticketsForPlayers)
  } catch (error) {
    // do a proper action on failure cases
  }
}

Now, if there are errors in your async actions, it catches by catch block, you may also use console.error(error) or console.warn(error) in the catch block to see the exception and stack traces.

Note: using this approach with try/catch will ensure the application continues to work even after exceptions and errors.

about 4 years ago · Juan Pablo Isaza Report

0

using an old version of web3 for a tutorial web3@0.20.6 and Firefox 100.0.1

this was what I added to react to get resolve the error

web3.eth.defaultAccount = web3.eth.accounts[0]

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!