Skip to content
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

feat(app): add deployed chains #1530

Merged
merged 3 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/.env-example.env
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,5 @@ NEXT_PUBLIC_MAINTENANCE_MODE_ON=["2023-06-07T21:00:00.000Z", "2023-06-08T22:15:0
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=YOUR_WALLET_CONNECT_PROJECT_ID
NEXT_PUBLIC_WEB3_ONBOARD_EXPLORE_URL=http://localhost:3000/

NEXT_PUBLIC_ACTIVE_ON_CHAIN_PASSPORT_CHAINIDS=["0x14a33"]
NEXT_PUBLIC_ACTIVE_ON_CHAIN_PASSPORT_CHAINIDS=["0x14a33"]
NEXT_PUBLIC_POSSIBLE_ON_CHAIN_PASSPORT_CHAINIDS=["0x1a8", "0x14a33"]
7 changes: 6 additions & 1 deletion app/components/OnchainSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ import { Drawer, DrawerContent, DrawerHeader, DrawerBody, DrawerOverlay, DrawerC
import { useEffect, useState } from "react";
import { chains } from "../utils/onboard";
import { NetworkCard } from "./NetworkCard";
import { pgnChainId, lineaChainId, optimismChainId, goerliBaseChainId } from "../utils/onboard";

type OnchainSidebarProps = {
isOpen: boolean;
onClose: () => void;
};

const onChainPassportChainIds = JSON.parse(process.env.NEXT_PUBLIC_POSSIBLE_ON_CHAIN_PASSPORT_CHAINIDS || "[]");

const deployedChains = chains.filter((chain) => onChainPassportChainIds.includes(chain.id));

export function OnchainSidebar({ isOpen, onClose }: OnchainSidebarProps) {
const activeOnChainPassportChains = process.env.NEXT_PUBLIC_ACTIVE_ON_CHAIN_PASSPORT_CHAINIDS;
const [activeChains, setActiveChains] = useState<string[]>([]);
Expand Down Expand Up @@ -41,7 +46,7 @@ export function OnchainSidebar({ isOpen, onClose }: OnchainSidebarProps) {
</div>
</DrawerHeader>
<DrawerBody>
{chains.map((chain) => (
{deployedChains.map((chain) => (
<NetworkCard key={chain.id} chain={chain} activeChains={activeChains} />
))}
</DrawerBody>
Expand Down
Binary file added app/public/assets/linea-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/public/assets/pgn-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions app/utils/onboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const ledger = ledgerModule();
export const sepoliaChainId = "0xaa36a7";
export const hardhatChainId = "0x7a69";
export const baseGoerliChainId = "0x14a33";
export const pgnChainId = "0x1a8";
export const lineaChainId = "0xe708";
export const optimismChainId = "0xa";
export const goerliBaseChainId = "0x14a33";

export const chains = [
{
Expand Down Expand Up @@ -77,6 +81,27 @@ if (process.env.NEXT_PUBLIC_FF_MULTICHAIN_SIGNATURE === "on") {
icon: "./assets/eth-network-logo.svg",
});
}
chains.push({
id: optimismChainId,
token: "ETH",
label: "Optimism Mainnet",
rpcUrl: "https://mainnet.optimism.io/",
icon: "./assets/op-logo.svg",
});
chains.push({
id: lineaChainId,
token: "ETH",
label: "Linea",
rpcUrl: "https://rpc.linea.build",
icon: "./assets/linea-logo.png",
});
chains.push({
id: pgnChainId,
token: "ETH",
label: "PGN",
rpcUrl: "https://rpc.publicgoods.network ",
icon: "./assets/pgn-logo.png",
});

// Exports onboard-core instance (https://github.com/blocknative/web3-onboard)
export const initWeb3Onboard = init({
Expand Down
Loading