diff --git a/qortal-ui-core/src/components/app-view.js b/qortal-ui-core/src/components/app-view.js
index 576f18e6..cffb9f60 100644
--- a/qortal-ui-core/src/components/app-view.js
+++ b/qortal-ui-core/src/components/app-view.js
@@ -1381,12 +1381,13 @@ class AppView extends connect(store)(LitElement) {
async updateQortWalletBalance() {
clearTimeout(this.updateQortBalanceTimeout)
let qortAddress = store.getState().app.selectedAddress.address
+
await parentEpml.request('apiCall', {
url: `/addresses/balance/${qortAddress}?apiKey=${this.getApiKey()}`,
}).then((res) => {
this.qortWalletBalance = res
- this.updateQortBalanceTimeout = setTimeout(() => this.updateQortWalletBalance(), 120000)
})
+ this.updateQortBalanceTimeout = setTimeout(() => this.updateQortWalletBalance(), 120000)
}
async updateBtcWalletBalance() {
@@ -1400,8 +1401,7 @@ class AppView extends connect(store)(LitElement) {
body: _body,
}).then((res) => {
if (isNaN(Number(res))) {
- let snack1string = get("tradepage.tchange30")
- parentEpml.request('showSnackBar', `${snack1string}`)
+ //...
} else {
this.btcWalletBalance = (Number(res) / 1e8).toFixed(8)
}
@@ -1420,8 +1420,7 @@ class AppView extends connect(store)(LitElement) {
body: _body,
}).then((res) => {
if (isNaN(Number(res))) {
- let snack1string = get("tradepage.tchange30")
- parentEpml.request('showSnackBar', `${snack1string}`)
+ //...
} else {
this.ltcWalletBalance = (Number(res) / 1e8).toFixed(8)
}
@@ -1440,8 +1439,7 @@ class AppView extends connect(store)(LitElement) {
body: _body,
}).then((res) => {
if (isNaN(Number(res))) {
- let snack1string = get("tradepage.tchange30")
- parentEpml.request('showSnackBar', `${snack1string}`)
+ //...
} else {
this.dogeWalletBalance = (Number(res) / 1e8).toFixed(8)
}
@@ -1460,8 +1458,7 @@ class AppView extends connect(store)(LitElement) {
body: _body,
}).then((res) => {
if (isNaN(Number(res))) {
- let snack1string = get("tradepage.tchange30")
- parentEpml.request('showSnackBar', `${snack1string}`)
+ //...
} else {
this.dgbWalletBalance = (Number(res) / 1e8).toFixed(8)
}
@@ -1480,8 +1477,7 @@ class AppView extends connect(store)(LitElement) {
body: _body,
}).then((res) => {
if (isNaN(Number(res))) {
- let snack1string = get("tradepage.tchange30")
- parentEpml.request('showSnackBar', `${snack1string}`)
+ //...
} else {
this.rvnWalletBalance = (Number(res) / 1e8).toFixed(8)
}
@@ -1500,8 +1496,7 @@ class AppView extends connect(store)(LitElement) {
body: _body,
}).then((res) => {
if (isNaN(Number(res))) {
- let snack1string = get("tradepage.tchange30")
- parentEpml.request('showSnackBar', `${snack1string}`)
+ //...
} else {
this.arrrWalletBalance = (Number(res) / 1e8).toFixed(8)
}
diff --git a/qortal-ui-core/src/components/sidenav-menu.js b/qortal-ui-core/src/components/sidenav-menu.js
index add40671..f79559fe 100644
--- a/qortal-ui-core/src/components/sidenav-menu.js
+++ b/qortal-ui-core/src/components/sidenav-menu.js
@@ -195,17 +195,8 @@ class SidenavMenu extends connect(store)(LitElement) {
>
-
+
-
-
-
{
if (isNaN(Number(res))) {
- let snack1string = get("tradepage.tchange30")
- parentEpml.request('showSnackBar', `${snack1string}`)
+ //...
} else {
this.listedCoins.get(this.selectedCoin).balance = (Number(res) / 1e8).toFixed(8)
}
@@ -2288,139 +2281,54 @@ class TradeBotPortal extends LitElement {
}
async getDoneTrades() {
+ let tradesUrl = ``
+ clearTimeout(this.updateDoneTradesTimeout)
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
const myAddress = window.parent.reduxStore.getState().app.selectedAddress.address
+
switch (this.selectedCoin) {
case 'BITCOIN':
- this.isLoadingDoneTrades = true
- const doneBtcQortalUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=BITCOIN&minimumTimestamp=1597310000000&limit=0&reverse=true`
-
- const doneBtcQortal = await fetch(doneBtcQortalUrl).then(response => {
- return response.json()
- })
-
- this.listedCoins.get(this.selectedCoin).myGridBoughtItems = doneBtcQortal.map(item => {
- const searchBtcAddress = item.buyerReceivingAddress
- if (searchBtcAddress == myAddress) {
- return {
- timestamp: item.tradeTimestamp,
- foreignAmount: item.foreignAmount,
- qortAmount: item.qortAmount
- }
- }
- }).filter(item => !!item)
-
- this.isLoadingDoneTrades = false
+ tradesUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=BITCOIN&minimumTimestamp=1597310000000&limit=0&reverse=true`
break
case 'LITECOIN':
- this.isLoadingDoneTrades = true
- const doneLtcQortalUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=LITECOIN&minimumTimestamp=1597310000000&limit=0&reverse=true`
-
- const doneLtcQortal = await fetch(doneLtcQortalUrl).then(response => {
- return response.json()
- })
-
- this.listedCoins.get(this.selectedCoin).myGridBoughtItems = doneLtcQortal.map(item => {
- const searchLtcAddress = item.buyerReceivingAddress
- if (searchLtcAddress == myAddress) {
- return {
- timestamp: item.tradeTimestamp,
- foreignAmount: item.foreignAmount,
- qortAmount: item.qortAmount
- }
- }
- }).filter(item => !!item)
-
- this.isLoadingDoneTrades = false
+ tradesUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=LITECOIN&minimumTimestamp=1597310000000&limit=0&reverse=true`
break
case 'DOGECOIN':
- this.isLoadingDoneTrades = true
- const doneDogeQortalUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=DOGECOIN&minimumTimestamp=1597310000000&limit=0&reverse=true`
-
- const doneDogeQortal = await fetch(doneDogeQortalUrl).then(response => {
- return response.json()
- })
-
- this.listedCoins.get(this.selectedCoin).myGridBoughtItems = doneDogeQortal.map(item => {
- const searchDogeAddress = item.buyerReceivingAddress
- if (searchDogeAddress == myAddress) {
- return {
- timestamp: item.tradeTimestamp,
- foreignAmount: item.foreignAmount,
- qortAmount: item.qortAmount
- }
- }
- }).filter(item => !!item)
-
- this.isLoadingDoneTrades = false
+ tradesUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=DOGECOIN&minimumTimestamp=1597310000000&limit=0&reverse=true`
break
case 'DIGIBYTE':
- this.isLoadingDoneTrades = true
- const doneDgbQortalUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=DIGIBYTE&minimumTimestamp=1597310000000&limit=0&reverse=true`
-
- const doneDgbQortal = await fetch(doneDgbQortalUrl).then(response => {
- return response.json()
- })
-
- this.listedCoins.get(this.selectedCoin).myGridBoughtItems = doneDgbQortal.map(item => {
- const searchDgbAddress = item.buyerReceivingAddress
- if (searchDgbAddress == myAddress) {
- return {
- timestamp: item.tradeTimestamp,
- foreignAmount: item.foreignAmount,
- qortAmount: item.qortAmount
- }
- }
- }).filter(item => !!item)
-
- this.isLoadingDoneTrades = false
+ tradesUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=DIGIBYTE&minimumTimestamp=1597310000000&limit=0&reverse=true`
break
case 'RAVENCOIN':
- this.isLoadingDoneTrades = true
- const doneRvnQortalUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=RAVENCOIN&minimumTimestamp=1597310000000&limit=0&reverse=true`
-
- const doneRvnQortal = await fetch(doneRvnQortalUrl).then(response => {
- return response.json()
- })
-
- this.listedCoins.get(this.selectedCoin).myGridBoughtItems = doneRvnQortal.map(item => {
- const searchRvnAddress = item.buyerReceivingAddress
- if (searchRvnAddress == myAddress) {
- return {
- timestamp: item.tradeTimestamp,
- foreignAmount: item.foreignAmount,
- qortAmount: item.qortAmount
- }
- }
- }).filter(item => !!item)
-
- this.isLoadingDoneTrades = false
+ tradesUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=RAVENCOIN&minimumTimestamp=1597310000000&limit=0&reverse=true`
break
case 'PIRATECHAIN':
- this.isLoadingDoneTrades = true
- const doneArrrQortalUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=PIRATECHAIN&minimumTimestamp=1597310000000&limit=0&reverse=true`
-
- const doneArrrQortal = await fetch(doneArrrQortalUrl).then(response => {
- return response.json()
- })
-
- this.listedCoins.get(this.selectedCoin).myGridBoughtItems = doneArrrQortal.map(item => {
- const searchArrrAddress = item.buyerReceivingAddress
- if (searchArrrAddress == myAddress) {
- return {
- timestamp: item.tradeTimestamp,
- foreignAmount: item.foreignAmount,
- qortAmount: item.qortAmount
- }
- }
- }).filter(item => !!item)
-
- this.isLoadingDoneTrades = false
+ tradesUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=PIRATECHAIN&minimumTimestamp=1597310000000&limit=0&reverse=true`
break
default:
break
}
+
+ this.isLoadingDoneTrades = true
+
+ const doneTradesAll = await fetch(tradesUrl).then(response => {
+ return response.json()
+ })
+
+ this.listedCoins.get(this.selectedCoin).myGridBoughtItems = doneTradesAll.map(item => {
+ const searchAddress = item.buyerReceivingAddress
+ if (searchAddress == myAddress) {
+ return {
+ timestamp: item.tradeTimestamp,
+ foreignAmount: item.foreignAmount,
+ qortAmount: item.qortAmount
+ }
+ }
+ }).filter(item => !!item)
+
+ this.isLoadingDoneTrades = false
+ this.updateDoneTradesTimeout = setTimeout(() => this.getDoneTrades(), 300000)
}
btcTradebook() {
diff --git a/qortal-ui-plugins/plugins/core/trade-portal/trade-portal.src.js b/qortal-ui-plugins/plugins/core/trade-portal/trade-portal.src.js
index b317facd..cf017801 100644
--- a/qortal-ui-plugins/plugins/core/trade-portal/trade-portal.src.js
+++ b/qortal-ui-plugins/plugins/core/trade-portal/trade-portal.src.js
@@ -1504,8 +1504,7 @@ class TradePortal extends LitElement {
body: _body,
}).then((res) => {
if (isNaN(Number(res))) {
- let snack1string = get("tradepage.tchange30")
- parentEpml.request('showSnackBar', `${snack1string}`)
+ //...
} else {
this.listedCoins.get(this.selectedCoin).balance = (Number(res) / 1e8).toFixed(8)
}