mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-04-17 00:25:59 +00:00
Update to dynamic fee
This commit is contained in:
parent
8f09ae49eb
commit
19da49cc97
@ -75,6 +75,7 @@ class MultiWallet extends LitElement {
|
|||||||
isValidAmount: { type: Boolean },
|
isValidAmount: { type: Boolean },
|
||||||
balance: { type: Number },
|
balance: { type: Number },
|
||||||
balanceString: { type: String },
|
balanceString: { type: String },
|
||||||
|
qortPaymentFee: { type: Number },
|
||||||
btcFeePerByte: { type: Number },
|
btcFeePerByte: { type: Number },
|
||||||
ltcFeePerByte: { type: Number },
|
ltcFeePerByte: { type: Number },
|
||||||
dogeFeePerByte: { type: Number },
|
dogeFeePerByte: { type: Number },
|
||||||
@ -795,6 +796,7 @@ class MultiWallet extends LitElement {
|
|||||||
this.dgbAmount = 0
|
this.dgbAmount = 0
|
||||||
this.rvnAmount = 0
|
this.rvnAmount = 0
|
||||||
this.arrrAmount = 0
|
this.arrrAmount = 0
|
||||||
|
this.qortPaymentFee = 0.001
|
||||||
this.btcFeePerByte = 100
|
this.btcFeePerByte = 100
|
||||||
this.btcSatMinFee = 20
|
this.btcSatMinFee = 20
|
||||||
this.btcSatMaxFee = 150
|
this.btcSatMaxFee = 150
|
||||||
@ -1352,7 +1354,7 @@ class MultiWallet extends LitElement {
|
|||||||
</mwc-textfield>
|
</mwc-textfield>
|
||||||
</p>
|
</p>
|
||||||
<div style="margin-bottom: 10px;">
|
<div style="margin-bottom: 10px;">
|
||||||
<p style="margin-bottom: 0;">${translate("walletpage.wchange21")} <span style="font-weight: bold;">0.001 QORT<span></p>
|
<p style="margin-bottom: 0;">${translate("walletpage.wchange21")} <span style="font-weight: bold;">${this.qortPaymentFee} QORT<span></p>
|
||||||
</div>
|
</div>
|
||||||
${this.renderClearSuccess()}
|
${this.renderClearSuccess()}
|
||||||
${this.renderClearError()}
|
${this.renderClearError()}
|
||||||
@ -2821,6 +2823,7 @@ class MultiWallet extends LitElement {
|
|||||||
firstUpdated() {
|
firstUpdated() {
|
||||||
this.changeTheme()
|
this.changeTheme()
|
||||||
this.changeLanguage()
|
this.changeLanguage()
|
||||||
|
this.paymentFee()
|
||||||
|
|
||||||
this.bookQortalAddress = window.parent.reduxStore.getState().app.selectedAddress.address
|
this.bookQortalAddress = window.parent.reduxStore.getState().app.selectedAddress.address
|
||||||
this.bookBitcoinAddress = window.parent.reduxStore.getState().app.selectedAddress.btcWallet.address
|
this.bookBitcoinAddress = window.parent.reduxStore.getState().app.selectedAddress.btcWallet.address
|
||||||
@ -2906,6 +2909,23 @@ class MultiWallet extends LitElement {
|
|||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
this.clearConsole()
|
this.clearConsole()
|
||||||
}, 60000)
|
}, 60000)
|
||||||
|
setInterval(() => {
|
||||||
|
this.paymentFee()
|
||||||
|
}, 600000)
|
||||||
|
}
|
||||||
|
|
||||||
|
async paymentFee() {
|
||||||
|
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=PAYMENT`
|
||||||
|
await fetch(url).then((response) => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.json()
|
||||||
|
}
|
||||||
|
return Promise.reject(response)
|
||||||
|
}).then((json) => {
|
||||||
|
this.qortPaymentFee = (Number(json) / 1e8).toFixed(8)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
clearConsole() {
|
clearConsole() {
|
||||||
@ -4048,11 +4068,11 @@ class MultiWallet extends LitElement {
|
|||||||
calculateQortAll() {
|
calculateQortAll() {
|
||||||
this.amount = 0
|
this.amount = 0
|
||||||
this.shadowRoot.getElementById('amountInput').value = this.amount
|
this.shadowRoot.getElementById('amountInput').value = this.amount
|
||||||
if (this.balance < 0.00110000) {
|
if (this.balance < 0.01100000) {
|
||||||
let not_enough_string = get("walletpage.wchange26")
|
let not_enough_string = get("walletpage.wchange26")
|
||||||
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
parentEpml.request('showSnackBar', `${not_enough_string}`)
|
||||||
} else {
|
} else {
|
||||||
this.amount = (this.balance - 0.00110000).toFixed(8)
|
this.amount = (this.balance - 0.01100000).toFixed(8)
|
||||||
this.shadowRoot.getElementById('amountInput').value = this.amount
|
this.shadowRoot.getElementById('amountInput').value = this.amount
|
||||||
this.shadowRoot.getElementById('amountInput').blur()
|
this.shadowRoot.getElementById('amountInput').blur()
|
||||||
this.shadowRoot.getElementById('amountInput').focus()
|
this.shadowRoot.getElementById('amountInput').focus()
|
||||||
@ -4238,7 +4258,7 @@ class MultiWallet extends LitElement {
|
|||||||
} else {
|
} else {
|
||||||
const checkQortAmountInput = this.shadowRoot.getElementById('amountInput').value
|
const checkQortAmountInput = this.shadowRoot.getElementById('amountInput').value
|
||||||
const checkQortAmount = this.round(parseFloat(checkQortAmountInput))
|
const checkQortAmount = this.round(parseFloat(checkQortAmountInput))
|
||||||
const myFunds = this.round(parseFloat(this.balance - 0.00110000))
|
const myFunds = this.round(parseFloat(this.balance - 0.01100000))
|
||||||
if (Number(myFunds) >= Number(checkQortAmount)) {
|
if (Number(myFunds) >= Number(checkQortAmount)) {
|
||||||
this.shadowRoot.getElementById('amountInput').value = checkQortAmountInput
|
this.shadowRoot.getElementById('amountInput').value = checkQortAmountInput
|
||||||
this.btnDisable = false
|
this.btnDisable = false
|
||||||
@ -4269,7 +4289,7 @@ class MultiWallet extends LitElement {
|
|||||||
} else {
|
} else {
|
||||||
const checkQortAmountInput = this.shadowRoot.getElementById('amountInput').value
|
const checkQortAmountInput = this.shadowRoot.getElementById('amountInput').value
|
||||||
const checkQortAmount = this.round(parseFloat(checkQortAmountInput))
|
const checkQortAmount = this.round(parseFloat(checkQortAmountInput))
|
||||||
const myFunds = this.round(parseFloat(this.balance - 0.00110000))
|
const myFunds = this.round(parseFloat(this.balance - 0.01100000))
|
||||||
if (Number(myFunds) >= Number(checkQortAmount)) {
|
if (Number(myFunds) >= Number(checkQortAmount)) {
|
||||||
this.shadowRoot.getElementById('amountInput').value = checkQortAmountInput
|
this.shadowRoot.getElementById('amountInput').value = checkQortAmountInput
|
||||||
this.btnDisable = false
|
this.btnDisable = false
|
||||||
@ -4287,7 +4307,7 @@ class MultiWallet extends LitElement {
|
|||||||
} else {
|
} else {
|
||||||
const checkQortAmountInput = this.shadowRoot.getElementById('amountInput').value
|
const checkQortAmountInput = this.shadowRoot.getElementById('amountInput').value
|
||||||
const checkQortAmount = this.round(parseFloat(checkQortAmountInput))
|
const checkQortAmount = this.round(parseFloat(checkQortAmountInput))
|
||||||
const myFunds = this.round(parseFloat(this.balance - 0.00110000))
|
const myFunds = this.round(parseFloat(this.balance - 0.01100000))
|
||||||
if (Number(myFunds) >= Number(checkQortAmount)) {
|
if (Number(myFunds) >= Number(checkQortAmount)) {
|
||||||
this.shadowRoot.getElementById('amountInput').value = checkQortAmountInput
|
this.shadowRoot.getElementById('amountInput').value = checkQortAmountInput
|
||||||
this.btnDisable = false
|
this.btnDisable = false
|
||||||
@ -4302,6 +4322,7 @@ class MultiWallet extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async sendQort() {
|
async sendQort() {
|
||||||
|
const sendFee = this.qortPaymentFee
|
||||||
const amount = this.shadowRoot.getElementById('amountInput').value
|
const amount = this.shadowRoot.getElementById('amountInput').value
|
||||||
let recipient = this.shadowRoot.getElementById('recipient').value
|
let recipient = this.shadowRoot.getElementById('recipient').value
|
||||||
|
|
||||||
@ -4390,11 +4411,10 @@ class MultiWallet extends LitElement {
|
|||||||
|
|
||||||
const getName = async (recipient)=> {
|
const getName = async (recipient)=> {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const getNames = await parentEpml.request("apiCall", {
|
const getNames = await parentEpml.request("apiCall", {
|
||||||
type: "api",
|
type: "api",
|
||||||
url: `/names/address/${recipient}`,
|
url: `/names/address/${recipient}`,
|
||||||
})
|
})
|
||||||
if(getNames?.length > 0 ){
|
if(getNames?.length > 0 ){
|
||||||
return getNames[0].name
|
return getNames[0].name
|
||||||
} else {
|
} else {
|
||||||
@ -4421,7 +4441,7 @@ class MultiWallet extends LitElement {
|
|||||||
recipientName: recipientName,
|
recipientName: recipientName,
|
||||||
amount: amount,
|
amount: amount,
|
||||||
lastReference: mylastRef,
|
lastReference: mylastRef,
|
||||||
fee: 0.001,
|
fee: sendFee,
|
||||||
dialogamount: dialogamount,
|
dialogamount: dialogamount,
|
||||||
dialogto: dialogto,
|
dialogto: dialogto,
|
||||||
dialogAddress,
|
dialogAddress,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user