diff --git a/app/components/ens/registerSubDomain.js b/app/components/ens/registerSubDomain.js index a78ee11..a4327ae 100644 --- a/app/components/ens/registerSubDomain.js +++ b/app/components/ens/registerSubDomain.js @@ -2,12 +2,14 @@ import web3 from "Embark/web3" import ENSSubdomainRegistry from 'Embark/contracts/ENSSubdomainRegistry'; import ENSRegistry from 'Embark/contracts/ENSRegistry'; import React, { Fragment } from 'react'; -import { Button } from 'react-bootstrap'; +import { Button, Input } from 'react-bootstrap'; import { withFormik } from 'formik'; import { hash } from 'eth-ens-namehash' import { zeroAddress, zeroBytes32 } from './utils' import FieldGroup from '../standard/FieldGroup' +const { soliditySha3, sha3 } = web3.utils; + const InnerForm = ({ values, errors, @@ -37,7 +39,22 @@ const InnerForm = ({ onChange={handleChange} onBlur={handleBlur} value={values.domainName} + button={ + + } /> + ({ subDomain: '', domainName: '' }), + mapPropsToValues: props => ({ subDomain: '', domainName: '', price: '' }), validate(values) { const errors = {}; - const { address } = values; - if (address && !web3.utils.isAddress(address)) errors.address = 'Not a valid address' + const { address, subDomain } = values; + if (address && !web3.utils.isAddress(address)) errors.address = 'Not a valid address'; + if (!subDomain) errors.subDomain = 'Required'; return errors; }, handleSubmit(values, { setSubmitting }) { const { subDomain, domainName, address } = values; - const { soliditySha3 } = web3.utils; const { methods: { register } } = ENSSubdomainRegistry; register( soliditySha3(subDomain),