Skip to content

Commit 748888a

Browse files
authored
Merge pull request #16389 from ethereum/what-is-ether
/what-is-ether page
2 parents 57be09c + 58ad394 commit 748888a

File tree

185 files changed

+1086
-5999
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+1086
-5999
lines changed

app/[locale]/eth/_components/eth.tsx

Lines changed: 0 additions & 478 deletions
This file was deleted.

app/[locale]/eth/page.tsx

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { getLocale, getTranslations } from "next-intl/server"
2+
3+
import {
4+
Table,
5+
TableBody,
6+
TableCell,
7+
TableHead,
8+
TableHeader,
9+
TableRow,
10+
} from "@/components/ui/table"
11+
12+
import { formatSmallUSD } from "@/lib/utils/numbers"
13+
14+
const GasTable = async () => {
15+
const t = await getTranslations({
16+
namespace: "page-what-is-ether",
17+
})
18+
const locale = await getLocale()
19+
20+
const etherscanApiKey = process.env.ETHERSCAN_API_KEY
21+
22+
const gwei = await fetch(
23+
`https://api.etherscan.io/v2/api?chainid=1&module=gastracker&action=gasoracle&apikey=${etherscanApiKey}`
24+
).then((res) => res.json())
25+
const ethPrice = await fetch(
26+
`https://api.etherscan.io/v2/api?chainid=1&module=stats&action=ethprice&apikey=${etherscanApiKey}`
27+
).then((res) => res.json())
28+
29+
// Calculate transaction costs in USD
30+
const gasPrice = parseFloat(gwei.result.ProposeGasPrice) // Gas price in gwei
31+
const ethPriceUSD = parseFloat(ethPrice.result.ethusd) // ETH price in USD
32+
33+
const calculateCost = (gasUnits: number) => {
34+
const costInETH = gasUnits * gasPrice * 1e-9 // Convert gwei to ETH
35+
const costInUSD = costInETH * ethPriceUSD
36+
return formatSmallUSD(costInUSD, locale)
37+
}
38+
39+
return (
40+
<Table variant="highlight-first-column">
41+
<TableHeader>
42+
<TableRow>
43+
<TableHead>
44+
{t("page-what-is-ether-gas-table-transaction-type")}
45+
</TableHead>
46+
<TableHead>
47+
{t("page-what-is-ether-gas-table-typical-cost-range")}
48+
</TableHead>
49+
<TableHead>
50+
{t("page-what-is-ether-gas-table-estimated-gas-units")}
51+
</TableHead>
52+
</TableRow>
53+
</TableHeader>
54+
<TableBody>
55+
<TableRow>
56+
<TableCell>{t("page-what-is-ether-gas-table-row-1-1")}</TableCell>
57+
<TableCell>{calculateCost(21000)}</TableCell>
58+
<TableCell>21,000 gas</TableCell>
59+
</TableRow>
60+
<TableRow>
61+
<TableCell>{t("page-what-is-ether-gas-table-row-2-1")}</TableCell>
62+
<TableCell>
63+
{calculateCost(125000)} - {calculateCost(150000)}
64+
</TableCell>
65+
<TableCell>100,000 - 150,000 gas</TableCell>
66+
</TableRow>
67+
<TableRow>
68+
<TableCell>{t("page-what-is-ether-gas-table-row-3-1")}</TableCell>
69+
<TableCell>
70+
{calculateCost(200000)} - {calculateCost(500000)}
71+
</TableCell>
72+
<TableCell>200,000 - 500,000 gas</TableCell>
73+
</TableRow>
74+
</TableBody>
75+
</Table>
76+
)
77+
}
78+
79+
export default GasTable

app/[locale]/eth/page-jsonld.tsx renamed to app/[locale]/what-is-ether/page-jsonld.tsx

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import PageJsonLD from "@/components/PageJsonLD"
66

77
import { normalizeUrlForJsonLd } from "@/lib/utils/url"
88

9-
export default async function EthPageJsonLD({
9+
export default async function WhatIsEtherPageJsonLD({
1010
locale,
1111
lastEditLocaleTimestamp,
1212
contributors,
@@ -16,24 +16,24 @@ export default async function EthPageJsonLD({
1616
contributors: FileContributor[]
1717
}) {
1818
const t = await getTranslations({
19-
namespace: "page-eth",
19+
namespace: "page-what-is-ether",
2020
})
2121

22-
const url = normalizeUrlForJsonLd(locale, `/eth/`)
22+
const url = normalizeUrlForJsonLd(locale, `/what-is-ether/`)
2323

2424
const contributorList = contributors.map((contributor) => ({
2525
"@type": "Person",
2626
name: contributor.login,
2727
url: contributor.html_url,
2828
}))
2929

30-
// JSON-LD structured data for the Ether/ETH page
30+
// JSON-LD structured data for the What is Ether page
3131
const webPageJsonLd = {
3232
"@context": "https://schema.org",
3333
"@type": "WebPage",
3434
"@id": url,
35-
name: t("page-eth-whats-eth"),
36-
description: t("page-eth-is-money"),
35+
name: t("page-what-is-ether-meta-title"),
36+
description: t("page-what-is-ether-meta-description"),
3737
url: url,
3838
inLanguage: locale,
3939
contributor: contributorList,
@@ -56,19 +56,15 @@ export default async function EthPageJsonLD({
5656
{
5757
"@type": "ListItem",
5858
position: 2,
59-
name: t("page-eth-whats-eth"),
60-
item: normalizeUrlForJsonLd(locale, "/eth/"),
59+
name: t("page-what-is-ether-title"),
60+
item: url,
6161
},
6262
],
6363
},
6464
publisher: {
6565
"@type": "Organization",
6666
name: "ethereum.org",
6767
url: "https://ethereum.org",
68-
logo: {
69-
"@type": "ImageObject",
70-
url: "https://ethereum.org/images/eth-home-icon.png",
71-
},
7268
},
7369
reviewedBy: {
7470
"@type": "Organization",
@@ -81,14 +77,13 @@ export default async function EthPageJsonLD({
8177
},
8278
}
8379

84-
// JSON-LD for the article content about Ether
80+
// JSON-LD for the article content
8581
const articleJsonLd = {
8682
"@context": "https://schema.org",
8783
"@type": "Article",
88-
headline: t("page-eth-whats-eth"),
89-
description: t("page-eth-is-money"),
84+
headline: t("page-what-is-ether-title"),
85+
description: t("page-what-is-ether-meta-description"),
9086
image: "https://ethereum.org/images/eth.png",
91-
contributor: contributorList,
9287
author: [
9388
{
9489
"@type": "Organization",
@@ -100,16 +95,8 @@ export default async function EthPageJsonLD({
10095
"@type": "Organization",
10196
name: "ethereum.org",
10297
url: "https://ethereum.org",
103-
logo: {
104-
"@type": "ImageObject",
105-
url: "https://ethereum.org/images/eth-home-icon.png",
106-
},
107-
},
108-
dateModified: lastEditLocaleTimestamp,
109-
mainEntityOfPage: {
110-
"@type": "WebPage",
111-
"@id": url,
11298
},
99+
contributor: contributorList,
113100
reviewedBy: {
114101
"@type": "Organization",
115102
name: "ethereum.org",
@@ -119,13 +106,21 @@ export default async function EthPageJsonLD({
119106
url: "https://ethereum.org/images/eth-home-icon.png",
120107
},
121108
},
122-
about: {
123-
"@type": "DigitalCurrency",
124-
name: "Ether",
125-
alternateName: ["ETH", "Ethereum"],
126-
symbol: "ETH",
127-
blockchain: "Ethereum",
128-
},
109+
about: [
110+
{
111+
"@type": "Thing",
112+
name: "Ether (ETH)",
113+
description:
114+
"The native cryptocurrency of the Ethereum network used for transactions, staking, and powering applications",
115+
},
116+
{
117+
"@type": "Thing",
118+
name: "Ethereum",
119+
description:
120+
"A decentralized platform for applications and digital economies powered by smart contracts",
121+
},
122+
],
123+
dateModified: lastEditLocaleTimestamp,
129124
}
130125

131126
return <PageJsonLD structuredData={[webPageJsonLd, articleJsonLd]} />

0 commit comments

Comments
 (0)