Skip to content

Commit ec8fd27

Browse files
authored
Merge pull request #463 from ensdomains/dev
Short name links (#427)
2 parents 1248183 + b4413cf commit ec8fd27

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"apollo-link": "^1.2.2",
1919
"apollo-link-http": "1.5.14",
2020
"apollo-link-state": "^0.4.1",
21+
"big-integer": "^1.6.44",
2122
"content-hash": "^2.4.1",
2223
"core-js": "^3.1.4",
2324
"cross-fetch": "^2.2.3",

src/components/SingleName/Name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function Name({ details: domain, name, pathname, type, refetch }) {
113113
readOnly={account === EMPTY_ADDRESS}
114114
/>
115115
) : type === 'short' && domain.owner === EMPTY_ADDRESS ? ( // check it's short and hasn't been claimed already
116-
<ShortName />
116+
<ShortName name={name} />
117117
) : (
118118
<NameDetails
119119
domain={domain}

src/components/SingleName/ShortName.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React from 'react'
22
import styled from '@emotion/styled'
33
import mq from 'mediaQuery'
44
import { ExternalButtonLink } from '../Forms/Button'
5+
import jsSHA3 from 'js-sha3'
6+
import BigInt from 'big-integer'
57

68
const ShortNameContainer = styled('div')`
79
padding: 20px;
@@ -37,14 +39,21 @@ const InnerWrapper = styled('div')`
3739
`
3840

3941
export default function ShortName({ name }) {
40-
const link = `https://opensea.io/ens-landing`
42+
const label = name.split('.')[0]
43+
const labelhash = `${jsSHA3.keccak256(label.toLowerCase())}`
44+
const bn = BigInt(labelhash, 16)
45+
const decimalLabelHash = bn.toString(10)
46+
console.log(decimalLabelHash)
47+
const link = `https://opensea.io/assets/0xFaC7BEA255a6990f749363002136aF6556b31e04/${decimalLabelHash}`
4148
return (
4249
<ShortNameContainer>
4350
<InnerWrapper>
4451
<p>
45-
Short names auctions will start soon at <a href={link}>OpenSea</a>
52+
Short names are currently on auction at <a href={link}>OpenSea</a>. 5+
53+
letter auctions end September 29, 4 letter auctions end October 6, and
54+
3 letter auctions end October 13
4655
</p>
47-
<ExternalButtonLink href={link} type="hollow-primary-disabled">
56+
<ExternalButtonLink href={link} type="hollow-primary">
4857
Bid Now
4958
</ExternalButtonLink>
5059
</InnerWrapper>

src/routes/Home.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ export default props => (
302302
</Hero>
303303
<ShortNameAuctions>
304304
<h3>
305-
The short name auctions will start soon at&nbsp;
306-
<a href="https://opensea.io/ens-landing">OpenSea</a>
305+
The short name auctions are in progress at&nbsp;
306+
<a href="https://opensea.io/ens-landing">opensea.io/ens-landing</a>
307307
</h3>
308308
</ShortNameAuctions>
309309
<Explanation>

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,6 +2724,11 @@ bcrypt-pbkdf@^1.0.0:
27242724
dependencies:
27252725
tweetnacl "^0.14.3"
27262726

2727+
big-integer@^1.6.44:
2728+
version "1.6.44"
2729+
resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.44.tgz#4ee9ae5f5839fc11ade338fea216b4513454a539"
2730+
integrity sha512-7MzElZPTyJ2fNvBkPxtFQ2fWIkVmuzw41+BZHSzpEq3ymB2MfeKp1+yXl/tS75xCx+WnyV+yb0kp+K1C3UNwmQ==
2731+
27272732
big.js@^5.2.2:
27282733
version "5.2.2"
27292734
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"

0 commit comments

Comments
 (0)