Skip to content

Commit

Permalink
Merge pull request #207 from ensdomains/dev
Browse files Browse the repository at this point in the history
Deploy to production
  • Loading branch information
jefflau authored Apr 26, 2019
2 parents 4400eb1 + d79a4f5 commit 168dac0
Show file tree
Hide file tree
Showing 21 changed files with 488 additions and 167 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"@emotion/styled": "^10.0.9",
"@ensdomains/ens": "^0.3.3",
"@ensdomains/ens-022": "npm:@ensdomains/[email protected]",
"@ensdomains/ethregistrar": "^1.1.4",
"@ensdomains/resolver": "^0.1.4",
"@ensdomains/ethregistrar": "^1.2.2",
"@ensdomains/resolver": "^0.1.6",
"apollo-cache-inmemory": "^1.2.9",
"apollo-client": "^2.4.5",
"apollo-link": "^1.2.2",
Expand All @@ -34,6 +34,7 @@
"react-add-to-calendar": "^0.1.5",
"react-apollo": "^2.1.2",
"react-dom": "16.7.0-alpha.0",
"react-ga": "^2.5.7",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "2.0.4",
Expand Down
3 changes: 3 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { NetworkError } from './components/Error/Errors'
import { CONFIRM } from './modals'

import DefaultLayout from './components/Layout/DefaultLayout'
import Analytics from './utils/analytics'

const HomePageLayout = ({ children }) => <Fragment>{children}</Fragment>

Expand All @@ -28,6 +29,7 @@ const Route = ({
layout: Layout = DefaultLayout,
...rest
}) => {
Analytics.pageview()
return (
<DefaultRoute
{...rest}
Expand All @@ -44,6 +46,7 @@ const App = () => (
<>
<Query query={GET_ERRORS}>
{({ data }) => {
Analytics.setup()
if (data.error && data.error.message) {
return <NetworkError message={data.error.message} />
} else {
Expand Down
40 changes: 35 additions & 5 deletions src/api/registrar.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,26 @@ export const transferOwner = async ({ to, name }) => {
const labelHash = web3.utils.sha3(nameArray[0])
const account = await getAccount()
const { permanentRegistrarRead: Registrar } = await getPermanentRegistrar()
return Registrar.safeTransferFrom(account, to, labelHash).send({
from: account
})
return () =>
Registrar.safeTransferFrom(account, to, labelHash).send({
from: account
})
} catch (e) {
console.log('error getting permanentRegistrar contract', e)
}
}

export const reclaim = async ({ name, address }) => {
try {
const web3 = await getWeb3()
const nameArray = name.split('.')
const labelHash = web3.utils.sha3(nameArray[0])
const account = await getAccount()
const { permanentRegistrarRead: Registrar } = await getPermanentRegistrar()
return () =>
Registrar.reclaim(labelHash, address).send({
from: account
})
} catch (e) {
console.log('error getting permanentRegistrar contract', e)
}
Expand Down Expand Up @@ -305,6 +322,19 @@ export const register = async (label, duration, secret) => {
.send({ from: account, gas: 1000000, value: price })
}

export const renew = async (label, duration) => {
const {
permanentRegistrarController
} = await getPermanentRegistrarController()
const account = await getAccount()
const price = await getRentPrice(label, duration)

return () =>
permanentRegistrarController
.renew(label, duration)
.send({ from: account, gas: 1000000, value: price })
}

export const createSealedBid = async (name, bidAmount, secret) => {
const Registrar = await getLegacyAuctionRegistrar()
const web3 = await getWeb3()
Expand Down Expand Up @@ -353,7 +383,7 @@ export const transferRegistrars = async label => {
const web3 = await getWeb3()
const hash = web3.utils.sha3(label)
const tx = ethRegistrar.transferRegistrars(hash)
const gas = await tx.estimateGas({from:account})
const gas = await tx.estimateGas({ from: account })
return () =>
tx.send({
from: account,
Expand All @@ -367,7 +397,7 @@ export const releaseDeed = async label => {
const web3 = await getWeb3()
const hash = web3.utils.sha3(label)
const tx = ethRegistrar.releaseDeed(hash)
const gas = await tx.estimateGas({from:account})
const gas = await tx.estimateGas({ from: account })
return () =>
tx.send({
from: account,
Expand Down
14 changes: 12 additions & 2 deletions src/api/registrar/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import {
commit,
getMinimumCommitmentAge,
register,
renew,
transferRegistrars,
releaseDeed,
transferOwner
transferOwner,
reclaim
} from '../registrar'
import { getOwner } from '../registry'
import modeNames from '../modes'
Expand Down Expand Up @@ -46,6 +48,14 @@ const resolvers = {

return sendHelper(tx)
},
async reclaim(_, { name, address }) {
const tx = await reclaim({ name, address })
return sendHelper(tx)
},
async renew(_, { label, duration }) {
const tx = await renew(label, duration)
return sendHelper(tx)
},
async getDomainAvailability(_, { name }, { cache }) {
try {
const {
Expand Down Expand Up @@ -89,7 +99,7 @@ const resolvers = {
}
},
async setRegistrant(_, { name, address }) {
const tx = transferOwner({ name, to: address })
const tx = await transferOwner({ name, to: address })
return sendHelper(tx)
},
async transferRegistrars(_, { label }) {
Expand Down
12 changes: 8 additions & 4 deletions src/components/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,25 @@ const ModalContainer = styled('div')`
top: 0;
width: 100%;
height: 100%;
padding: 20px;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
z-index: 99999999;
background: rgba(0, 0, 0, 0.5);
${mq.small`
padding: 20px;
`};
`

const ModalContent = styled('div')`
background: white;
padding: 40px;
padding: 20px;
overflow-y: scroll;
height: auto%;
min-width: 850px;
height: auto;
${mq.medium`
padding: 40px;
width: 70%;
`};
Expand Down
3 changes: 2 additions & 1 deletion src/components/SingleName/AddRecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ const Select = styled(DefaultSelect)`

const RecordsTitle = styled('h3')`
/* Pointers: */
font-family: Overpass-Bold;
font-family: Overpass;
font-weight: 700;
font-size: 12px;
color: #adbbcd;
letter-spacing: 0.5px;
Expand Down
78 changes: 58 additions & 20 deletions src/components/SingleName/Confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,37 @@ import React from 'react'
import styled from '@emotion/styled'
import Button from '../Forms/Button'
import warning from '../../assets/warning.svg'
import write from '../../assets/Write.svg'
import write from '../../assets/Write.svg'

import mq from 'mediaQuery'

const ConfirmContainer = styled('div')`
&:before {
display: none;
background: url(${write});
content: '';
height: 43px;
width: 42px;
float: right;
${mq.large`
display: block;
flex-direction: row;
`}
}
`
const Content = styled('div')`
display: flex;
justify-content: space-between;
flex-direction: column;
`

const Title = styled('h3')`
margin:0 0 0 1.5em;
margin: 0 0 0 1.5em;
font-size: 16px;
font-weight: 300;
${mq.small`
font-size: 22px;
`}
&:before {
background: url(${warning});
content: '';
Expand All @@ -32,15 +45,18 @@ const Title = styled('h3')`
`

const SubTitle = styled('p')`
margin:0;
margin-bottom:1em;
margin: 0;
margin-bottom: 1em;
font-size: 12px;
${mq.small`
font-size: 14px;
`}
`

const Values = styled('ul')`
list-style-type: none;
width:30em;
padding: 4px 0;
margin:0;
margin: 0;
display: flex;
flex-direction: column;
justify-content: space-between;
Expand All @@ -53,11 +69,21 @@ const Value = styled('li')`
display: flex;
justify-content: space-between;
color: ${({ old }) => (old ? 'grey' : 'black')};
margin-bottom: 10px;
${mq.large`
justify-content: flex-start;
`}
span:first-child {
width: 75px;
}
`

const Buttons = styled('div')`
height:100%;
margin-top:1em;
height: 100%;
margin-top: 1em;
display: flex;
`

const Action = styled(Button)``
Expand All @@ -79,24 +105,36 @@ const Confirm = ({
<Title>Are you sure you want to do this?</Title>
<SubTitle>This action will modify the state of the blockchain.</SubTitle>
<Content>
{explanation ? (<p>{explanation}</p>): ''}
{explanation ? <p>{explanation}</p> : ''}
{value || newValue ? (
<Values>
<Value old={true} ><span>PREVIOUS</span><span>{value}</span></Value>
<Value><span>FUTURE</span><span>{newValue}</span></Value>
</Values>
): ''}
<Values>
<Value old={true}>
<span>PREVIOUS</span>
<span>{value}</span>
</Value>
<Value>
<span>FUTURE</span>
<span>{newValue}</span>
</Value>
</Values>
) : (
''
)}
<Buttons>
<Cancel type="hollow" onClick={cancel}>
Cancel
Cancel
</Cancel>
{disabled ? (
<Action type="disabled">Confirm</Action>
<Action type="disabled">Confirm</Action>
) : (
<Action onClick={()=>{
mutation()
cancel()
}}>Confirm</Action>
<Action
onClick={() => {
mutation()
cancel()
}}
>
Confirm
</Action>
)}
</Buttons>
</Content>
Expand Down
Loading

0 comments on commit 168dac0

Please sign in to comment.