From e87d455ee1c332eeec9c55a72954a18f47078e71 Mon Sep 17 00:00:00 2001 From: QuickMythril Date: Thu, 25 May 2023 16:28:57 -0400 Subject: [PATCH] Add fee to SEND_COIN modal --- .../plugins/core/qdn/browser/browser.src.js | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/plugins/plugins/core/qdn/browser/browser.src.js b/plugins/plugins/core/qdn/browser/browser.src.js index 29293c01..3a289b07 100644 --- a/plugins/plugins/core/qdn/browser/browser.src.js +++ b/plugins/plugins/core/qdn/browser/browser.src.js @@ -1702,9 +1702,9 @@ class WebBrowser extends LitElement { const walletBalanceDecimals = Number(transformDecimals) const amountDecimals = Number(amount) * QORT_DECIMALS const balance = (Number(transformDecimals) / 1e8).toFixed(8) - const fee = await this.sendQortFee() + const feeAmount = await this.sendQortFee() - if (amountDecimals + (fee * QORT_DECIMALS) > walletBalanceDecimals) { + if (amountDecimals + (feeAmount * QORT_DECIMALS) > walletBalanceDecimals) { let errorMsg = "Insufficient Funds!" let failedMsg = get("walletpage.wchange26") let pleaseMsg = get("walletpage.wchange44") @@ -1739,7 +1739,8 @@ class WebBrowser extends LitElement { amount, recipient, coin, - balance + balance, + feeAmount } ) @@ -1837,7 +1838,7 @@ class WebBrowser extends LitElement { recipientName: recipientName, amount: amount, lastReference: mylastRef, - fee: fee, + fee: feeAmount, dialogamount: dialogamount, dialogto: dialogto, dialogAddress, @@ -1879,6 +1880,7 @@ class WebBrowser extends LitElement { const coin = data.coin const xprv58 = this.btcWallet.derivedMasterPrivateKey const feePerByte = data.fee ? data.fee : this.btcFeePerByte + const feeAmount = (feePerByte / 1e8).toFixed(8) const btcWalletBalance = await parentEpml.request('apiCall', { url: `/crosschain/btc/walletbalance?apiKey=${this.getApiKey()}`, @@ -1923,7 +1925,8 @@ class WebBrowser extends LitElement { amount, recipient, coin, - balance + balance, + feeAmount } ) @@ -1986,6 +1989,7 @@ class WebBrowser extends LitElement { const coin = data.coin const xprv58 = this.ltcWallet.derivedMasterPrivateKey const feePerByte = data.fee ? data.fee : this.ltcFeePerByte + const feeAmount = (feePerByte / 1e8).toFixed(8) const ltcWalletBalance = await parentEpml.request('apiCall', { url: `/crosschain/ltc/walletbalance?apiKey=${this.getApiKey()}`, @@ -2030,7 +2034,8 @@ class WebBrowser extends LitElement { amount, recipient, coin, - balance + balance, + feeAmount } ) @@ -2093,6 +2098,7 @@ class WebBrowser extends LitElement { const coin = data.coin const xprv58 = this.dogeWallet.derivedMasterPrivateKey const feePerByte = data.fee ? data.fee : this.dogeFeePerByte + const feeAmount = (feePerByte / 1e8).toFixed(8) const dogeWalletBalance = await parentEpml.request('apiCall', { url: `/crosschain/doge/walletbalance?apiKey=${this.getApiKey()}`, @@ -2137,7 +2143,8 @@ class WebBrowser extends LitElement { amount, recipient, coin, - balance + balance, + feeAmount } ) @@ -2200,6 +2207,7 @@ class WebBrowser extends LitElement { const coin = data.coin const xprv58 = this.dgbWallet.derivedMasterPrivateKey const feePerByte = data.fee ? data.fee : this.dgbFeePerByte + const feeAmount = (feePerByte / 1e8).toFixed(8) const dgbWalletBalance = await parentEpml.request('apiCall', { url: `/crosschain/dgb/walletbalance?apiKey=${this.getApiKey()}`, @@ -2244,7 +2252,8 @@ class WebBrowser extends LitElement { amount, recipient, coin, - balance + balance, + feeAmount } ) @@ -2307,6 +2316,7 @@ class WebBrowser extends LitElement { const coin = data.coin const xprv58 = this.rvnWallet.derivedMasterPrivateKey const feePerByte = data.fee ? data.fee : this.rvnFeePerByte + const feeAmount = (feePerByte / 1e8).toFixed(8) const rvnWalletBalance = await parentEpml.request('apiCall', { url: `/crosschain/rvn/walletbalance?apiKey=${this.getApiKey()}`, @@ -2351,7 +2361,8 @@ class WebBrowser extends LitElement { amount, recipient, coin, - balance + balance, + feeAmount } ) @@ -2437,6 +2448,7 @@ class WebBrowser extends LitElement { const arrrAmountDecimals = Number(amount) * QORT_DECIMALS const balance = (Number(arrrWalletBalance) / 1e8).toFixed(8) const fee = 10000 + const feeAmount = (fee / 1e8).toFixed(8) if (arrrAmountDecimals + fee > arrrWalletBalanceDecimals) { this.loader.hide() @@ -2458,7 +2470,8 @@ class WebBrowser extends LitElement { amount, recipient, coin, - balance + balance, + feeAmount } ) @@ -2889,6 +2902,7 @@ async function showModalAndWait(type, data) { + ` : ''}