-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
90 lines (88 loc) · 2.95 KB
/
index.html
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="style.css" rel="stylesheet">
<link href="custom.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.7.0-rc.0/web3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.7/handlebars.min.js"></script>
<script src="https://unpkg.com/f0js/dist/f0.js"></script>
<script src="https://unpkg.com/@walletconnect/web3-provider/dist/umd/index.min.js"></script>
<script src="https://unpkg.com/web3modal@1.9.5/dist/index.js"></script>
<script src="connect.js"></script>
<script id="template" type="text/x-handlebars-template">
<img src="{{image}}">
<h1>{{title}}</h1>
{{#if table}}
<table class='invites'>
<tr>
<th>mint price</th>
<th>mint limit</th>
<th>Invite</th>
</tr>
{{#each items}}
<tr>
<td>{{eth}} ETH</td>
<td>{{limit}}</td>
<td><a class='btn' href="mint.html#address={{address}}&key={{key}}">Go</td</a></td>
</tr>
{{/each}}
</table>
<div class='power'>
<div class='line'>
<div class='b'>verified contract</div>
<a target="_blank" href="{{etherscan}}">{{contract}}</a>
</div>
<div class='line'>
<div class='b'>collection explorer</div>
<a target="_blank" href="https://open.factoria.app/contract/#{{contract}}">Factoria</a>
</div>
</div>
{{/if}}
</script>
<script>
const template = Handlebars.compile(document.querySelector("#template").innerHTML);
document.addEventListener("DOMContentLoaded", async () => {
let config = await fetch("box.json").then((r) => {
return r.json()
})
try {
let { f0, web3, cached } = await connect(config)
let net = await web3.eth.getChainId()
let netPrefix = (net.toString() === "4" ? "rinkeby." : "")
let etherscan = `https://${netPrefix}etherscan.io/address/${config.contract}#code`
const name = await f0.name()
const symbol = await f0.symbol()
const placeholder = await f0.placeholder()
const invites = await f0.myInvites()
let image = (cached && cached[placeholder.converted.image] ? cached[placeholder.converted.image] : placeholder.converted.image)
document.querySelector(".box").innerHTML = template({
title: `${name} (${symbol}) Invite List`,
image,
etherscan,
contract: config.contract,
table: (Object.keys(invites).length > 0),
items: Object.keys(invites).map((key, index) => {
return {
index: index,
address: config.contract,
key: key,
eth: invites[key].condition.converted.eth,
limit: invites[key].condition.converted.limit
}
})
})
} catch (e) {
document.querySelector(".box").classList.add("hidden")
document.querySelector(".error").innerHTML = `${e.message.toLowerCase()}`
}
})
</script>
</head>
<body>
<div class='box'>
<div class="lds-ripple"><div></div><div></div></div>
<h2>Loading...</h2>
</div>
<pre class='error'></pre>
</body>
</html>