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

157
Views
obtener /u0000 al usar web3js

Tengo pruebas que funcionan al 100% y devuelven valores, pero cuando trato de leer los datos usando la API web3 en javascript para la tarea, recupero un valor de retorno de /u0000 para el nombre y el símbolo, no estoy seguro de por qué.

Resultado

 0: "" 1: "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" name: "" symbol: "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" [[Prototype]]: Object

JS

 lookUp: async function (){ const { lookUptokenIdToStarInfo } = this.meta.methods; const id = document.getElementById("lookid").value; var star = await lookUptokenIdToStarInfo(id).call(); console.log(star) console.log(JSON.stringify(star)); App.setStatus("star info is name:" + star.name + " symbol:" + star.symbol + "."); }

Solidez

 function lookUptokenIdToStarInfo (uint _tokenId) public view returns (string memory name, string memory symbol) { //Solidity 0.8.0 and above can return our Star struct but to be pure to previous standard way of doing things we are returning it as a string name = tokenIdToStarInfo[_tokenId].name; symbol = tokenIdToStarInfo[_tokenId].symbol; return (name,symbol); }

Prueba

 it('lookUptokenIdToStarInfo test', async() => { let tokenId = 7; let instance = await StarNotary.deployed(); await instance.createStar('Awesome Star!', "AS", tokenId, {from: accounts[0]}) var getByTokenId = await instance.lookUptokenIdToStarInfo(tokenId); assert.equal(await getByTokenId.name, 'Awesome Star!') assert.equal(await getByTokenId.symbol, 'AS') });
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!