Skip to content

Commit

Permalink
feat: Better Web3Modal support for the website
Browse files Browse the repository at this point in the history
  • Loading branch information
alainncls committed Jan 6, 2024
1 parent a1924be commit 717123b
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/website-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 36 additions & 0 deletions website/src/assets/arbitrum-mainnet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions website/src/assets/arbitrum-testnet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions website/src/assets/linea-mainnet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions website/src/assets/linea-testnet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 17 additions & 2 deletions website/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 || "";

Expand All @@ -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(
<React.StrictMode>
Expand Down

0 comments on commit 717123b

Please sign in to comment.