diff --git a/packages/website/docs/reference/_category_.json b/packages/website/docs/alpha-1-testnet/_category_.json similarity index 54% rename from packages/website/docs/reference/_category_.json rename to packages/website/docs/alpha-1-testnet/_category_.json index b49710abb9e..31f1bdb4e09 100644 --- a/packages/website/docs/reference/_category_.json +++ b/packages/website/docs/alpha-1-testnet/_category_.json @@ -1,7 +1,8 @@ { - "label": "Reference", + "label": "Alpha-1 Testnet Guide", "collapsed": false, "link": { "type": "generated-index" - } + }, + "position": 2 } diff --git a/packages/website/docs/alpha-1-testnet/configure-wallet.mdx b/packages/website/docs/alpha-1-testnet/configure-wallet.mdx new file mode 100644 index 00000000000..3e94507d1aa --- /dev/null +++ b/packages/website/docs/alpha-1-testnet/configure-wallet.mdx @@ -0,0 +1,25 @@ +--- +sidebar_position: 1 +--- + +import AddEthereumChainButton from "../../src/components/AddEthereumChainButton"; + +# ➕ Add networks to wallet + +## Automatically add networks + +Use the buttons below to add Ethereum A1 and Taiko A1 to any wallet that supports `wallet_addEthereumChain` (e.g., MetaMask). + +| Network | Add to wallet | +| ----------- | ------------------------------------------------------------------ | +| Ethereum A1 | | +| Taiko A1 | | + +## Manually add networks + +Use this RPC configuration to add Ethereum A1 and Taiko A1 to other wallets. + +| Network | Chain ID | RPC URL | Symbol | Block Explorer URL | +| ----------- | -------- | -------------------------- | ------ | ------------------------------- | +| Ethereum A1 | 31338 | https://l1rpc.a1.taiko.xyz | ETH | https://l1explorer.a1.taiko.xyz | +| Taiko A1 | 167003 | https://l2rpc.a1.taiko.xyz | ETH | https://l2explorer.a1.taiko.xyz | diff --git a/packages/website/docs/alpha-1-testnet/deploy-a-contract.md b/packages/website/docs/alpha-1-testnet/deploy-a-contract.md new file mode 100644 index 00000000000..e4cd3564285 --- /dev/null +++ b/packages/website/docs/alpha-1-testnet/deploy-a-contract.md @@ -0,0 +1,14 @@ +--- +sidebar_position: 4 +--- + +# 🚀 Deploy a contract + +We will deploy a smart contract to Taiko A1 using Foundry. + +1. Follow the Foundry Book to install Foundry and init the default project: https://book.getfoundry.sh/getting-started/first-steps +2. From `~/hello_foundry` run `forge create --legacy --rpc-url https://l2rpc.a1.taiko.xyz --private-key src/Counter.sol:Counter` (replace `` with the private key of the account deploying the contract) + +We are using the `--legacy` flag because EIP-1559 is currently disabled on Taiko. We have plans to re-enable it in the future. + +You can use the block explorer to verify that the contract was deployed: https://l2explorer.a1.taiko.xyz/ diff --git a/packages/website/docs/alpha-1-testnet/explore-the-network.md b/packages/website/docs/alpha-1-testnet/explore-the-network.md new file mode 100644 index 00000000000..5f0d42ad368 --- /dev/null +++ b/packages/website/docs/alpha-1-testnet/explore-the-network.md @@ -0,0 +1,44 @@ +--- +sidebar_position: 7 +--- + +# 🔍 Explore the network + +Taiko's Alpha-1 testnet consists of L1 / L2 nodes with all [Taiko protocol contracts](/docs/category/contract-documentation) deployed. The mining interval of the L1 node is set to 12 seconds. + +## Endpoints + +### L1 + +- **Block Explorer:** +- **HTTP RPC Endpoint:** +- **Web Socket RPC Endpoint:** +- **ETH faucet:** +- **Chain ID:** `31338` + +### L2 + +- **Block Explorer:** +- **HTTP RPC Endpoint:** +- **Web Socket RPC Endpoint:** +- **ETH faucet:** +- **Chain ID:** `167003` + +## Contract addresses + +### L1 + +- **TaikoL1:** `0x7B3AF414448ba906f02a1CA307C56c4ADFF27ce7` +- **TokenVault:** `0xD0dfd5baCf160B97C8eE3ecb463F18c08673160c` +- **Bridge:** `0x3612E284D763f42f5E4CB72B1602b23DAEC3cA60` + +### L2 + +- **TaikoL2:** `0x0000777700000000000000000000000000000001` +- **TokenVault:** `0x0000777700000000000000000000000000000002` +- **EtherVault:** `0x0000777700000000000000000000000000000003` +- **Bridge:** `0x0000777700000000000000000000000000000004` + +## Cron job + +There will be a cron job service that proposes empty blocks periodically (every 2 minutes). diff --git a/packages/website/docs/alpha-1-testnet/get-help.md b/packages/website/docs/alpha-1-testnet/get-help.md new file mode 100644 index 00000000000..d10f4528f80 --- /dev/null +++ b/packages/website/docs/alpha-1-testnet/get-help.md @@ -0,0 +1,12 @@ +--- +sidebar_position: 8 +--- + +# ❓ Get help + +Here are two places for you to get help: + +- [Post your question on GitHub Discussions](https://github.com/orgs/taikoxyz/discussions/new?category=questions) +- [Chat with us on Discord](https://discord.gg/taikoxyz) + +GitHub Discussions is preferred because your question might help others who are also running into the same issue. Conversely, you might find the answer to your problem here! diff --git a/packages/website/docs/alpha-1-testnet/request-eth-from-faucet.md b/packages/website/docs/alpha-1-testnet/request-eth-from-faucet.md new file mode 100644 index 00000000000..c8aaf33de79 --- /dev/null +++ b/packages/website/docs/alpha-1-testnet/request-eth-from-faucet.md @@ -0,0 +1,8 @@ +--- +sidebar_position: 2 +--- + +# 💧 Request ETH from faucet + +- Request ETH from Ethereum A1: https://l1faucet.a1.taiko.xyz/. +- Request ETH from Taiko A1: https://l2faucet.a1.taiko.xyz/. diff --git a/packages/website/docs/alpha-1-testnet/run-a-node.md b/packages/website/docs/alpha-1-testnet/run-a-node.md new file mode 100644 index 00000000000..13ec107832a --- /dev/null +++ b/packages/website/docs/alpha-1-testnet/run-a-node.md @@ -0,0 +1,13 @@ +--- +sidebar_position: 5 +--- + +# 🌐 Run a node + +This is arguably the most important part of the testnet! Taiko is fully decentralized and relies on the community to run nodes. + +Follow the guide at [simple-taiko-node/README.md](https://github.com/taikoxyz/simple-taiko-node/blob/main/README.md) to get started. + +:::note +You will only be able to run a node regularly or as a proposer. In this testnet we are not running any provers. +::: diff --git a/packages/website/docs/alpha-1-testnet/start-here.md b/packages/website/docs/alpha-1-testnet/start-here.md new file mode 100644 index 00000000000..885f197d30a --- /dev/null +++ b/packages/website/docs/alpha-1-testnet/start-here.md @@ -0,0 +1,41 @@ +--- +sidebar_position: 0 +--- + +# 👋 Start here + +Welcome to Taiko's Alpha-1 testnet, **Snæfellsjökull**. There are two networks involved in the testnet, which we'll define: + +- **Taiko A1** is the Alpha-1 testnet release of Taiko — a fully decentralized, Ethereum-equivalent ZK-Rollup. +- **Ethereum A1** is Taiko's privately deployed Ethereum network, which serves as the L1 for Taiko's Alpha-1 testnet. + +## What can I do? + +In this testnet, you can: + +- 🌉 Bridge tokens between Ethereum A1 and Taiko A1. +- 🤝 Send transactions (e.g., deploy contracts). +- 🌐 Run a node — this makes **you** a part of Taiko! +- 📝 Submit feedback and be forever loved. +- 🥇 Earn a POAP by using your wallet to complete any 2 of the 3 following actions by January 31st 23:59 UTC: + - Use the bridge + - Interact with contract (e.g., interact with dapp, deploy a contract) + - Transfer between accounts + +## Create a feedback log + +Create a feedback log by clicking [here](https://github.com/orgs/taikoxyz/discussions/new?category=feedback&title=Testnet%20feedback%20form&body=%23+Friction+log%0D%0A-+TODO%0D%0A%0D%0A%23+Other+notes%0D%0A-+TODO%0D%0A), and use this to write down any [friction points, bugs, suggestions, etc.] while testing Taiko. + +Once you are finished testing the network, please submit the feedback log to help improve Taiko! + +## Navigating Snæfellsjökull + +All of the relevant links can be found in this site's navigation. The relevant links are: + +| Link | Purpose | +| ----------------------------------------------- | -------------------------------------------------- | +| [Bridge](https://bridge.a1.taiko.xyz/) | Bridge ETH/tokens between Ethereum A1 and Taiko A1 | +| [L1 faucet](https://l1faucet.a1.taiko.xyz/) | For receiving ETH on Ethereum A1 | +| [L2 faucet](https://l2faucet.a1.taiko.xyz/) | For receiving ETH on Taiko A1 | +| [L1 explorer](https://l1explorer.a1.taiko.xyz/) | Explore blocks on Ethereum A1 | +| [L2 explorer](https://l2explorer.a1.taiko.xyz/) | Explore blocks on Taiko A1 | diff --git a/packages/website/docs/alpha-1-testnet/submit-feedback.md b/packages/website/docs/alpha-1-testnet/submit-feedback.md new file mode 100644 index 00000000000..ad38c9b9727 --- /dev/null +++ b/packages/website/docs/alpha-1-testnet/submit-feedback.md @@ -0,0 +1,9 @@ +--- +sidebar_position: 7 +--- + +# 📝 Submit feedback + +Submit your [feedback log](/docs/alpha-1-testnet/start-here#create-a-feedback-log) to [GitHub Discussions](https://github.com/orgs/taikoxyz/discussions). + +Thank you for participating in the Snæfellsjökull testnet! 🌋 diff --git a/packages/website/docs/alpha-1-testnet/use-the-bridge.md b/packages/website/docs/alpha-1-testnet/use-the-bridge.md new file mode 100644 index 00000000000..3714fdeeef9 --- /dev/null +++ b/packages/website/docs/alpha-1-testnet/use-the-bridge.md @@ -0,0 +1,25 @@ +--- +sidebar_position: 3 +--- + +# 🌉 Use the bridge + +The bridge contract can be found: + +- Deployed on L1: https://l1explorer.a1.taiko.xyz/address/0x3612E284D763f42f5E4CB72B1602b23DAEC3cA60 +- Deployed on L2: https://l2explorer.a1.taiko.xyz/address/0x0000777700000000000000000000000000000002 + +## Test the bridge + +Use the [bridge](https://bridge.a1.taiko.xyz/) for the following actions: + +- Bridge ETH between Ethereum A1 and Taiko A1 +- Bridge HORSE between Ethereum A1 and Taiko A1 + +## Why is my L2 -> L1 transfer taking so long? + +The transfer from L2 to L1 can take a while because Taiko has a several hours delay in syncing block headers to allow uncle proof generation time, and we need the synced header to match so the Merkle proof of the message being sent on L2 is valid on L1. + +## Bridge contract explained + +Read the bridge documentation on our GitHub: https://github.com/taikoxyz/taiko-mono/tree/main/packages/protocol/contracts/bridge. diff --git a/packages/website/docs/intro/_category_.json b/packages/website/docs/intro/_category_.json index 18d2f319168..efdf4817727 100644 --- a/packages/website/docs/intro/_category_.json +++ b/packages/website/docs/intro/_category_.json @@ -1,6 +1,7 @@ { - "label": "Introduction", + "label": "Learn", "collapsed": false, + "position": 1, "link": { "type": "generated-index" } diff --git a/packages/website/faq/index.md b/packages/website/docs/intro/faq.md similarity index 98% rename from packages/website/faq/index.md rename to packages/website/docs/intro/faq.md index da02f7c4750..cafbbf9aa23 100644 --- a/packages/website/faq/index.md +++ b/packages/website/docs/intro/faq.md @@ -1,4 +1,8 @@ -# Frequently Asked Questions +--- +sidebar_position: 4 +--- + +# FAQs ## What is Taiko? @@ -65,7 +69,7 @@ There are 2 types of zero-knowledge proofs: ZK-SNARKs and ZK-STARKs. Taiko uses ## What does "Taiko" mean? -It comes from an old Chinese saying 一鼓作气 (Yīgǔzuòqì). The literal meaning is that the first drum beat arouses courage. The implied meaning of the idiom is to accomplish a task or goal in one intense effort. +It comes from an old Chinese saying 一鼓作气 (Yīgǔzuòqì). The literal meaning is that the first drum beat arouses courage. The implied meaning of the idiom is to accomplish a task or goal in one intense effort. Taiko (太鼓) is the Japanese term for a drum. For us, Taiko is the "drum" that arouses courage and leads to accomplishing goals. diff --git a/packages/website/docs/intro/index.md b/packages/website/docs/intro/index.md index 7a39aa8557e..336d41e24ef 100644 --- a/packages/website/docs/intro/index.md +++ b/packages/website/docs/intro/index.md @@ -2,11 +2,11 @@ sidebar_position: 1 --- -# Quickstart +# What is Taiko? -Welcome to Taiko! 🥁 +Taiko is a fully decentralized, Ethereum-equivalent ZK-Rollup. This is also referred to as a [Type 1 ZK-EVM](https://mirror.xyz/labs.taiko.eth/w7NSKDeKfJoEy0p89I9feixKfdK-20JgWF9HZzxfeBo). -## Learn about Taiko +## Learn more about Taiko Here are the best places to learn about Taiko. @@ -15,8 +15,8 @@ Here are the best places to learn about Taiko. - [Introduction to Taiko](https://mirror.xyz/labs.taiko.eth/oRy3ZZ_4-6IEQcuLCMMlxvdH6E-T3_H7UwYVzGDsgf4) - [The Type 1 ZK-EVM](https://mirror.xyz/labs.taiko.eth/w7NSKDeKfJoEy0p89I9feixKfdK-20JgWF9HZzxfeBo) - [Whitepaper](https://taikoxyz.github.io/taiko-mono/taiko-whitepaper.pdf) -- [Contract documentation](/docs/category/smart-contracts/) -- [Frequently Asked Questions (FAQ)](/faq/) +- [Contract documentation](/docs/category/contract-documentation/) +- [Frequently Asked Questions (FAQ)](/docs/intro/faq.md) ### Follow us diff --git a/packages/website/talks/index.md b/packages/website/docs/intro/talks.md similarity index 84% rename from packages/website/talks/index.md rename to packages/website/docs/intro/talks.md index f3cd1512abe..174cea78371 100644 --- a/packages/website/talks/index.md +++ b/packages/website/docs/intro/talks.md @@ -1,4 +1,8 @@ -# Talks +--- +sidebar_position: 3 +--- + +# Presentations - `2022-11-01`: [Taiko ZK-EVM: Layer 2 Finality](https://hackmd.io/@taikolabs/HkN7GR64i) (Old Friends Reunion - ETH Lisbon) - `2022-10-10`: [Taiko ZK-EVM: Overview and Optimizations](https://hackmd.io/@taikolabs/S1haywHIj) (Rollup Day - Devcon) diff --git a/packages/website/docs/reference/whitepaper.md b/packages/website/docs/intro/whitepaper.md similarity index 70% rename from packages/website/docs/reference/whitepaper.md rename to packages/website/docs/intro/whitepaper.md index 2150c7b0a45..0945340c5e3 100644 --- a/packages/website/docs/reference/whitepaper.md +++ b/packages/website/docs/intro/whitepaper.md @@ -1,3 +1,7 @@ -# Whitepaper +--- +sidebar_position: 2 +--- + +# Read the whitepaper Read about the Taiko protocol in depth with the [whitepaper](https://taikoxyz.github.io/taiko-mono/taiko-whitepaper.pdf). diff --git a/packages/website/docs/reference/smart-contracts/L1/TaikoL1.md b/packages/website/docs/smart-contracts/L1/TaikoL1.md similarity index 100% rename from packages/website/docs/reference/smart-contracts/L1/TaikoL1.md rename to packages/website/docs/smart-contracts/L1/TaikoL1.md diff --git a/packages/website/docs/reference/smart-contracts/L1/TkoToken.md b/packages/website/docs/smart-contracts/L1/TkoToken.md similarity index 100% rename from packages/website/docs/reference/smart-contracts/L1/TkoToken.md rename to packages/website/docs/smart-contracts/L1/TkoToken.md diff --git a/packages/website/docs/reference/smart-contracts/L2/TaikoL2.md b/packages/website/docs/smart-contracts/L2/TaikoL2.md similarity index 100% rename from packages/website/docs/reference/smart-contracts/L2/TaikoL2.md rename to packages/website/docs/smart-contracts/L2/TaikoL2.md diff --git a/packages/website/docs/reference/smart-contracts/_category_.json b/packages/website/docs/smart-contracts/_category_.json similarity index 65% rename from packages/website/docs/reference/smart-contracts/_category_.json rename to packages/website/docs/smart-contracts/_category_.json index d33e5f152f7..7c0061995d3 100644 --- a/packages/website/docs/reference/smart-contracts/_category_.json +++ b/packages/website/docs/smart-contracts/_category_.json @@ -1,5 +1,5 @@ { - "label": "Smart contracts", + "label": "Contract documentation", "collapsed": true, "link": { "type": "generated-index" diff --git a/packages/website/docs/reference/smart-contracts/bridge/Bridge.md b/packages/website/docs/smart-contracts/bridge/Bridge.md similarity index 100% rename from packages/website/docs/reference/smart-contracts/bridge/Bridge.md rename to packages/website/docs/smart-contracts/bridge/Bridge.md diff --git a/packages/website/docs/reference/smart-contracts/bridge/BridgedERC20.md b/packages/website/docs/smart-contracts/bridge/BridgedERC20.md similarity index 100% rename from packages/website/docs/reference/smart-contracts/bridge/BridgedERC20.md rename to packages/website/docs/smart-contracts/bridge/BridgedERC20.md diff --git a/packages/website/docs/reference/smart-contracts/bridge/EtherVault.md b/packages/website/docs/smart-contracts/bridge/EtherVault.md similarity index 100% rename from packages/website/docs/reference/smart-contracts/bridge/EtherVault.md rename to packages/website/docs/smart-contracts/bridge/EtherVault.md diff --git a/packages/website/docs/reference/smart-contracts/bridge/IBridge.md b/packages/website/docs/smart-contracts/bridge/IBridge.md similarity index 100% rename from packages/website/docs/reference/smart-contracts/bridge/IBridge.md rename to packages/website/docs/smart-contracts/bridge/IBridge.md diff --git a/packages/website/docs/reference/smart-contracts/bridge/TokenVault.md b/packages/website/docs/smart-contracts/bridge/TokenVault.md similarity index 100% rename from packages/website/docs/reference/smart-contracts/bridge/TokenVault.md rename to packages/website/docs/smart-contracts/bridge/TokenVault.md diff --git a/packages/website/docs/reference/smart-contracts/common/AddressResolver.md b/packages/website/docs/smart-contracts/common/AddressResolver.md similarity index 100% rename from packages/website/docs/reference/smart-contracts/common/AddressResolver.md rename to packages/website/docs/smart-contracts/common/AddressResolver.md diff --git a/packages/website/docs/reference/smart-contracts/common/ConfigManager.md b/packages/website/docs/smart-contracts/common/ConfigManager.md similarity index 100% rename from packages/website/docs/reference/smart-contracts/common/ConfigManager.md rename to packages/website/docs/smart-contracts/common/ConfigManager.md diff --git a/packages/website/docs/reference/smart-contracts/common/IAddressManager.md b/packages/website/docs/smart-contracts/common/IAddressManager.md similarity index 100% rename from packages/website/docs/reference/smart-contracts/common/IAddressManager.md rename to packages/website/docs/smart-contracts/common/IAddressManager.md diff --git a/packages/website/docs/reference/smart-contracts/common/IHeaderSync.md b/packages/website/docs/smart-contracts/common/IHeaderSync.md similarity index 100% rename from packages/website/docs/reference/smart-contracts/common/IHeaderSync.md rename to packages/website/docs/smart-contracts/common/IHeaderSync.md diff --git a/packages/website/docs/reference/smart-contracts/common/IMintableERC20.md b/packages/website/docs/smart-contracts/common/IMintableERC20.md similarity index 100% rename from packages/website/docs/reference/smart-contracts/common/IMintableERC20.md rename to packages/website/docs/smart-contracts/common/IMintableERC20.md diff --git a/packages/website/docusaurus.config.js b/packages/website/docusaurus.config.js index 95de7e7bd9f..e67036a6a57 100644 --- a/packages/website/docusaurus.config.js +++ b/packages/website/docusaurus.config.js @@ -24,28 +24,7 @@ const config = { locales: ["en"], }, - plugins: [ - [ - "content-docs", - { - id: "talks", - path: "talks", - routeBasePath: "talks", - editUrl: - "https://github.com/taikoxyz/taiko-mono/tree/main/packages/website/", - }, - ], - [ - "content-docs", - { - id: "faq", - path: "faq", - routeBasePath: "faq", - editUrl: - "https://github.com/taikoxyz/taiko-mono/tree/main/packages/website/", - }, - ], - ], + plugins: [], presets: [ [ @@ -81,6 +60,14 @@ const config = { themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ + announcementBar: { + id: "alpha-1-testnet", + content: + 'Snæfellsjökull is erupting 🌋 start here', + backgroundColor: "#fafbfc", + textColor: "#171717", + isCloseable: false, + }, colorMode: { defaultMode: "light", respectPrefersColorScheme: false, @@ -94,28 +81,47 @@ const config = { items: [ { to: "docs/intro", - label: "Learn", - position: "left", + label: "Docs", }, { href: "https://mirror.xyz/labs.taiko.eth", label: "Blog", - position: "left", }, { - href: "https://github.com/taikoxyz/taiko-mono/discussions", - label: "Discussions", - position: "left", + href: "https://github.com/orgs/taikoxyz/discussions", + label: "Discuss", + }, + { + href: "https://bridge.a1.taiko.xyz/", + label: "Bridge", }, { - to: "talks", - label: "Talks", - position: "left", + label: "Faucet", + type: "dropdown", + items: [ + { + href: "https://l1faucet.a1.taiko.xyz/", + label: "L1 Faucet", + }, + { + href: "https://l2faucet.a1.taiko.xyz/", + label: "L2 Faucet", + }, + ], }, { - to: "faq", - label: "FAQ", - position: "left", + label: "Block Explorer", + type: "dropdown", + items: [ + { + href: "https://l1explorer.a1.taiko.xyz/", + label: "L1 Explorer", + }, + { + href: "https://l2explorer.a1.taiko.xyz/", + label: "L2 Explorer", + }, + ], }, { href: "https://discord.gg/taikoxyz", @@ -152,24 +158,28 @@ const config = { items: [ { label: "Careers", - href: "https://www.notion.so/taikoxyz/Taiko-Jobs-828fd7232d2c4150a11e10c8baa910a2", + to: "https://www.notion.so/taikoxyz/Taiko-Jobs-828fd7232d2c4150a11e10c8baa910a2", }, { label: "Media kit", - href: "https://github.com/taikoxyz/taiko-mono/tree/main/packages/branding/", + to: "https://github.com/taikoxyz/taiko-mono/tree/main/packages/branding/", }, ], }, { title: "Developers", items: [ + { + label: "Discussions", + to: "https://github.com/taikoxyz/taiko-mono/discussions", + }, { label: "Getting started", to: "docs/intro", }, { label: "GitHub", - href: "https://github.com/taikoxyz", + to: "https://github.com/taikoxyz", }, ], }, @@ -178,19 +188,19 @@ const config = { items: [ { label: "Discord", - href: "https://discord.gg/taikoxyz", + to: "https://discord.gg/taikoxyz", }, { label: "Reddit", - href: "https://www.reddit.com/r/taiko_xyz/", + to: "https://www.reddit.com/r/taiko_xyz/", }, { label: "Twitter", - href: "https://twitter.com/taikoxyz", + to: "https://twitter.com/taikoxyz", }, { label: "YouTube", - href: "https://www.youtube.com/@taikoxyz", + to: "https://www.youtube.com/@taikoxyz", }, ], }, diff --git a/packages/website/src/components/AddEthereumChainButton/index.tsx b/packages/website/src/components/AddEthereumChainButton/index.tsx new file mode 100644 index 00000000000..fc16e80300e --- /dev/null +++ b/packages/website/src/components/AddEthereumChainButton/index.tsx @@ -0,0 +1,64 @@ +import React from "react"; + +type Props = { + buttonText: string; + chain: string; +}; + +async function addEthereumChain(chain: string) { + interface AddEthereumChainParameter { + chainId: string; // A 0x-prefixed hexadecimal string + chainName: string; + nativeCurrency: { + name: string; + symbol: string; // 2-6 characters long + decimals: 18; + }; + rpcUrls: string[]; + blockExplorerUrls?: string[]; + iconUrls?: string[]; // Currently ignored. + } + const l1params: AddEthereumChainParameter = { + chainId: "0x7A6A", + chainName: "Taiko Testnet L1", + nativeCurrency: { + name: "ETH", + symbol: "eth", + decimals: 18, + }, + rpcUrls: ["https://l1rpc.a1.taiko.xyz"], + blockExplorerUrls: ["https://l1explorer.a1.taiko.xyz/"], + iconUrls: [], + }; + + const l2params: AddEthereumChainParameter = { + chainId: "0x28C5B", + chainName: "Taiko Testnet", + nativeCurrency: { + name: "ETH", + symbol: "eth", + decimals: 18, + }, + rpcUrls: ["https://l2rpc.a1.taiko.xyz"], + blockExplorerUrls: ["https://l2explorer.a1.taiko.xyz/"], + iconUrls: [], + }; + + const params = chain === "l1" ? l1params : l2params; + + await (window as any).ethereum.request({ + method: "wallet_addEthereumChain", + params: [params], + }); +} + +export default function AddEthereumChainButton(props: Props): JSX.Element { + return ( +
addEthereumChain(props.chain)} + className="hover:cursor-pointer text-neutral-900 bg-white hover:bg-neutral-100 border-solid border-neutral-200 focus:ring-4 focus:outline-none focus:ring-neutral-100 font-medium rounded-lg text-sm px-3 py-2 text-center inline-flex items-center dark:focus:ring-neutral-600 dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700" + > + {props.buttonText} +
+ ); +} diff --git a/packages/website/src/components/Hero/index.tsx b/packages/website/src/components/Hero/index.tsx index ba103f8a18b..4ca99117d54 100644 --- a/packages/website/src/components/Hero/index.tsx +++ b/packages/website/src/components/Hero/index.tsx @@ -52,10 +52,10 @@ export default function Hero() { diff --git a/packages/website/src/pages/index.tsx b/packages/website/src/pages/index.tsx index e82bf99fa73..3138458ffc7 100644 --- a/packages/website/src/pages/index.tsx +++ b/packages/website/src/pages/index.tsx @@ -5,6 +5,7 @@ import JoinUs from "../components/JoinUs"; import Features from "../components/Features"; import Hero from "../components/Hero"; import Head from "@docusaurus/Head"; +import AddEthereumChainButton from "../components/AddEthereumChainButton"; export default function Home(): JSX.Element { return ( diff --git a/packages/website/static/img/metamask-fox.svg b/packages/website/static/img/metamask-fox.svg new file mode 100644 index 00000000000..e69de29bb2d