Skip to content

Commit

Permalink
Merge pull request #1065 from ensdomains/dev
Browse files Browse the repository at this point in the history
Deploy live
  • Loading branch information
makoto authored Jan 28, 2021
2 parents 688c4e1 + 04c82e8 commit 0d0caac
Show file tree
Hide file tree
Showing 20 changed files with 293 additions and 49 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"@portis/web3": "^2.0.0-beta.59",
"@toruslabs/torus-embed": "^1.8.6",
"@walletconnect/web3-provider": "^1.3.1",
"@ensdomains/address-encoder": "^0.2.5",
"@ensdomains/address-encoder": "^0.2.6",
"@ensdomains/mock": "^2.0.34",
"@ensdomains/react-ens-address": "^0.0.27",
"@ensdomains/ui": "^3.0.57",
"@ensdomains/ui": "^3.0.58",
"apollo-cache-inmemory": "^1.2.9",
"apollo-client": "^2.4.5",
"apollo-link": "^1.2.2",
Expand Down
4 changes: 4 additions & 0 deletions public/locales/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,11 @@
"text": "等待交易被打包"
},
"pricer": {
"gasDescription": "Estimated Gas Price (Step 1 + Step 3). The gas price will flucuate.",
"pricePerAmount": "当前选定时长的注册价格",
"registrationPeriodLabel": "注册期",
"registrationPriceLabel": "Registration price to pay",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiSlow}}-{{gasPriceToGweiFast}} Gwei.",
"totalPriceLabel": "支付总额",
"yearUnit": "年份"
},
Expand Down Expand Up @@ -189,6 +192,7 @@
"step1": {
"label": "第 1 步",
"text": "需要在钱包中确认一笔交易,这是完成域名注册所需的两笔交易中的第一笔。",
"text2": "If the second transaction is not processed within 24 hours of the first, you will need to start again from step 1.",
"title": "请求注册"
},
"step2": {
Expand Down
4 changes: 4 additions & 0 deletions public/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@
"text": "Tx ausstehend"
},
"pricer": {
"gasDescription": "Estimated Gas Price (Step 1 + Step 3). The gas price will flucuate.",
"pricePerAmount": "Price per amount of time selected",
"registrationPeriodLabel": "Registration Period",
"registrationPriceLabel": "Registration price to pay",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiSlow}}-{{gasPriceToGweiFast}} Gwei.",
"totalPriceLabel": "Gesamtpreis",
"yearUnit": "Jahr"
},
Expand Down Expand Up @@ -193,6 +196,7 @@
"step1": {
"label": "Schritt 1",
"text": "Ihr Wallet wird sich öffnen und Sie werden gebeten, die erste von zwei für die Registrierung erforderlichen Transaktionen zu bestätigen.",
"text2": "If the second transaction is not processed within 24 hours of the first, you will need to start again from step 1.",
"title": "Anfrage zur Registrierung"
},
"step2": {
Expand Down
4 changes: 4 additions & 0 deletions public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@
"text": "Tx Pending"
},
"pricer": {
"gasDescription": "Estimated Gas Price (Step 1 + Step 3). The gas price will flucuate.",
"pricePerAmount": "Price per amount of time selected",
"registrationPeriodLabel": "Registration Period",
"registrationPriceLabel": "Registration price to pay",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiSlow}}-{{gasPriceToGweiFast}} Gwei.",
"totalPriceLabel": "Total price to pay",
"yearUnit": "year"
},
Expand Down Expand Up @@ -193,6 +196,7 @@
"step1": {
"label": "Step 1",
"text": "Your wallet will open and you will be asked to confirm the first of two transactions required for registration.",
"text2": "If the second transaction is not processed within 24 hours of the first, you will need to start again from step 1.",
"title": "Request to register"
},
"step2": {
Expand Down
4 changes: 4 additions & 0 deletions public/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@
"text": "Tx Pendiente"
},
"pricer": {
"gasDescription": "Estimated Gas Price (Step 1 + Step 3). The gas price will flucuate.",
"pricePerAmount": "Price per amount of time selected",
"registrationPeriodLabel": "Periodo de registración",
"registrationPriceLabel": "Registration price to pay",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiSlow}}-{{gasPriceToGweiFast}} Gwei.",
"totalPriceLabel": "Precio total a pagar",
"yearUnit": "año"
},
Expand Down Expand Up @@ -193,6 +196,7 @@
"step1": {
"label": "Paso 1",
"text": "Tu cartera se abrirá y se te pedirá que confirmes la primera de las dos transacciones necesarias para el registro",
"text2": "If the second transaction is not processed within 24 hours of the first, you will need to start again from step 1.",
"title": "Solicitud de registro"
},
"step2": {
Expand Down
4 changes: 4 additions & 0 deletions public/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@
"text": "Transaction en attente"
},
"pricer": {
"gasDescription": "Estimated Gas Price (Step 1 + Step 3). The gas price will flucuate.",
"pricePerAmount": "Price per amount of time selected",
"registrationPeriodLabel": "Période d'enregistrement",
"registrationPriceLabel": "Registration price to pay",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiSlow}}-{{gasPriceToGweiFast}} Gwei.",
"totalPriceLabel": "Prix ​​total à payer",
"yearUnit": "année"
},
Expand Down Expand Up @@ -193,6 +196,7 @@
"step1": {
"label": "Étape 1",
"text": "Votre portefeuille s'ouvrira et il vous sera demandé de confirmer la première des deux transactions requises pour l'inscription.",
"text2": "If the second transaction is not processed within 24 hours of the first, you will need to start again from step 1.",
"title": "Demande d'enregistrement"
},
"step2": {
Expand Down
4 changes: 4 additions & 0 deletions public/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@
"text": "保留中のTx"
},
"pricer": {
"gasDescription": "Estimated Gas Price (Step 1 + Step 3). The gas price will flucuate.",
"pricePerAmount": "Price per amount of time selected",
"registrationPeriodLabel": "登録期間",
"registrationPriceLabel": "Registration price to pay",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiSlow}}-{{gasPriceToGweiFast}} Gwei.",
"totalPriceLabel": "お支払合計額",
"yearUnit": ""
},
Expand Down Expand Up @@ -191,6 +194,7 @@
"step1": {
"label": "ステップ1",
"text": "ウォレットが開き、登録に必要な2つのトランザクションのうち最初のトランザクションの確認を求められます。",
"text2": "If the second transaction is not processed within 24 hours of the first, you will need to start again from step 1.",
"title": "登録のリクエスト"
},
"step2": {
Expand Down
4 changes: 4 additions & 0 deletions public/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@
"text": "트랜잭션 보류"
},
"pricer": {
"gasDescription": "Estimated Gas Price (Step 1 + Step 3). The gas price will flucuate.",
"pricePerAmount": "Price per amount of time selected",
"registrationPeriodLabel": "등록 기간",
"registrationPriceLabel": "Registration price to pay",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiSlow}}-{{gasPriceToGweiFast}} Gwei.",
"totalPriceLabel": "결제할 총 금액",
"yearUnit": ""
},
Expand Down Expand Up @@ -191,6 +194,7 @@
"step1": {
"label": "단계 1",
"text": "지갑 화면이 열리고 등록에 필요한 두 개의 트랜잭션 중 첫번째 트랜잭션에 대한 컨펌 요청이 있을 것입니다.",
"text2": "If the second transaction is not processed within 24 hours of the first, you will need to start again from step 1.",
"title": "등록 요청"
},
"step2": {
Expand Down
4 changes: 4 additions & 0 deletions public/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,11 @@
"text": "Oczekujący Tx"
},
"pricer": {
"gasDescription": "Estimated Gas Price (Step 1 + Step 3). The gas price will flucuate.",
"pricePerAmount": "Price per amount of time selected",
"registrationPeriodLabel": "Czas rejestracji",
"registrationPriceLabel": "Registration price to pay",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiSlow}}-{{gasPriceToGweiFast}} Gwei.",
"totalPriceLabel": "Łączna kwota do zapłaty",
"yearUnit": "rok"
},
Expand Down Expand Up @@ -195,6 +198,7 @@
"step1": {
"label": "Krok 1",
"text": "Twój portfel zostanie otwarty i będziesz poproszony o potwierdzenie dwóch transakcji wymaganych do rejestracji",
"text2": "If the second transaction is not processed within 24 hours of the first, you will need to start again from step 1.",
"title": "Wniosek o rejestrację"
},
"step2": {
Expand Down
4 changes: 4 additions & 0 deletions public/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,11 @@
"text": "TX в ожидании"
},
"pricer": {
"gasDescription": "Estimated Gas Price (Step 1 + Step 3). The gas price will flucuate.",
"pricePerAmount": "Price per amount of time selected",
"registrationPeriodLabel": "Срок регистрации",
"registrationPriceLabel": "Registration price to pay",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiSlow}}-{{gasPriceToGweiFast}} Gwei.",
"totalPriceLabel": "Общие сумма к оплате",
"yearUnit": "год"
},
Expand Down Expand Up @@ -195,6 +198,7 @@
"step1": {
"label": "Шаг 1",
"text": "Ваш кошелёк откроется и вас попросят подтвердить первые две транзакции, необходимые для регистрации.",
"text2": "If the second transaction is not processed within 24 hours of the first, you will need to start again from step 1.",
"title": "Запрос на регистрацию"
},
"step2": {
Expand Down
4 changes: 4 additions & 0 deletions public/locales/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@
"text": "Đang xử lý giao dịch"
},
"pricer": {
"gasDescription": "Estimated Gas Price (Step 1 + Step 3). The gas price will flucuate.",
"pricePerAmount": "Price per amount of time selected",
"registrationPeriodLabel": "Thời gian đăng ký",
"registrationPriceLabel": "Registration price to pay",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiSlow}}-{{gasPriceToGweiFast}} Gwei.",
"totalPriceLabel": "Tổng giá thanh toán",
"yearUnit": "Năm"
},
Expand Down Expand Up @@ -191,6 +194,7 @@
"step1": {
"label": "Bước 1",
"text": "Ví của bạn sẽ mở và bạn sẽ được yêu cầu xác nhận 2 giao dịch bắt buộc để đăng ký",
"text2": "If the second transaction is not processed within 24 hours of the first, you will need to start again from step 1.",
"title": "Yêu cầu đăng ký"
},
"step2": {
Expand Down
10 changes: 2 additions & 8 deletions src/components/Links/ContentHashLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react'
import styled from '@emotion/styled/macro'
import { ReactComponent as ExternalLinkIcon } from '../Icons/externalLink.svg'
import { decodeContenthash, encodeContenthash } from '@ensdomains/ui'
import useNetworkInfo from '../NetworkInformation/useNetworkInfo'

const ContentHashLinkContainer = styled('a')`
display: inline-block;
Expand All @@ -29,7 +28,6 @@ const DecodedError = styled('div')`
`

const ContentHashLink = ({ value, contentType, domain }) => {
const { networkId } = useNetworkInfo()
if (contentType === 'oldcontent') {
return <div>{value}</div>
}
Expand All @@ -40,15 +38,11 @@ const ContentHashLink = ({ value, contentType, domain }) => {
if (error) {
return <DecodedError>{error}</DecodedError>
}
const ethUrl =
!!domain.name.match('.eth$') && networkId === 1
? `https://${domain.name}.link`
: null
if (protocolType === 'ipfs') {
externalLink = ethUrl || `https://dweb.link/ipfs/${decoded}` // using ipfs's secured origin gateway
externalLink = `https://dweb.link/ipfs/${decoded}` // using ipfs's secured origin gateway
url = `ipfs://${decoded}`
} else if (protocolType === 'ipns') {
externalLink = ethUrl || `https://dweb.link/ipns/${decoded}`
externalLink = `https://dweb.link/ipns/${decoded}`
url = `ipns://${decoded}`
} else if (protocolType === 'bzz') {
externalLink = `https://swarm-gateways.net/bzz://${decoded}`
Expand Down
97 changes: 97 additions & 0 deletions src/components/SingleName/NameRegister/EthRegistrationGasPrice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import React, { useState } from 'react'
import styled from '@emotion/styled/macro'
import { useTranslation, Trans } from 'react-i18next'
import mq from 'mediaQuery'
import EthVal from 'ethval'
import DefaultInput from '../../Forms/Input'
const GWEI = 1000000000
const COMMIT_GAS_WEI = 42000
const REGISTER_GAS_WEI = 240000
const TOGAL_GAS_WEI = COMMIT_GAS_WEI + REGISTER_GAS_WEI

const PriceContainer = styled('div')`
width: 100%;
${mq.medium`
width: auto
`}
margin:5px 0;
`

const Value = styled('div')`
font-family: Overpass;
font-weight: 100;
font-size: 22px;
color: #2b2b2b;
border-bottom: 1px solid #dbdbdb;
${mq.small`
font-size: 28px;
`}
`

const TotalValue = styled(Value)`
font-weight: 300;
`

const Description = styled('div')`
font-family: Overpass;
font-weight: 300;
font-size: 14px;
color: #adbbcd;
margin-top: 10px;
`

const USD = styled('span')`
font-size: 22px;
color: #adbbcd;
margin-left: 20px;
${mq.small`
font-size: 28px;
`}
`

const Input = styled(DefaultInput)`
display: inline-block;
width: 4em;
margin: 5px 0;
`

const EthRegistrationGasPrice = ({ price, ethUsdPrice, gasPrice }) => {
const { t } = useTranslation()
const ethVal = new EthVal(`${price}`).toEth()
const registerGasSlow = new EthVal(`${TOGAL_GAS_WEI * gasPrice.slow}`).toEth()
const registerGasFast = new EthVal(`${TOGAL_GAS_WEI * gasPrice.fast}`).toEth()
const gasPriceToGweiSlow = new EthVal(`${gasPrice.slow}`).toGwei()
const gasPriceToGweiFast = new EthVal(`${gasPrice.fast}`).toGwei()
const totalSlow = ethVal.add(registerGasSlow)
const totalFast = ethVal.add(registerGasFast)
let totalInUsdSlow, totalInUsdFast
// No price oracle on Goerli
if (ethUsdPrice) {
totalInUsdSlow = totalSlow.mul(ethUsdPrice)
totalInUsdFast = totalFast.mul(ethUsdPrice)
}
return (
<PriceContainer>
<TotalValue>
{ethVal.toFixed(3)} ETH + {registerGasSlow.toFixed(3)}-
{registerGasFast.toFixed(3)} ETH = {totalSlow.toFixed(3)}-
{totalFast.toFixed(3)} ETH
{ethVal && ethUsdPrice && (
<USD>
{' '}
${totalInUsdSlow.toFixed(2)}-${totalInUsdFast.toFixed(2)}
USD
</USD>
)}
</TotalValue>
<Description>
{t('pricer.totalDescription', {
gasPriceToGweiSlow: gasPriceToGweiSlow.toFixed(0),
gasPriceToGweiFast: gasPriceToGweiFast.toFixed(0)
})}
</Description>
</PriceContainer>
)
}

export default EthRegistrationGasPrice
2 changes: 1 addition & 1 deletion src/components/SingleName/NameRegister/Explainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const Explainer = ({ step, waitPercentComplete, waitTime }) => {
step === 'PRICE_DECISION' ? 0 : step === 'COMMIT_SENT' ? 50 : 100
}
title={t('register.step1.title')}
text={t('register.step1.text')}
text={t('register.step1.text') + ' ' + t('register.step1.text2')}
/>
<Step
number={2}
Expand Down
12 changes: 10 additions & 2 deletions src/components/SingleName/NameRegister/NameRegister.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ import {
WAIT_BLOCK_TIMESTAMP,
GET_BALANCE
} from 'graphql/queries'
import { useInterval, useEthPrice, useBlock } from 'components/hooks'
import {
useInterval,
useEthPrice,
useGasPrice,
useBlock
} from 'components/hooks'
import { useAccount } from '../../QueryAccount'
import { registerMachine, registerReducer } from './registerReducer'
import { sendNotification } from './notification'
Expand Down Expand Up @@ -69,6 +74,7 @@ const NameRegister = ({
false
)
const { loading: ethUsdPriceLoading, price: ethUsdPrice } = useEthPrice()
const { loading: gasPriceLoading, price: gasPrice } = useGasPrice()
const { block } = useBlock()
const [invalid, setInvalid] = useState(false)
const { data: { waitBlockTimestamp } = {} } = useQuery(WAIT_BLOCK_TIMESTAMP, {
Expand Down Expand Up @@ -189,7 +195,7 @@ const NameRegister = ({
const diff = zeroPremiumDate.diff(releasedDate)
const rate = 2000 / diff
if (!registrationOpen) return <NotAvailable domain={domain} />
if (ethUsdPriceLoading) return <></>
if (ethUsdPriceLoading || gasPriceLoading) return <></>

const getTargetAmountByDate = date => {
return zeroPremiumDate.diff(date) * rate
Expand Down Expand Up @@ -245,9 +251,11 @@ const NameRegister = ({
ethUsdPriceLoading={ethUsdPriceLoading}
ethUsdPremiumPrice={currentPremium}
ethUsdPrice={ethUsdPrice}
gasPrice={gasPrice}
loading={rentPriceLoading}
price={getRentPrice}
underPremium={underPremium}
displayGas={true}
/>
)}
{showPremiumWarning ? (
Expand Down
Loading

0 comments on commit 0d0caac

Please sign in to comment.