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

191
Views
NFT en cadena codificado en base64 que no se muestra en Fronted

Estoy tratando de mostrar todos los tokens acuñados en la página principal de mi dapp, así que creé una matriz en Solidity y le presioné el tokenId, luego intenté usar un operador de propagación y asignarlo a los tokenURI. Desafortunadamente, no he podido obtener la imagen para mostrarla.

 for (let i = 1; i <= totalSupply; i++) { //this is listing an array of minted tokens const tokenURI = await contract.methods.tokenURI(i - 1).call() const imageURI = await tokenURI.image // how should we handle the state on the front end this.setState({ NFTz: [...this.state.NFTz, imageURI] // spread operator }) // pretty sure the array could be done on the front end } console.log(this.state.imageURI) console.log(this.state.NFTz)

La consola devuelve:

 index.js:1437 Warning: Each child in a list should have a unique "key" prop. Check the render method of `App`. See fb.me/react-warning-keys for more information. in div (at App.js:136) in App (at src/index.js:7)

Lo renderiza en tarjetas MDBcards con:

 <div className="row textCenter"> {this.state.NFTz.map((key, imageURI) => { return ( <div> <div> <MDBCard className="token img" style={{ maxWidth: '22rem' }}> <MDBCardImage src={imageURI} position='top' height='250rem' style={{ marginRight: '4px' }} /> <MDBCardBody> <MDBCardTitle></MDBCardTitle> <MDBCardText></MDBCardText> <MDBBtn href={imageURI}>Download</MDBBtn> </MDBCardBody> </MDBCard> </div> </div>

PD: Err, probablemente sea más eficiente crear una matriz en el front-end, en lugar de solidez.

Gracias y Dios te bendiga

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!