-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
656 lines (414 loc) · 23.2 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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
<!DOCTYPE html>
<html lang="en" class = "bg-black">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="TeraWav NFT Sound Kits" />
<meta name="author" content="TeraWav" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TeraWav</title>
<link rel="icon" type="image/x-icon" href="pics/pic/TeraWav.jpg" />
<!-- Ethereum Related -->
<script src="https://unpkg.com/web3@latest/dist/web3.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/web3@latest/dist/web3.min.js"></script>
<!-- Font Awesome icons (free version)-->
<script src="https://use.fontawesome.com/releases/v5.13.0/js/all.js" crossorigin="anonymous"></script>
<!-- Google fonts-->
<!-- Core theme CSS (includes Bootstrap)-->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
/>
<link rel="preconnect" href="https://fonts.googleapis.com"/>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Viaoda+Libre">
<link href="css/styles.css" rel="stylesheet" />
<link href="css/nucleo-icons.css" rel="stylesheet" />
<link href="css/nucleo-svg.css" rel="stylesheet" />
<!-- Font Awesome Icons -->
<script src="https://kit.fontawesome.com/42d5adcbca.js" crossorigin="anonymous"></script>
<link href="css/nucleo-svg.css" rel="stylesheet" />
<!-- CSS Files -->
</head>
<body id="page-top">
<div class="modal fade animate__animated animate__fadeInDown" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog " role="document">
<div class="modal-content bg-greygrey text-white">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">TeraWAV</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<audio controls style = "">
<source src="Music/immortal_preview.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
<div class="form-group">
<label for="recipient-name" class="col-form-label">Email</label>
<input type="text" class="form-control bg-greygrey text-white " id="inputEmail">
</div>
</form>
</div>
<div class="modal-footer">
<button type="submit" id = "TERAWAV_PURCHASE" name = "KIT_PURCHASE" value = "success" class="btn btn-grey text-white">Purchase</button>
<script>
async function PURCHASE_WINDOW_X() {
$('#TERAWAV_PURCHASE').attr('data-target','#exampleModal');
$("#exampleModal").modal('hide');
console.log('Hide me');
}
</script>
</div>
</div>
</div>
</div>
<div class="modal fade" id="errorwebModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" style = "border-radius: 10px;">
<div class="modal-dialog modal-dialog-centered " style = "position: relative; right: 8px; ">
<div class="modal-content bg-greygrey text-white" >
<div class="modal-body bg-greygrey text-white">
Error
</div>
</div>
</div>
</div>
<div class="modal fade" id="ZERO_ORDER_MODAL" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" style = "border-radius: 10px;">
<div class="modal-dialog modal-dialog-centered " style = "position: relative; right: 8px; ">
<div class="modal-content bg-greygrey text-white" >
<div class="modal-body bg-greygrey text-white">
You are trying to purchase nothing. Please put atleast the number 1 into one of the size "Amount" inputs.
</div>
</div>
</div>
</div>
<div class="modal fade" id="successwebModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" style = "border-radius: 10px;">
<div class="modal-dialog modal-dialog-centered " style = "position: relative; right: 8px; ">
<div class="modal-content bg-greygrey text-white" >
<div class="modal-body bg-greygrey text-white">
You've successfully Purchased a TeraWav NFT <br>
You now have access to the Immortal Beat Kit<br>
Here's your transaction link: <br> <a id="suchash" class = "text-yellow" href="" >Receipt</a><br>
Check out your NFT on <br> <a id="OPENSEA" class = "text-yellow" href="" >OpenSea <img style = " width: 30px; right: 10px;" src="pics/pic/opensea.png"></a> <br>
</div>
</div>
</div>
</div>
<script>
function OPEN_SUCCESS_HASH() {
window.open(document.getElementById('suchash').href, '_blank');
};
</script>
<div class="modal fade" id="subwebModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" style = "border-radius: 10px;">
<div class="modal-dialog modal-dialog-centered " style = "position: relative; right: 8px; ">
<div class="modal-content bg-greygrey text-white" >
<div class="modal-body bg-greygrey text-white">
Transaction Submitted<br>
Another window will pop up when transaction is confirmed<br>
Here's your transaction link: <br> <a id="subhash" class = "text-yellow" href="" >Confirmation</a><br>
</div>
<script>
function OPEN_SUB_HASH() {
window.open(document.getElementById('subhash').href, '_blank');
};
</script>
</div>
</div>
</div>
<div class="modal fade" id="nowebModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" style = "border-radius: 10px;">
<div class="modal-dialog modal-dialog-centered " style = "position: relative; ">
<div class="modal-content bg-greygrey text-white" >
<div class="modal-body bg-greygrey text-white">
You don't have a Web 3.0 wallet installed.<br>
Please Install A Web 3.0 Wallet<br>
Try Installing <a class = "text-yellow" href="https://metamask.io/">MetaMask.<img style = " width: 30px; right: 10px;" src="pics/pic/meta.png"></a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="connectModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" style = "border-radius: 10px;">
<div class="modal-dialog modal-dialog-centered " >
<div class="modal-content bg-greygrey text-white" >
<div class="modal-body bg-greygrey text-white">
Connect Your Wallet!
</div>
</div>
</div>
</div>
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-transparent text-white animate__animated animate__fadeInDown">
<button class="btn blur blur-rounded btn-greygrey animate__animated " style = " position: relative;padding: 0px 0px; left: 0px " onclick = "SHIP_DATA();"><img src="pics/pic/music-folder.png " width = "60px" style = "position: relative; border-radius: 0%; top: 0px; left:13px " onclick = "SHIP_DATA();">
<script>
async function SHIP_DATA() {
if (window.ethereum !== undefined) {
$("#Modalchart").modal('show');
} else {
$("#connectModal").modal('show');
}
}
</script>
<a class="navbar-brand text-white" onclick = "connectx(); check(); ethereum.on('connect', () => window.location.reload());">
<button id = "buttoneth" value = "Connect" class="btn blur blur-rounded btn-grey" style = "font-size: 0px; padding: 0px 0px; "
onclick = "connectx(); check(); ethereum.on('connect', () => window.location.reload()); ">
<style>
.btn-greygrey {
background-color: #222222 !important;
}
.btn-uniblue {
background-color: rgba(76, 130, 251, 0.24) !important;
}
.btn-outline-retro {
color: #ffffff00;
border-color: #ffffff;
}
</style>
<script>
async function check() {
// Then get the currently selected radio button's value
console.log(window.ethereum)
if (window.ethereum !== undefined) {
// From now on, this should always be true:
// provider === window.ethereum
console.log(window.ethereum); // initialize your app
} else {
$("#nowebModal").modal('show');
}
// Check the value to make sure you want to show the modal
}
async function TERAWAV_ORACLE_CALL() {
const accounts = await ethereum.request({method: 'eth_accounts' });
const chainIDs = await ethereum.request({method: 'eth_chainId'});
var numchain = {'0x89' : 'Polgyon'}
var addychain = {'Polygon' : '0xAB594600376Ec9fD91F8e885dADF0CE036862dE0'};
var capchain = {'Polygon': 'ETH/USD'};
var choosechain = numchain[chainIDs];
await ethereum.request({
method: 'eth_call',
params: [{
from: accounts[0],
to: addychain[choosechain],
chainid: chainIDs,
data: '0x50d25bcd'}, 'latest']
})
.catch((err) => { if(err.code === 4001 )
{console.log(err.code)}
}
).then(result => { if(result === undefined) {console.log(result)} else{
var data = result;
console.log(parseInt(data));
const pricex = (50) / (parseInt(data) / 100000000);
console.log('Smart Contract Address: ' + addychain[choosechain])
console.log("Latest " + capchain[choosechain] + " price was: " + parseInt(data)/ 100000000);
document.getElementById("mogsub").value = "Ξ " + pricex.toFixed(2) + " MATIC" ;
}
}
);
};
async function changex()
{
const accounts = await ethereum.request({ method: 'eth_accounts' });
const chainIDs = await ethereum.request({method: 'eth_chainId'});
if (chainIDs !== "0x89") {
document.getElementById("connecteth").innerHTML = "Polygon Only";
switchChain("Polygon") ;
ethereum.on('chainChanged', (_chainId) => window.location.reload());
} else {
document.getElementById("connecteth").innerHTML = accounts[0].substring(0,6) + "...";
document.getElementById("Avatar").src = "pics/pic/greenensimage.png";
}
}
async function switchChain(chains) {
const Polygon = [{ chainId: '0x89'}];
const Polygonp = '0x89' ;
var chainsx = { "Polygon" : Polygon};
var chainx = { "Polygon" : Polygonp};
var RPCchain = {'Polygon' : ' https://polygon-rpc.com/'}
var symChain = {'Polygon' : 'MATIC'}
var expchain = {'Polygon' : 'https://polygonscan.io/'}
await ethereum.request({
method: 'wallet_switchEthereumChain',
params: chainsx[chains]
}).catch(async (switchError) => {
// This error code indicates that the chain has not been added to MetaMask.
if (switchError.code === 4902) {
await ethereum.request({
method: 'wallet_addEthereumChain',
params: [
{
chainId: chainx[chains],
chainName: chains,
nativeCurrency: {
name: chains,
symbol: symChain[chains],
decimals: 18
},
rpcUrls: [RPCchain[chains]],
blockExplorerUrls: [expchain[chains]]
}
]
});
}
// handle other "switch" errors
})
ethereum.on('chainChanged', (_chainId) => window.location.reload());
};
async function connectx() {
ethereum
.request({ method: 'eth_requestAccounts' })
.then(changex)
.catch((err) => {
if (err.code === 4001) {
// EIP-1193 userRejectedRequest error
// If this happens, the user rejected the connection request.
console.log('Please connect to MetaMask.');
document.getElementById("connecteth").innerHTML = "Rejected";
} else {
console.error(err);
}
}).then((result) => { window.location.reload()});
};
</script>
<img onload = "changex(); " src="pics/pic/goldensimage.png" id="Avatar" width = "50px" style = "position: relative; border-radius: 50%; top: 2px; left: 5px; ">
<a id = "connecteth" class=" btn blur blur-rounded btn-greygrey text-white " style = "font-size: 15px;padding: 15px 15px; right: 8px; top:-5px; position: relative"> Connect
</a>
<style>
.bg-darkgrey {
background-color: #333333 !important;
}
.btn-lightgrey {
background-color: #333333 !important;
}
</style>
</nav>
<script type="text/javascript">
async function changext()
{
const accounts = await ethereum.request({ method: 'eth_accounts' });
const chainIDs = await ethereum.request({method: 'eth_chainId'});
const web3 = new Web3(new Web3.providers.HttpProvider("https://polygon-mainnet.infura.io/v3/3ac1c65d7658459ebafe15361c77dbac"))
if (chainIDs !== "0x89") {
document.getElementById("connecteth").innerHTML = "Polygon Only";
ethereum.on('chainChanged', (_chainId) => window.location.reload());
} else {
document.getElementById("connecteth").innerHTML = accounts[0].substring(0,12) + "...";
document.getElementById("Avatar").src = "pics/pic/greenensimage.png"
TERAWAV_ORACLE_CALL()
}
};
</script>
<!-- Masthead-->
<header class="masthead ">
<div class="container d-flex h-100 align-items-center animate__animated animate__fadeInDown">
<div class="mx-auto text-center">
<img onload = "changex();changext();" class="img-fluid " src="pics/pic/immortal.png" width = "350" height = "350" alt="" >
<button id = "ineedit" class="btn blur blur-rounded btn-grey mogul-btn" style= "font-size: 1px; padding: 5px 40px; right: 5px; " data-toggle="modal" data-target="" data-whatever="@mdo"
onclick = "blackout(); blackout();">
<script>
async function blackout() {
if (window.ethereum !== undefined) {
$('#ineedit').attr('data-target','#exampleModal');
$("#exampleModal").modal('show');
} else {
console.log(window.ethereum)
$("#connectModal").modal('show');
}
}
async function PURCHASE_WINDOW_X() {
$('#SUBMITmOGUL').attr('data-target','#exampleModal');
$("#exampleModal").modal('hide');
}
</script>
<style>
.btn-greygrey {
background-color: #222222 !important;
}
.btn-darkgrey {
background-color: #464545 !important;
}
</style>
<input type = "button" class="btn text-white blur blur-rounded btn-grey" id = "PurchaseETH" style = "font-size: 11px; right: 20px; top: 0px; position: relative" onclick = "blackout(); " value = ""><img src="pics/pic/polygon.png" width = "12px" style = "position: relative; border-radius: 0%; top: -2px; right:48px " >
</a>
<input type ="button" class="btn text-white blur blur-rounded btn-greygrey" id = 'mogsub' style = "font-size: 15px; left: 15px; top: 0px; position: relative" onclick = "blackout();" value ="Connect">
</input>
<style>
.btn-greygrey {
background-color: #222222 !important;
}
</style>
<script>
async function TERAWAV_ORACLE_CALL() {
const accounts = await ethereum.request({method: 'eth_accounts' });
const chainIDs = await ethereum.request({method: 'eth_chainId'});
var numchain = {'0x89' : 'Polygon'}
var addychain = {'Polygon' : '0x7A396A11d5716bb7462171dd49B3BE2D941FE593'};
var capchain = {'Polygon': 'ETH/USD'};
var choosechain = numchain[chainIDs];
await ethereum.request({
method: 'eth_call',
params: [{
from: accounts[0],
to: addychain[choosechain],
chainid: chainIDs,
data: '0x1b222ecb'}, 'latest']
})
.catch((err) => { if(err.code === 4001 )
{console.log(err.code)}
}
).then(result => { if(result === undefined) {console.log(result)} else{
var data = result;
console.log(parseInt(data));
const pricex = (parseInt(data) / 1000000000000000000);
console.log('Smart Contract Address: ' + addychain[choosechain])
console.log("Latest " + capchain[choosechain] + " price was: " + parseInt(data)/ 100000000);
document.getElementById("mogsub").value = pricex.toFixed(2) + " MATIC" ;
}
}
);
};
</script>
</div>
</div>
</header>
<!-- About-->
<!-- Footer-->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.7.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.7.1/firebase-database.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.7.1/firebase-auth.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/8.7.1/firebase-analytics.js"></script>
<script>
const firebaseConfig = {
apiKey: "AIzaSyD9TMz1zFN8YND3R8529pyAbGZv-9JmSNE",
authDomain: "terawavy.firebaseapp.com",
projectId: "terawavy",
storageBucket: "terawavy.appspot.com",
messagingSenderId: "1055234692944",
appId: "1:1055234692944:web:55b5dc255720f006997e55",
measurementId: "G-C6DYHGGFY1"
};
firebase.initializeApp(firebaseConfig)
</script>
<script src="https://cdn.jsdelivr.net/npm/@metamask/detect-provider"></script>
<!-- Bootstrap core JS-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/utf8/3.0.0/utf8.js" integrity="sha512-TpkRcfygox9TaC40D5Nu9CQElI7PaQ9d+/RrhWccgvktjgh/HITPo+VZ+xQc98DZbiR3Ct/z9BHXAp/m88j/kw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/utf8/3.0.0/utf8.min.js" integrity="sha512-Up/VFqLmUsS5GMd4XTuxE6NsCsBJlPv12A9apHDqRx8v/x+++Qmmg2M1kTs8cQztxHk0d/rgAqmVOjzEKBZH7A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.bundle.min.js"></script>
<!-- Third party plugin JS-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js"></script>
<!-- Core theme JS-->
<script src="js/scripts.js"></script>
<script type="text/javascript" src="js-main/utils.js"></script>
<script type="text/javascript" src="js/metaAcct.js"></script>
<script type="text/javascript" src="js/ABI_TERAWAV.1.js"></script>
<script type="text/javascript" src="js/TERAWAV.js"></script>
</body>
</html>