Added errors for providers trying to use ENS on networks without ENS.
This commit is contained in:
parent
e778ab6f30
commit
d6cf970ae9
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ethers-providers",
|
||||
"version": "2.1.15",
|
||||
"version": "2.1.16",
|
||||
"description": "Service provider for Ethereum wallet library.",
|
||||
"bugs": {
|
||||
"url": "http://github.com/ethers-io/ethers.js/issues",
|
||||
|
@ -845,6 +845,8 @@ utils.defineProperty(Provider.prototype, 'resolveName', function(name) {
|
||||
return Promise.resolve(utils.getAddress(name));
|
||||
} catch (error) { }
|
||||
|
||||
if (!this.ensAddress) { throw new Error('network does not have ENS deployed'); }
|
||||
|
||||
var self = this;
|
||||
|
||||
var nodeHash = utils.namehash(name);
|
||||
@ -867,6 +869,8 @@ utils.defineProperty(Provider.prototype, 'resolveName', function(name) {
|
||||
});
|
||||
|
||||
utils.defineProperty(Provider.prototype, 'lookupAddress', function(address) {
|
||||
if (!this.ensAddress) { throw new Error('network does not have ENS deployed'); }
|
||||
|
||||
address = utils.getAddress(address);
|
||||
|
||||
var name = address.substring(2) + '.addr.reverse'
|
||||
|
Loading…
Reference in New Issue
Block a user