diff --git a/app/components/ens/addDomain.js b/app/components/ens/addDomain.js index b3a1b41..72d2182 100644 --- a/app/components/ens/addDomain.js +++ b/app/components/ens/addDomain.js @@ -69,21 +69,6 @@ const AddDomain = withFormik({ const { methods: { domains, setDomainPrice, updateDomainPrice } } = ENSSubdomainRegistry const { sha3 } = window.web3.utils const hashedDomain = hash(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( !!Number(state) ? updateDomainPrice : setDomainPrice, diff --git a/app/components/ens/nameLookup.js b/app/components/ens/nameLookup.js index 7e5d2a5..d628e72 100644 --- a/app/components/ens/nameLookup.js +++ b/app/components/ens/nameLookup.js @@ -1,21 +1,52 @@ import React, { Fragment } from 'react'; import { Button, Field, TextInput, Card } from '../../ui/components' +import { withFormik } from 'formik'; +import PublicResolver from 'Embark/contracts/PublicResolver'; +import { hash } from 'eth-ens-namehash'; +const formatName = domainName => domainName.includes('.') ? domainName : `${domainName}.stateofus.eth`; const cardStyle = { width: '75%', marginLeft: '15%', padding: '30px' } -const NameLookup = () => ( +const InnerForm = ({ + values, + errors, + touched, + handleChange, + handleBlur, + handleSubmit, + isSubmitting, +}) => ( - - - - +
+ + + + +
) +const NameLookup = withFormik({ + mapPropsToValues: props => ({ domainName: '' }), + handleSubmit(values, { setSubmitting }) { + const { domainName } = values; + PublicResolver.methods.addr(hash(formatName(domainName))) + .call() + .then(res =>{ + console.log('addr', res); + }); + } +})(InnerForm) + export default NameLookup; diff --git a/app/components/ensSubManagement.js b/app/components/ensSubManagement.js index 70deeb2..86592a8 100644 --- a/app/components/ensSubManagement.js +++ b/app/components/ensSubManagement.js @@ -1,7 +1,6 @@ import EmbarkJS from 'Embark/EmbarkJS'; import ENSRegistry from 'Embark/contracts/ENSRegistry'; import ENSSubdomainRegistry from 'Embark/contracts/ENSSubdomainRegistry'; -import PublicResolver from 'Embark/contracts/PublicResolver'; import TestToken from 'Embark/contracts/TestToken'; import React, { Fragment } from 'react'; import { Form, FormGroup, FormControl, HelpBlock, Button, ControlLabel } from 'react-bootstrap'; @@ -9,7 +8,6 @@ import AddDomain from './ens/addDomain'; import RegisterSubDomain from './ens/registerSubDomain'; import TokenPermissions from './standard/TokenPermission'; import SetupENS from './ens/setupENS'; -import { hash } from 'eth-ens-namehash'; const FieldGroup = ({ id, label, help, ...props }) => ( @@ -40,9 +38,6 @@ setTimeout(() => ENSRegistry.getPastEvents( 'allEvents', {}, (err, res) => { - PublicResolver.methods.addr(hash('bobby.stateofus.eth')).call().then(res =>{ - console.log('addr', res); - }); console.log(err, res) }), 2000) export default ENSSubManagement;