From 717123b3057d927b5f3a0b614869678a5d48c7e9 Mon Sep 17 00:00:00 2001 From: Alain Nicolas Date: Sun, 7 Jan 2024 00:47:10 +0100 Subject: [PATCH] feat: Better Web3Modal support for the website --- .github/workflows/website-deploy.yml | 3 +++ website/src/assets/arbitrum-mainnet.svg | 36 +++++++++++++++++++++++++ website/src/assets/arbitrum-testnet.svg | 36 +++++++++++++++++++++++++ website/src/assets/linea-mainnet.svg | 7 +++++ website/src/assets/linea-testnet.svg | 7 +++++ website/src/main.tsx | 19 +++++++++++-- 6 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 website/src/assets/arbitrum-mainnet.svg create mode 100644 website/src/assets/arbitrum-testnet.svg create mode 100644 website/src/assets/linea-mainnet.svg create mode 100644 website/src/assets/linea-testnet.svg diff --git a/.github/workflows/website-deploy.yml b/.github/workflows/website-deploy.yml index a8e232c8..af9bfb04 100644 --- a/.github/workflows/website-deploy.yml +++ b/.github/workflows/website-deploy.yml @@ -61,6 +61,9 @@ jobs: - name: Build run: pnpm run build + env: + VITE_WALLETCONNECT_PROJECT_ID: ${{ secrets.VITE_WALLETCONNECT_PROJECT_ID }} + VITE_INFURA_API_KEY: ${{ secrets.VITE_INFURA_API_KEY }} - name: Setup Pages uses: actions/configure-pages@v3 diff --git a/website/src/assets/arbitrum-mainnet.svg b/website/src/assets/arbitrum-mainnet.svg new file mode 100644 index 00000000..ae766afc --- /dev/null +++ b/website/src/assets/arbitrum-mainnet.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + diff --git a/website/src/assets/arbitrum-testnet.svg b/website/src/assets/arbitrum-testnet.svg new file mode 100644 index 00000000..ea09a8cc --- /dev/null +++ b/website/src/assets/arbitrum-testnet.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + diff --git a/website/src/assets/linea-mainnet.svg b/website/src/assets/linea-mainnet.svg new file mode 100644 index 00000000..e77dbeea --- /dev/null +++ b/website/src/assets/linea-mainnet.svg @@ -0,0 +1,7 @@ + + + + diff --git a/website/src/assets/linea-testnet.svg b/website/src/assets/linea-testnet.svg new file mode 100644 index 00000000..0eddf2a8 --- /dev/null +++ b/website/src/assets/linea-testnet.svg @@ -0,0 +1,7 @@ + + + + diff --git a/website/src/main.tsx b/website/src/main.tsx index ec27a57e..953bd88f 100644 --- a/website/src/main.tsx +++ b/website/src/main.tsx @@ -3,8 +3,12 @@ import ReactDOM from "react-dom/client"; import App from "./App.tsx"; import "./index.css"; import { WagmiConfig } from "wagmi"; -import { linea, lineaTestnet, arbitrum, arbitrumGoerli, mainnet } from "wagmi/chains"; +import { arbitrum, arbitrumGoerli, linea, lineaTestnet, mainnet } from "wagmi/chains"; import { createWeb3Modal, defaultWagmiConfig } from "@web3modal/wagmi/react"; +import LineaMainnetIcon from "./assets/linea-mainnet.svg"; +import LineaTestnetIcon from "./assets/linea-testnet.svg"; +import ArbitrumMainnetIcon from "./assets/arbitrum-mainnet.svg"; +import ArbitrumTestnetIcon from "./assets/arbitrum-testnet.svg"; const projectId = import.meta.env.VITE_WALLETCONNECT_PROJECT_ID || ""; @@ -16,7 +20,18 @@ const metadata = { const chains = [linea, lineaTestnet, arbitrum, arbitrumGoerli, mainnet]; const wagmiConfig = defaultWagmiConfig({ chains, projectId, metadata }); -createWeb3Modal({ wagmiConfig, projectId, chains }); +createWeb3Modal({ + wagmiConfig, + projectId, + chains, + defaultChain: linea, + chainImages: { + 59144: LineaMainnetIcon, + 59140: LineaTestnetIcon, + 42161: ArbitrumMainnetIcon, + 421613: ArbitrumTestnetIcon, + }, +}); ReactDOM.createRoot(document.getElementById("root")!).render(