add debug table for addDomain

This commit is contained in:
Barry Gitarts 2018-05-25 15:22:55 -04:00
parent dac59c0f55
commit b214914ea2
1 changed files with 17 additions and 1 deletions

View File

@ -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,