File tree Expand file tree Collapse file tree
packages/nextjs/components/helper/RainbowKitCustomConnectButton Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { useDisconnect } from "wagmi" ;
2- import { ArrowLeftOnRectangleIcon , ChevronDownIcon , ExclamationTriangleIcon } from "@heroicons/react/24/outline" ;
1+ import { useDisconnect , useSwitchChain } from "wagmi" ;
2+ import {
3+ ArrowLeftOnRectangleIcon ,
4+ ArrowsRightLeftIcon ,
5+ ChevronDownIcon ,
6+ ExclamationTriangleIcon ,
7+ } from "@heroicons/react/24/outline" ;
8+ import { sepolia } from "~~/utils/chains" ;
39
410export const WrongNetworkDropdown = ( ) => {
511 const { disconnect } = useDisconnect ( ) ;
12+ const { switchChain, isPending } = useSwitchChain ( ) ;
613
714 return (
815 < div className = "dropdown dropdown-end mr-2" >
@@ -20,6 +27,17 @@ export const WrongNetworkDropdown = () => {
2027 < span > Switch to Sepolia from your wallet to use DarkONNET transactions.</ span >
2128 </ span >
2229 </ li >
30+ < li >
31+ < button
32+ className = "smooth-action menu-item btn-sm rounded-xl! flex gap-3 py-3"
33+ type = "button"
34+ disabled = { isPending }
35+ onClick = { ( ) => switchChain ( { chainId : sepolia . id } ) }
36+ >
37+ < ArrowsRightLeftIcon className = "h-6 w-4 ml-2 sm:ml-0" />
38+ < span > { isPending ? "Opening wallet..." : "Switch to Sepolia" } </ span >
39+ </ button >
40+ </ li >
2341 < li >
2442 < button
2543 className = "smooth-action menu-item text-error btn-sm rounded-xl! flex gap-3 py-3"
You can’t perform that action at this time.
0 commit comments