From 10500ac1711d6c6f07a4a5b2f879683d0496b12a Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Tue, 19 Jun 2018 10:12:49 -0400 Subject: [PATCH] add expiration time for given domain --- app/components/ens/nameLookup.js | 12 ++++++++---- contracts/registry/ENSSubdomainRegistry.sol | 10 +++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/components/ens/nameLookup.js b/app/components/ens/nameLookup.js index b13da8c..21df468 100644 --- a/app/components/ens/nameLookup.js +++ b/app/components/ens/nameLookup.js @@ -12,7 +12,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'; -const { getPrice } = ENSSubdomainRegistry.methods; +const { getPrice, getExpirationTime } = ENSSubdomainRegistry.methods; const invalidSuffix = '0000000000000000000000000000000000000000' const nullAddress = '0x0000000000000000000000000000000000000000' @@ -41,18 +41,20 @@ const backButton = { cursor: 'pointer' } +const generatePrettyDate = (timestamp) => new Date(timestamp * 1000).toDateString(); + class RenderAddresses extends PureComponent { state = { copied: false } render() { - const { domainName, address, statusAccount } = this.props + const { domainName, address, statusAccount, expirationTime } = this.props const { copied } = this.state const markCopied = (v) => { this.setState({ copied: v }) } const isCopied = address => address == copied; const renderCopied = address => isCopied(address) && Copied!; return (
- {formatName(domainName).toUpperCase()} Resolves To: + {formatName(domainName).toUpperCase()}{expirationTime && (Expires {generatePrettyDate(expirationTime)})} Resolves To: {address && Ethereum Address {renderCopied(address)}}
{address}
@@ -163,6 +165,7 @@ const InnerForm = ({ domainName={values.domainName} address={status.address} statusAccount={status.statusAccount} + expirationTime={status.expirationTime} setStatus={setStatus} /> :