diff --git a/README.md b/README.md index 5f13ae9..107a194 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,4 @@ Usage: | token/ERC20Token | No | Yes | Yes | | ens/ENSRegistry | Yes | Yes | No | | ens/PublicRegistry | Yes | Yes | No | -| registry/ENSSubdomainRegistry | Yes | Yes | No | \ No newline at end of file +| registry/UsernameRegistrar | Yes | Yes | Yes | \ No newline at end of file diff --git a/app/actions/accounts.js b/app/actions/accounts.js index 0f9e25a..8fd8cd3 100644 --- a/app/actions/accounts.js +++ b/app/actions/accounts.js @@ -1,5 +1,5 @@ import ERC20Token from 'Embark/contracts/ERC20Token' -import ENSSubdomainRegistry from 'Embark/contracts/ENSSubdomainRegistry' +import UsernameRegistrar from 'Embark/contracts/UsernameRegistrar' import TestToken from 'Embark/contracts/TestToken' import { getDefaultAccount } from '../utils/web3Helpers' @@ -42,7 +42,7 @@ export const checkAndDispatchStatusContactCode = dispatch => { export const fetchAndDispatchSNTAllowance = dispatch => { const { methods: { allowance } } = TestToken; const { receiveSntAllowance } = accountActions; - const spender = ENSSubdomainRegistry._address; + const spender = UsernameRegistrar._address; allowance(getDefaultAccount(), spender) .call() .then(allowance => { diff --git a/app/components/ens/addDomain.js b/app/components/ens/addDomain.js index 294d500..d256b29 100644 --- a/app/components/ens/addDomain.js +++ b/app/components/ens/addDomain.js @@ -1,4 +1,4 @@ -import ENSSubdomainRegistry from 'Embark/contracts/ENSSubdomainRegistry'; +import UsernameRegistrar from 'Embark/contracts/UsernameRegistrar'; import web3 from 'web3'; import ENSRegistry from 'Embark/contracts/ENSRegistry'; import React from 'react'; @@ -11,16 +11,16 @@ import { debounce } from 'lodash/fp'; const { methods: { owner } } = ENSRegistry; const delay = debounce(500); -const getDomain = (hashedDomain, domains) => domains(hashedDomain).call(); -const registryIsOwner = address => address == ENSSubdomainRegistry._address; -const fetchOwner = domainName => owner(hash(domainName)).call(); +const getRegistry = (hashedRegistry, registrys) => registrys(hashedRegistry).call(); +const registryIsOwner = address => address == UsernameRegistrar._address; +const fetchOwner = registryName => owner(hash(registryName)).call(); const debounceFetchOwner = delay(fetchOwner); -const getAndIsOwner = async domainName => { - const address = await debounceFetchOwner(domainName); +const getAndIsOwner = async registryName => { + const address = await debounceFetchOwner(registryName); return registryIsOwner(address); } -const fetchDomain = delay(getDomain); -const setPrice = (domainFn, hashedDomain, price) => domainFn(hashedDomain, price || 0).send(); +const fetchRegistry = delay(getRegistry); +const setPrice = (registryFn, price) => registryFn(price || 0).send(); const InnerForm = ({ values, @@ -33,53 +33,50 @@ const InnerForm = ({ }) => (
) -const AddDomain = withFormik({ - mapPropsToValues: props => ({ domainName: '', domainPrice: '' }), +const AddRegistry = withFormik({ + mapPropsToValues: props => ({ registryName: '', registryPrice: '' }), async validate(values) { - const { domainName } = values; + const { registryName } = values; const errors = {}; - if (!domainName) errors.domainName = 'Required'; - if (domainName && !await getAndIsOwner(domainName)) errors.domainName = 'This domain is not owned by registry'; + if (!registryName) errors.registryName = 'Required'; + if (registryName && !await getAndIsOwner(registryName)) errors.registryName = 'This registry is not owned by registry'; if (Object.keys(errors).length) throw errors; }, async handleSubmit(values, { setSubmitting }) { - const { domainName, domainPrice } = values; - const { methods: { domains, setDomainPrice, updateDomainPrice } } = ENSSubdomainRegistry; - const hashedDomain = hash(domainName); - const { state } = await getDomain(hashedDomain, domains); + const { registryName, registryPrice } = values; + const { methods: { state, activate, updateRegistryPrice } } = UsernameRegistrar; + const { registryState } = await state(); console.log( 'Inputs for setPrice', - Number(state) ? 'updateDomainPrice' : 'setDomainPrice', - hashedDomain, - web3.utils.toWei(domainPrice.toString(), 'ether'), + Number(registryState) ? 'updateRegistryPrice' : 'activate', + web3.utils.toWei(registryPrice.toString(), 'ether'), ); setPrice( - Number(state) ? updateDomainPrice : setDomainPrice, - hashedDomain, - web3.utils.toWei(domainPrice.toString(), 'ether'), + Number(registryState) ? updateRegistryPrice : activate, + web3.utils.toWei(registryPrice.toString(), 'ether'), ) .then(res => { setSubmitting(false); @@ -92,4 +89,4 @@ const AddDomain = withFormik({ } })(InnerForm); -export default AddDomain; +export default AddRegistry; diff --git a/app/components/ens/copy.js b/app/components/ens/copy.js index c0e5d00..bcd5a10 100644 --- a/app/components/ens/copy.js +++ b/app/components/ens/copy.js @@ -2,7 +2,7 @@ export default { release: { title: { sub: 'Done!', - body: 'The released domain will be available to other users' + body: 'The released username will be available to other users' }, subheading: 'Follow the progress in the Transaction History section of your wallet.' }, diff --git a/app/components/ens/moveDomain.js b/app/components/ens/moveDomain.js index 0d35cf4..b6bd7df 100644 --- a/app/components/ens/moveDomain.js +++ b/app/components/ens/moveDomain.js @@ -1,7 +1,6 @@ -import ENSSubdomainRegistry from 'Embark/contracts/ENSSubdomainRegistry'; +import UsernameRegistrar from 'Embark/contracts/UsernameRegistrar'; import web3 from 'web3'; import React from 'react'; -import { hash } from 'eth-ens-namehash'; import { Button } from 'react-bootstrap'; import FieldGroup from '../standard/FieldGroup'; import { withFormik } from 'formik'; @@ -25,16 +24,6 @@ const InnerForm = ({ value={values.newAddress} error={errors.newAddress} /> -Javascript calls being made:
-{item}
) - } -