added xmr/btc data for shapeshift

This commit is contained in:
Jan Scheiper 2019-07-25 10:55:22 +02:00
parent 3162bcf4c8
commit 27ec18cf7a
2 changed files with 18 additions and 4 deletions

View File

@ -8,7 +8,7 @@ class XMRData extends EventEmitter {
} }
get initial() { get initial() {
return { shapeshift: null, xmrto: null }; return { shapeshift: null, xmrto: null, shapeshift_xmr: null };
} }
start() { start() {
@ -25,12 +25,13 @@ class XMRData extends EventEmitter {
axios.get("https://shapeshift.io/marketinfo/btc_xmr").catch(err => log.error(err.config.url, err.message)), axios.get("https://shapeshift.io/marketinfo/btc_xmr").catch(err => log.error(err.config.url, err.message)),
axios.get("https://xmr.to/api/v2/xmr2btc/order_parameter_query/").catch(err => log.error(err.config.url, err.message)), axios.get("https://xmr.to/api/v2/xmr2btc/order_parameter_query/").catch(err => log.error(err.config.url, err.message)),
]).then(resp => { ]).then(resp => {
let bitpay = null, shapeshift = null, xmrto = null; let bitpay = null, shapeshift = null, xmrto = null, shapeshift_xmr = null;
if (resp[0] != undefined) { if (resp[0] != undefined) {
bitpay = resp[0].data.rate; bitpay = resp[0].data.rate;
if (resp[1] != undefined) { if (resp[1] != undefined) {
shapeshift_xmr = (Math.round(resp[1].data.rate * 100) / 100) + "XMR";
shapeshift = (Math.round((bitpay / resp[1].data.rate) * 100) / 100) + "€"; shapeshift = (Math.round((bitpay / resp[1].data.rate) * 100) / 100) + "€";
} }
@ -39,7 +40,7 @@ class XMRData extends EventEmitter {
} }
} }
this.emit("data", { shapeshift, xmrto }); this.emit("data", { shapeshift, xmrto, shapeshift_xmr });
}); });
} }
} }

View File

@ -56,6 +56,19 @@
line-height: 50px; line-height: 50px;
vertical-align: top; vertical-align: top;
font-size: 1.5em; font-size: 1.5em;
margin-left: 5px;
}
.databox .data:nth-of-type(1) {
margin-left: 0px;
}
.data.parentheses::before {
content: "(";
}
.data.parentheses::after {
content: ")";
} }
#overlay { #overlay {
@ -90,7 +103,7 @@
<div class="title">Monero</div> <div class="title">Monero</div>
<div class="databox"> <div class="databox">
<img class="icon" src="img/shapeshift.png"><div class="data d-monero-shapeshift">---</div> <img class="icon" src="img/shapeshift.png"><div class="data d-monero-shapeshift">---</div> <div class="data parentheses d-monero-shapeshift_xmr">---</div>
</div> </div>
<div class="databox"> <div class="databox">