Created
April 24, 2023 08:01
-
-
Save RareSkills/b370d4e097f996df3ae8f988600160d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useAccount, useConnect } from "wagmi"; | |
import { useEffect } from "react"; | |
import styles from "@/styles/Home.module.css"; | |
export default function Home() { | |
const { connect, connectors } = useConnect(); | |
const { isConnected } = useAccount(); | |
useEffect(() => { | |
console.log( | |
`Current connection status: ${isConnected ? "connected" : "disconnected"}` | |
); | |
}, [isConnected]); | |
return ( | |
<> | |
<p | |
className={styles.status} | |
style={{ | |
color: isConnected ? "green" : "red", | |
}} | |
> | |
{" "} | |
{isConnected !== undefined | |
? isConnected | |
? "Connected" | |
: "Disconnected" | |
: "loading..."} | |
</p> | |
<div className={styles.maincontainer}> | |
<div className={styles.container}> | |
<div className={styles.buttonswrapper}> | |
<div className={styles.buttonswrapperGrid}> | |
{connectors.map((connector) => ( | |
<button | |
suppressHydrationWarning | |
key={connector.id} | |
onClick={() => connect({ connector })} | |
className={styles.button28} | |
> | |
{connector.name} | |
</button> | |
))} | |
</div> | |
</div> | |
</div> | |
{/* send funds */} | |
{/* mint nft */} | |
</div> | |
</> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment