-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
115 lines (115 loc) · 3.4 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html>
<head>
<script src="https://aloycwl.github.io/js/cdn/jquery.min.js"></script>
<script src="https://aloycwl.github.io/js/cdn/web3.min.js"></script>
<script src="https://aloycwl.github.io/js/cdn/web3ac.js"></script>
<style>
@font-face {
font-family: cartoonlsg;
src: url('https://aloycwl.github.io/lsg_frontend/css/cartoonfont.ttf');
}
* {
font-family: cartoonlsg;
}
</style>
</head>
<body>
<button id="connect" onclick="start()">Connect</button>
<br /><br />
<div id="root">
<button onclick="changeNum(-1)">-</button>
<button id="mintBtn" onclick="mint()">Mint 1</button>
<button onclick="changeNum(1)">+</button>
</div>
<br /><br />
<a id="count3333"></a> <a id="addr"></a> <br /><br />
<div id="nfts" class=""></div>
</body>
<script>
num = 1;
CHAIN = 5;
CS = 'https://aloycwl.github.io/lsg_frontend/css/lsg.css';
function getString() {
$('#addr').html(
acct.substring(0, 3) +
'.........' +
acct.substring(acct.length - 4, acct.length)
);
}
function changeNum(n) {
num += n;
num = num < 1 ? 5 : num > 5 ? 1 : num;
$('#mintBtn').html('Mint ' + num);
}
async function mint() {
if (typeof count == 'undefined') await start();
balance = count = await contract.balanceOf(acct).call();
if (Number(balance) + Number(num) > 5) {
$('#count3333').html('Each address can only mint up to 5 NFTs');
return;
}
if (Number(count) + Number(num) > 3333) {
$('#count3333').html('Max token exceeded');
return;
}
$('#nfts').html('');
$('#count3333').html('Fetching number...');
cnt = 0;
ipfs = IpfsApi(IA);
cidImg = new Array();
$('#count3333').html('Generating art...');
for (i = count; i < Number(count) + Number(num); i++) {
await drawLCA(i);
cidImg.push(
await uploadJson(
`{"name":"LCA #${i}","description":"Haha to those who have invested in LUNA","image":"ipfs://${await uploadImg(
i
)}",${txt}}`
)
);
}
$('#count3333').html('Minting...');
await contract.MINT(cidImg).send(FA);
$('#count3333').html('Congratulation!');
$('#nfts').show();
}
async function start() {
$.getScript('js/generative.js', function () {});
$.getScript(
'https://aloycwl.github.io/js/cdn/ipfs-api.min.js',
function () {}
);
await load(
[
{
inputs: [u6],
name: 'MINT',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'count',
outputs: [u1],
stateMutability: 'view',
type: 'function',
},
{
inputs: [u3],
name: 'balanceOf',
outputs: [u1],
stateMutability: 'view',
type: 'function',
},
],
'0x3bA977bAB2e7f845b73eBB455C6c33D3b564A7f2'
);
loaded = 1;
count = await contract.count().call();
$('#count3333').html(3333 - count + '/3333');
getString();
}
</script>
</html>