Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to live #1076

Merged
merged 6 commits into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions cypress/integration/nameDetail.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,19 @@ describe('Name detail view', () => {
])
})

it('cannot change deprecated ipns contenthash', () => {
const url = `${NAME_ROOT}/abittooawesome4.eth`
cy.visit(url)
const DEPRECATED_CONTENT_HASH = 'ipns://app.uniswap.org'
cy.queryByText(DEPRECATED_CONTENT_HASH, { timeout: 10000 }).should('exist')

cy.getByTestId('name-details', { timeout: 10000 }).within(container => {
cy.getByText('Add/Edit Record').click({ force: true })
cy.wait(2000)
cy.queryByTestId('content-record-input-invalid')
})
})

it('can delete records', () => {
cy.visit(`${NAME_ROOT}/notsoawesome.eth`)
cy.getByTestId('name-details').within(container => {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"@toruslabs/torus-embed": "^1.8.6",
"@walletconnect/web3-provider": "^1.3.1",
"@ensdomains/address-encoder": "^0.2.6",
"@ensdomains/mock": "^2.0.34",
"@ensdomains/mock": "^2.0.36",
"@ensdomains/react-ens-address": "^0.0.27",
"@ensdomains/ui": "^3.0.58",
"@ensdomains/ui": "^3.0.62",
"apollo-cache-inmemory": "^1.2.9",
"apollo-client": "^2.4.5",
"apollo-link": "^1.2.2",
Expand Down
22 changes: 11 additions & 11 deletions public/locales/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
"warning": "警告"
},
"certificate": {
"button": "Request SSL certificate",
"warning": "SSL certificate for {{ name }}.link is not created yet"
"button": "请求 SSL 证书",
"warning": "{{ name }}.link 的 SSL 证书还没有创建"
},
"childDomainItem": {
"notmigrated": "暂未迁移"
Expand Down Expand Up @@ -127,7 +127,7 @@
"title": "如何使用 ENS"
},
"whatisens": {
"body": "以太坊名称服务(Ethereum Name Service)是一个基于以太坊区块链的分布式、开放和可扩展的命名系统。ENS 域名让人们不用再复制或输入冗长的区块链地址。通俗地说,ENS 就是区块链中的域名系统。",
"body": "以太坊名称服务(Ethereum Name Service)是一个基于以太坊区块链的分布式、开放和可扩展的域名系统。ENS 域名让人们不用再复制或输入冗长的区块链地址。通俗地说,ENS 就是区块链中的域名系统。",
"title": "ENS 是什么"
}
},
Expand Down Expand Up @@ -159,11 +159,11 @@
"text": "等待交易被打包"
},
"pricer": {
"gasDescription": "Estimated Gas Price (Step 1 + Step 3). The gas price will flucuate.",
"gasDescription": "预估的 Gas 价格(第 1 步 + 第 3 步)。Gas 价格存在波动。",
"pricePerAmount": "当前选定时长的注册价格",
"registrationPeriodLabel": "注册期",
"registrationPriceLabel": "Registration price to pay",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiSlow}}-{{gasPriceToGweiFast}} Gwei.",
"registrationPriceLabel": "注册费用",
"totalDescription": "预估的总费用(注册费 + Gas)。The gas price is based at {{gasPriceToGweiFast}} Gwei",
"totalPriceLabel": "支付总额",
"yearUnit": "年份"
},
Expand All @@ -173,7 +173,7 @@
"manage": "管理域名",
"register": "注册",
"request": "请求注册",
"warning": "点击“注册”进入第三步"
"warning": "点击“注册”进入第 3 步"
},
"favourite": "* 您可以收藏喜欢的域名,以便于浏览器关闭以后重新查看这个域名。",
"notifications": {
Expand All @@ -192,7 +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.",
"text2": "如果第 1 步完成之后的 24 小时内没有进行第 2 步,则需要从第 1 步重新开始。",
"title": "请求注册"
},
"step2": {
Expand All @@ -206,7 +206,7 @@
"title": "完成注册"
},
"titles": [
"注册一个域名需要三个步骤",
"注册一个域名需要 3 个步骤",
"您很快就可以完成域名注册",
"您已经完成域名注册,现在可以管理域名了!"
]
Expand Down Expand Up @@ -316,9 +316,9 @@
"closeEdit": "关闭 添加/编辑 记录",
"messages": {
"explanation": "反向解析将地址转换为域名。它能让 dapp 在其界面上显示 “{{name}}”,而不是 “{{account}}” 这个冗长的地址。如果您想为另一个账户设置反向解析,请先在 dapp 浏览器中切换帐户。",
"explanation2": "You can only select names you set this Ethereum Address as.",
"explanation2": "您只能选择已经解析至这个以太坊地址的域名。",
"notSet": "反向记录:未设置",
"selectPlaceholder": "Select your ENS name",
"selectPlaceholder": "选择您的 ENS 域名",
"setTo": "反向记录:解析至 ",
"setToDifferent": "反向记录:已解析至另一个域名:"
},
Expand Down
2 changes: 1 addition & 1 deletion public/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"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.",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiFast}} Gwei",
"totalPriceLabel": "Gesamtpreis",
"yearUnit": "Jahr"
},
Expand Down
2 changes: 1 addition & 1 deletion public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"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.",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiFast}} Gwei",
"totalPriceLabel": "Total price to pay",
"yearUnit": "year"
},
Expand Down
2 changes: 1 addition & 1 deletion public/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"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.",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiFast}} Gwei",
"totalPriceLabel": "Precio total a pagar",
"yearUnit": "año"
},
Expand Down
2 changes: 1 addition & 1 deletion public/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"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.",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiFast}} Gwei",
"totalPriceLabel": "Prix ​​total à payer",
"yearUnit": "année"
},
Expand Down
2 changes: 1 addition & 1 deletion public/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
"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.",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiFast}} Gwei",
"totalPriceLabel": "お支払合計額",
"yearUnit": "年"
},
Expand Down
2 changes: 1 addition & 1 deletion public/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
"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.",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiFast}} Gwei",
"totalPriceLabel": "결제할 총 금액",
"yearUnit": "년"
},
Expand Down
2 changes: 1 addition & 1 deletion public/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"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.",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiFast}} Gwei",
"totalPriceLabel": "Łączna kwota do zapłaty",
"yearUnit": "rok"
},
Expand Down
2 changes: 1 addition & 1 deletion public/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"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.",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiFast}} Gwei",
"totalPriceLabel": "Общие сумма к оплате",
"yearUnit": "год"
},
Expand Down
2 changes: 1 addition & 1 deletion public/locales/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
"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.",
"totalDescription": "Estimated Total (Price + Gas). The gas price is based at {{gasPriceToGweiFast}} Gwei",
"totalPriceLabel": "Tổng giá thanh toán",
"yearUnit": "Năm"
},
Expand Down
5 changes: 3 additions & 2 deletions src/api/manager/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ const resolvers = {
records.content === ''
? emptyAddress
: records.content
? encodeContenthash(records.content)
? encodeContenthash(records.content)?.encoded
: undefined,
records.textRecords,
records.coins
Expand Down Expand Up @@ -807,7 +807,8 @@ const resolvers = {
provider
})
const content = await resolverInstanceWithoutSigner.content(namehash)
return encodeContenthash('bzz://' + content)
const { encoded } = encodeContenthash('bzz://' + content)
return encoded
}

async function getContenthash(name) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Forms/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ const styles = {
// : null,
backgroundColor: 'white',
textTransform: 'uppercase',
fontWeight: '700',
fontWeight: isSelected ? 700 : 500,
fontSize: '12px',
letterSpacing: '0.5px',
color: isDisabled ? '#ccc' : isSelected ? 'black' : '#ccc',
color: isDisabled ? '#ccc' : isSelected ? 'black' : '#666',
cursor: isDisabled ? 'not-allowed' : 'default'
}
},
Expand Down
19 changes: 6 additions & 13 deletions src/components/Links/ContentHashLink.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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 { getProtocolType } from '@ensdomains/ui'

const ContentHashLinkContainer = styled('a')`
display: inline-block;
Expand All @@ -22,22 +22,12 @@ const ContentHashLinkContainer = styled('a')`
}
`

const DecodedError = styled('div')`
white-space: normal;
overflow: scroll;
`

const ContentHashLink = ({ value, contentType, domain }) => {
if (contentType === 'oldcontent') {
if (contentType === 'oldcontent' || !value) {
return <div>{value}</div>
}

const encoded = encodeContenthash(value)
const { protocolType, decoded, error } = decodeContenthash(encoded)
const { protocolType, decoded } = getProtocolType(value)
let externalLink, url
if (error) {
return <DecodedError>{error}</DecodedError>
}
if (protocolType === 'ipfs') {
externalLink = `https://dweb.link/ipfs/${decoded}` // using ipfs's secured origin gateway
url = `ipfs://${decoded}`
Expand All @@ -50,6 +40,9 @@ const ContentHashLink = ({ value, contentType, domain }) => {
} else if (protocolType === 'onion' || protocolType === 'onion3') {
externalLink = `http://${decoded}.onion`
url = `onion://${decoded}`
} else if (protocolType === 'sia') {
externalLink = `https://siasky.net/${decoded}`
url = `sia://${decoded}`
} else {
console.warn(`Unsupported protocol ${protocolType}`)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,12 @@ const EthRegistrationGasPrice = ({ price, ethUsdPrice, gasPrice }) => {
return (
<PriceContainer>
<TotalValue>
{ethVal.toFixed(3)} ETH + {registerGasSlow.toFixed(3)}-
{registerGasFast.toFixed(3)} ETH = {totalSlow.toFixed(3)}-
{totalFast.toFixed(3)} ETH
{ethVal.toFixed(3)} ETH + at least {registerGasFast.toFixed(3)} ETH gas
fee = at least {totalFast.toFixed(3)} ETH
{ethVal && ethUsdPrice && (
<USD>
{' '}
${totalInUsdSlow.toFixed(2)}-${totalInUsdFast.toFixed(2)}
${totalInUsdFast.toFixed(2)}
USD
</USD>
)}
Expand Down
23 changes: 15 additions & 8 deletions src/components/SingleName/ResolverAndRecords/AddRecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,19 @@ const AddRecordButton = styled('div')`
justify-content: flex-end;
`

const textRecordOptions = TEXT_RECORD_KEYS.slice()
.sort()
.map(key => ({
label: key,
value: key
}))
const coinOptions = COIN_LIST.slice()
.sort()
.map(key => ({
label: key,
value: key
}))

function TextRecordInput({
selectedRecord,
updateValue,
Expand All @@ -141,10 +154,7 @@ function TextRecordInput({
handleChange={setSelectedKey}
placeholder="Key"
addNewKey={true}
options={TEXT_RECORD_KEYS.map(key => ({
label: key,
value: key
}))}
options={textRecordOptions}
/>
<DetailsItemInput
newValue={newValue}
Expand Down Expand Up @@ -173,10 +183,7 @@ function AddressRecordInput({
selectedRecord={selectedKey}
handleChange={setSelectedKey}
placeholder="Coin"
options={COIN_LIST.map(key => ({
label: key,
value: key
}))}
options={coinOptions}
/>
<DetailsItemInput
newValue={newValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const ContentHashEditable = ({
<>
<EditRecord>
<RecordInput
testId="content-record-input"
testId={`content-record-input${isInvalid ? '-invalid' : ''}`}
onChange={event => {
const value = event.target.value
setUpdatedRecords(records => ({
Expand Down
6 changes: 3 additions & 3 deletions src/utils/records.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export function validateRecord({ type, value, contentType, selectedKey }) {
return isAddress
case 'content':
if (value === EMPTY_ADDRESS) return true // delete record
const encoded = encodeContenthash(value)
if (encoded) {
const { encoded, error: encodeError } = encodeContenthash(value)
if (!encodeError && encoded) {
return isValidContenthash(encoded)
} else {
return false
Expand Down Expand Up @@ -45,7 +45,7 @@ export function getPlaceholder(recordType, contentType) {
return 'Enter an Ethereum address'
case 'content':
if (contentType === 'contenthash') {
return 'Enter a content hash (eg: /ipfs/..., ipfs://..., /ipns/..., ipns://..., bzz://..., onion://..., onion3://...)'
return 'Enter a content hash (eg: /ipfs/..., ipfs://..., /ipns/..., ipns://..., bzz://..., onion://..., onion3://..., sia://...)'
} else {
return 'Enter a content'
}
Expand Down
Loading