Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

212
Vistas
How to extract image URL from ens avatar text record

When using ethers JavaScript library to retrieve ENS text records from the Ethereum Name Service. I got the NFT URI from the text record but not the image URL. Please is there any way/service to convert this metadata URI to an HTTPS image URL.

TO RECREATE:

TERMINAL : npm install --save ethers

Code:

var ethers = require('ethers');
var url = 'https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161';
var provider = new ethers.providers.JsonRpcProvider(url);


async function main() {
    const resolver = await provider.getResolver("brantly.eth");
    const avatar = await resolver.getAvatar();
    const avatarMetaData = await resolver.getText("avatar");
    console.log(`Avatar Metadata: ${avatarMetaData}`);
}

main();

.

Output: Avatar Metadata: eip155:1/erc721:0xb7F7F6C52F2e2fdb1963Eab30438024864c313F6/2430

The EIP155... Is not an imageURL. I'd prefer it came in the form of {https://...}. Is there any way to achieve this or convert the NFT URI EIP155... To an image or image URL.

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

As far as I know you will have to go through the entire process to get that IPFS URI.

You will want to take the contract address and token ID from that returned avatar string (the last 2 parts) and call the tokenURI ABI method, parse the JSON and read image there:

const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const contract = new ethers.Contract(address, abi, signer);

const uri = await contract.tokenURI(tokenId)
const data = (await axios.get(uri)).data;
const image = data.image;
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda