mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-12 02:05:51 +00:00
Update auto buy
This commit is contained in:
parent
d1942df293
commit
abe7b2b87f
@ -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)
|
||||
}
|
||||
|
@ -195,17 +195,8 @@ class SidenavMenu extends connect(store)(LitElement) {
|
||||
>
|
||||
<vaadin-icon icon="vaadin:desktop" slot="icon" ></vaadin-icon>
|
||||
</side-menu-item>
|
||||
<side-menu-item
|
||||
label="${translate('sidemenu.groups')}"
|
||||
expanded
|
||||
>
|
||||
<side-menu-item label="${translate('sidemenu.groups')}" href="/app/group-management">
|
||||
<vaadin-icon icon="vaadin:group" slot="icon"></vaadin-icon>
|
||||
<side-menu-item
|
||||
label="${translate('sidemenu.groupmanagement')}"
|
||||
href="/app/group-management"
|
||||
>
|
||||
<vaadin-icon icon="vaadin:group" slot="icon"></vaadin-icon>
|
||||
</side-menu-item>
|
||||
</side-menu-item>
|
||||
<side-menu-item
|
||||
label="${translate('sidemenu.puzzles')}"
|
||||
|
@ -793,12 +793,6 @@ class TradeBotPortal extends LitElement {
|
||||
this.dgbqort = 0
|
||||
this.rvnqort = 0
|
||||
this.arrrqort = 0
|
||||
this.tradeInfoAccountName = ''
|
||||
this.tradeImageUrl = ''
|
||||
this.tradeAddressResult = []
|
||||
this.displayTradeAddress = ''
|
||||
this.displayTradeLevel = ''
|
||||
this.displayTradeBalance = ''
|
||||
this.tradeBotBtcBook = []
|
||||
this.tradeBotLtcBook = []
|
||||
this.tradeBotDogeBook = []
|
||||
@ -2257,8 +2251,7 @@ class TradeBotPortal 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)
|
||||
}
|
||||
@ -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() {
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user