diff --git a/client/src/App.js b/client/src/App.js index 79b3020..6c14d8b 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -1,13 +1,46 @@ import "./App.css"; +import {} from "ethers"; +import { useEffect, useState } from "react"; +import { withEth } from "./lib/eth"; function App() { + const [currentAccount, setCurrentAccount] = useState(""); + + const checkIfWalletConnected = withEth(async (ethereum) => { + const accounts = await ethereum.request({ method: "eth_accounts" }); + if (accounts.length !== 0) { + console.log(`Found authorized account ${accounts[0]}`); + setCurrentAccount(accounts[0]); + } + }); + + const connectWallet = withEth(async (ethereum) => { + const accounts = await ethereum.request({ method: "eth_requestAccounts" }); + console.log(`connected to ${accounts[0]}`); + setCurrentAccount(accounts[0]); + }); + + const mintNFT = withEth(async (ethereum) => {}); + + useEffect(() => { + checkIfWalletConnected(); + }, []); + return (
EpicNFTs Collection
Each unique. Each beautiful. Discover your NFT today.
- + {currentAccount ? ( + + ) : ( + + )}