Browse Source

Add dynamic fee to Trades

resolve-20231003
QuickMythril 1 year ago
parent
commit
85883d4166
  1. 15
      plugins/plugins/core/trade-bot/trade-bot-portal.src.js
  2. 17
      plugins/plugins/core/trade-portal/trade-portal.src.js

15
plugins/plugins/core/trade-bot/trade-bot-portal.src.js

@ -2104,6 +2104,7 @@ class TradeBotPortal extends LitElement {
this.changeTheme()
this.changeLanguage()
this.tradeFee()
this.autoHelperMessage = this.renderAutoHelperPass()
@ -3736,6 +3737,20 @@ class TradeBotPortal extends LitElement {
}
}
async tradeFee() {
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 url = `${nodeUrl}/transactions/unitfee?txType=DEPLOY_AT`
await fetch(url).then((response) => {
if (response.ok) {
return response.json()
}
return Promise.reject(response)
}).then((json) => {
this.listedCoins.get("QORTAL").tradeFee = (Number(json) / 1e8).toFixed(2)
})
}
getApiKey() {
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
let apiKey = myNode.apiKey;

17
plugins/plugins/core/trade-portal/trade-portal.src.js

@ -1421,6 +1421,7 @@ class TradePortal extends LitElement {
this.changeTheme()
this.changeLanguage()
this.tradeFee()
this.tradeHelperMessage = this.renderTradeHelperPass()
@ -2758,7 +2759,7 @@ class TradePortal extends LitElement {
}
}
if (this.round(parseFloat(fundingQortAmount) + parseFloat(0.002)) > parseFloat(this.listedCoins.get("QORTAL").balance)) {
if (this.round(parseFloat(fundingQortAmount) + parseFloat(this.listedCoins.get("QORTAL").tradeFee)) > parseFloat(this.listedCoins.get("QORTAL").balance)) {
this.isSellLoading = false
this.sellBtnDisable = false
let snack4string = get("tradepage.tchange22")
@ -3021,6 +3022,20 @@ class TradePortal extends LitElement {
}
}
async tradeFee() {
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 url = `${nodeUrl}/transactions/unitfee?txType=DEPLOY_AT`
await fetch(url).then((response) => {
if (response.ok) {
return response.json()
}
return Promise.reject(response)
}).then((json) => {
this.listedCoins.get("QORTAL").tradeFee = (Number(json) / 1e8).toFixed(2)
})
}
getApiKey() {
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
let apiKey = myNode.apiKey;

Loading…
Cancel
Save