Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getAvatar returning null but domain has an avatar #2426

Closed
githubdoramon opened this issue Dec 20, 2021 · 10 comments
Closed

getAvatar returning null but domain has an avatar #2426

githubdoramon opened this issue Dec 20, 2021 · 10 comments
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.

Comments

@githubdoramon
Copy link

Describe the bug
getAvatar returns null although ENS has an avatar

Reproduction steps
Use getAvatar on bratly.eth for example, I will return null. This happens because on the getAvatar function the following check is done

if (!metadata || typeof(metadata.image) !== "string" || !metadata.image.match(/^https:\/\//i)) {
  return null;
}

but NFT can have ipfs hashes as images instead of an https link. Ideally function should check for ipfs links as well

@githubdoramon githubdoramon added the investigate Under investigation and may be a bug. label Dec 20, 2021
@ricmoo
Copy link
Member

ricmoo commented Dec 20, 2021

The ENS name "bratly.eth" is not registered, did you mean "brantly.eth"? That one works.

But if you have any examples that don’t, please let me know. :)

@ricmoo ricmoo removed the investigate Under investigation and may be a bug. label Dec 20, 2021
@githubdoramon
Copy link
Author

Sry... was a typo... I meant "brantly.eth". The following code returns null (using ethers 5.5.2)

 const provider = new ethers.providers.InfuraProvider("homestead", {
        projectId: xxxx, -> > purposely hidden
        projectSecret: xxxx -> purposely hidden
    });

    const resolver = await provider.getResolver("brantly.eth");
    console.log('avatar ', await resolver?.getAvatar())

@githubdoramon
Copy link
Author

githubdoramon commented Dec 21, 2021

Updating, works for brantly.eth (my node modules had the wrong ethers version).

But still doesn't work for this example - 9tails.eth - cause its avatar is an ipfs link

@slingncrypto
Copy link

slingncrypto commented Dec 30, 2021

I also observe this behavior when Avatar is set to value which should ultimately be resolved to a base64 encoded image:

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

image

@ricmoo ricmoo added bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published. labels Jan 7, 2022
@ricmoo
Copy link
Member

ricmoo commented Jan 7, 2022

This has been fixed in 5.5.3. Try it out and let me know if there are any issues.

Thanks! :)

@githubdoramon
Copy link
Author

works :)

Thanks @ricmoo

@ricmoo ricmoo closed this as completed Feb 1, 2022
@rhamnett
Copy link

rhamnett commented Feb 3, 2022

Think you should add arweave ar:// too

@ricmoo
Copy link
Member

ricmoo commented Feb 3, 2022

I’m not sure what ar:// is, but keep in mind I only support open protocols that do not require large amounts of additional code to implement, and that are quite common.

@rhamnett
Copy link

rhamnett commented Feb 3, 2022

@ricmoo thanks for the prompt reply. Arweave is a permaweb storage like ipfs. It's supported and popular on opensea and solana NFTs. The urls are like this ar://{hash} it can be simply fetched via a gateway like this: https://arweave.net/{hash}

@rhamnett
Copy link

rhamnett commented Feb 3, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

No branches or pull requests

4 participants