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

206
Views
¿Cómo diferencio b/wa ipfs url/ruta (dirección de contenido) de normal-url (dirección de ubicación)?

Estoy tratando de obtener metadatos nft para los nfts agregados en mi plataforma. Algunos Nfts contienen ipfs-urls como tokenURI y necesito un mecanismo para diferenciarlos de las URL normales (URL con dirección de ubicación).

¡Estaba usando is-ipfs , pero da resultados falsos incluso para ipfs-urls válidos!

 if (mtokenUri) { var res; var data; console.log("### ipfs url check ###"); console.log( isIPFS.urlOrPath( "ipfs://bafybeihbsysdkemc3kyylegtfopkrcfiih4exnasoql2q36fb4zawlrwhy/volcano.json", ), ); // false for "ipfs://bafybeihbsysdkemc3kyylegtfopkrcfiih4exnasoql2q36fb4zawlrwhy/volcano.json" //this is not very reliable if (isIPFS.urlOrPath(mtokenUri)) { //gives false even for a valid ipfs-url console.log("inside erc721 ipfs: "); isIpfsUrl = true; console.log("*** 721 isIpfs url ***"); console.log(isIPFS.urlOrPath(mtokenUri)); // example ccid = 'QmPzhc9ezphJ85qJWfVVpeHkPieDJznpYduGhMYD7Z4Ac9' const cid_eg2 = "bafybeihbsysdkemc3kyylegtfopkrcfiih4exnasoql2q36fb4zawlrwhy/volcano.json"; try { res = await ipfs.cat(mtokenUri); // data = await res.json() console.log(res); } catch (error) { console.log(error); } //shows:cat {<suspended>} } else { //do normal fetch try { res = await fetch(mtokenUri); data = await res.json(); console.log("erc721 normal fetch"); console.log("*** Normal fetch data *** "); console.log(data); _imageUrl = data.image; _name = data.name; _description = data.description; } catch (error) { console.log(error); } } }

Cuando trato de buscar una URL de ipfs usando 'buscar', muestra-

ingrese la descripción de la imagen aquí

¿Hay alguna manera de hacer esto de manera eficiente/confiable?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Gracias a @AKX por la entrada. Usando esto por ahora-

 if ( isIPFS.urlOrPath(theUri) || mtokenUri.startsWith('ipfs://') || mtokenUri.includes('/ipfs/') || mtokenUri.includes('/bafy') ) { // parse/cat ipfs-url } else { // parse/fetch normal-non-ipfs-url }
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!