0

my web3.js version is 1.2.1

let testAddr = "0x0c1A5F4556B09C89D29c1F4C4b2497EEd81aF31D";
    let contract = new web3.eth.Contract(abi, contractAddress, {gasPrice: '3000000', from: userAddr});
    web3.eth.getBalance(userAddr).then(console.log)
    // let options = {
 //            from: userAddr, //创建账户用主账号
 //            gas: 8000000, //最大的gas数值
 //            gasPrice:"2100000" 
 //        }
    contract.methods.findUser(userAddr).call().then(res => {
        console.log(res)
    }).catch(err => {
        console.log(err)
    })

Error: Returned values aren't valid, did it run Out of Gas? at ABICoder.decodeParameters (/home/zhr/solspace/house_rent/node_modules/web3-eth-abi/src/index.js:226:15) at Contract._decodeMethodReturn (/home/zhr/solspace/house_rent/node_modules/web3-eth-contract/src/index.js:465:22) at Method.outputFormatter (/home/zhr/solspace/house_rent/node_modules/

  • What is testAddr here for??? – goodvibration Aug 22 at 15:27
  • Without a reproducible example is hard to know what is wrong or where it is failing (ie contract code, javascript code). My guess is that findUser is failing, it is expecting some output but the output is empty. And it fails because contract was not initialized properly. – Ismael Aug 22 at 16:23
  • Find the contract whether have testAddr, which already register in the contract – Smith Jone Aug 24 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.