forked from Gazamony/ReputeX
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
50 lines (34 loc) · 1.02 KB
/
Copy pathindex.html
File metadata and controls
50 lines (34 loc) · 1.02 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<title>ReputeX</title>
</head>
<body>
<h1>ReputeX</h1>
<button id="connect">Connect Wallet</button>
<br><br>
<input id="achievement" placeholder="Enter achievement">
<button id="claim">Claim Achievement</button>
<script src="https://cdn.ethers.io/lib/ethers-6.9.0.umd.min.js"></script>
<script>
const contractAddress = "0xC40C7A54148f24C1f23533733E1d54070fC17D6a";
const abi = [
"function claim(string _title)"
];
let provider, signer, contract;
document.getElementById("connect").onclick = async () => {
provider = new ethers.BrowserProvider(window.ethereum);
await provider.send("eth_requestAccounts", []);
signer = await provider.getSigner();
alert("Wallet Connected");
};
document.getElementById("claim").onclick = async () => {
const text = document.getElementById("achievement").value;
contract = new ethers.Contract(contractAddress, abi, signer);
const tx = await contract.claim(text);
await tx.wait();
alert("Achievement stored on IOPn!");
};
</script>
</body>
</html>