-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.html
633 lines (586 loc) · 31.1 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
<!DOCTYPE html>
<html lang="en" class="notranslate" translate="no">
<head>
<meta charset="utf-8">
<meta name="google" content="notranslate" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>DUCO Exchange | Swap coins with ease</title>
<link rel="icon" href="images/logo.png" type="image/png" />
<link rel="shortcut icon" href="images/logo.png" type="image/png" />
<!-- SEO Stuff -->
<meta name="description" content="Swap Duino-Coin between Bitcoin Cash, Coin Magi, Likecoin, Ripple, Tron and others in a few clicks">
<meta name="keywords" content="exchange, altcoin, beyondcoin, xmg, magi, bynd, bch, bitcoincash, likecoin, lke, duco, duino, duinocoin, arduino, crypto, mining, blockchain, cryptocurrency, bitcoin">
<link rel="canonical" href="https://exchange.duinocoin.com/" />
<meta name="robots" content="index, follow">
<meta name="theme-color" content="#D90088">
<!-- Open Graph Metadata -->
<meta property="og:site_name" content="DUCO Exchange - Swap coins with ease!" />
<meta property="og:site" content="https://exchange.duinocoin.com/" />
<meta property="og:title" content="DUCO Exchange - Swap coins with ease!" />
<meta property="og:description" content="Swap Duino-Coin between Bitcoin Cash, Coin Magi, Likecoin, Ripple, Tron and others in a few clicks" />
<meta property="og:image" content="images/logo.png" />
<meta property="og:url" content="https://exchange.duinocoin.com/" />
<meta property="og:type" content="website" />
<!-- Twitter Metadata -->
<meta name="twitter:title" content="Swap coins with ease!">
<meta name="twitter:description" content="Swap Duino-Coin between Bitcoin Cash, Coin Magi, Likecoin, Ripple, Tron and others in a few clicks">
<meta name="twitter:image" content="images/logo.png">
<meta name="twitter:site" content="@DuinoCoin">
<meta name="twitter:creator" content="@DuinoCoin">
<link rel="stylesheet" href="https://server.duinocoin.com/assets/css/mystyles.css">
<script src="https://explorer.duinocoin.com/assets/jquery.min.js"></script>
<script src="https://explorer.duinocoin.com/assets/fontawesome.js"></script>
<script src="https://exchange.duinocoin.com/js/wallet-address-validator.min.js"></script>
<script type="text/javascript" src="//widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js" async></script>
<meta name="twitter:image" content="https://exchange.duinocoin.com/images/ducoe_banner.png">
<meta property="og:image" content="https://exchange.duinocoin.com/images/ducoe_banner.png">
<meta property="og:image:url" content="https://exchange.duinocoin.com/images/ducoe_banner.png">
<meta name="twitter:card" content="summary_large_image">
<style>
#background {
position: fixed;
width: 100%;
height: 100%;
filter: brightness(0.7);
overflow: hidden;
background-position: 50% 50%;
background-image: url("https://wallet.duinocoin.com/backgrounds/wallet/yenn-mountains-1.jpg");
}
select {
border: 2px solid #DDD !important;
}
button, select {
transition: 0.2s all;
}
button:hover, select:hover {
transform: scale(1.03);
}
.footer {
width: 100%;
position: relative;
bottom: 0;
}
</style>
</head>
<body>
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="index.html">
<img src="images/logo.png"> DUCO Exchange
</a>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbar_mobile">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navbar_mobile" class="navbar-menu">
<div class="navbar-end">
<a href="listing.html" class="navbar-item">
<i class="fa fa-plus"></i> Coin listing
</a>
</div>
</div>
</nav>
<div id="background"></div>
<section class="section mb-5">
<div class="container my-5 py-5">
<div class="columns pt-5" style="min-height: 768px">
<div class="column"></div>
<div class="column is-narrow" id="step_one">
<p class="title is-size-4 has-text-white">
Step 1/3: choose a trading pair
</p>
<div class="box blur pb-1" style="max-width:500px">
<p class="heading is-size-5">
1. Select assets
</p>
<p class="title is-size-5">
<div class="columns is-touch">
<div class="column mt-2 is-narrow">
<p class="title is-size-5">Duino-Coin</span>
</div>
<div class="column mt-2 is-narrow">
<span class="has-text-weight-normal">and</span>
</div>
<div class="column">
<div class="select is-narrow" onchange="update_coins()">
<select id="coin_select">
<option value="BCH">Bitcoin Cash (Buy only)</option>
<option value="BTC">Bitcoin (Buy only)</option>
<option value="XMG">Coin Magi</option>
<option value="TRX">Tron (Buy only)</option>
<option value="XNO">Nano (Buy only)</option>
<option value="RVN">Ravencoin (Buy only)</option>
<option value="DGB">Digibyte (Buy only)</option>
<option value="XRP">Ripple (Buy only)</option>
<option value="ETH">Ethereum (Buy only)</option>
<option value="LTC">Litecoin (Buy only)</option>
<option selected value="LKE">Likecoin</option>
<option value="SHIB">Shiba inu (Buy only)</option>
<option value="XMR">Monero (Buy only)</option>
<option value="DOGE">Dogecoin (Buy only)</option>
</select>
</div>
</div>
</div>
<p id="likecoin_notice" style="display: none;" class="has-text-info-dark mb-3"><i class="fa fa-info-circle"></i> Likecoin we support is <a href="https://likecoin.pro" target="_blank">likecoin.pro</a> and not the other one. Double check which one you're using to avoid confusion.</p>
</p>
</div>
<div class="box pb-1" style="max-width:500px">
<p class="heading is-size-5">
2. Select swap type
</p>
<div class="columns is-mobile">
<div class="column">
<p class="title is-size-5 mt-2">
<img class="icon is-small" src="https://exchange.duinocoin.com/images/duco.png" id="from_icon">
<span id="coin_from">DUCO</span>
<span class="has-text-weight-normal">to</span>
<img class="icon is-small" src="https://exchange.duinocoin.com/images/lke.png" id="to_icon">
<span id="coin_to">LKE</span>
</p>
</div>
<div class="column is-narrow">
<button class="button" onclick="change_coin()"><i class="fa fa-sync"></i></button>
</div>
</div>
</p>
</div>
<div class="box" style="max-width:500px">
<p class="heading is-size-5">
Confirm your choice
</p>
<p class="subtitle has-text-weight-normal is-size-5">
You are about to <span id="swap_type" class="has-text-weight-bold">sell</span> DUCO.<br>Current <span id="swap_type">sell</span> price is<br><span id="swap_price" class="has-text-weight-bold">3 LKE</span> per <span class="has-text-weight-bold">1 DUCO</span>.
</p>
<button class="button is-fullwidth is-success" onclick="$('#step_one').fadeOut(250, function(){$('#step_two').fadeIn(250)});">Continue to details</button>
</div>
</div>
<div class="column is-narrow" id="step_two" style="display:none">
<p class="title is-size-4 has-text-white">
Step 2/3: Input the desired amount
</p>
<div class="box" style="max-width:500px">
<p class="heading is-size-5">
3. How much DUCO are you <span id="swap_type">sell</span>ing?
</p>
<input class="input" value="200" min="1" max="1000000" id="amount_input" type="number">
<p class="subtitle mt-3 is-size-6" id="bonustag" style="display:none">
<b class="has-text-success">Buy bonus:</b>
you will receive 5% more <b>(+<span id="bonus">0</span> DUCO)</b>
</p>
</div>
<div class="box" style="max-width:500px">
<p class="heading is-size-5">
Confirm your choice
</p>
<p class="subtitle has-text-weight-normal is-size-5">
You want to <span id="swap_type" class="has-text-weight-bold">sell</span> <span id="swap_amount" class="has-text-weight-bold">0 DUCO</span> for <span id="swap_amount_alt" class="has-text-weight-bold">0 LKE</span>.<br>
<span class="has-text-grey is-size-6">This pair has <span id="swap_liquidity" class="has-text-weight-bold">medium</span> liquidity.</span>
</p>
<div class="columns">
<div class="column is-one-third">
<button class="button is-fullwidth" onclick="$('#step_two').fadeOut(250, function(){$('#step_one').fadeIn(250)});">Return</button>
</div>
<div class="column">
<button id="submit_amount" class="button is-fullwidth is-success" onclick="$('#step_two').fadeOut(250, function(){$('#step_three').fadeIn(250)});">Continue to swap</button>
</div>
</div>
</div>
</div>
<div class="column is-narrow" id="step_three" style="display:none">
<p class="title is-size-4 has-text-white">
Step 3/3: Connect your wallets
</p>
<div class="box" style="max-width:500px">
<p class="heading is-size-5">
4. Connect your <img class="icon is-small" src="https://exchange.duinocoin.com/images/duco.png"> DUCO wallet
</p>
<div class="columns is-multiline is-gapless">
<div class="column is-full mb-1">
<input class="input" placeholder="Your Duino-Coin username" id="username" type="text">
</div>
<div class="column is-full mt-1">
<input class="input" placeholder="Your Duino-Coin password" id="password" type="password">
</div>
</div>
</div>
<div class="box" style="max-width:500px">
<p class="heading is-size-5">
5. Enter your <img class="icon is-small" src="https://exchange.duinocoin.com/images/lke.png" id="to_icon_t"> <span id="current_coin">LKE</span> wallet
</p>
<div class="columns is-multiline is-gapless">
<div class="column is-full">
<input class="input" placeholder="Wallet address" id="address" type="text">
</div>
<div class="column mt-2">
<span id="invalid_address" class="has-text-danger">
<i class="fa fa-times-circle"></i> Provide a valid <span id="current_coin">LKE</span> wallet address!
</span>
<span id="valid_address" class="has-text-success">
<i class="fa fa-check-circle"></i> Wallet address looks correct
</span>
</div>
</div>
</div>
<div class="box" style="max-width:500px">
<p class="heading is-size-5">
6. Enter your e-mail
</p>
<div class="columns is-multiline">
<div class="column is-full">
<input class="input" placeholder="Your e-mail address" id="email" type="email">
</div>
</div>
</div>
<div class="box" style="max-width:500px">
<p class="heading is-size-5">
Ready to swap?
</p>
<p class="subtitle is-size-6 mb-3">If you're buying DUCO you'll receive further instructions via e-mail. If you're selling you'll get an e-mail once the swap is complete.</p>
<div class="columns">
<div class="column is-one-third">
<button class="button is-fullwidth" onclick="$('#step_three').fadeOut(250, function(){$('#step_two').fadeIn(250)});">Return</button>
</div>
<div class="column">
<button id="submit" disabled class="button is-fullwidth is-success" onclick="swap()">Swap</button>
</div>
</div>
</div>
</div>
<div class="column"></div>
</div>
<br><br>
<hr>
<br><br>
<div class="columns">
<div class="column">
<div class="box">
<p class="heading is-size-5">
How to use the DUCO Exchange?
</p>
<div class="content">
<ul class="subtitle mt-0">
<li>
Select a desired exchange pair - e.g. <b>DUCO</b> to <b>XMG</b>
</li>
<li>
<b>Fill in the swap form</b> - enter how much are you swapping and connect your wallets
</li>
<li>
Wait for your exchange request to be processed - you'll be notified by an <b>e-mail from us</b>
<br>
(some exchanges are processed manually - they may take <b>up to 72 hours</b>)
</li>
<li>
Receive exchanged assets <b>directly</b> in your desired crypto wallet - you can see<br>
our last exchanges in the chain explorers:
<a href="https://chainz.cryptoid.info/xmg/address.dws?93qJ8j93ibCye7pTWKTu88pr6a8xy7EUqC.htm">
XMG
</a>
<a href="https://tronscan.org/#/address/TJsSD29FXfbq6BtGRmnfYGDUfrF9DPVGSq/transactions">
TRX
</a>
<a href="https://www.blockchain.com/bch/address/bitcoincash:qzv4g8e2nkpwg6dkzdfuyf1zzrfts9qe350t2">
BCH
</a>
<a href="https://explorer.duinocoin.com?search=coinexchange">
DUCO
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="column">
<div class="box">
<p class="heading is-size-5">
How it works?
</p>
<span class="subtitle">
Since 2019, <b>the official DUCO Exchange</b> allows Duino-Coin users to quickly exchange their Duino-Coins to other cryptocurrencies and assets. At first, only Coin Magi was supported, but new coins came in quickly. Currently you can choose one of many trading pairs to convert your DUCOs into more usable coins.<br>
Assets are stored inside our reserves and distributed accordingly to the liquidity. When you swap coins with DUCO Exchange the system automatically subtracts Duino-Coins from your account and sends you the second exchanged asset directly to your wallet.
</span>
</div>
</div>
</div>
</section>
<footer class="footer">
<div class="content has-text-centered is-size-6">
<b>DUCO Exchange 2019-2024</b>
by
<b>the Duino team</b>
2019-2024<br>
This page is open-source.
You can improve it
<a href="https://github.com/revoxhere/duco-exchange">
<b>here</b>
</a><br>
Made with
<a href="https://bulma.io">
<b>Bulma</b>
</a>
<div class="trustpilot-widget" data-locale="en-US" data-template-id="5419b6a8b0d04a076446a9ad" data-businessunit-id="610739f8f6bbd1001def29cc" data-style-height="24px" data-style-width="100%" data-theme="light" data-min-review-count="10">
<a href="https://www.trustpilot.com/review/duinocoin.com" target="_blank" rel="noopener">Trustpilot</a>
</div>
</div>
</footer>
</body>
<script>
let prices, dollar_prices;
$.getJSON('https://exchange.duinocoin.com/api/v1/rates?v=' + new Date(), function(data) {
prices = data.result;
});
$.getJSON(`https://api.coingecko.com/api/v3/simple/price?ids=bitcoin-cash,nano,tron,ripple,ravencoin,digibyte,bitcoin,ethereum,litecoin,shiba-inu,monero,dogecoin&vs_currencies=usd`, function(data) {
dollar_prices = data;
});
function round_to(precision, value) {
power_of_ten = 10 ** precision;
return Math.round(value * power_of_ten) / power_of_ten;
}
function update_element(element, value) {
// Nicely fade in the new value if it changed
element = "[id=" + element + "]";
old_value = $(element).text()
if ($("<div>" + value + "</div>").text() != old_value) {
$(element).fadeOut('fast', function() {
$(element).html(value);
$(element).fadeIn('fast');
});
return true;
}
return false;
}
/* https://stackoverflow.com/questions/1685680/how-to-avoid-scientific-notation-for-large-numbers-in-javascript */
function eToNumber(num) {
try {
let sign = "";
(num += "").charAt(0) == "-" && (num = num.substring(1), sign = "-");
let arr = num.split(/[e]/ig);
if (arr.length < 2) return sign + num;
let dot = (.1).toLocaleString().substr(1, 1), n = arr[0], exp = +arr[1],
w = (n = n.replace(/^0+/, '')).replace(dot, ''),
pos = n.split(dot)[1] ? n.indexOf(dot) + exp : w.length + exp,
L = pos - w.length, s = "" + BigInt(w);
w = exp >= 0 ? (L >= 0 ? s + "0".repeat(L) : r()) : (pos <= 0 ? "0" + dot + "0".repeat(Math.abs(pos)) + s : r());
L= w.split(dot); if (L[0]==0 && L[1]==0 || (+w==0 && +s==0) ) w = 0; //** added 9/10/2021
return sign + w;
function r() {return w.replace(new RegExp(`^(.{${pos}})(.)`), `$1${dot}$2`)}
} catch(e) {
console.error(e);
return num;
}
}
/* ----------- Step 1 ----------- */
function update_coins() {
from_icon = document.getElementById("from_icon");
to_icon = document.getElementById("to_icon");
to_icon_t = document.getElementById("to_icon_t");
current_coin = document.getElementById("coin_select").value;
update_element("current_coin", current_coin);
if (current_coin == "LKE") $("#likecoin_notice").fadeIn('fast');
else $("#likecoin_notice").fadeOut('fast');
if (get_price(current_coin, "sell") <= 0) {
update_element("coin_from",
current_coin + "<span class='has-text-info'> (Buy only)</span>");
update_element("swap_type", "buy");
update_element("coin_to", "DUCO");
update_element("swap_price", eToNumber(get_price(current_coin, "buy")) + " " + current_coin)
update_element("swap_liquidity", prices[current_coin.toLowerCase()]["liquidity"].toLowerCase());
$("#bonustag").fadeIn();
from_icon.src = `https://exchange.duinocoin.com/images/${current_coin.toLowerCase()}.png`;
to_icon.src = `https://exchange.duinocoin.com/images/duco.png`;
to_icon_t.src = `https://exchange.duinocoin.com/images/${current_coin.toLowerCase()}.png`;
} else {
update_element("coin_to", current_coin);
update_element("coin_from", "DUCO");
update_element("swap_type", "sell");
update_element("swap_price", eToNumber(get_price(current_coin, "sell")) + " " + current_coin);
update_element("swap_liquidity", prices[current_coin.toLowerCase()]["liquidity"].toLowerCase());
$("#bonustag").fadeOut();
from_icon.src = `https://exchange.duinocoin.com/images/duco.png`;
to_icon.src = `https://exchange.duinocoin.com/images/${current_coin.toLowerCase()}.png`;
to_icon_t.src = `https://exchange.duinocoin.com/images/${current_coin.toLowerCase()}.png`;
}
}
function get_price(coin, type) {
try {
return prices[coin.toLowerCase()][type.toLowerCase()];
} catch (err) {
return 0.0
}
}
function dollar_price(coin) {
if (coin.toUpperCase() == "LKE") return 0.0;
if (coin.toUpperCase() == "XMG") return 0.0;
else if (coin.toUpperCase() == "XNO") coin = "nano";
else if (coin.toUpperCase() == "BCH") coin = "bitcoin-cash";
else if (coin.toUpperCase() == "SHIB") coin = "shiba-inu";
else if (coin.toUpperCase() == "XRP") coin = "ripple";
else if (coin.toUpperCase() == "TRX") coin = "tron";
else if (coin.toUpperCase() == "RVN") coin = "ravencoin";
else if (coin.toUpperCase() == "DGB") coin = "digibyte";
else if (coin.toUpperCase() == "ETH") coin = "ethereum";
else if (coin.toUpperCase() == "XMR") coin = "monero";
else if (coin.toUpperCase() == "BTC") coin = "bitcoin";
else if (coin.toUpperCase() == "DOGE") coin = "dogecoin";
else if (coin.toUpperCase() == "LTC") coin = "litecoin";
return dollar_prices[coin.toLowerCase()]["usd"];
}
function change_coin() {
current_coin = document.getElementById("coin_select").value;
from_span = document.getElementById("coin_from");
to_span = document.getElementById("coin_to");
from_icon = document.getElementById("from_icon");
to_icon = document.getElementById("to_icon");
type_span = document.getElementById("swap_type");
to_icon_t = document.getElementById("to_icon_t");
old_from = from_span.innerHTML;
old_to = to_span.innerHTML;
if (type_span.innerHTML == "sell") {
new_type = "buy";
$("#bonustag").fadeIn();
}
else {
new_type = "sell";
$("#bonustag").fadeOut();
}
if (get_price(current_coin, new_type) <= 0) {
alert("This pair is buy only because of no liquidity");
return
}
from_icon.src = `https://exchange.duinocoin.com/images/${old_to.toLowerCase()}.png`;
to_icon.src = `https://exchange.duinocoin.com/images/${old_from.toLowerCase()}.png`;
to_icon_t.src = `https://exchange.duinocoin.com/images/${old_from.toLowerCase()}.png`;
update_element("coin_from", old_to);
update_element("coin_to", old_from);
update_element("swap_type", new_type);
update_element("swap_price", eToNumber(get_price(current_coin, new_type)) + " " + current_coin)
update_element("swap_liquidity", prices[current_coin.toLowerCase()]["liquidity"].toLowerCase());
}
/* ----------- Step 2 ----------- */
function process_input() {
current_coin = document.getElementById("coin_select").value;
current_type = document.getElementById("swap_type").innerHTML;
amount = document.getElementById("amount_input").value;
swap_amount = document.getElementById("swap_amount");
amount_button = document.getElementById("submit_amount");
swap_amount_alt = document.getElementById("swap_amount_alt");
if (amount > 0) {
update_element("swap_amount", amount + " DUCO");
update_element("swap_amount_alt", round_to(8, amount * get_price(current_coin, current_type)) + " " + current_coin +
" ($" + round_to(4, amount * get_price(current_coin, current_type) * dollar_price(current_coin)) + ")");
amount_button.disabled = false;
} else {
update_element("swap_amount", "0 DUCO");
update_element("swap_amount_alt", "0 " + current_coin + " ($0)");
amount_button.disabled = true;
}
}
setInterval(function() {
process_input();
}, 150)
/* ----------- Step 3 ----------- */
function swap() {
submit_button = document.getElementById("submit");
submit_button.classList.add("is-loading");
username = document.getElementById("username").value;
password = document.getElementById("password").value;
email = document.getElementById("email").value;
amount = document.getElementById("amount_input").value;
coin = document.getElementById("coin_select").value;
type = document.getElementById("swap_type").innerHTML;
address = document.getElementById("address").value;
exchange(username, password, email, type, amount, address, coin);
}
function exchange(username, password, email, type, amount, address, coin) {
submit_button = document.getElementById("submit");
$.getJSON('https://server.duinocoin.com/exchange_request/' +
'?username=' + encodeURIComponent(username) +
'&password=' + encodeURIComponent(password) +
'&email=' + encodeURIComponent(email) +
'&type=' + encodeURIComponent(type) +
'&amount=' + encodeURIComponent(amount) +
'&coin=' + encodeURIComponent(coin) +
'&address=' + encodeURIComponent(address),
function(data) {
submit_button.classList.remove("is-loading");
if (data.success == true) {
window.location = 'success.html';
} else {
alert(data.message);
}
}).fail(function(jqXHR, textStatus, errorThrown) {
if (!jqXHR) alert(`Too many exchange requests`);
else alert(`Error submitting exchange request: ${jqXHR.responseText}, ${textStatus}, ${errorThrown} - please contact us`);
})
}
/* --------- Checks -------- */
function check_inputs() {
submit_button = document.getElementById("submit");
username = document.getElementById("username").value;
password = document.getElementById("password").value;
email = document.getElementById("email").value;
amount = document.getElementById("amount_input").value;
coin = document.getElementById("coin_select").value;
type = document.getElementById("swap_type").innerHTML;
address = document.getElementById("address").value;
bonus = document.getElementById("bonus");
ignored_coins = ["LKE", "XMG", "RVN", "SHIB"];
if (coin == "XNO") coin = "NANO";
bonus.innerHTML = round_to(3, ((amount*1.05) - amount))
if (!ignored_coins.includes(coin.toUpperCase())) {
correct_address = WAValidator.validate(address, coin.toUpperCase());
} else {
if (coin.toUpperCase() == "LKE") {
if (address.length == 43 && address.startsWith('Like')) {
correct_address = true;
} else correct_address = false;
} else if (coin.toUpperCase() == "XMG") {
if (address.length == 34 && address.startsWith('9')) {
correct_address = true;
} else correct_address = false;
} else if (coin.toUpperCase() == "SHIB") {
if (address.length == 42 && address.startsWith('0x')) {
correct_address = true;
} else correct_address = false;
} else if (coin.toUpperCase() == "RVN") {
if (address.length == 34 && address.startsWith('R')) {
correct_address = true;
} else correct_address = false;
}
}
if (correct_address) {
$("#invalid_address").fadeOut('fast', function() {
$("#valid_address").fadeIn('fast');
});
} else {
$("#valid_address").fadeOut('fast', function() {
$("#invalid_address").fadeIn('fast');
});
}
if (username && password && email && amount && coin && type && address && correct_address) {
submit_button.disabled = false;
} else {
submit_button.disabled = true;
}
}
setInterval(function() {
check_inputs();
}, 150)
document.addEventListener('DOMContentLoaded', () => { // HAMBURGER MENU
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
if ($navbarBurgers.length > 0) {
$navbarBurgers.forEach(el => { // Add a click event on each of burger menus
el.addEventListener('click', () => {
const target = el.dataset.target; // Get the target from the "data-target" attribute
const $target = document.getElementById(target);
el.classList.toggle('is-active'); // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
$target.classList.toggle('is-active');
});
});
}
});
</script>
</html>