From 39fa338937cee68d111db226a729aa6f08c9ac0b Mon Sep 17 00:00:00 2001
From: QuickMythril
Date: Thu, 25 May 2023 02:00:01 -0400
Subject: [PATCH 1/6] Add fee info for Group transactions
---
README.md | 11 ++++++-----
.../core/group-management/group-management.src.js | 11 ++++++++++-
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 35a2df57..ec2e0ef4 100644
--- a/README.md
+++ b/README.md
@@ -31,20 +31,21 @@ Easiest way to install the lastest required packages on Linux is via nvm.
Adding via binary package mirror will only work if you have set the package path. You can do a node or java build via ports instead by downloading ports with portsnap fetch method.
-Verify your installtion with node --version
-- ``` If you have an older installation of npm, please do not forget to update that with npm update -g. ```
+Verify your installation with ``` node --version ```
+ - If you have an older installation of npm, please do not forget to update that with ``` npm update -g ```
Clone the main UI repo
- ``` git clone https://github.com/Qortal/qortal-ui.git ```
Installation
------------------------
- In `qortal-ui/` npm install
-
+In `qortal-ui` directory, run:
+```
+npm install
+```
Build UI server and files
-------------------------
-In `qortal-ui` directory, run:
```
npm run build
```
diff --git a/plugins/plugins/core/group-management/group-management.src.js b/plugins/plugins/core/group-management/group-management.src.js
index a3c3bb26..7e1e7f57 100644
--- a/plugins/plugins/core/group-management/group-management.src.js
+++ b/plugins/plugins/core/group-management/group-management.src.js
@@ -604,7 +604,7 @@ class GroupManagement extends LitElement {
-
${translate("walletpage.wchange21")} ${this.addGroupAdminFee} QORT
+
${translate("walletpage.wchange21")} ${this.createBanFee} QORT
${this.renderClearSuccess()}
@@ -1500,6 +1500,9 @@ class GroupManagement extends LitElement {
${this.message}
+
+
+ ${translate("walletpage.wchange21")} ${this.createFee} QORT.
@@ -1557,6 +1560,9 @@ class GroupManagement extends LitElement {
${this.message}
+
+
+ ${translate("walletpage.wchange21")} ${this.joinFee} QORT.
@@ -1619,6 +1625,9 @@ class GroupManagement extends LitElement {
${this.message}
+
+
+ ${translate("walletpage.wchange21")} ${this.leaveFee} QORT.
From c566f33255410fd74df263eccb037300157c314b Mon Sep 17 00:00:00 2001
From: QuickMythril
Date: Thu, 25 May 2023 03:12:43 -0400
Subject: [PATCH 2/6] Enable altcoin balances in Q-Apps
---
.../plugins/core/qdn/browser/browser.src.js | 109 +++++++++---------
1 file changed, 54 insertions(+), 55 deletions(-)
diff --git a/plugins/plugins/core/qdn/browser/browser.src.js b/plugins/plugins/core/qdn/browser/browser.src.js
index ce9355a0..fc94208b 100644
--- a/plugins/plugins/core/qdn/browser/browser.src.js
+++ b/plugins/plugins/core/qdn/browser/browser.src.js
@@ -1580,62 +1580,61 @@ class WebBrowser extends LitElement {
} finally {
this.loader.hide();
}
- }
- // else {
- // let _url = ``
- // let _body = null
+ } else {
+ let _url = ``
+ let _body = null
- // switch (coin) {
- // case 'LTC':
- // _url = `/crosschain/ltc/walletbalance?apiKey=${this.getApiKey()}`
- // _body = window.parent.reduxStore.getState().app.selectedAddress.ltcWallet.derivedMasterPublicKey
- // break
- // case 'DOGE':
- // _url = `/crosschain/doge/walletbalance?apiKey=${this.getApiKey()}`
- // _body = window.parent.reduxStore.getState().app.selectedAddress.dogeWallet.derivedMasterPublicKey
- // break
- // case 'DGB':
- // _url = `/crosschain/dgb/walletbalance?apiKey=${this.getApiKey()}`
- // _body = window.parent.reduxStore.getState().app.selectedAddress.dgbWallet.derivedMasterPublicKey
- // break
- // case 'RVN':
- // _url = `/crosschain/rvn/walletbalance?apiKey=${this.getApiKey()}`
- // _body = window.parent.reduxStore.getState().app.selectedAddress.rvnWallet.derivedMasterPublicKey
- // break
- // case 'ARRR':
- // _url = `/crosschain/arrr/walletbalance?apiKey=${this.getApiKey()}`
- // _body = window.parent.reduxStore.getState().app.selectedAddress.arrrWallet.seed58
- // break
- // default:
- // break
- // }
- // try {
- // this.loader.show();
- // const res = await parentEpml.request('apiCall', {
- // url: _url,
- // method: 'POST',
- // body: _body,
- // })
- // if (isNaN(Number(res))) {
- // const data = {};
- // const errorMsg = error.message || get("browserpage.bchange21");
- // data['error'] = errorMsg;
- // response = JSON.stringify(data);
- // return;
- // } else {
- // response = (Number(res) / 1e8).toFixed(8);
- // }
- // } catch (error) {
- // console.error(error);
- // const data = {};
- // const errorMsg = error.message || get("browserpage.bchange21");
- // data['error'] = errorMsg;
- // response = JSON.stringify(data);
- // return;
- // } finally {
- // this.loader.hide()
- // }
- // }
+ switch (coin) {
+ case 'LTC':
+ _url = `/crosschain/ltc/walletbalance?apiKey=${this.getApiKey()}`
+ _body = window.parent.reduxStore.getState().app.selectedAddress.ltcWallet.derivedMasterPublicKey
+ break
+ case 'DOGE':
+ _url = `/crosschain/doge/walletbalance?apiKey=${this.getApiKey()}`
+ _body = window.parent.reduxStore.getState().app.selectedAddress.dogeWallet.derivedMasterPublicKey
+ break
+ case 'DGB':
+ _url = `/crosschain/dgb/walletbalance?apiKey=${this.getApiKey()}`
+ _body = window.parent.reduxStore.getState().app.selectedAddress.dgbWallet.derivedMasterPublicKey
+ break
+ case 'RVN':
+ _url = `/crosschain/rvn/walletbalance?apiKey=${this.getApiKey()}`
+ _body = window.parent.reduxStore.getState().app.selectedAddress.rvnWallet.derivedMasterPublicKey
+ break
+ case 'ARRR':
+ _url = `/crosschain/arrr/walletbalance?apiKey=${this.getApiKey()}`
+ _body = window.parent.reduxStore.getState().app.selectedAddress.arrrWallet.seed58
+ break
+ default:
+ break
+ }
+ try {
+ this.loader.show();
+ const res = await parentEpml.request('apiCall', {
+ url: _url,
+ method: 'POST',
+ body: _body,
+ })
+ if (isNaN(Number(res))) {
+ const data = {};
+ const errorMsg = error.message || get("browserpage.bchange21");
+ data['error'] = errorMsg;
+ response = JSON.stringify(data);
+ return;
+ } else {
+ response = (Number(res) / 1e8).toFixed(8);
+ }
+ } catch (error) {
+ console.error(error);
+ const data = {};
+ const errorMsg = error.message || get("browserpage.bchange21");
+ data['error'] = errorMsg;
+ response = JSON.stringify(data);
+ return;
+ } finally {
+ this.loader.hide()
+ }
+ }
} else if (res3.action === 'reject') {
response = '{"error": "User declined request"}';
}
From 2c32108a8bb812fac82fa0d9600add4643d6b593 Mon Sep 17 00:00:00 2001
From: QuickMythril
Date: Thu, 25 May 2023 05:10:00 -0400
Subject: [PATCH 3/6] Add BTC to GET_WALLET_BALANCE action
---
.../plugins/core/qdn/browser/browser.src.js | 20 +++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/plugins/plugins/core/qdn/browser/browser.src.js b/plugins/plugins/core/qdn/browser/browser.src.js
index fc94208b..1e7f63f3 100644
--- a/plugins/plugins/core/qdn/browser/browser.src.js
+++ b/plugins/plugins/core/qdn/browser/browser.src.js
@@ -1585,6 +1585,10 @@ class WebBrowser extends LitElement {
let _body = null
switch (coin) {
+ case 'BTC':
+ _url = `/crosschain/btc/walletbalance?apiKey=${this.getApiKey()}`
+ _body = window.parent.reduxStore.getState().app.selectedAddress.btcWallet.derivedMasterPublicKey
+ break
case 'LTC':
_url = `/crosschain/ltc/walletbalance?apiKey=${this.getApiKey()}`
_body = window.parent.reduxStore.getState().app.selectedAddress.ltcWallet.derivedMasterPublicKey
@@ -1704,7 +1708,7 @@ class WebBrowser extends LitElement {
let errorMsg = "Insufficient Funds!"
let failedMsg = get("walletpage.wchange26")
let pleaseMsg = get("walletpage.wchange44")
- showErrorAndWait("INSSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
+ showErrorAndWait("INSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
let obj = {}
obj['error'] = errorMsg
response = JSON.stringify(obj)
@@ -1903,7 +1907,7 @@ class WebBrowser extends LitElement {
let errorMsg = "Insufficient Funds!"
let failedMsg = get("walletpage.wchange26")
let pleaseMsg = get("walletpage.wchange44")
- showErrorAndWait("INSSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
+ showErrorAndWait("INSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
let obj = {}
obj['error'] = errorMsg
response = JSON.stringify(obj)
@@ -2009,7 +2013,7 @@ class WebBrowser extends LitElement {
let errorMsg = "Insufficient Funds!"
let failedMsg = get("walletpage.wchange26")
let pleaseMsg = get("walletpage.wchange44")
- showErrorAndWait("INSSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
+ showErrorAndWait("INSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
let obj = {}
obj['error'] = errorMsg
response = JSON.stringify(obj)
@@ -2115,7 +2119,7 @@ class WebBrowser extends LitElement {
let errorMsg = "Insufficient Funds!"
let failedMsg = get("walletpage.wchange26")
let pleaseMsg = get("walletpage.wchange44")
- showErrorAndWait("INSSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
+ showErrorAndWait("INSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
let obj = {}
obj['error'] = errorMsg
response = JSON.stringify(obj)
@@ -2221,7 +2225,7 @@ class WebBrowser extends LitElement {
let errorMsg = "Insufficient Funds!"
let failedMsg = get("walletpage.wchange26")
let pleaseMsg = get("walletpage.wchange44")
- showErrorAndWait("INSSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
+ showErrorAndWait("INSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
let obj = {}
obj['error'] = errorMsg
response = JSON.stringify(obj)
@@ -2327,7 +2331,7 @@ class WebBrowser extends LitElement {
let errorMsg = "Insufficient Funds!"
let failedMsg = get("walletpage.wchange26")
let pleaseMsg = get("walletpage.wchange44")
- showErrorAndWait("INSSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
+ showErrorAndWait("INSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
let obj = {}
obj['error'] = errorMsg
response = JSON.stringify(obj)
@@ -2434,7 +2438,7 @@ class WebBrowser extends LitElement {
let errorMsg = "Insufficient Funds!"
let failedMsg = get("walletpage.wchange26")
let pleaseMsg = get("walletpage.wchange44")
- showErrorAndWait("INSSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
+ showErrorAndWait("INSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
let obj = {}
obj['error'] = errorMsg
response = JSON.stringify(obj)
@@ -3025,7 +3029,7 @@ async function showErrorAndWait(type, data, data1) {
` : ''}
- ${type === "INSSUFFICIENT_FUNDS" ? `
+ ${type === "INSUFFICIENT_FUNDS" ? `
${data}
${data1}
From fe8c871b0e01feb04a42bb8638b345339a0409b8 Mon Sep 17 00:00:00 2001
From: QuickMythril
Date: Thu, 25 May 2023 14:45:44 -0400
Subject: [PATCH 4/6] Add optional fee to foreign SEND_COIN action
---
.../plugins/core/qdn/browser/browser.src.js | 25 +++++++++++--------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/plugins/plugins/core/qdn/browser/browser.src.js b/plugins/plugins/core/qdn/browser/browser.src.js
index 1e7f63f3..29293c01 100644
--- a/plugins/plugins/core/qdn/browser/browser.src.js
+++ b/plugins/plugins/core/qdn/browser/browser.src.js
@@ -1878,6 +1878,7 @@ class WebBrowser extends LitElement {
const recipient = data.destinationAddress
const coin = data.coin
const xprv58 = this.btcWallet.derivedMasterPrivateKey
+ const feePerByte = data.fee ? data.fee : this.btcFeePerByte
const btcWalletBalance = await parentEpml.request('apiCall', {
url: `/crosschain/btc/walletbalance?apiKey=${this.getApiKey()}`,
@@ -1900,7 +1901,7 @@ class WebBrowser extends LitElement {
const btcWalletBalanceDecimals = Number(btcWalletBalance)
const btcAmountDecimals = Number(amount) * QORT_DECIMALS
const balance = (Number(btcWalletBalance) / 1e8).toFixed(8)
- const fee = 50000
+ const fee = feePerByte * 500 // default 50000
if (btcAmountDecimals + fee > btcWalletBalanceDecimals) {
this.loader.hide()
@@ -1942,7 +1943,7 @@ class WebBrowser extends LitElement {
xprv58: xprv58,
receivingAddress: recipient,
bitcoinAmount: amount,
- feePerByte: (this.btcFeePerByte / 1e8).toFixed(8)
+ feePerByte: (feePerByte / 1e8).toFixed(8)
}
const response = await parentEpml.request('sendBtc', opts)
return response
@@ -1984,6 +1985,7 @@ class WebBrowser extends LitElement {
const recipient = data.destinationAddress
const coin = data.coin
const xprv58 = this.ltcWallet.derivedMasterPrivateKey
+ const feePerByte = data.fee ? data.fee : this.ltcFeePerByte
const ltcWalletBalance = await parentEpml.request('apiCall', {
url: `/crosschain/ltc/walletbalance?apiKey=${this.getApiKey()}`,
@@ -2006,7 +2008,7 @@ class WebBrowser extends LitElement {
const ltcWalletBalanceDecimals = Number(ltcWalletBalance)
const ltcAmountDecimals = Number(amount) * QORT_DECIMALS
const balance = (Number(ltcWalletBalance) / 1e8).toFixed(8)
- const fee = 30000
+ const fee = feePerByte * 1000 // default 30000
if (ltcAmountDecimals + fee > ltcWalletBalanceDecimals) {
this.loader.hide()
@@ -2048,7 +2050,7 @@ class WebBrowser extends LitElement {
xprv58: xprv58,
receivingAddress: recipient,
litecoinAmount: amount,
- feePerByte: (this.ltcFeePerByte / 1e8).toFixed(8)
+ feePerByte: (feePerByte / 1e8).toFixed(8)
}
const response = await parentEpml.request('sendLtc', opts)
return response
@@ -2090,6 +2092,7 @@ class WebBrowser extends LitElement {
const recipient = data.destinationAddress
const coin = data.coin
const xprv58 = this.dogeWallet.derivedMasterPrivateKey
+ const feePerByte = data.fee ? data.fee : this.dogeFeePerByte
const dogeWalletBalance = await parentEpml.request('apiCall', {
url: `/crosschain/doge/walletbalance?apiKey=${this.getApiKey()}`,
@@ -2112,7 +2115,7 @@ class WebBrowser extends LitElement {
const dogeWalletBalanceDecimals = Number(dogeWalletBalance)
const dogeAmountDecimals = Number(amount) * QORT_DECIMALS
const balance = (Number(dogeWalletBalance) / 1e8).toFixed(8)
- const fee = 5000000
+ const fee = feePerByte * 5000 // default 5000000
if (dogeAmountDecimals + fee > dogeWalletBalanceDecimals) {
this.loader.hide()
@@ -2154,7 +2157,7 @@ class WebBrowser extends LitElement {
xprv58: xprv58,
receivingAddress: recipient,
dogecoinAmount: amount,
- feePerByte: (this.dogeFeePerByte / 1e8).toFixed(8)
+ feePerByte: (feePerByte / 1e8).toFixed(8)
}
const response = await parentEpml.request('sendDoge', opts)
return response
@@ -2196,6 +2199,7 @@ class WebBrowser extends LitElement {
const recipient = data.destinationAddress
const coin = data.coin
const xprv58 = this.dgbWallet.derivedMasterPrivateKey
+ const feePerByte = data.fee ? data.fee : this.dgbFeePerByte
const dgbWalletBalance = await parentEpml.request('apiCall', {
url: `/crosschain/dgb/walletbalance?apiKey=${this.getApiKey()}`,
@@ -2218,7 +2222,7 @@ class WebBrowser extends LitElement {
const dgbWalletBalanceDecimals = Number(dgbWalletBalance)
const dgbAmountDecimals = Number(amount) * QORT_DECIMALS
const balance = (Number(dgbWalletBalance) / 1e8).toFixed(8)
- const fee = 5000
+ const fee = feePerByte * 500 // default 5000
if (dgbAmountDecimals + fee > dgbWalletBalanceDecimals) {
this.loader.hide()
@@ -2260,7 +2264,7 @@ class WebBrowser extends LitElement {
xprv58: xprv58,
receivingAddress: recipient,
digibyteAmount: amount,
- feePerByte: (this.dgbFeePerByte / 1e8).toFixed(8)
+ feePerByte: (feePerByte / 1e8).toFixed(8)
}
const response = await parentEpml.request('sendDgb', opts)
return response
@@ -2302,6 +2306,7 @@ class WebBrowser extends LitElement {
const recipient = data.destinationAddress
const coin = data.coin
const xprv58 = this.rvnWallet.derivedMasterPrivateKey
+ const feePerByte = data.fee ? data.fee : this.rvnFeePerByte
const rvnWalletBalance = await parentEpml.request('apiCall', {
url: `/crosschain/rvn/walletbalance?apiKey=${this.getApiKey()}`,
@@ -2324,7 +2329,7 @@ class WebBrowser extends LitElement {
const rvnWalletBalanceDecimals = Number(rvnWalletBalance)
const rvnAmountDecimals = Number(amount) * QORT_DECIMALS
const balance = (Number(rvnWalletBalance) / 1e8).toFixed(8)
- const fee = 562500
+ const fee = feePerByte * 500 // default 562500
if (rvnAmountDecimals + fee > rvnWalletBalanceDecimals) {
this.loader.hide()
@@ -2366,7 +2371,7 @@ class WebBrowser extends LitElement {
xprv58: xprv58,
receivingAddress: recipient,
ravencoinAmount: amount,
- feePerByte: (this.rvnFeePerByte / 1e8).toFixed(8)
+ feePerByte: (feePerByte / 1e8).toFixed(8)
}
const response = await parentEpml.request('sendRvn', opts)
return response
From e87d455ee1c332eeec9c55a72954a18f47078e71 Mon Sep 17 00:00:00 2001
From: QuickMythril
Date: Thu, 25 May 2023 16:28:57 -0400
Subject: [PATCH 5/6] 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) {
${get("walletpage.wchange19")}: ${data.balance} ${data.coin}
${get("walletpage.wchange10")}: ${data.recipient}
${get("walletpage.wchange11")}: ${data.amount} ${data.coin}
+ ${get("walletpage.wchange36")}: ${data.feeAmount} ${data.coin}
` : ''}
From 32e0fc443163fcf772e4c1e33cb19dfa4486ce00 Mon Sep 17 00:00:00 2001
From: QuickMythril
Date: Thu, 25 May 2023 18:04:19 -0400
Subject: [PATCH 6/6] Adjust fee values to long format
---
.../plugins/core/qdn/browser/browser.src.js | 72 +++++++++----------
1 file changed, 33 insertions(+), 39 deletions(-)
diff --git a/plugins/plugins/core/qdn/browser/browser.src.js b/plugins/plugins/core/qdn/browser/browser.src.js
index 3a289b07..75fccf3f 100644
--- a/plugins/plugins/core/qdn/browser/browser.src.js
+++ b/plugins/plugins/core/qdn/browser/browser.src.js
@@ -202,11 +202,11 @@ class WebBrowser extends LitElement {
}
this.selectedAddress = {}
- this.btcFeePerByte = 100
- this.ltcFeePerByte = 30
- this.dogeFeePerByte = 1000
- this.dgbFeePerByte = 10
- this.rvnFeePerByte = 1125
+ this.btcFeePerByte = 0.00000100
+ this.ltcFeePerByte = 0.00000030
+ this.dogeFeePerByte = 0.00001000
+ this.dgbFeePerByte = 0.00000010
+ this.rvnFeePerByte = 0.00001125
this.arrrWalletAddress = ''
let configLoaded = false;
@@ -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 feeAmount = await this.sendQortFee()
+ const fee = await this.sendQortFee()
- if (amountDecimals + (feeAmount * QORT_DECIMALS) > walletBalanceDecimals) {
+ if (amountDecimals + (fee * QORT_DECIMALS) > walletBalanceDecimals) {
let errorMsg = "Insufficient Funds!"
let failedMsg = get("walletpage.wchange26")
let pleaseMsg = get("walletpage.wchange44")
@@ -1740,7 +1740,7 @@ class WebBrowser extends LitElement {
recipient,
coin,
balance,
- feeAmount
+ fee
}
)
@@ -1838,7 +1838,7 @@ class WebBrowser extends LitElement {
recipientName: recipientName,
amount: amount,
lastReference: mylastRef,
- fee: feeAmount,
+ fee: fee,
dialogamount: dialogamount,
dialogto: dialogto,
dialogAddress,
@@ -1880,7 +1880,6 @@ 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()}`,
@@ -1903,9 +1902,9 @@ class WebBrowser extends LitElement {
const btcWalletBalanceDecimals = Number(btcWalletBalance)
const btcAmountDecimals = Number(amount) * QORT_DECIMALS
const balance = (Number(btcWalletBalance) / 1e8).toFixed(8)
- const fee = feePerByte * 500 // default 50000
+ const fee = feePerByte * 500 // default 0.00050000
- if (btcAmountDecimals + fee > btcWalletBalanceDecimals) {
+ if (btcAmountDecimals + (fee * QORT_DECIMALS) > btcWalletBalanceDecimals) {
this.loader.hide()
let errorMsg = "Insufficient Funds!"
let failedMsg = get("walletpage.wchange26")
@@ -1926,7 +1925,7 @@ class WebBrowser extends LitElement {
recipient,
coin,
balance,
- feeAmount
+ fee
}
)
@@ -1946,7 +1945,7 @@ class WebBrowser extends LitElement {
xprv58: xprv58,
receivingAddress: recipient,
bitcoinAmount: amount,
- feePerByte: (feePerByte / 1e8).toFixed(8)
+ feePerByte: feePerByte * QORT_DECIMALS
}
const response = await parentEpml.request('sendBtc', opts)
return response
@@ -1989,7 +1988,6 @@ 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()}`,
@@ -2012,9 +2010,9 @@ class WebBrowser extends LitElement {
const ltcWalletBalanceDecimals = Number(ltcWalletBalance)
const ltcAmountDecimals = Number(amount) * QORT_DECIMALS
const balance = (Number(ltcWalletBalance) / 1e8).toFixed(8)
- const fee = feePerByte * 1000 // default 30000
+ const fee = feePerByte * 1000 // default 0.00030000
- if (ltcAmountDecimals + fee > ltcWalletBalanceDecimals) {
+ if (ltcAmountDecimals + (fee * QORT_DECIMALS) > ltcWalletBalanceDecimals) {
this.loader.hide()
let errorMsg = "Insufficient Funds!"
let failedMsg = get("walletpage.wchange26")
@@ -2035,7 +2033,7 @@ class WebBrowser extends LitElement {
recipient,
coin,
balance,
- feeAmount
+ fee
}
)
@@ -2055,7 +2053,7 @@ class WebBrowser extends LitElement {
xprv58: xprv58,
receivingAddress: recipient,
litecoinAmount: amount,
- feePerByte: (feePerByte / 1e8).toFixed(8)
+ feePerByte: feePerByte * QORT_DECIMALS
}
const response = await parentEpml.request('sendLtc', opts)
return response
@@ -2098,7 +2096,6 @@ 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()}`,
@@ -2121,9 +2118,9 @@ class WebBrowser extends LitElement {
const dogeWalletBalanceDecimals = Number(dogeWalletBalance)
const dogeAmountDecimals = Number(amount) * QORT_DECIMALS
const balance = (Number(dogeWalletBalance) / 1e8).toFixed(8)
- const fee = feePerByte * 5000 // default 5000000
+ const fee = feePerByte * 5000 // default 0.05000000
- if (dogeAmountDecimals + fee > dogeWalletBalanceDecimals) {
+ if (dogeAmountDecimals + (fee * QORT_DECIMALS) > dogeWalletBalanceDecimals) {
this.loader.hide()
let errorMsg = "Insufficient Funds!"
let failedMsg = get("walletpage.wchange26")
@@ -2144,7 +2141,7 @@ class WebBrowser extends LitElement {
recipient,
coin,
balance,
- feeAmount
+ fee
}
)
@@ -2164,7 +2161,7 @@ class WebBrowser extends LitElement {
xprv58: xprv58,
receivingAddress: recipient,
dogecoinAmount: amount,
- feePerByte: (feePerByte / 1e8).toFixed(8)
+ feePerByte: feePerByte * QORT_DECIMALS
}
const response = await parentEpml.request('sendDoge', opts)
return response
@@ -2207,7 +2204,6 @@ 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()}`,
@@ -2230,9 +2226,9 @@ class WebBrowser extends LitElement {
const dgbWalletBalanceDecimals = Number(dgbWalletBalance)
const dgbAmountDecimals = Number(amount) * QORT_DECIMALS
const balance = (Number(dgbWalletBalance) / 1e8).toFixed(8)
- const fee = feePerByte * 500 // default 5000
+ const fee = feePerByte * 500 // default 0.00005000
- if (dgbAmountDecimals + fee > dgbWalletBalanceDecimals) {
+ if (dgbAmountDecimals + (fee * QORT_DECIMALS) > dgbWalletBalanceDecimals) {
this.loader.hide()
let errorMsg = "Insufficient Funds!"
let failedMsg = get("walletpage.wchange26")
@@ -2253,7 +2249,7 @@ class WebBrowser extends LitElement {
recipient,
coin,
balance,
- feeAmount
+ fee
}
)
@@ -2273,7 +2269,7 @@ class WebBrowser extends LitElement {
xprv58: xprv58,
receivingAddress: recipient,
digibyteAmount: amount,
- feePerByte: (feePerByte / 1e8).toFixed(8)
+ feePerByte: feePerByte * QORT_DECIMALS
}
const response = await parentEpml.request('sendDgb', opts)
return response
@@ -2316,7 +2312,6 @@ 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()}`,
@@ -2339,9 +2334,9 @@ class WebBrowser extends LitElement {
const rvnWalletBalanceDecimals = Number(rvnWalletBalance)
const rvnAmountDecimals = Number(amount) * QORT_DECIMALS
const balance = (Number(rvnWalletBalance) / 1e8).toFixed(8)
- const fee = feePerByte * 500 // default 562500
+ const fee = feePerByte * 500 // default 0.00562500
- if (rvnAmountDecimals + fee > rvnWalletBalanceDecimals) {
+ if (rvnAmountDecimals + (fee * QORT_DECIMALS) > rvnWalletBalanceDecimals) {
this.loader.hide()
let errorMsg = "Insufficient Funds!"
let failedMsg = get("walletpage.wchange26")
@@ -2362,7 +2357,7 @@ class WebBrowser extends LitElement {
recipient,
coin,
balance,
- feeAmount
+ fee
}
)
@@ -2382,7 +2377,7 @@ class WebBrowser extends LitElement {
xprv58: xprv58,
receivingAddress: recipient,
ravencoinAmount: amount,
- feePerByte: (feePerByte / 1e8).toFixed(8)
+ feePerByte: feePerByte * QORT_DECIMALS
}
const response = await parentEpml.request('sendRvn', opts)
return response
@@ -2447,10 +2442,9 @@ class WebBrowser extends LitElement {
const arrrWalletBalanceDecimals = Number(arrrWalletBalance)
const arrrAmountDecimals = Number(amount) * QORT_DECIMALS
const balance = (Number(arrrWalletBalance) / 1e8).toFixed(8)
- const fee = 10000
- const feeAmount = (fee / 1e8).toFixed(8)
+ const fee = 0.00010000
- if (arrrAmountDecimals + fee > arrrWalletBalanceDecimals) {
+ if (arrrAmountDecimals + (fee * QORT_DECIMALS) > arrrWalletBalanceDecimals) {
this.loader.hide()
let errorMsg = "Insufficient Funds!"
let failedMsg = get("walletpage.wchange26")
@@ -2471,7 +2465,7 @@ class WebBrowser extends LitElement {
recipient,
coin,
balance,
- feeAmount
+ fee
}
)
@@ -2902,7 +2896,7 @@ async function showModalAndWait(type, data) {
${get("walletpage.wchange19")}: ${data.balance} ${data.coin}
${get("walletpage.wchange10")}: ${data.recipient}
${get("walletpage.wchange11")}: ${data.amount} ${data.coin}
- ${get("walletpage.wchange36")}: ${data.feeAmount} ${data.coin}
+ ${get("walletpage.wchange36")}: ~${data.fee} ${data.coin}
` : ''}