From b214914ea23e37c8ce23e8dbfeb441f8c4ba5fef Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Fri, 25 May 2018 15:22:55 -0400 Subject: [PATCH] add debug table for addDomain --- app/components/ens/addDomain.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/components/ens/addDomain.js b/app/components/ens/addDomain.js index 0f4558f..da62e80 100644 --- a/app/components/ens/addDomain.js +++ b/app/components/ens/addDomain.js @@ -63,7 +63,23 @@ const AddDomain = withFormik({ async handleSubmit(values, { setSubmitting }) { const { domainName, domainPrice } = values const { methods: { domains, addDomain, setDomainPrice } } = ENSSubdomainRegistry - const hashedDomain = hash(domainName); + const { sha3 } = window.web3.utils + const hashedDomain = sha3(domainName); + const debugTable = await ['eth', 'stateofus', 'stateofus.eth', 'freedomain', 'freedomain.eth', domainName] + .map(async str => { + const result = {}; + result['domainName'] = str; + result['sha3Result'] = await getDomain(sha3(str), domains); + result['sha3State'] = result.sha3Result.state + result['sha3Price'] = result.sha3Result.price + result['nameHashResult'] = await getDomain(hash(str), domains); + result['nameHashState'] = result['nameHashResult'].state + result['nameHashPrice'] = result['nameHashResult'].price + result['sha3String'] = sha3(str); + result['nameHashString'] = hash(str); + return result; + }) + Promise.all(debugTable).then(v => { console.table(v) }); const { state } = await getDomain(hashedDomain, domains); setPrice( !!state ? setDomainPrice : addDomain,