mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-10 22:05:55 +00:00
refactor(@embark/ens): use ZERO_ADDRESS constant
This commit is contained in:
parent
2ff119d2df
commit
2dfaaa8201
@ -1,10 +1,10 @@
|
||||
import { ZERO_ADDRESS } from '../../utils/addressUtils';
|
||||
/*global web3*/
|
||||
const namehash = require('eth-ens-namehash');
|
||||
// Price of ENS registration contract functions
|
||||
const ENS_GAS_PRICE = 700000;
|
||||
|
||||
const reverseAddressSuffix = '.addr.reverse';
|
||||
const voidAddr = '0x0000000000000000000000000000000000000000';
|
||||
const NoDecodeAddrErr = 'Error: Couldn\'t decode address from ABI: 0x';
|
||||
const NoDecodeStringErr = 'ERROR: The returned value is not a convertible string: 0x0';
|
||||
|
||||
@ -66,7 +66,7 @@ function lookupAddress(address, ens, utils, createResolverContract, callback) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
if (resolverAddress === voidAddr) {
|
||||
if (resolverAddress === ZERO_ADDRESS) {
|
||||
return cb('Address not associated to a resolver');
|
||||
}
|
||||
createResolverContract(resolverAddress, (_, resolverContract) => {
|
||||
@ -90,7 +90,7 @@ function resolveName(name, ens, createResolverContract, callback) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
if (resolverAddress === voidAddr) {
|
||||
if (resolverAddress === ZERO_ADDRESS) {
|
||||
return cb('Name not yet registered');
|
||||
}
|
||||
createResolverContract(resolverAddress, (_, resolverContract) => {
|
||||
|
@ -5,6 +5,7 @@ const async = require('async');
|
||||
const embarkJsUtils = require('embarkjs').Utils;
|
||||
const reverseAddrSuffix = '.addr.reverse';
|
||||
const ENSFunctions = require('./ENSFunctions');
|
||||
import { ZERO_ADDRESS } from '../../utils/addressUtils';
|
||||
|
||||
const MAINNET_ID = '1';
|
||||
const ROPSTEN_ID = '3';
|
||||
@ -177,7 +178,7 @@ class ENS {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
if (resolverAddress === '0x0000000000000000000000000000000000000000') {
|
||||
if (resolverAddress === ZERO_ADDRESS) {
|
||||
return cb('Name not yet registered');
|
||||
}
|
||||
next(null, resolverAddress);
|
||||
@ -455,7 +456,7 @@ class ENS {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
if(resolverAddress === '0x0000000000000000000000000000000000000000') {
|
||||
if(resolverAddress === ZERO_ADDRESS) {
|
||||
return next('Name not yet registered');
|
||||
}
|
||||
next(null, resolverAddress);
|
||||
|
Loading…
x
Reference in New Issue
Block a user