From 41eed488eeb3d5d17f6151fb513c05a845c83942 Mon Sep 17 00:00:00 2001 From: Kenk Date: Wed, 19 Jul 2023 14:18:18 +0200 Subject: [PATCH 01/12] feat(website): update wallet setup docs --- .../components/Button/AddTokenButton.tsx | 46 +++++++++++++++++-- .../build-on-taiko/setup-your-wallet.mdx | 45 +++++++++++++++++- 2 files changed, 86 insertions(+), 5 deletions(-) diff --git a/packages/website/components/Button/AddTokenButton.tsx b/packages/website/components/Button/AddTokenButton.tsx index 85af5bbde41..6ba56d8222e 100644 --- a/packages/website/components/Button/AddTokenButton.tsx +++ b/packages/website/components/Button/AddTokenButton.tsx @@ -1,15 +1,52 @@ +import { + ELDFELL_ADD_ETHEREUM_CHAIN, + ELDFELL_CONFIG, + GRIMSVOTN_ADD_ETHEREUM_CHAIN, + GRIMSVOTN_CONFIG, + SEPOLIA_ADD_ETHEREUM_CHAIN, + SEPOLIA_CONFIG, +} from "../../domain/chain"; + import { ethereumRequest } from "../../utils/ethereumRequest"; +type ConnectButtonProps = { + network: + | typeof SEPOLIA_CONFIG.names.shortName + | typeof ELDFELL_CONFIG.names.shortName + | typeof GRIMSVOTN_CONFIG.names.shortName; +}; + +const chainMap = { + Eldfell: ELDFELL_CONFIG.chainId.hex, // 167005 + Grimsvotn: GRIMSVOTN_CONFIG.chainId.hex, // 167005 + Sepolia: SEPOLIA_CONFIG.chainId.hex, // 11155111 +}; + +const configMap = { + Eldfell: ELDFELL_ADD_ETHEREUM_CHAIN, + Grimsvotn: GRIMSVOTN_ADD_ETHEREUM_CHAIN, + Sepolia: SEPOLIA_ADD_ETHEREUM_CHAIN, +}; + interface AddTokenButtonProps { address: string; symbol: string; decimals: number; image: string; + network: ConnectButtonProps["network"]; } const addTokenToWallet = async (token: AddTokenButtonProps) => { - const options = { ...token, type: "ERC20" }; - await ethereumRequest("wallet_watchAsset", options); + const { ethereum } = window as any; + + if (ethereum.chainId != chainMap[token.network]) { + await ethereumRequest("wallet_addEthereumChain", [configMap[token.network]]); + } + + const params = { options: { address: token.address, symbol: token.symbol, decimals: token.decimals, image: token.image }, type: "ERC20" }; + + await ethereumRequest("wallet_watchAsset", params); + }; export function AddTokenButton({ @@ -17,13 +54,14 @@ export function AddTokenButton({ symbol, decimals, image, + network, }: AddTokenButtonProps) { return (
addTokenToWallet({ address, symbol, decimals, image })} + onClick={() => addTokenToWallet({ address, symbol, decimals, image, network })} className="hover:cursor-pointer text-neutral-100 bg-[#E81899] hover:bg-[#d1168a] 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" > - Add {symbol} to wallet + Add {symbol} ({network})
); } diff --git a/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx b/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx index 330d18b4bb8..6976a0d6482 100644 --- a/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx +++ b/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx @@ -1,4 +1,12 @@ import { Steps } from "nextra-theme-docs"; +import { AddTokenButton } from "components/Button/AddTokenButton"; +import { ConnectToMetamaskButton } from "components/Button/ConnectToMetamaskButton"; + +import { + ELDFELL_CONFIG, + GRIMSVOTN_CONFIG, + SEPOLIA_CONFIG, +} from "domain/chain"; # Setup your wallet @@ -12,10 +20,45 @@ This guide helps you connect your wallet to Taiko's networks. ### Visit RPC configuration + +
+ +
+ Visit the [RPC configuration page](/docs/reference/rpc-configuration) and click the buttons to add the networks. Or, add them manually in your wallet with the provided configuration. ### Add tokens to your wallet - Use your wallet (e.g., Metamask) to [import the tokens](https://support.ledger.com/hc/en-us/articles/6375103346077-Add-custom-tokens-to-MetaMask?docs=true). You can find all deployed tokens contract addresses [here](/docs/reference/contract-addresses). + + + +
+ + +
From 405c3990b882e5dad8a846d4d37975cb18fef588 Mon Sep 17 00:00:00 2001 From: Kenk Date: Wed, 19 Jul 2023 16:25:18 +0200 Subject: [PATCH 02/12] feat: further simplification --- .../pages/docs/guides/build-on-taiko/setup-your-wallet.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx b/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx index 6976a0d6482..4b4a65fdac1 100644 --- a/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx +++ b/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx @@ -19,13 +19,12 @@ This guide helps you connect your wallet to Taiko's networks. ## Steps - ### Visit RPC configuration + ### Add chains to your wallet

- Visit the [RPC configuration page](/docs/reference/rpc-configuration) and click the buttons to add the networks. Or, add them manually in your wallet with the provided configuration. ### Add tokens to your wallet Date: Thu, 20 Jul 2023 10:53:29 +0200 Subject: [PATCH 03/12] update image name --- .../testnet-token-images/{bull_32x32.svg => bull.svg} | 0 .../pages/docs/guides/build-on-taiko/setup-your-wallet.mdx | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename packages/branding/testnet-token-images/{bull_32x32.svg => bull.svg} (100%) diff --git a/packages/branding/testnet-token-images/bull_32x32.svg b/packages/branding/testnet-token-images/bull.svg similarity index 100% rename from packages/branding/testnet-token-images/bull_32x32.svg rename to packages/branding/testnet-token-images/bull.svg diff --git a/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx b/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx index 4b4a65fdac1..58315053fec 100644 --- a/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx +++ b/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx @@ -35,7 +35,7 @@ This guide helps you connect your wallet to Taiko's networks. Date: Thu, 20 Jul 2023 11:23:54 +0200 Subject: [PATCH 04/12] feat: create add tokens button --- .../components/Button/AddTokenButton.tsx | 1 + .../components/Button/AddTokensButton.tsx | 68 +++++++++++++++++++ packages/website/domain/chain/baseTypes.ts | 10 +++ .../domain/chain/grimsvotn/addTokens.ts | 31 +++++++++ packages/website/domain/chain/index.ts | 3 + .../website/domain/chain/sepolia/addTokens.ts | 33 +++++++++ .../build-on-taiko/setup-your-wallet.mdx | 34 ++-------- 7 files changed, 151 insertions(+), 29 deletions(-) create mode 100644 packages/website/components/Button/AddTokensButton.tsx create mode 100644 packages/website/domain/chain/grimsvotn/addTokens.ts create mode 100644 packages/website/domain/chain/sepolia/addTokens.ts diff --git a/packages/website/components/Button/AddTokenButton.tsx b/packages/website/components/Button/AddTokenButton.tsx index 6ba56d8222e..c479fda662b 100644 --- a/packages/website/components/Button/AddTokenButton.tsx +++ b/packages/website/components/Button/AddTokenButton.tsx @@ -47,6 +47,7 @@ const addTokenToWallet = async (token: AddTokenButtonProps) => { await ethereumRequest("wallet_watchAsset", params); + }; export function AddTokenButton({ diff --git a/packages/website/components/Button/AddTokensButton.tsx b/packages/website/components/Button/AddTokensButton.tsx new file mode 100644 index 00000000000..3c196c7ca7e --- /dev/null +++ b/packages/website/components/Button/AddTokensButton.tsx @@ -0,0 +1,68 @@ +import { + ELDFELL_ADD_ETHEREUM_CHAIN, + ELDFELL_CONFIG, + GRIMSVOTN_ADD_ETHEREUM_CHAIN, + GRIMSVOTN_ADD_TOKENS, + GRIMSVOTN_CONFIG, + SEPOLIA_ADD_ETHEREUM_CHAIN, + SEPOLIA_ADD_TOKENS, + SEPOLIA_CONFIG, +} from "../../domain/chain"; + +import { ethereumRequest } from "../../utils/ethereumRequest"; + +type ConnectButtonProps = { + network: + | typeof SEPOLIA_CONFIG.names.shortName + | typeof ELDFELL_CONFIG.names.shortName + | typeof GRIMSVOTN_CONFIG.names.shortName; +}; + +const chainMap = { + Eldfell: ELDFELL_CONFIG.chainId.hex, // 167005 + Grimsvotn: GRIMSVOTN_CONFIG.chainId.hex, // 167005 + Sepolia: SEPOLIA_CONFIG.chainId.hex, // 11155111 +}; + +const configMap = { + Eldfell: ELDFELL_ADD_ETHEREUM_CHAIN, + Grimsvotn: GRIMSVOTN_ADD_ETHEREUM_CHAIN, + Sepolia: SEPOLIA_ADD_ETHEREUM_CHAIN, +}; + +const tokenConfigMap = { + Grimsvotn: GRIMSVOTN_ADD_TOKENS, + Sepolia: SEPOLIA_ADD_TOKENS, +}; + +interface AddTokensButtonProps { + network: ConnectButtonProps["network"]; +} + +const addTokensToWallet = async ({ network }: AddTokensButtonProps) => { + const { ethereum } = window as any; + + if (ethereum.chainId != chainMap[network]) { + await ethereumRequest("wallet_addEthereumChain", [configMap[network]]); + } + + for (const token of tokenConfigMap[network]) { + const params = { options: { address: token.address, symbol: token.symbol, decimals: token.decimals, image: token.image }, type: "ERC20" }; + await ethereumRequest("wallet_watchAsset", params); + } + + +}; + +export function AddTokensButton({ + network, +}: AddTokensButtonProps) { + return ( +
addTokensToWallet({ network })} + className="hover:cursor-pointer text-neutral-100 bg-[#E81899] hover:bg-[#d1168a] 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" + > + Add {network} Tokens +
+ ); +} diff --git a/packages/website/domain/chain/baseTypes.ts b/packages/website/domain/chain/baseTypes.ts index b9c10da3297..01f64320431 100644 --- a/packages/website/domain/chain/baseTypes.ts +++ b/packages/website/domain/chain/baseTypes.ts @@ -54,6 +54,15 @@ interface AddEthereumChainParameter { rpcUrls: string[]; } +// Interface from EIP-747: https://eips.ethereum.org/EIPS/eip-747 +interface AddTokenParameter { + address: string; + symbol: string; + decimals: number; + image: string; +} + + // Taiko network types interface BasedContracts { addressManager: Contract; @@ -107,6 +116,7 @@ type TaikoL2Alpha4 = TaikoL2Alpha3; export type { AddEthereumChainParameter, + AddTokenParameter, TaikoL1Alpha3, TaikoL1Alpha4, TaikoL2Alpha3, diff --git a/packages/website/domain/chain/grimsvotn/addTokens.ts b/packages/website/domain/chain/grimsvotn/addTokens.ts new file mode 100644 index 00000000000..db665a39b03 --- /dev/null +++ b/packages/website/domain/chain/grimsvotn/addTokens.ts @@ -0,0 +1,31 @@ +import { AddTokenParameter } from "../baseTypes"; +import { GRIMSVOTN_CONFIG } from "./config"; + +export const GRIMSVOTN_ADD_TTKO: AddTokenParameter = { + address: GRIMSVOTN_CONFIG.rollupContracts.erc20Contracts.bridgedTaikoToken.address.impl, + symbol: GRIMSVOTN_CONFIG.rollupContracts.erc20Contracts.bridgedTaikoToken.symbol, + decimals: GRIMSVOTN_CONFIG.rollupContracts.erc20Contracts.bridgedTaikoToken.decimals, + image: "https://raw.githubusercontent.com/taikoxyz/taiko-mono/main/packages/branding/testnet-token-images/ttko.svg" +}; + +export const GRIMSVOTN_ADD_BLL: AddTokenParameter = { + address: GRIMSVOTN_CONFIG.rollupContracts.erc20Contracts.bridgedBullToken.address.impl, + symbol: GRIMSVOTN_CONFIG.rollupContracts.erc20Contracts.bridgedBullToken.symbol, + decimals: GRIMSVOTN_CONFIG.rollupContracts.erc20Contracts.bridgedBullToken.decimals, + image: "https://raw.githubusercontent.com/taikoxyz/taiko-mono/main/packages/branding/testnet-token-images/bull.svg" +}; + +export const GRIMSVOTN_ADD_HORSE: AddTokenParameter = { + address: GRIMSVOTN_CONFIG.rollupContracts.erc20Contracts.bridgedHorseToken.address.impl, + symbol: GRIMSVOTN_CONFIG.rollupContracts.erc20Contracts.bridgedHorseToken.symbol, + decimals: GRIMSVOTN_CONFIG.rollupContracts.erc20Contracts.bridgedHorseToken.decimals, + image: "https://raw.githubusercontent.com/taikoxyz/taiko-mono/main/packages/branding/testnet-token-images/horse.svg" +}; + +export const GRIMSVOTN_ADD_TOKENS = [ + GRIMSVOTN_ADD_TTKO, + GRIMSVOTN_ADD_BLL, + GRIMSVOTN_ADD_HORSE +] + + diff --git a/packages/website/domain/chain/index.ts b/packages/website/domain/chain/index.ts index 756b57ae76a..203fff69b66 100644 --- a/packages/website/domain/chain/index.ts +++ b/packages/website/domain/chain/index.ts @@ -7,3 +7,6 @@ export { ELDFELL_CONFIG } from "./eldfell/config"; export { SEPOLIA_ADD_ETHEREUM_CHAIN } from "./sepolia/addEthereumChain"; export { GRIMSVOTN_ADD_ETHEREUM_CHAIN } from "./grimsvotn/addEthereumChain"; export { ELDFELL_ADD_ETHEREUM_CHAIN } from "./eldfell/addEthereumChain"; + +export { SEPOLIA_ADD_TOKENS } from "./sepolia/addTokens"; +export { GRIMSVOTN_ADD_TOKENS } from "./grimsvotn/addTokens"; diff --git a/packages/website/domain/chain/sepolia/addTokens.ts b/packages/website/domain/chain/sepolia/addTokens.ts new file mode 100644 index 00000000000..a2c17d2b517 --- /dev/null +++ b/packages/website/domain/chain/sepolia/addTokens.ts @@ -0,0 +1,33 @@ +import { AddTokenParameter } from "../baseTypes"; +import { SEPOLIA_CONFIG } from "./config"; + +export const SEPOLIA_ADD_TTKO: AddTokenParameter = { + address: SEPOLIA_CONFIG.basedContracts.erc20Contracts.taikoToken.address.proxy, + symbol: SEPOLIA_CONFIG.basedContracts.erc20Contracts.taikoToken.symbol, + decimals: SEPOLIA_CONFIG.basedContracts.erc20Contracts.taikoToken.decimals, + image: "https://raw.githubusercontent.com/taikoxyz/taiko-mono/main/packages/branding/testnet-token-images/ttko.svg" +}; + +export const SEPOLIA_ADD_BLL: AddTokenParameter = { + address: SEPOLIA_CONFIG.basedContracts.erc20Contracts.bullToken.address.impl, + symbol: SEPOLIA_CONFIG.basedContracts.erc20Contracts.bullToken.symbol, + decimals: SEPOLIA_CONFIG.basedContracts.erc20Contracts.bullToken.decimals, + image: "https://raw.githubusercontent.com/taikoxyz/taiko-mono/main/packages/branding/testnet-token-images/bull.svg" +}; + + +export const SEPOLIA_ADD_HORSE: AddTokenParameter = { + address: SEPOLIA_CONFIG.basedContracts.erc20Contracts.horseToken.address.impl, + symbol: SEPOLIA_CONFIG.basedContracts.erc20Contracts.horseToken.symbol, + decimals: SEPOLIA_CONFIG.basedContracts.erc20Contracts.horseToken.decimals, + image: "https://raw.githubusercontent.com/taikoxyz/taiko-mono/main/packages/branding/testnet-token-images/horse.svg" +}; + +export const SEPOLIA_ADD_TOKENS = [ + SEPOLIA_ADD_TTKO, + SEPOLIA_ADD_BLL, + SEPOLIA_ADD_HORSE +] + + + diff --git a/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx b/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx index 58315053fec..6618849412a 100644 --- a/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx +++ b/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx @@ -1,5 +1,5 @@ import { Steps } from "nextra-theme-docs"; -import { AddTokenButton } from "components/Button/AddTokenButton"; +import { AddTokensButton } from "components/Button/AddTokensButton"; import { ConnectToMetamaskButton } from "components/Button/ConnectToMetamaskButton"; import { @@ -27,38 +27,14 @@ This guide helps you connect your wallet to Taiko's networks. ### Add tokens to your wallet - - - +
- - - +
## Troubleshooting From 2ba3e011c30aaec6959efa27d7df5bb9ce2f6c2d Mon Sep 17 00:00:00 2001 From: Kenk Date: Thu, 20 Jul 2023 11:32:48 +0200 Subject: [PATCH 05/12] update css --- .../components/Button/AddTokensButton.tsx | 6 +----- .../Button/ConnectToMetamaskButton.tsx | 17 +++++++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/packages/website/components/Button/AddTokensButton.tsx b/packages/website/components/Button/AddTokensButton.tsx index 3c196c7ca7e..1fd0f5b7454 100644 --- a/packages/website/components/Button/AddTokensButton.tsx +++ b/packages/website/components/Button/AddTokensButton.tsx @@ -41,17 +41,13 @@ interface AddTokensButtonProps { const addTokensToWallet = async ({ network }: AddTokensButtonProps) => { const { ethereum } = window as any; - if (ethereum.chainId != chainMap[network]) { await ethereumRequest("wallet_addEthereumChain", [configMap[network]]); } - for (const token of tokenConfigMap[network]) { const params = { options: { address: token.address, symbol: token.symbol, decimals: token.decimals, image: token.image }, type: "ERC20" }; await ethereumRequest("wallet_watchAsset", params); } - - }; export function AddTokensButton({ @@ -60,7 +56,7 @@ export function AddTokensButton({ return (
addTokensToWallet({ network })} - className="hover:cursor-pointer text-neutral-100 bg-[#E81899] hover:bg-[#d1168a] 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" + className="hover:cursor-pointer text-neutral-100 bg-[#E81899] hover:bg-[#d1168a] 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 m-1 w-48 justify-center" > Add {network} Tokens
diff --git a/packages/website/components/Button/ConnectToMetamaskButton.tsx b/packages/website/components/Button/ConnectToMetamaskButton.tsx index 770b99acd96..813cbaf7f28 100644 --- a/packages/website/components/Button/ConnectToMetamaskButton.tsx +++ b/packages/website/components/Button/ConnectToMetamaskButton.tsx @@ -1,17 +1,18 @@ import { - SEPOLIA_CONFIG, - GRIMSVOTN_CONFIG, + ELDFELL_ADD_ETHEREUM_CHAIN, ELDFELL_CONFIG, GRIMSVOTN_ADD_ETHEREUM_CHAIN, - ELDFELL_ADD_ETHEREUM_CHAIN, + GRIMSVOTN_CONFIG, + SEPOLIA_CONFIG, } from "../../domain/chain"; + import { ethereumRequest } from "../../utils/ethereumRequest"; type ConnectButtonProps = { network: - | typeof SEPOLIA_CONFIG.names.shortName - | typeof ELDFELL_CONFIG.names.shortName - | typeof GRIMSVOTN_CONFIG.names.shortName; + | typeof SEPOLIA_CONFIG.names.shortName + | typeof ELDFELL_CONFIG.names.shortName + | typeof GRIMSVOTN_CONFIG.names.shortName; }; const chainMap = { @@ -52,7 +53,7 @@ async function ConnectToMetamask(network: ConnectButtonProps["network"]) { } catch (error) { alert( "Failed to add the network with wallet_addEthereumChain request. Add the network with https://chainlist.org/ or do it manually. Error log: " + - error.message + error.message ); } } @@ -61,7 +62,7 @@ export function ConnectToMetamaskButton(props: ConnectButtonProps) { return (
ConnectToMetamask(props.network)} - className="hover:cursor-pointer text-neutral-100 bg-[#E81899] hover:bg-[#d1168a] 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" + className="hover:cursor-pointer text-neutral-100 bg-[#E81899] hover:bg-[#d1168a] 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 m-1 w-48 justify-center" > Connect to {props.network}
From 8f5df05a35bd21c1f52d115ded18e9174d31748b Mon Sep 17 00:00:00 2001 From: d1onys1us <13951458+d1onys1us@users.noreply.github.com> Date: Thu, 20 Jul 2023 16:25:44 -0400 Subject: [PATCH 06/12] Trigger build From c0703454c79c191929371417e33a4a6643849b95 Mon Sep 17 00:00:00 2001 From: Kenk Date: Fri, 21 Jul 2023 13:15:54 +0200 Subject: [PATCH 07/12] add eldfell tokens --- .../components/Button/AddTokensButton.tsx | 8 +++-- .../website/domain/chain/eldfell/addTokens.ts | 31 +++++++++++++++++++ packages/website/domain/chain/index.ts | 1 + .../build-on-taiko/setup-your-wallet.mdx | 4 ++- 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 packages/website/domain/chain/eldfell/addTokens.ts diff --git a/packages/website/components/Button/AddTokensButton.tsx b/packages/website/components/Button/AddTokensButton.tsx index c67b9ee54e3..5eb7732a4b2 100644 --- a/packages/website/components/Button/AddTokensButton.tsx +++ b/packages/website/components/Button/AddTokensButton.tsx @@ -1,5 +1,6 @@ import { ELDFELL_ADD_ETHEREUM_CHAIN, + ELDFELL_ADD_TOKENS, ELDFELL_CONFIG, GRIMSVOTN_ADD_ETHEREUM_CHAIN, GRIMSVOTN_ADD_TOKENS, @@ -13,9 +14,9 @@ import { ethereumRequest } from "../../utils/ethereumRequest"; type ConnectButtonProps = { network: - | typeof SEPOLIA_CONFIG.names.shortName - | typeof ELDFELL_CONFIG.names.shortName - | typeof GRIMSVOTN_CONFIG.names.shortName; + | typeof SEPOLIA_CONFIG.names.shortName + | typeof ELDFELL_CONFIG.names.shortName + | typeof GRIMSVOTN_CONFIG.names.shortName; }; const chainMap = { @@ -33,6 +34,7 @@ const configMap = { const tokenConfigMap = { Grimsvotn: GRIMSVOTN_ADD_TOKENS, Sepolia: SEPOLIA_ADD_TOKENS, + Eldfell: ELDFELL_ADD_TOKENS, }; interface AddTokensButtonProps { diff --git a/packages/website/domain/chain/eldfell/addTokens.ts b/packages/website/domain/chain/eldfell/addTokens.ts new file mode 100644 index 00000000000..5a64d5ffab1 --- /dev/null +++ b/packages/website/domain/chain/eldfell/addTokens.ts @@ -0,0 +1,31 @@ +import { AddTokenParameter } from "../baseTypes"; +import { ELDFELL_CONFIG } from "./config"; + +export const ELDFELL_ADD_TTKO: AddTokenParameter = { + address: ELDFELL_CONFIG.rollupContracts.erc20Contracts.bridgedTaikoToken.address.impl, + symbol: ELDFELL_CONFIG.rollupContracts.erc20Contracts.bridgedTaikoToken.symbol, + decimals: ELDFELL_CONFIG.rollupContracts.erc20Contracts.bridgedTaikoToken.decimals, + image: "https://raw.githubusercontent.com/taikoxyz/taiko-mono/main/packages/branding/testnet-token-images/ttko.svg" +}; + +export const ELDFELL_ADD_BLL: AddTokenParameter = { + address: ELDFELL_CONFIG.rollupContracts.erc20Contracts.bridgedBullToken.address.impl, + symbol: ELDFELL_CONFIG.rollupContracts.erc20Contracts.bridgedBullToken.symbol, + decimals: ELDFELL_CONFIG.rollupContracts.erc20Contracts.bridgedBullToken.decimals, + image: "https://raw.githubusercontent.com/taikoxyz/taiko-mono/main/packages/branding/testnet-token-images/bull.svg" +}; + +export const ELDFELL_ADD_HORSE: AddTokenParameter = { + address: ELDFELL_CONFIG.rollupContracts.erc20Contracts.bridgedHorseToken.address.impl, + symbol: ELDFELL_CONFIG.rollupContracts.erc20Contracts.bridgedHorseToken.symbol, + decimals: ELDFELL_CONFIG.rollupContracts.erc20Contracts.bridgedHorseToken.decimals, + image: "https://raw.githubusercontent.com/taikoxyz/taiko-mono/main/packages/branding/testnet-token-images/horse.svg" +}; + +export const ELDFELL_ADD_TOKENS = [ + ELDFELL_ADD_TTKO, + ELDFELL_ADD_BLL, + ELDFELL_ADD_HORSE +] + + diff --git a/packages/website/domain/chain/index.ts b/packages/website/domain/chain/index.ts index 203fff69b66..8919afaa22f 100644 --- a/packages/website/domain/chain/index.ts +++ b/packages/website/domain/chain/index.ts @@ -10,3 +10,4 @@ export { ELDFELL_ADD_ETHEREUM_CHAIN } from "./eldfell/addEthereumChain"; export { SEPOLIA_ADD_TOKENS } from "./sepolia/addTokens"; export { GRIMSVOTN_ADD_TOKENS } from "./grimsvotn/addTokens"; +export { ELDFELL_ADD_TOKENS } from "./eldfell/addTokens"; diff --git a/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx b/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx index f5c75b09496..c79bbaac01b 100644 --- a/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx +++ b/packages/website/pages/docs/guides/build-on-taiko/setup-your-wallet.mdx @@ -25,10 +25,12 @@ This guide helps you connect your wallet to Taiko's networks. ### Add tokens to your wallet -
+
+ From ab3f8d65d64fbc68985927b631367c26b2cf0a41 Mon Sep 17 00:00:00 2001 From: Kenk Date: Fri, 21 Jul 2023 16:21:56 +0200 Subject: [PATCH 08/12] add TTKOe on L2 --- packages/website/domain/chain/grimsvotn/addTokens.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/website/domain/chain/grimsvotn/addTokens.ts b/packages/website/domain/chain/grimsvotn/addTokens.ts index db665a39b03..c0681a9a699 100644 --- a/packages/website/domain/chain/grimsvotn/addTokens.ts +++ b/packages/website/domain/chain/grimsvotn/addTokens.ts @@ -8,6 +8,13 @@ export const GRIMSVOTN_ADD_TTKO: AddTokenParameter = { image: "https://raw.githubusercontent.com/taikoxyz/taiko-mono/main/packages/branding/testnet-token-images/ttko.svg" }; +export const GRIMSVOTN_ADD_TTKOE: AddTokenParameter = { + address: GRIMSVOTN_CONFIG.basedContracts.erc20Contracts.taikoToken.address.proxy, + symbol: GRIMSVOTN_CONFIG.basedContracts.erc20Contracts.taikoToken.symbol, + decimals: GRIMSVOTN_CONFIG.basedContracts.erc20Contracts.taikoToken.decimals, + image: "https://raw.githubusercontent.com/taikoxyz/taiko-mono/main/packages/branding/testnet-token-images/ttko.svg" +}; + export const GRIMSVOTN_ADD_BLL: AddTokenParameter = { address: GRIMSVOTN_CONFIG.rollupContracts.erc20Contracts.bridgedBullToken.address.impl, symbol: GRIMSVOTN_CONFIG.rollupContracts.erc20Contracts.bridgedBullToken.symbol, @@ -24,6 +31,7 @@ export const GRIMSVOTN_ADD_HORSE: AddTokenParameter = { export const GRIMSVOTN_ADD_TOKENS = [ GRIMSVOTN_ADD_TTKO, + GRIMSVOTN_ADD_TTKOE, GRIMSVOTN_ADD_BLL, GRIMSVOTN_ADD_HORSE ] From 0479dd5df47e6ca05da8bfcc3f7ae8ef6367bcbd Mon Sep 17 00:00:00 2001 From: dave | d1onys1us <13951458+d1onys1us@users.noreply.github.com> Date: Fri, 21 Jul 2023 09:53:44 -0400 Subject: [PATCH 09/12] feat(website): add node runner manuals (#14236) --- packages/website/pages/docs/_meta.json | 6 +- .../website/pages/docs/manuals/_meta.json | 3 +- .../manuals/node-runner-manuals/_meta.json | 4 ++ .../eldfell-l3-node-runner-manual.mdx | 67 +++++++++++++++++++ .../grimsvotn-l2-node-runner-manual.mdx | 67 +++++++++++++++++++ 5 files changed, 143 insertions(+), 4 deletions(-) create mode 100644 packages/website/pages/docs/manuals/node-runner-manuals/_meta.json create mode 100644 packages/website/pages/docs/manuals/node-runner-manuals/eldfell-l3-node-runner-manual.mdx create mode 100644 packages/website/pages/docs/manuals/node-runner-manuals/grimsvotn-l2-node-runner-manual.mdx diff --git a/packages/website/pages/docs/_meta.json b/packages/website/pages/docs/_meta.json index 280f9538e95..1f83565266b 100644 --- a/packages/website/pages/docs/_meta.json +++ b/packages/website/pages/docs/_meta.json @@ -8,13 +8,13 @@ "reference": { "title": "Reference" }, + "manuals": { + "title": "Manuals" + }, "concepts": { "title": "Concepts" }, "resources": { "title": "Resources" - }, - "manuals": { - "title": "Manuals" } } diff --git a/packages/website/pages/docs/manuals/_meta.json b/packages/website/pages/docs/manuals/_meta.json index 09d486fcee0..c5204216352 100644 --- a/packages/website/pages/docs/manuals/_meta.json +++ b/packages/website/pages/docs/manuals/_meta.json @@ -1,4 +1,5 @@ { "contributing-manual": "Contributing manual", - "integration-manual": "Integration manual" + "integration-manual": "Integration manual", + "node-runner-manuals": "Node runner manuals" } diff --git a/packages/website/pages/docs/manuals/node-runner-manuals/_meta.json b/packages/website/pages/docs/manuals/node-runner-manuals/_meta.json new file mode 100644 index 00000000000..00670cdc45b --- /dev/null +++ b/packages/website/pages/docs/manuals/node-runner-manuals/_meta.json @@ -0,0 +1,4 @@ +{ + "grimsvotn-l2-node-runner-manual": "Grimsvotn L2 node runner manual", + "eldfell-l3-node-runner-manual": "Eldfell L3 node runner manual" +} diff --git a/packages/website/pages/docs/manuals/node-runner-manuals/eldfell-l3-node-runner-manual.mdx b/packages/website/pages/docs/manuals/node-runner-manuals/eldfell-l3-node-runner-manual.mdx new file mode 100644 index 00000000000..a68fa366b01 --- /dev/null +++ b/packages/website/pages/docs/manuals/node-runner-manuals/eldfell-l3-node-runner-manual.mdx @@ -0,0 +1,67 @@ +# Eldfell L3 node runner manual + +## Start node + +```sh +docker compose -f ./docker-compose.l3.yml --env-file .env.l3 up -d +``` + +## Stop node + +```sh +docker compose -f ./docker-compose.l3.yml --env-file .env.l3 down +``` + +## Update node + +```sh +git pull origin main && docker compose -f ./docker-compose.l3.yml --env-file .env.l3 pull +``` + +## Remove node + +```sh +docker compose -f ./docker-compose.l3.yml --env-file .env.l3 down -v +``` + +## View grafana dashboard + +```sh +open http://localhost:3001/d/L2ExecutionEngine/l2-execution-engine-overview +``` + +## View all logs + +```sh +docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f +``` + +## View execution logs + +```sh +docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f l2_execution_engine +``` + +## View client driver logs + +```sh +docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f taiko_client_driver +``` + +## View client proposer logs + +```sh +docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f taiko_client_proposer +``` + +## View client prover relayer logs + +```sh +docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f taiko_client_prover_relayer +``` + +## View zkevm prover logs + +```sh +docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f zkevm-chain-prover-rpcd +``` diff --git a/packages/website/pages/docs/manuals/node-runner-manuals/grimsvotn-l2-node-runner-manual.mdx b/packages/website/pages/docs/manuals/node-runner-manuals/grimsvotn-l2-node-runner-manual.mdx new file mode 100644 index 00000000000..4b481bca7b7 --- /dev/null +++ b/packages/website/pages/docs/manuals/node-runner-manuals/grimsvotn-l2-node-runner-manual.mdx @@ -0,0 +1,67 @@ +# Grimsvotn L2 node runner manual + +## Start node + +```sh +docker compose up -d +``` + +## Stop node + +```sh +docker compose down +``` + +## Update node + +```sh +git pull origin main && docker compose pull +``` + +## Remove node + +```sh +docker compose down -v +``` + +## View grafana dashboard + +```sh +open http://localhost:3000/d/L2ExecutionEngine/l2-execution-engine-overview +``` + +## View all logs + +```sh +docker compose logs -f +``` + +## View execution logs + +```sh +docker compose logs -f l2_execution_engine +``` + +## View client driver logs + +```sh +docker compose logs -f taiko_client_driver +``` + +## View client proposer logs + +```sh +docker compose logs -f taiko_client_proposer +``` + +## View client prover relayer logs + +```sh +docker compose logs -f taiko_client_prover_relayer +``` + +## View zkevm prover logs + +```sh +docker compose logs -f zkevm-chain-prover-rpcd +``` From f9faa6e7d071c35643b6497407e846b543d97760 Mon Sep 17 00:00:00 2001 From: Kenk Date: Fri, 21 Jul 2023 15:55:05 +0200 Subject: [PATCH 10/12] feat(website): add warning for casual provers (#14232) --- .../website/pages/docs/guides/run-a-node/enable-a-prover.mdx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/website/pages/docs/guides/run-a-node/enable-a-prover.mdx b/packages/website/pages/docs/guides/run-a-node/enable-a-prover.mdx index f5d0ebd8ebf..a2c9c5bcd12 100644 --- a/packages/website/pages/docs/guides/run-a-node/enable-a-prover.mdx +++ b/packages/website/pages/docs/guides/run-a-node/enable-a-prover.mdx @@ -1,5 +1,10 @@ import { Callout, Steps } from "nextra-theme-docs"; + + Keep in mind that running a prover is a very competitive space, and those who generate proofs will have very powerful machines and optimized clients. + It's unlikely to prove a block and gain rewards with the default client and minimum hardware requirements. + + # Enable a prover This guide will help you enable your Taiko node as a prover. Read more about prover dynamics [here](/docs/concepts/proving#prover-dynamics) (especially to set your expectations about running a prover). From ad4df332399e36de65042c76f0e8cc66e03af823 Mon Sep 17 00:00:00 2001 From: Kenk Date: Fri, 21 Jul 2023 15:56:07 +0200 Subject: [PATCH 11/12] feat(website): add l3 error handling (#14231) --- .../website/pages/docs/guides/run-a-node/run-a-taiko-node.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/website/pages/docs/guides/run-a-node/run-a-taiko-node.mdx b/packages/website/pages/docs/guides/run-a-node/run-a-taiko-node.mdx index c005eb86f11..3fea8aa9ba2 100644 --- a/packages/website/pages/docs/guides/run-a-node/run-a-taiko-node.mdx +++ b/packages/website/pages/docs/guides/run-a-node/run-a-taiko-node.mdx @@ -357,6 +357,10 @@ This issue occurs on windows because of the Control Characters in this case the If you do not want to delete the node folder, please follow one of these steps below. +#### `no contract code at given address` + +When running a L3 node, users may run into this issue if their underlying L2 is still syncing. Please wait until your L2 is fully synced before starting your L3 node. + {" "} From a7707e71107d66670a963680c3b4ad87091988d6 Mon Sep 17 00:00:00 2001 From: dave | d1onys1us <13951458+d1onys1us@users.noreply.github.com> Date: Fri, 21 Jul 2023 11:24:29 -0400 Subject: [PATCH 12/12] feat(website): add private key warning (#14240) --- .../docs/guides/run-a-node/enable-a-proposer.mdx | 6 ++++++ .../pages/docs/guides/run-a-node/enable-a-prover.mdx | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/website/pages/docs/guides/run-a-node/enable-a-proposer.mdx b/packages/website/pages/docs/guides/run-a-node/enable-a-proposer.mdx index e8f40159505..f05f61cc92a 100644 --- a/packages/website/pages/docs/guides/run-a-node/enable-a-proposer.mdx +++ b/packages/website/pages/docs/guides/run-a-node/enable-a-proposer.mdx @@ -58,6 +58,12 @@ Open the `.env` file in the `simple-taiko-node` directory. ### Set environment variables to enable a proposer + + Do **not** use a private key that is valuable to you. The private key will be + stored in plain text in the `.env` file, and this is not secure. There is a + real risk of losing your assets. You should **only use a test account**. + + Set the following environment variables to enable your node as a proposer: - Set `ENABLE_PROPOSER` to `true` (replacing the default `false` with `true`). diff --git a/packages/website/pages/docs/guides/run-a-node/enable-a-prover.mdx b/packages/website/pages/docs/guides/run-a-node/enable-a-prover.mdx index a2c9c5bcd12..c991df6181c 100644 --- a/packages/website/pages/docs/guides/run-a-node/enable-a-prover.mdx +++ b/packages/website/pages/docs/guides/run-a-node/enable-a-prover.mdx @@ -1,8 +1,10 @@ import { Callout, Steps } from "nextra-theme-docs"; - Keep in mind that running a prover is a very competitive space, and those who generate proofs will have very powerful machines and optimized clients. - It's unlikely to prove a block and gain rewards with the default client and minimum hardware requirements. + Keep in mind that running a prover is a very competitive space, and those who + generate proofs will have very powerful machines and optimized clients. It's + unlikely to prove a block and gain rewards with the default client and minimum + hardware requirements. # Enable a prover @@ -23,6 +25,12 @@ Open the `.env` file in the `simple-taiko-node` directory. ### Set environment variables to enable prover + + Do **not** use a private key that is valuable to you. The private key will be + stored in plain text in the `.env` file, and this is not secure. There is a + real risk of losing your assets. You should **only use a test account**. + + Set the following environment variables to enable your node as a prover: - Set `ENABLE_PROVER` to `true` (replacing the default `false` with `true`).