Created
April 24, 2023 08:15
-
-
Save RareSkills/396d9b1f242c4c3b022b07f6e6a0ac4e 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 SendFunds from "./RareSend"; | |
import { useEffect } from "react"; | |
import styles from "@/styles/Home.module.css"; | |
import { MintNFT } from "./mint"; | |
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 */} | |
<SendFunds disabled={!isConnected} /> | |
{/* mint nft */} | |
<MintNFT /> | |
</div> | |
</> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment