Getting inconsistent responses with web3.eth

Viewed 109

The code runs but says "food.eth" is available (it isn't):

var Web3 = require("web3")
let web3 = new Web3(Web3.givenProvider || "ws://localhost:8546");
var ens = web3.eth.ens;
const words = [
    'beer',
    'food',
    'chovy',
];

(async () => {
    for (let word of words) {
        console.log('checking: '+ word);
        const addr = await getDomain(word);
        console.log(word+': '+ addr);
    }
})();

async function getDomain(word) {
    try {
        const addr = await ens.getAddress(`${word}.eth`)
        console.log(addr);
        return addr;
    } catch(err) {
        console.error(err);
        return;
    }
}

I'm running geth with the following command on Ubuntu 20.04:

geth --syncmode "light" --ws --mainnet

0 Answers
Related