-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
357 lines (343 loc) · 19.7 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tatum NFT Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<link rel="icon" type="image/png" sizes="32x32" href="./img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="./img/favicon-16x16.png">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<meta name="description" content="Tatum - NFT Demo">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@tatum">
<meta name="twitter:title" content="Tatum - NFT Demo">
<meta name="twitter:description" content="Tatum - NFT Demo">
<meta name="twitter:creator" content="@tatum">
<meta name="twitter:image" content="https://i.imgur.com/L4ncsOj.png">
<meta property="og:title" content="Tatum - NFT Demo">
<meta property="og:type" content="Article">
<meta property="og:url" content="https://bf.tatum.io">
<meta property="og:image" content="https://i.imgur.com/Vb5o5mh.png">
<meta property="og:description" content="Tatum NFT Demo">
<meta property="og:site_name" content="Tatum NFT Demo">
<meta property="fb:admins" content="132951670226590">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@700&family=Poppins:wght@400;500;600;700&display=swap"
rel="stylesheet">
<link rel="stylesheet" media="all" href="./css/app.min.css">
<script src="https://www.google.com/recaptcha/api.js?render=6LeuI-UUAAAAABfElcMN-Sv4LZm4_0iZ-OcJ-0n-" async defer></script>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/styles/base16/google-light.min.css"
integrity="sha512-u/yq0I36izVImG/Nkz5Lu/JnuI+HlC6fbGyxaWYHk/pechSuMuslu964MdTSkcoppvdUJYlGyTXfQmpI9R+oEw=="
crossorigin="anonymous" referrerpolicy="no-referrer"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/highlight.min.js"></script>
<script type="text/javascript"src="js/modalLoading.js"></script>
<script>
var viewportmeta = document.querySelector('meta[name="viewport"]');
if (viewportmeta) {
if (screen.width < 375) {
var newScale = screen.width / 375;
viewportmeta.content = 'width=375, minimum-scale=' + newScale +
', maximum-scale=1.0, user-scalable=no, initial-scale=' + newScale + '';
} else {
viewportmeta.content = 'width=device-width, maximum-scale=1.0, initial-scale=1.0';
}
}
var submitted = async function (event, chain) {
event.preventDefault();
event.stopPropagation();
grecaptcha.ready(async function () {
const token = await grecaptcha.execute('6LeuI-UUAAAAABfElcMN-Sv4LZm4_0iZ-OcJ-0n-', {action: 'submit'});
if (!document.getElementsByName('file')[0].files[0]) {
alert("No file chosen!");
return;
}
if (document.getElementsByName('file')[0].files[0].size > 1048576) {
alert("File is too big!");
return;
}
document.getElementById('chain').value = chain;
document.getElementById('token').value = token;
modalLoading.init(true);
try {
const response = await fetch('/mint', {
method: 'POST',
body: new FormData(document.getElementsByTagName('form')[0])
});
var result = await response.json();
modalLoading.init(false);
if (result.statusCode) {
alert(result.message);
return false;
}
let element = document.getElementById('result');
element.style.display = 'none'
let successpopup = document.getElementById('popup-success-show');
successpopup.style.display = 'block'
document.getElementsByTagName('pre')[0].style.display = 'block'
switch (chain) {
case 'MATIC':
document.getElementById('successTxId').href = 'https://mumbai.polygonscan.com/tx/' + result.txId
break;
case 'FLOW':
document.getElementById('successTxId').href = 'https://flow-view-source.com/testnet/tx/' + result.txId
break;
case 'BSC':
document.getElementById('successTxId').href = 'https://testnet.bscscan.com/tx/' + result.txId
break;
}
document.getElementsByClassName('language-js')[0].innerHTML = `Tatum.createNFT(true, {
to: RECIPIENT[chain],
contractAddress: NFT_ADDRESS[chain],
account: SENDER_ADDRESS[chain],
chain: Currency.${chain},
tokenId: \`${Date.now()}\`,
fromPrivateKey: PRIVATE_KEYS[chain],
}, file, name, description);`
document.getElementById('resName').innerText = document.getElementById('name').value;
document.getElementById('resDescription').innerText = document.getElementById('description').value;
document.getElementById('successTxId').innerText = result.txId;
document.getElementById('successImg').src = result.imagePublicUrl;
document.getElementById('successImgUrl').href = result.imagePublicUrl;
hljs.highlightAll();
} catch (e) {
alert(e);
console.error(e);
} finally {
modalLoading.init(false);
}
});
return false
};
window.onload = registerModalClickListener;
function registerModalClickListener() {
document.getElementById("modal-close").onclick = function () {
document.getElementById('popup-success-show').style.display = 'none';
};
}
var loadFile = function (event) {
var output = document.getElementById('preview-img');
output.src = URL.createObjectURL(event.target.files[0]);
output.onload = function () {
URL.revokeObjectURL(output.src)
}
};
var changeName = function (event) {
document.getElementById('preview-name').innerText = event.target.value;
};
var changeDescription = function (event) {
document.getElementById('preview-description').innerText = event.target.value;
};
</script>
</head>
<body>
<!-- outer-->
<div class="outer">
<!-- header-->
<header class="header js-header" data-id="#header">
<div class="header__center center"><a class="header__logo" href="index.html"><img class="some-icon"
src="img/tatum-logo.svg"
alt="Tatum Logo"><img
class="some-icon-dark" src="img/logo-light.png"
alt="Tatum Logo"></a>
</div>
</header>
<div class="outer__inner">
<div class="section upload">
<div class="upload__center center">
<div class="upload__wrapper">
<div class="upload__head">
<h2 class="upload__title h2">Create your NFT</h2>
</div>
<form action="/mint" method="post" enctype="multipart/form-data">
<div class="upload__form">
<div class="upload__list">
<div class="upload__item">
<div class="upload__category">Upload file</div>
<div class="upload__note">Drag or choose your file to upload</div>
<div class="upload__file">
<input class="upload__input" type="file" accept="image/*"
name="file" onchange="loadFile(event)">
<div class="upload__icon">
<svg class="icon icon-upload-file">
<use xlink:href="#icon-upload-file"></use>
</svg>
</div>
<div class="upload__format">PNG, GIF, JPG. Max 1MB.</div>
</div>
</div>
<div class="upload__item">
<div class="upload__category">NFT Details</div>
<div class="upload__fieldset">
<div class="field">
<div class="field__label">Name of your NFT asset *</div>
<div class="field__wrap">
<input class="field__input" type="text"
id="name"
name="name"
value="Tatum Magic NFT"
onchange="changeName(event)"
onkeyup="changeName(event)"
placeholder="Name of your NFT asset"
required>
</div>
</div>
<div class="field">
<div class="field__label">Description of your NFT asset *</div>
<div class="field__wrap">
<input class="field__input" type="text"
name="description"
id="description"
onchange="changeDescription(event)"
onkeyup="changeDescription(event)"
value="Tatum logo forever."
placeholder="Description of your NFT asset"
required>
</div>
</div>
<p id="result" style="display: none">
<a id="txId" target="_blank"></a>
<a id="metadata" target="_blank"></a>
</p>
</div>
</div>
</div>
<div class="upload__foot">
<input type="hidden" name="chain" id="chain" value="MATIC"/>
<input type="hidden" name="token" id="token"/>
<button type="submit" onclick="submitted(event, 'MATIC')"
class="button upload__button" data-effect="mfp-zoom-in">
<span>Mint on MATIC</span>
<svg class="icon icon-arrow-next">
<use xlink:href="#icon-arrow-next"></use>
</svg>
</button>
<button type="submit" onclick="submitted(event, 'FLOW')"
class="button upload__button" data-effect="mfp-zoom-in">
<span>Mint on FLOW</span>
<svg class="icon icon-arrow-next">
<use xlink:href="#icon-arrow-next"></use>
</svg>
</button>
<button type="submit" onclick="submitted(event, 'BSC')"
class="button upload__button" data-effect="mfp-zoom-in"><span>Mint on BSC</span>
<svg class="icon icon-arrow-next">
<use xlink:href="#icon-arrow-next"></use>
</svg>
</button>
</div>
</div>
</form>
</div>
<div class="preview js-preview">
<div class="preview__inner">
<button class="preview__close js-preview-close">
<svg class="icon icon-close">
<use xlink:href="#icon-close"></use>
</svg>
</button>
<div class="preview__info">Preview</div>
<div class="card">
<div class="card__preview"><img id="preview-img"
src="img/tatum-logo.svg" alt="Card preview"/>
</div>
<a class="card__link">
<div class="card__body">
<div class="card__line">
<div class="card__title" id="preview-name">Tatum Magic NFT</div>
</div>
</div>
<div class="card__foot">
<div class="card__status" id="preview-description">
Tatum logo forever.
</div>
</div>
</a>
</div>
</div>
</div>
</div>
</div>
<div class="modal popup popup_purchase" id="popup-success-show" style="display: none;">
<div class="modal-content popup__item" id="popup-success">
<div class="success">
<div class="modal-close" id="modal-close">×</div>
<div class="success__title h3">Yay! <span role="img" aria-label="firework">🎉</span></div>
<div class="success__info">Your NFT was minted</div>
<div class="success__table container">
<div>
<a target="_blank" href="" id="successImgUrl"><img class="image" id="successImg" src=""
alt="NFT Preview">
<div class="overlay">
<div class="overlay-text">
<svg class="icon icon-globe">
<use xlink:href="#icon-globe"></use>
</svg>
<br>View Metadata
</div>
</div>
</a>
</div>
</div>
<div class="success__table">
<div class="success__row">
<div class="success__col">Status</div>
<div class="success__col">Transaction ID</div>
</div>
<div class="success__row">
<div class="success__col">Success</div>
<a class="success__col" id="successTxId" target="_blank"></a>
</div>
<div class="success__row">
<div class="success__col">Name</div>
<div class="success__col">Description</div>
</div>
<div class="success__row">
<div class="success__col" id="resName"></div>
<div class="success__col" id="resDescription">Description</div>
</div>
</div>
<div class="success__table snippet">
<pre><code class="language-js">
</code></pre>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- footer-->
<footer class="footer">
<div class="footer__center center">
<div class="footer__foot">
<div class="footer__copyright">This web-application is solely intended for demo purposes at TechCrunch
Disrupt 2021.
</div>
<div class="footer__note">Contribute on <a target="_blank" href="https://github.com/tatumio/tc2021">Github</a></div>
</div>
</div>
</footer>
</div>
<!-- scripts -->
<div style="display: none">
<svg width="0" height="0">
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="icon-upload-file">
<path
d="M10.229.667c.707 0 1.386.281 1.886.781l1.105 1.105c.5.5.781 1.178.781 1.886v8.229c0 1.473-1.194 2.667-2.667 2.667H4.667C3.194 15.334 2 14.14 2 12.667V3.334C2 1.861 3.194.667 4.667.667h5.562zM9.333 2H4.667c-.693 0-1.263.529-1.327 1.205l-.006.128v9.333c0 .693.529 1.263 1.205 1.327l.128.006h6.667c.693 0 1.263-.529 1.327-1.205l.006-.128V5.334h-1.333a2 2 0 0 1-1.995-1.851l-.005-.149V2zM7.745 6.051c.242-.1.53-.052.727.145h0l2 2c.26.26.26.682 0 .943s-.682.26-.943 0h0l-.862-.862v3.057c0 .368-.298.667-.667.667s-.667-.298-.667-.667h0V8.276l-.862.862c-.26.26-.682.26-.943 0s-.26-.682 0-.943h0l2-2c.064-.064.138-.112.216-.145zm2.922-3.977v1.259c0 .368.298.667.667.667h1.259c-.065-.188-.173-.361-.317-.505l-1.105-1.105c-.144-.144-.317-.251-.505-.317z">
</path>
</symbol>
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="icon-arrow-next">
<path
d="M10.39 3.765c.464-.375 1.187-.349 1.615.057l3.692 3.5a.91.91 0 0 1 0 1.357l-3.692 3.5c-.428.406-1.151.431-1.615.057s-.493-1.007-.065-1.413L12.247 9H1.143C.512 9 0 8.552 0 8s.512-1 1.143-1h11.104l-1.922-1.822c-.428-.406-.399-1.038.065-1.413z">
</path>
</symbol>
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="icon-globe">
<path d="M8.001 1.334a6.67 6.67 0 0 1 6.631 5.971l.003.029.033.667a6.67 6.67 0 0 1-6.667 6.667h-.003l-.231-.004a6.67 6.67 0 0 1-6.4-5.996l-.033-.667c0-.225.011-.447.033-.667h0a6.67 6.67 0 0 1 6.632-6h0 .002zm1.98 7.334H6.018c.077 1.396.391 2.599.817 3.451.532 1.065 1.021 1.216 1.164 1.216s.632-.151 1.164-1.216c.426-.852.74-2.055.817-3.451zm3.312 0h-1.977c-.081 1.623-.452 3.075-1.009 4.144a5.34 5.34 0 0 0 2.986-4.144zm-8.61 0H2.709c.228 1.83 1.384 3.373 2.982 4.142-.557-1.069-.928-2.519-1.008-4.141zM5.69 3.192l-.141.07c-1.525.79-2.619 2.295-2.841 4.07h1.974c.081-1.622.452-3.073 1.008-4.141zm2.309-.525c-.143 0-.632.151-1.164 1.216-.426.852-.74 2.055-.817 3.451h3.963c-.077-1.396-.391-2.599-.817-3.451-.532-1.065-1.021-1.216-1.164-1.216zm2.308.523l.049.096c.529 1.059.882 2.472.96 4.047h1.976c-.229-1.831-1.386-3.374-2.985-4.142z"></path>
</symbol>
</svg>
</div>
</body>
</html>