-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
34 lines (29 loc) · 793 Bytes
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { useState } from "react";
import ConnectWallet from "../components/connect-wallet";
import { useSigner } from "../hooks/use-signer";
export default function Home() {
const signer = useSigner();
const [signature, setSignature] = useState<string>();
return (
<div>
<main>
<h1>Integrate MetaMask into Next.js React App</h1>
<ConnectWallet />
{signer && (
<>
<h2>Sign a message</h2>
<p>Signature is: {signature}</p>
<button
onClick={async () => {
const signature = await signer.signMessage("hey");
setSignature(signature);
}}
>
Sign
</button>
</>
)}
</main>
</div>
);
}