-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
30 lines (24 loc) · 837 Bytes
/
script.js
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
async function checkWhitelist() {
const address = document.getElementById("addressInput").value.trim();
const result = document.getElementById("result");
if (!address) {
result.textContent = "Please enter an address.";
return;
}
try {
const response = await fetch("whitelist.json");
const data = await response.json();
let wlSpots = "no wl for this address";
for (let entry of data) {
if (entry.address === address) {
wlSpots = `You have ${entry.count} whitelist spot(s).`;
break;
}
}
result.textContent = wlSpots;
} catch (error) {
result.textContent = "Error checking whitelist. Please try again.";
console.error(error);
}
}
document.getElementById("checkButton").addEventListener("click", checkWhitelist);