add domain utils

This commit is contained in:
Barry Gitarts 2018-09-01 08:22:34 -04:00
parent 5ac27a1c93
commit 49e8d771e9
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
import EmbarkJS from 'Embark/EmbarkJS';
import ENSRegistry from 'Embark/contracts/ENSRegistry';
import PublicResolver from 'Embark/contracts/PublicResolver';
const { methods: { owner, resolver } } = ENSRegistry;
export const nullAddress = '0x0000000000000000000000000000000000000000';
export const getResolver = async node => {
const resolverAddress = await resolver(node).call();
return resolverAddress !== nullAddress
? new EmbarkJS.Contract({ abi: PublicResolver._jsonInterface, address: resolverAddress })
: PublicResolver
}