wslyvh / proof-of-competence

Proof of Competence (PoC) is an open, modular framework to create on-chain quests and Web3 on-boarding journeys.
https://www.poc.quest/
MIT License
72 stars 19 forks source link

Invalid ENS name error #6

Closed fjun99 closed 2 years ago

fjun99 commented 2 years ago

image

when switching to an address without an ENS, I get this error.

I have no idea what's going wrong. Still digging. Someone encounter the same issue with ethers...

https://github.com/ethers-io/ethers.js/issues/1051

fjun99 commented 2 years ago

I guess something wrong with useAvatar.

hooks/useAvatar.tsx

comment this out, the error is gone

        // const resolver = await web3.library?.getResolver(name)
        // const ensAvatar = await resolver?.getAvatar()
        // if (ensAvatar?.url) {
        //     setAvatar({
        //         name: name,
        //         url: ensAvatar.url
        //     })
        // } else {
        //     setAvatar({
        //         name: '',
        //         url: makeBlockie(web3.account)
        //     })
        // } 
fjun99 commented 2 years ago

If the problem is coming from the ENS avatar, my suggestion is:

I didn't even know ENS avatar before digging into your PoC repo. So, I think ENS Avatar is not very very important.

Perhaps you can consider removing the ENS avatar feature here to quickly correct this error.

fjun99 commented 2 years ago

make this change will fix this issue:

        const resolver = await web3.library?.getResolver(web3.account)

        // const resolver = await web3.library?.getResolver(name)

Don't know what is the meaning as I haven't digged into ENS/ENS.solver.

wslyvh commented 2 years ago

Hmm, strange. I don't remember this was an issue before? The problem is trying to getResolver with an empty name.

Fixed here https://github.com/wslyvh/proof-of-competence/commit/8c10b8580180154885fadc7a2ca22e0e352e5cb4

But you're right that below should work as well. name is empty, but web3.account should not.

make this change will fix this issue:

        const resolver = await web3.library?.getResolver(web3.account)

        // const resolver = await web3.library?.getResolver(name)

Don't know what is the meaning as I haven't digged into ENS/ENS.solver.

fjun99 commented 2 years ago

great