Hi ! I just noticed a strange behaviour when querying with ENS names :
Ethers v4.0.27 on node
This will trigger the following error :
UnhandledPromiseRejectionWarning: Error: invalid argument 0: json: cannot unmarshal non-string into Go value of type common.Address
at getResult (C:\Users\Campalo\CASCADE8\blockframes\node_modules\ethers\providers\json-rpc-provider.js:40:21)
at exports.XMLHttpRequest.request.onreadystatechange (C:\Users\Campalo\CASCADE8\blockframes\node_modules\ethers\utils\web.js:111:30)
at exports.XMLHttpRequest.dispatchEvent (C:\Users\Campalo\CASCADE8\blockframes\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:591:25)
at setState (C:\Users\Campalo\CASCADE8\blockframes\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:610:14)
at IncomingMessage.<anonymous> (C:\Users\Campalo\CASCADE8\blockframes\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:447:13)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
Expected behaviour :
return a more meaningful error, or in case of getBalance() simply 0x0
Minimal step to reproduce (on goerli) :
doesntexist.test doesn't existvitalik.test exist without any resolverblockframes.test exist with a resolver but no addressethers.getDefaultProvider('goerli').getBalance('vitalik.test');
That鈥檚 odd. That looks more like the error when the internet is down (obviously since you can get the balance, that is not the case).
I鈥檒l look into this once I get to Starbucks.
yes ! for exemple the domain tokyo.blockframes.test is linked to an address that have some eth and ethers.getDefaultProvider('goerli').getBalance('tokyo.blockframes.test').then(console.log) works perfectly
I have verified this is a bug and will get it fixed soon.
This should be fixed in 4.0.28. Let me know if you still have any problems.
Thanks! :)
(oh, also getBalance still throws an error, just a more meaningful error, since getting the balance of a non-existent ENS name should still be an error. :))
Thanks for your work @ricmoo !!!