-
Notifications
You must be signed in to change notification settings - Fork 5.3k
/what-is-ether page #16389
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
Open
corwintines
wants to merge
40
commits into
dev
Choose a base branch
from
what-is-ether
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
/what-is-ether page #16389
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
a0ce353
page setup
corwintines b9c078b
Merge branch 'ethereum-history-and-founder' into what-is-ether
corwintines 6f6a495
abstract HighlightCard
corwintines 571ea81
what is ether page
corwintines 4f11323
column header
corwintines a8c8dce
deprecate old markdown versions
corwintines d2537be
remove old /eth page
corwintines 991c3a4
redirects
corwintines 8065cb0
/eth -> /what-is-ether internal links
corwintines 27f415e
nav
corwintines 178a339
Merge branch 'dev' into ethereum-history-and-founder
corwintines 0df9427
Merge branch 'ethereum-history-and-founder' into what-is-ether
corwintines 876fab2
add structured data
corwintines 869c050
Merge branch 'dev' into what-is-ether
wackerow e9e7bc3
Merge branch 'dev' into what-is-ether
wackerow 4691f1c
refactor: use ui/alert; info banner deprecated
wackerow 913e7a6
Update src/intl/en/page-what-is-ether.json
konopkja d99e7eb
Update src/intl/en/page-what-is-ether.json
konopkja 99178ba
Update src/intl/en/page-what-is-ether.json
konopkja 1d523f6
Update src/intl/en/page-what-is-ether.json
konopkja bb7ba39
Update src/intl/en/page-what-is-ether.json
konopkja 3f04416
Update src/intl/en/page-what-is-ether.json
konopkja f2ca833
Merge branch 'dev' into what-is-ether
corwintines f88591f
Update app/[locale]/what-is-ether/page.tsx
corwintines 4953ecf
Update app/[locale]/what-is-ether/page.tsx
corwintines 03eeb0f
cleanup spacing
corwintines 3e614bb
Update app/[locale]/what-is-ether/page.tsx
corwintines 9482aa8
copy update
corwintines e32d3ed
Update src/intl/en/page-what-is-ether.json
corwintines d97e451
Update src/intl/en/page-what-is-ether.json
corwintines bcc5d79
Update src/intl/en/page-what-is-ether.json
corwintines 12bf0ad
Update src/intl/en/page-what-is-ether.json
corwintines fddb3d6
Update src/intl/en/page-what-is-ether.json
corwintines bccbf93
Update src/intl/en/page-what-is-ether.json
corwintines 775eb50
Update src/intl/en/page-what-is-ether.json
corwintines c27f1a6
Update src/intl/en/page-what-is-ether.json
corwintines 488612e
copy updates
corwintines db0152d
Merge branch 'what-is-ether' of https://github.com/ethereum/ethereum-…
corwintines 1399520
fix keys
corwintines 3ad85ec
add who holds the most eth content
corwintines File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| import { getTranslations } from "next-intl/server" | ||
|
|
||
| import { | ||
| Table, | ||
| TableBody, | ||
| TableCell, | ||
| TableHead, | ||
| TableHeader, | ||
| TableRow, | ||
| } from "@/components/ui/table" | ||
|
|
||
| const GasTable = async () => { | ||
| const t = await getTranslations({ | ||
| namespace: "page-what-is-ether", | ||
| }) | ||
|
|
||
| const etherscanApiKey = process.env.ETHERSCAN_API_KEY | ||
|
|
||
| const gwei = await fetch( | ||
| `https://api.etherscan.io/v2/api?chainid=1&module=gastracker&action=gasoracle&apikey=${etherscanApiKey}` | ||
| ).then((res) => res.json()) | ||
| const ethPrice = await fetch( | ||
| `https://api.etherscan.io/v2/api?chainid=1&module=stats&action=ethprice&apikey=${etherscanApiKey}` | ||
| ).then((res) => res.json()) | ||
|
|
||
| // Calculate transaction costs in USD | ||
| const gasPrice = parseFloat(gwei.result.ProposeGasPrice) // Gas price in gwei | ||
| const ethPriceUSD = parseFloat(ethPrice.result.ethusd) // ETH price in USD | ||
|
|
||
| const calculateCost = (gasUnits: number) => { | ||
| const costInETH = gasUnits * gasPrice * 1e-9 // Convert gwei to ETH | ||
| const costInUSD = costInETH * ethPriceUSD | ||
| return `$${costInUSD.toFixed(2)}` | ||
| } | ||
|
|
||
| return ( | ||
| <Table variant="highlight-first-column"> | ||
| <TableHeader> | ||
| <TableRow> | ||
| <TableHead> | ||
| {t("page-what-is-ether-gas-table-transaction-type")} | ||
| </TableHead> | ||
| <TableHead> | ||
| {t("page-what-is-ether-gas-table-typical-cost-range")} | ||
| </TableHead> | ||
| <TableHead> | ||
| {t("page-what-is-ether-gas-table-estimated-gas-units")} | ||
| </TableHead> | ||
| </TableRow> | ||
| </TableHeader> | ||
| <TableBody> | ||
| <TableRow> | ||
| <TableCell>{t("page-what-is-ether-gas-table-row-1-1")}</TableCell> | ||
| <TableCell>{calculateCost(21000)}</TableCell> | ||
| <TableCell>21,000 gas</TableCell> | ||
| </TableRow> | ||
| <TableRow> | ||
| <TableCell>{t("page-what-is-ether-gas-table-row-2-1")}</TableCell> | ||
| <TableCell> | ||
| {calculateCost(125000)} - {calculateCost(150000)} | ||
| </TableCell> | ||
| <TableCell>100,000 - 150,000 gas</TableCell> | ||
| </TableRow> | ||
| <TableRow> | ||
| <TableCell>{t("page-what-is-ether-gas-table-row-3-1")}</TableCell> | ||
| <TableCell> | ||
| {calculateCost(200000)} - {calculateCost(500000)} | ||
| </TableCell> | ||
| <TableCell>200,000 - 500,000 gas</TableCell> | ||
| </TableRow> | ||
| </TableBody> | ||
| </Table> | ||
| ) | ||
| } | ||
|
|
||
| export default GasTable | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to adjust this to account for small fees so it doesn't read as if it's free.
In
calculateCost, I'd suggest importing and using the existingformatSmallUSD:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...or indicating
<$0.01, but would still suggest using theIntlapproach for i18n purposes