mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-11 17:55:51 +00:00
Load exchange rate once at start then every 5 minutes
This commit is contained in:
parent
2c13227809
commit
ed5163ff8c
@ -1026,6 +1026,48 @@ class TradePortal extends LitElement {
|
||||
|
||||
this.getOpenOrdersGrid()
|
||||
|
||||
const getQortBtcPrice = () => {
|
||||
parentEpml.request("apiCall", { url: `/crosschain/price/BITCOIN?inverse=true` }).then((res) => {
|
||||
setTimeout(() => { this.qortbtc = (Number(res) / 1e8).toFixed(8) }, 1)
|
||||
})
|
||||
setTimeout(getQortBtcPrice, 300000)
|
||||
}
|
||||
|
||||
const getQortLtcPrice = () => {
|
||||
parentEpml.request("apiCall", { url: `/crosschain/price/LITECOIN?inverse=true` }).then((res) => {
|
||||
setTimeout(() => { this.qortltc = (Number(res) / 1e8).toFixed(8) }, 1)
|
||||
})
|
||||
setTimeout(getQortLtcPrice, 300000)
|
||||
}
|
||||
|
||||
const getQortDogePrice = () => {
|
||||
parentEpml.request("apiCall", { url: `/crosschain/price/DOGECOIN?inverse=true` }).then((res) => {
|
||||
setTimeout(() => { this.qortdoge = (Number(res) / 1e8).toFixed(8) }, 1)
|
||||
})
|
||||
setTimeout(getQortDogePrice, 300000)
|
||||
}
|
||||
|
||||
const getQortDgbPrice = () => {
|
||||
parentEpml.request("apiCall", { url: `/crosschain/price/DIGIBYTE?inverse=true` }).then((res) => {
|
||||
setTimeout(() => { this.qortdgb = (Number(res) / 1e8).toFixed(8) }, 1)
|
||||
})
|
||||
setTimeout(getQortDgbPrice, 300000)
|
||||
}
|
||||
|
||||
const getQortRvnPrice = () => {
|
||||
parentEpml.request("apiCall", { url: `/crosschain/price/RAVENCOIN?inverse=true` }).then((res) => {
|
||||
setTimeout(() => { this.qortrvn = (Number(res) / 1e8).toFixed(8) }, 1)
|
||||
})
|
||||
setTimeout(getQortRvnPrice, 300000)
|
||||
}
|
||||
|
||||
const getQortArrrPrice = () => {
|
||||
parentEpml.request("apiCall", { url: `/crosschain/price/PIRATECHAIN?inverse=true` }).then((res) => {
|
||||
setTimeout(() => { this.qortarrr = (Number(res) / 1e8).toFixed(8) }, 1)
|
||||
})
|
||||
setTimeout(getQortArrrPrice, 300000)
|
||||
}
|
||||
|
||||
window.addEventListener('contextmenu', (event) => {
|
||||
event.preventDefault()
|
||||
this._textMenu(event)},
|
||||
@ -1067,7 +1109,15 @@ class TradePortal extends LitElement {
|
||||
})
|
||||
|
||||
parentEpml.subscribe('config', (c) => {
|
||||
if (!configLoaded) configLoaded = true
|
||||
if (!configLoaded) {
|
||||
setTimeout(getQortBtcPrice, 1)
|
||||
setTimeout(getQortLtcPrice, 1)
|
||||
setTimeout(getQortDogePrice, 1)
|
||||
setTimeout(getQortDgbPrice, 1)
|
||||
setTimeout(getQortRvnPrice, 1)
|
||||
setTimeout(getQortArrrPrice, 1)
|
||||
configLoaded = true
|
||||
}
|
||||
this.config = JSON.parse(c)
|
||||
})
|
||||
|
||||
@ -1112,46 +1162,16 @@ class TradePortal extends LitElement {
|
||||
|
||||
exchangeRateQort() {
|
||||
if (this.listedCoins.get(this.selectedCoin).coinCode === "BTC") {
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/crosschain/price/BITCOIN?inverse=true`
|
||||
}).then((res) => {
|
||||
this.qortbtc = (Number(res) / 1e8).toFixed(8)
|
||||
})
|
||||
return html`${this.qortbtc}`
|
||||
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "LTC") {
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/crosschain/price/LITECOIN?inverse=true`
|
||||
}).then((res) => {
|
||||
this.qortltc = (Number(res) / 1e8).toFixed(8)
|
||||
})
|
||||
return html`${this.qortltc}`
|
||||
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "DOGE") {
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/crosschain/price/DOGECOIN?inverse=true`
|
||||
}).then((res) => {
|
||||
this.qortdoge = (Number(res) / 1e8).toFixed(8)
|
||||
})
|
||||
return html`${this.qortdoge}`
|
||||
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "DGB") {
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/crosschain/price/DIGIBYTE?inverse=true`
|
||||
}).then((res) => {
|
||||
this.qortdgb = (Number(res) / 1e8).toFixed(8)
|
||||
})
|
||||
return html`${this.qortdgb}`
|
||||
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "RVN") {
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/crosschain/price/RAVENCOIN?inverse=true`
|
||||
}).then((res) => {
|
||||
this.qortrvn = (Number(res) / 1e8).toFixed(8)
|
||||
})
|
||||
return html`${this.qortrvn}`
|
||||
} else if (this.listedCoins.get(this.selectedCoin).coinCode === "ARRR") {
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/crosschain/price/PIRATECHAIN?inverse=true`
|
||||
}).then((res) => {
|
||||
this.qortarrr = (Number(res) / 1e8).toFixed(8)
|
||||
})
|
||||
return html`${this.qortarrr}`
|
||||
}
|
||||
}
|
||||
|
@ -3699,7 +3699,7 @@ class MultiWallet extends LitElement {
|
||||
}
|
||||
|
||||
calculateQortAll() {
|
||||
if (this.balance < 0.00100000) {
|
||||
if (this.balance < 0.00110000) {
|
||||
let not_enough_string = get("walletpage.wchange26")
|
||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||
} else {
|
||||
@ -3708,7 +3708,7 @@ class MultiWallet extends LitElement {
|
||||
}
|
||||
|
||||
calculateBtcAll() {
|
||||
if (this.balance < 0.00050000) {
|
||||
if (this.balance < 0.00051000) {
|
||||
let not_enough_string = get("walletpage.wchange26")
|
||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||
} else {
|
||||
@ -3718,17 +3718,17 @@ class MultiWallet extends LitElement {
|
||||
}
|
||||
|
||||
calculateLtcAll() {
|
||||
if (this.balance < 0.00050000) {
|
||||
if (this.balance < 0.00031000) {
|
||||
let not_enough_string = get("walletpage.wchange26")
|
||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||
} else {
|
||||
this.ltcAmount = (this.balance - 0.00025000).toFixed(8)
|
||||
this.ltcAmount = (this.balance - 0.00030000).toFixed(8)
|
||||
this.ltcFeePerByte = 15
|
||||
}
|
||||
}
|
||||
|
||||
calculateDogeAll() {
|
||||
if (this.balance < 0.05000000) {
|
||||
if (this.balance < 0.05100000) {
|
||||
let not_enough_string = get("walletpage.wchange26")
|
||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||
} else {
|
||||
@ -3738,7 +3738,7 @@ class MultiWallet extends LitElement {
|
||||
}
|
||||
|
||||
calculateDgbAll() {
|
||||
if (this.balance < 0.00005000) {
|
||||
if (this.balance < 0.00005100) {
|
||||
let not_enough_string = get("walletpage.wchange26")
|
||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||
} else {
|
||||
@ -3748,7 +3748,7 @@ class MultiWallet extends LitElement {
|
||||
}
|
||||
|
||||
calculateRvnAll() {
|
||||
if (this.balance < 0.00562500) {
|
||||
if (this.balance < 0.00572500) {
|
||||
let not_enough_string = get("walletpage.wchange26")
|
||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||
} else {
|
||||
@ -3758,7 +3758,7 @@ class MultiWallet extends LitElement {
|
||||
}
|
||||
|
||||
calculateArrrAll() {
|
||||
if (this.balance < 0.00010000) {
|
||||
if (this.balance < 0.00011000) {
|
||||
let not_enough_string = get("walletpage.wchange26")
|
||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user