From eddeab51d6cb522b18e87535004449041c1a3148 Mon Sep 17 00:00:00 2001 From: Hamid Roohi Date: Fri, 4 Oct 2024 17:25:50 +0330 Subject: [PATCH 1/9] feat(network): add darwinia network to the app --- context/Web3Modal.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/context/Web3Modal.tsx b/context/Web3Modal.tsx index 988853b4..ecd1c99c 100644 --- a/context/Web3Modal.tsx +++ b/context/Web3Modal.tsx @@ -10,7 +10,8 @@ import { PUB_WALLET_ICON, PUB_WEB3_ENDPOINT, } from "@/constants"; -import { mainnet } from "viem/chains"; +import { mainnet, darwinia } from "viem/chains"; +import type { Chain } from "viem/chains"; // wagmi config const metadata = { @@ -20,8 +21,20 @@ const metadata = { icons: [PUB_WALLET_ICON], }; +// const crabChain: Chain = { +// // Define your Crab network configuration +// id: 421611, // Crab network chain ID +// name: "Darwinia Crab", +// rpcUrls: { default: { http: ["https://crab.rpc.darwinia.network"] } }, +// nativeCurrency: { +// decimals: 18, +// name: "Crab", +// symbol: "CRAB", +// }, +// blockExplorers: { default: { name: "Etherscan", url: "https://etherscan.io" } }, +// }; export const config = createConfig({ - chains: [PUB_CHAIN, mainnet], + chains: [PUB_CHAIN, mainnet, darwinia], ssr: true, transports: { [PUB_CHAIN.id]: http(PUB_WEB3_ENDPOINT, { batch: true }), From 2a9a8ab0f86ee43e50cf975f50f751481107289a Mon Sep 17 00:00:00 2001 From: Hamid Roohi Date: Fri, 4 Oct 2024 18:06:41 +0330 Subject: [PATCH 2/9] fix(darwinia chain): add transporter --- context/Web3Modal.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/context/Web3Modal.tsx b/context/Web3Modal.tsx index ecd1c99c..1eacf92f 100644 --- a/context/Web3Modal.tsx +++ b/context/Web3Modal.tsx @@ -39,6 +39,7 @@ export const config = createConfig({ transports: { [PUB_CHAIN.id]: http(PUB_WEB3_ENDPOINT, { batch: true }), [mainnet.id]: http(PUB_WEB3_ENDPOINT, { batch: true }), + [darwinia.id]: http(PUB_WEB3_ENDPOINT, { batch: true }), }, connectors: [ walletConnect({ From 223d189aa4646f0401043adbadcf1615164b0fc7 Mon Sep 17 00:00:00 2001 From: Hamid Roohi Date: Fri, 4 Oct 2024 18:25:07 +0330 Subject: [PATCH 3/9] feat(koi and crab): add koi and crab networks --- context/Web3Modal.tsx | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/context/Web3Modal.tsx b/context/Web3Modal.tsx index 1eacf92f..ea42bad7 100644 --- a/context/Web3Modal.tsx +++ b/context/Web3Modal.tsx @@ -21,25 +21,41 @@ const metadata = { icons: [PUB_WALLET_ICON], }; -// const crabChain: Chain = { -// // Define your Crab network configuration -// id: 421611, // Crab network chain ID -// name: "Darwinia Crab", -// rpcUrls: { default: { http: ["https://crab.rpc.darwinia.network"] } }, -// nativeCurrency: { -// decimals: 18, -// name: "Crab", -// symbol: "CRAB", -// }, -// blockExplorers: { default: { name: "Etherscan", url: "https://etherscan.io" } }, -// }; +const crabChain: Chain = { + // Define your Crab network configuration + id: 44, // Crab network chain ID + name: "Crab2", + rpcUrls: { default: { http: ["https://crab-rpc.darwinia.network"] } }, + nativeCurrency: { + decimals: 18, + name: "Crab", + symbol: "CRAB", + }, + blockExplorers: { default: { name: "Carb scab", url: "https://crab-scan.darwinia.network/" } }, +}; + +const KoiChain: Chain = { + // Define your Crab network configuration + id: 701, // Crab network chain ID + name: "Koi", + rpcUrls: { default: { http: ["https://koi-rpc.darwinia.network"] } }, + nativeCurrency: { + decimals: 18, + name: "KRing", + symbol: "KRING", + }, + blockExplorers: { default: { name: "Koi scab", url: "https://koi-scan.darwinia.network/" } }, +}; + export const config = createConfig({ - chains: [PUB_CHAIN, mainnet, darwinia], + chains: [PUB_CHAIN, mainnet, darwinia, crabChain, KoiChain], ssr: true, transports: { [PUB_CHAIN.id]: http(PUB_WEB3_ENDPOINT, { batch: true }), [mainnet.id]: http(PUB_WEB3_ENDPOINT, { batch: true }), [darwinia.id]: http(PUB_WEB3_ENDPOINT, { batch: true }), + [crabChain.id]: http(PUB_WEB3_ENDPOINT, { batch: true }), + [KoiChain.id]: http(PUB_WEB3_ENDPOINT, { batch: true }), }, connectors: [ walletConnect({ From 93a560b785e5da5d02683324b8f2bd0edaafb4d6 Mon Sep 17 00:00:00 2001 From: Hamid Roohi Date: Fri, 4 Oct 2024 18:41:27 +0330 Subject: [PATCH 4/9] fix(text and title): fix logo and text changes by network changes --- components/layout.tsx | 4 ++-- components/nav/navbar.tsx | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/components/layout.tsx b/components/layout.tsx index fce7797d..8e084c97 100644 --- a/components/layout.tsx +++ b/components/layout.tsx @@ -5,7 +5,7 @@ import Footer from "./footer"; export const Layout: React.FC<{ children: ReactNode }> = (props) => { return ( -
+
= (props) => { className="absolute left-0 right-0 top-0 h-[100vh] w-[100vw] object-contain object-left-top" /> -
+
{props.children} diff --git a/components/nav/navbar.tsx b/components/nav/navbar.tsx index ac34622b..b81de2a9 100644 --- a/components/nav/navbar.tsx +++ b/components/nav/navbar.tsx @@ -7,9 +7,13 @@ import Link from "next/link"; import { useState } from "react"; import { MobileNavDialog } from "./mobileNavDialog"; import { NavLink, type INavLink } from "./navLink"; +import { useChainId } from "wagmi"; export const Navbar: React.FC = () => { const [open, setOpen] = useState(false); + const chainId = useChainId(); + + console.log("chain id", chainId); const navLinks: INavLink[] = [ // { path: "/", id: "dashboard", name: "Dashboard", icon: IconType.APP_DASHBOARD }, @@ -23,21 +27,24 @@ export const Navbar: React.FC = () => { return ( <> -