mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-15 03:35: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() {
|
async updateQortWalletBalance() {
|
||||||
clearTimeout(this.updateQortBalanceTimeout)
|
clearTimeout(this.updateQortBalanceTimeout)
|
||||||
let qortAddress = store.getState().app.selectedAddress.address
|
let qortAddress = store.getState().app.selectedAddress.address
|
||||||
|
|
||||||
await parentEpml.request('apiCall', {
|
await parentEpml.request('apiCall', {
|
||||||
url: `/addresses/balance/${qortAddress}?apiKey=${this.getApiKey()}`,
|
url: `/addresses/balance/${qortAddress}?apiKey=${this.getApiKey()}`,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
this.qortWalletBalance = res
|
this.qortWalletBalance = res
|
||||||
this.updateQortBalanceTimeout = setTimeout(() => this.updateQortWalletBalance(), 120000)
|
|
||||||
})
|
})
|
||||||
|
this.updateQortBalanceTimeout = setTimeout(() => this.updateQortWalletBalance(), 120000)
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateBtcWalletBalance() {
|
async updateBtcWalletBalance() {
|
||||||
@ -1400,8 +1401,7 @@ class AppView extends connect(store)(LitElement) {
|
|||||||
body: _body,
|
body: _body,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (isNaN(Number(res))) {
|
if (isNaN(Number(res))) {
|
||||||
let snack1string = get("tradepage.tchange30")
|
//...
|
||||||
parentEpml.request('showSnackBar', `${snack1string}`)
|
|
||||||
} else {
|
} else {
|
||||||
this.btcWalletBalance = (Number(res) / 1e8).toFixed(8)
|
this.btcWalletBalance = (Number(res) / 1e8).toFixed(8)
|
||||||
}
|
}
|
||||||
@ -1420,8 +1420,7 @@ class AppView extends connect(store)(LitElement) {
|
|||||||
body: _body,
|
body: _body,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (isNaN(Number(res))) {
|
if (isNaN(Number(res))) {
|
||||||
let snack1string = get("tradepage.tchange30")
|
//...
|
||||||
parentEpml.request('showSnackBar', `${snack1string}`)
|
|
||||||
} else {
|
} else {
|
||||||
this.ltcWalletBalance = (Number(res) / 1e8).toFixed(8)
|
this.ltcWalletBalance = (Number(res) / 1e8).toFixed(8)
|
||||||
}
|
}
|
||||||
@ -1440,8 +1439,7 @@ class AppView extends connect(store)(LitElement) {
|
|||||||
body: _body,
|
body: _body,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (isNaN(Number(res))) {
|
if (isNaN(Number(res))) {
|
||||||
let snack1string = get("tradepage.tchange30")
|
//...
|
||||||
parentEpml.request('showSnackBar', `${snack1string}`)
|
|
||||||
} else {
|
} else {
|
||||||
this.dogeWalletBalance = (Number(res) / 1e8).toFixed(8)
|
this.dogeWalletBalance = (Number(res) / 1e8).toFixed(8)
|
||||||
}
|
}
|
||||||
@ -1460,8 +1458,7 @@ class AppView extends connect(store)(LitElement) {
|
|||||||
body: _body,
|
body: _body,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (isNaN(Number(res))) {
|
if (isNaN(Number(res))) {
|
||||||
let snack1string = get("tradepage.tchange30")
|
//...
|
||||||
parentEpml.request('showSnackBar', `${snack1string}`)
|
|
||||||
} else {
|
} else {
|
||||||
this.dgbWalletBalance = (Number(res) / 1e8).toFixed(8)
|
this.dgbWalletBalance = (Number(res) / 1e8).toFixed(8)
|
||||||
}
|
}
|
||||||
@ -1480,8 +1477,7 @@ class AppView extends connect(store)(LitElement) {
|
|||||||
body: _body,
|
body: _body,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (isNaN(Number(res))) {
|
if (isNaN(Number(res))) {
|
||||||
let snack1string = get("tradepage.tchange30")
|
//...
|
||||||
parentEpml.request('showSnackBar', `${snack1string}`)
|
|
||||||
} else {
|
} else {
|
||||||
this.rvnWalletBalance = (Number(res) / 1e8).toFixed(8)
|
this.rvnWalletBalance = (Number(res) / 1e8).toFixed(8)
|
||||||
}
|
}
|
||||||
@ -1500,8 +1496,7 @@ class AppView extends connect(store)(LitElement) {
|
|||||||
body: _body,
|
body: _body,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (isNaN(Number(res))) {
|
if (isNaN(Number(res))) {
|
||||||
let snack1string = get("tradepage.tchange30")
|
//...
|
||||||
parentEpml.request('showSnackBar', `${snack1string}`)
|
|
||||||
} else {
|
} else {
|
||||||
this.arrrWalletBalance = (Number(res) / 1e8).toFixed(8)
|
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>
|
<vaadin-icon icon="vaadin:desktop" slot="icon" ></vaadin-icon>
|
||||||
</side-menu-item>
|
</side-menu-item>
|
||||||
<side-menu-item
|
<side-menu-item label="${translate('sidemenu.groups')}" href="/app/group-management">
|
||||||
label="${translate('sidemenu.groups')}"
|
|
||||||
expanded
|
|
||||||
>
|
|
||||||
<vaadin-icon icon="vaadin:group" slot="icon"></vaadin-icon>
|
<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>
|
||||||
<side-menu-item
|
<side-menu-item
|
||||||
label="${translate('sidemenu.puzzles')}"
|
label="${translate('sidemenu.puzzles')}"
|
||||||
|
@ -793,12 +793,6 @@ class TradeBotPortal extends LitElement {
|
|||||||
this.dgbqort = 0
|
this.dgbqort = 0
|
||||||
this.rvnqort = 0
|
this.rvnqort = 0
|
||||||
this.arrrqort = 0
|
this.arrrqort = 0
|
||||||
this.tradeInfoAccountName = ''
|
|
||||||
this.tradeImageUrl = ''
|
|
||||||
this.tradeAddressResult = []
|
|
||||||
this.displayTradeAddress = ''
|
|
||||||
this.displayTradeLevel = ''
|
|
||||||
this.displayTradeBalance = ''
|
|
||||||
this.tradeBotBtcBook = []
|
this.tradeBotBtcBook = []
|
||||||
this.tradeBotLtcBook = []
|
this.tradeBotLtcBook = []
|
||||||
this.tradeBotDogeBook = []
|
this.tradeBotDogeBook = []
|
||||||
@ -2257,8 +2251,7 @@ class TradeBotPortal extends LitElement {
|
|||||||
body: _body,
|
body: _body,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (isNaN(Number(res))) {
|
if (isNaN(Number(res))) {
|
||||||
let snack1string = get("tradepage.tchange30")
|
//...
|
||||||
parentEpml.request('showSnackBar', `${snack1string}`)
|
|
||||||
} else {
|
} else {
|
||||||
this.listedCoins.get(this.selectedCoin).balance = (Number(res) / 1e8).toFixed(8)
|
this.listedCoins.get(this.selectedCoin).balance = (Number(res) / 1e8).toFixed(8)
|
||||||
}
|
}
|
||||||
@ -2288,139 +2281,54 @@ class TradeBotPortal extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getDoneTrades() {
|
async getDoneTrades() {
|
||||||
|
let tradesUrl = ``
|
||||||
|
clearTimeout(this.updateDoneTradesTimeout)
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
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 nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
|
||||||
const myAddress = window.parent.reduxStore.getState().app.selectedAddress.address
|
const myAddress = window.parent.reduxStore.getState().app.selectedAddress.address
|
||||||
|
|
||||||
switch (this.selectedCoin) {
|
switch (this.selectedCoin) {
|
||||||
case 'BITCOIN':
|
case 'BITCOIN':
|
||||||
this.isLoadingDoneTrades = true
|
tradesUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=BITCOIN&minimumTimestamp=1597310000000&limit=0&reverse=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
|
|
||||||
break
|
break
|
||||||
case 'LITECOIN':
|
case 'LITECOIN':
|
||||||
this.isLoadingDoneTrades = true
|
tradesUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=LITECOIN&minimumTimestamp=1597310000000&limit=0&reverse=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
|
|
||||||
break
|
break
|
||||||
case 'DOGECOIN':
|
case 'DOGECOIN':
|
||||||
this.isLoadingDoneTrades = true
|
tradesUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=DOGECOIN&minimumTimestamp=1597310000000&limit=0&reverse=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
|
|
||||||
break
|
break
|
||||||
case 'DIGIBYTE':
|
case 'DIGIBYTE':
|
||||||
this.isLoadingDoneTrades = true
|
tradesUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=DIGIBYTE&minimumTimestamp=1597310000000&limit=0&reverse=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
|
|
||||||
break
|
break
|
||||||
case 'RAVENCOIN':
|
case 'RAVENCOIN':
|
||||||
this.isLoadingDoneTrades = true
|
tradesUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=RAVENCOIN&minimumTimestamp=1597310000000&limit=0&reverse=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
|
|
||||||
break
|
break
|
||||||
case 'PIRATECHAIN':
|
case 'PIRATECHAIN':
|
||||||
this.isLoadingDoneTrades = true
|
tradesUrl = `${nodeUrl}/crosschain/trades?foreignBlockchain=PIRATECHAIN&minimumTimestamp=1597310000000&limit=0&reverse=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
|
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
break
|
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() {
|
btcTradebook() {
|
||||||
|
@ -1504,8 +1504,7 @@ class TradePortal extends LitElement {
|
|||||||
body: _body,
|
body: _body,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (isNaN(Number(res))) {
|
if (isNaN(Number(res))) {
|
||||||
let snack1string = get("tradepage.tchange30")
|
//...
|
||||||
parentEpml.request('showSnackBar', `${snack1string}`)
|
|
||||||
} else {
|
} else {
|
||||||
this.listedCoins.get(this.selectedCoin).balance = (Number(res) / 1e8).toFixed(8)
|
this.listedCoins.get(this.selectedCoin).balance = (Number(res) / 1e8).toFixed(8)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user