Skip to content

Commit

Permalink
Merge pull request #463 from ensdomains/dev
Browse files Browse the repository at this point in the history
Short name links (#427)
  • Loading branch information
jefflau authored Sep 1, 2019
2 parents 1248183 + b4413cf commit ec8fd27
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"apollo-link": "^1.2.2",
"apollo-link-http": "1.5.14",
"apollo-link-state": "^0.4.1",
"big-integer": "^1.6.44",
"content-hash": "^2.4.1",
"core-js": "^3.1.4",
"cross-fetch": "^2.2.3",
Expand Down
2 changes: 1 addition & 1 deletion src/components/SingleName/Name.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function Name({ details: domain, name, pathname, type, refetch }) {
readOnly={account === EMPTY_ADDRESS}
/>
) : type === 'short' && domain.owner === EMPTY_ADDRESS ? ( // check it's short and hasn't been claimed already
<ShortName />
<ShortName name={name} />
) : (
<NameDetails
domain={domain}
Expand Down
15 changes: 12 additions & 3 deletions src/components/SingleName/ShortName.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from 'react'
import styled from '@emotion/styled'
import mq from 'mediaQuery'
import { ExternalButtonLink } from '../Forms/Button'
import jsSHA3 from 'js-sha3'
import BigInt from 'big-integer'

const ShortNameContainer = styled('div')`
padding: 20px;
Expand Down Expand Up @@ -37,14 +39,21 @@ const InnerWrapper = styled('div')`
`

export default function ShortName({ name }) {
const link = `https://opensea.io/ens-landing`
const label = name.split('.')[0]
const labelhash = `${jsSHA3.keccak256(label.toLowerCase())}`
const bn = BigInt(labelhash, 16)
const decimalLabelHash = bn.toString(10)
console.log(decimalLabelHash)
const link = `https://opensea.io/assets/0xFaC7BEA255a6990f749363002136aF6556b31e04/${decimalLabelHash}`
return (
<ShortNameContainer>
<InnerWrapper>
<p>
Short names auctions will start soon at <a href={link}>OpenSea</a>
Short names are currently on auction at <a href={link}>OpenSea</a>. 5+
letter auctions end September 29, 4 letter auctions end October 6, and
3 letter auctions end October 13
</p>
<ExternalButtonLink href={link} type="hollow-primary-disabled">
<ExternalButtonLink href={link} type="hollow-primary">
Bid Now
</ExternalButtonLink>
</InnerWrapper>
Expand Down
4 changes: 2 additions & 2 deletions src/routes/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ export default props => (
</Hero>
<ShortNameAuctions>
<h3>
The short name auctions will start soon at&nbsp;
<a href="https://opensea.io/ens-landing">OpenSea</a>
The short name auctions are in progress at&nbsp;
<a href="https://opensea.io/ens-landing">opensea.io/ens-landing</a>
</h3>
</ShortNameAuctions>
<Explanation>
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2724,6 +2724,11 @@ bcrypt-pbkdf@^1.0.0:
dependencies:
tweetnacl "^0.14.3"

big-integer@^1.6.44:
version "1.6.44"
resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.44.tgz#4ee9ae5f5839fc11ade338fea216b4513454a539"
integrity sha512-7MzElZPTyJ2fNvBkPxtFQ2fWIkVmuzw41+BZHSzpEq3ymB2MfeKp1+yXl/tS75xCx+WnyV+yb0kp+K1C3UNwmQ==

big.js@^5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
Expand Down

0 comments on commit ec8fd27

Please sign in to comment.