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

330
Views
Contract.methods.call() devolviendo un error Web3-js

Estoy usando web3 CDN y he implementado un contrato con dos variables. ejemplo:

 pragma solidity ^0.5.0; contract Sweet() { address public owner; uint256 sweets; uint256 shops; constructor(uint256 _sweets, uint256 _shops){ owner = msg.sender; sweets = _sweet; shops = _shops; } function setSweetAndShop(uint256 _sweets, uint256 _shops) public { sweets = _sweets; shops = _shops; } }

Después de implementar este código de ejemplo, todo funciona bien en el remix. Después de eso, he creado un ejemplo de DAPP.

 async function change(){ var web3 = await new Web3(window.ethereum); var account = await web3.eth.getAccounts(); var abi = []; var contract = "0x000000000........."; var token = new web3.eth.Contract(abi, contract); try{ token.methods.setSweetAndShop(10, 20).call({ from: account[0], gas: 800000 }) .then(function(error, result) { if (!error){ console.log(result); }else{ console.log(error); // This part is returning an error g{} , no data inside. } }) }catch(error){ console.log(error) } }
about 4 years ago · Juan Pablo Isaza
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!