diff --git a/app/components/ens/nameLookup.js b/app/components/ens/nameLookup.js index 21df468..44d771b 100644 --- a/app/components/ens/nameLookup.js +++ b/app/components/ens/nameLookup.js @@ -1,4 +1,5 @@ import React, { Fragment, PureComponent } from 'react'; +import web3 from 'web3'; import { connect } from 'react-redux'; import { actions as accountActions } from '../../reducers/accounts'; import ENSSubdomainRegistry from 'Embark/contracts/ENSSubdomainRegistry'; @@ -12,6 +13,7 @@ import { CopyToClipboard } from 'react-copy-to-clipboard'; import RegisterSubDomain from '../ens/registerSubDomain'; import StatusLogo from '../../ui/icons/components/StatusLogo' import EnsLogo from '../../ui/icons/logos/ens.png'; +import { formatPrice } from '../ens/utils' const { getPrice, getExpirationTime } = ENSSubdomainRegistry.methods; const invalidSuffix = '0000000000000000000000000000000000000000' @@ -21,6 +23,7 @@ const validStatusAddress = address => !address.includes(invalidSuffix); const formatName = domainName => domainName.includes('.') ? domainName : `${domainName}.stateofus.eth`; const getDomain = fullDomain => formatName(fullDomain).split('.').slice(1).join('.'); const hashedDomain = domainName => hash(getDomain(domainName)); +const { fromWei } = web3.utils; const cardStyle = { width: '100%', @@ -95,7 +98,7 @@ class Register extends PureComponent { {!registered ? - {formattedDomain.toUpperCase()} can be registered for {domainPrice} SNT + {formattedDomain.toUpperCase()} can be registered for {!!domainPrice && formatPrice(fromWei(domainPrice))} SNT (
{!subDomain && - } + } {!domainName && - { + { ENSSubdomainRegistry.methods.getPrice(hash(values.domainName)) .call() - .then((res) => { setFieldValue('price', res); }); + .then((res) => { setFieldValue('price', fromWei(res)); }); }} - > - Get Price - - } - />} + > + Get Price + + } + />} {!domainPrice && - } + } price.includes('.') ? price : Number(price).toLocaleString(); diff --git a/app/components/standard/TokenPermission.js b/app/components/standard/TokenPermission.js index c03778b..664e886 100644 --- a/app/components/standard/TokenPermission.js +++ b/app/components/standard/TokenPermission.js @@ -8,10 +8,11 @@ import CircularProgress from '@material-ui/core/CircularProgress'; // We set an allowance to be "unlimited" by setting it to // it's maximum possible value -- namely, 2^256 - 1. +const { fromWei } = web3.utils; const unlimitedAllowance = new BigNumber(2).pow(256).sub(1); const getDefaultAccount = () => web3.eth.defaultAccount; -const SUPPORTED_TOKENS = ['SNT']; -const BALANCE_KEYS = { 'SNT': 'SNTBalance' }; +const SUPPORTED_TOKENS = ['SNT', 'STT']; +const BALANCE_KEYS = { 'SNT': 'SNTBalance', 'STT': 'SNTBalance' }; class TokenHandle extends PureComponent { constructor(props){ @@ -65,7 +66,7 @@ class TokenHandle extends PureComponent { checked={!!Number(approved)} name={symbol} onChange={this.toggleApproved} /> - + } {isLoading || updating && } diff --git a/app/index.html b/app/index.html index 43438ee..5cb3738 100644 --- a/app/index.html +++ b/app/index.html @@ -1,8 +1,7 @@ - Status.im - Contracts + Status.im Domain Registration -
diff --git a/config/contracts.json b/config/contracts.json index 0c7fb02..c2ad38e 100644 --- a/config/contracts.json +++ b/config/contracts.json @@ -79,8 +79,11 @@ "PublicResolver": { "address": "0x5FfC014343cd971B7eb70732021E26C35B744cc4" }, + "TestToken": { + "address": "0xc55cF4B03948D7EBc8b9E8BAD92643703811d162" + }, "ENSSubdomainRegistry": { - "address": "0x149651FF48AEDBe84ab2551D2CaA48538449CEA5" + "address": "0xb1C47B61CDaeee3fA85Fe8B93FcE6311165E6291" } } },