mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-11 17:55:51 +00:00
Merge pull request #167 from QuickMythril/2023-05-25
Add some fee info & Q-App support for foreign coins
This commit is contained in:
commit
7d7aeedb98
11
README.md
11
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.
|
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 <br/>
|
Verify your installation with ``` node --version ``` <br/>
|
||||||
- ``` If you have an older installation of npm, please do not forget to update that with npm update -g. ```
|
- If you have an older installation of npm, please do not forget to update that with ``` npm update -g ```
|
||||||
|
|
||||||
Clone the main UI repo
|
Clone the main UI repo
|
||||||
- ``` git clone https://github.com/Qortal/qortal-ui.git ```
|
- ``` git clone https://github.com/Qortal/qortal-ui.git ```
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------------------
|
------------------------
|
||||||
In `qortal-ui/` npm install
|
In `qortal-ui` directory, run:
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
Build UI server and files
|
Build UI server and files
|
||||||
-------------------------
|
-------------------------
|
||||||
In `qortal-ui` directory, run:
|
|
||||||
```
|
```
|
||||||
npm run build
|
npm run build
|
||||||
```
|
```
|
||||||
|
@ -604,7 +604,7 @@ class GroupManagement extends LitElement {
|
|||||||
</select>
|
</select>
|
||||||
</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;">${this.addGroupAdminFee} QORT<span></p>
|
<p style="margin-bottom: 0;">${translate("walletpage.wchange21")} <span style="font-weight: bold;">${this.createBanFee} QORT<span></p>
|
||||||
<br>
|
<br>
|
||||||
</div>
|
</div>
|
||||||
${this.renderClearSuccess()}
|
${this.renderClearSuccess()}
|
||||||
@ -1500,6 +1500,9 @@ class GroupManagement extends LitElement {
|
|||||||
</span>
|
</span>
|
||||||
<span ?hidden=${this.message === ''} style="${this.error ? 'color:red;' : ''}">
|
<span ?hidden=${this.message === ''} style="${this.error ? 'color:red;' : ''}">
|
||||||
${this.message}
|
${this.message}
|
||||||
|
</span><br>
|
||||||
|
<span>
|
||||||
|
<b>${translate("walletpage.wchange21")} ${this.createFee} QORT.</b>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -1557,6 +1560,9 @@ class GroupManagement extends LitElement {
|
|||||||
</span>
|
</span>
|
||||||
<span ?hidden=${this.message === ''} style="${this.error ? 'color:red;' : ''}">
|
<span ?hidden=${this.message === ''} style="${this.error ? 'color:red;' : ''}">
|
||||||
${this.message}
|
${this.message}
|
||||||
|
</span><br>
|
||||||
|
<span>
|
||||||
|
<b>${translate("walletpage.wchange21")} ${this.joinFee} QORT.</b>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -1619,6 +1625,9 @@ class GroupManagement extends LitElement {
|
|||||||
</span>
|
</span>
|
||||||
<span ?hidden=${this.message === ''} style="${this.error ? 'color:red;' : ''}">
|
<span ?hidden=${this.message === ''} style="${this.error ? 'color:red;' : ''}">
|
||||||
${this.message}
|
${this.message}
|
||||||
|
</span><br>
|
||||||
|
<span>
|
||||||
|
<b>${translate("walletpage.wchange21")} ${this.leaveFee} QORT.</b>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -202,11 +202,11 @@ class WebBrowser extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.selectedAddress = {}
|
this.selectedAddress = {}
|
||||||
this.btcFeePerByte = 100
|
this.btcFeePerByte = 0.00000100
|
||||||
this.ltcFeePerByte = 30
|
this.ltcFeePerByte = 0.00000030
|
||||||
this.dogeFeePerByte = 1000
|
this.dogeFeePerByte = 0.00001000
|
||||||
this.dgbFeePerByte = 10
|
this.dgbFeePerByte = 0.00000010
|
||||||
this.rvnFeePerByte = 1125
|
this.rvnFeePerByte = 0.00001125
|
||||||
this.arrrWalletAddress = ''
|
this.arrrWalletAddress = ''
|
||||||
|
|
||||||
let configLoaded = false;
|
let configLoaded = false;
|
||||||
@ -1580,62 +1580,65 @@ class WebBrowser extends LitElement {
|
|||||||
} finally {
|
} finally {
|
||||||
this.loader.hide();
|
this.loader.hide();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
// else {
|
let _url = ``
|
||||||
// let _url = ``
|
let _body = null
|
||||||
// let _body = null
|
|
||||||
|
|
||||||
// switch (coin) {
|
switch (coin) {
|
||||||
// case 'LTC':
|
case 'BTC':
|
||||||
// _url = `/crosschain/ltc/walletbalance?apiKey=${this.getApiKey()}`
|
_url = `/crosschain/btc/walletbalance?apiKey=${this.getApiKey()}`
|
||||||
// _body = window.parent.reduxStore.getState().app.selectedAddress.ltcWallet.derivedMasterPublicKey
|
_body = window.parent.reduxStore.getState().app.selectedAddress.btcWallet.derivedMasterPublicKey
|
||||||
// break
|
break
|
||||||
// case 'DOGE':
|
case 'LTC':
|
||||||
// _url = `/crosschain/doge/walletbalance?apiKey=${this.getApiKey()}`
|
_url = `/crosschain/ltc/walletbalance?apiKey=${this.getApiKey()}`
|
||||||
// _body = window.parent.reduxStore.getState().app.selectedAddress.dogeWallet.derivedMasterPublicKey
|
_body = window.parent.reduxStore.getState().app.selectedAddress.ltcWallet.derivedMasterPublicKey
|
||||||
// break
|
break
|
||||||
// case 'DGB':
|
case 'DOGE':
|
||||||
// _url = `/crosschain/dgb/walletbalance?apiKey=${this.getApiKey()}`
|
_url = `/crosschain/doge/walletbalance?apiKey=${this.getApiKey()}`
|
||||||
// _body = window.parent.reduxStore.getState().app.selectedAddress.dgbWallet.derivedMasterPublicKey
|
_body = window.parent.reduxStore.getState().app.selectedAddress.dogeWallet.derivedMasterPublicKey
|
||||||
// break
|
break
|
||||||
// case 'RVN':
|
case 'DGB':
|
||||||
// _url = `/crosschain/rvn/walletbalance?apiKey=${this.getApiKey()}`
|
_url = `/crosschain/dgb/walletbalance?apiKey=${this.getApiKey()}`
|
||||||
// _body = window.parent.reduxStore.getState().app.selectedAddress.rvnWallet.derivedMasterPublicKey
|
_body = window.parent.reduxStore.getState().app.selectedAddress.dgbWallet.derivedMasterPublicKey
|
||||||
// break
|
break
|
||||||
// case 'ARRR':
|
case 'RVN':
|
||||||
// _url = `/crosschain/arrr/walletbalance?apiKey=${this.getApiKey()}`
|
_url = `/crosschain/rvn/walletbalance?apiKey=${this.getApiKey()}`
|
||||||
// _body = window.parent.reduxStore.getState().app.selectedAddress.arrrWallet.seed58
|
_body = window.parent.reduxStore.getState().app.selectedAddress.rvnWallet.derivedMasterPublicKey
|
||||||
// break
|
break
|
||||||
// default:
|
case 'ARRR':
|
||||||
// break
|
_url = `/crosschain/arrr/walletbalance?apiKey=${this.getApiKey()}`
|
||||||
// }
|
_body = window.parent.reduxStore.getState().app.selectedAddress.arrrWallet.seed58
|
||||||
// try {
|
break
|
||||||
// this.loader.show();
|
default:
|
||||||
// const res = await parentEpml.request('apiCall', {
|
break
|
||||||
// url: _url,
|
}
|
||||||
// method: 'POST',
|
try {
|
||||||
// body: _body,
|
this.loader.show();
|
||||||
// })
|
const res = await parentEpml.request('apiCall', {
|
||||||
// if (isNaN(Number(res))) {
|
url: _url,
|
||||||
// const data = {};
|
method: 'POST',
|
||||||
// const errorMsg = error.message || get("browserpage.bchange21");
|
body: _body,
|
||||||
// data['error'] = errorMsg;
|
})
|
||||||
// response = JSON.stringify(data);
|
if (isNaN(Number(res))) {
|
||||||
// return;
|
const data = {};
|
||||||
// } else {
|
const errorMsg = error.message || get("browserpage.bchange21");
|
||||||
// response = (Number(res) / 1e8).toFixed(8);
|
data['error'] = errorMsg;
|
||||||
// }
|
response = JSON.stringify(data);
|
||||||
// } catch (error) {
|
return;
|
||||||
// console.error(error);
|
} else {
|
||||||
// const data = {};
|
response = (Number(res) / 1e8).toFixed(8);
|
||||||
// const errorMsg = error.message || get("browserpage.bchange21");
|
}
|
||||||
// data['error'] = errorMsg;
|
} catch (error) {
|
||||||
// response = JSON.stringify(data);
|
console.error(error);
|
||||||
// return;
|
const data = {};
|
||||||
// } finally {
|
const errorMsg = error.message || get("browserpage.bchange21");
|
||||||
// this.loader.hide()
|
data['error'] = errorMsg;
|
||||||
// }
|
response = JSON.stringify(data);
|
||||||
// }
|
return;
|
||||||
|
} finally {
|
||||||
|
this.loader.hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (res3.action === 'reject') {
|
} else if (res3.action === 'reject') {
|
||||||
response = '{"error": "User declined request"}';
|
response = '{"error": "User declined request"}';
|
||||||
}
|
}
|
||||||
@ -1705,7 +1708,7 @@ class WebBrowser extends LitElement {
|
|||||||
let errorMsg = "Insufficient Funds!"
|
let errorMsg = "Insufficient Funds!"
|
||||||
let failedMsg = get("walletpage.wchange26")
|
let failedMsg = get("walletpage.wchange26")
|
||||||
let pleaseMsg = get("walletpage.wchange44")
|
let pleaseMsg = get("walletpage.wchange44")
|
||||||
showErrorAndWait("INSSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
|
showErrorAndWait("INSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
|
||||||
let obj = {}
|
let obj = {}
|
||||||
obj['error'] = errorMsg
|
obj['error'] = errorMsg
|
||||||
response = JSON.stringify(obj)
|
response = JSON.stringify(obj)
|
||||||
@ -1736,7 +1739,8 @@ class WebBrowser extends LitElement {
|
|||||||
amount,
|
amount,
|
||||||
recipient,
|
recipient,
|
||||||
coin,
|
coin,
|
||||||
balance
|
balance,
|
||||||
|
fee
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1875,6 +1879,7 @@ class WebBrowser extends LitElement {
|
|||||||
const recipient = data.destinationAddress
|
const recipient = data.destinationAddress
|
||||||
const coin = data.coin
|
const coin = data.coin
|
||||||
const xprv58 = this.btcWallet.derivedMasterPrivateKey
|
const xprv58 = this.btcWallet.derivedMasterPrivateKey
|
||||||
|
const feePerByte = data.fee ? data.fee : this.btcFeePerByte
|
||||||
|
|
||||||
const btcWalletBalance = await parentEpml.request('apiCall', {
|
const btcWalletBalance = await parentEpml.request('apiCall', {
|
||||||
url: `/crosschain/btc/walletbalance?apiKey=${this.getApiKey()}`,
|
url: `/crosschain/btc/walletbalance?apiKey=${this.getApiKey()}`,
|
||||||
@ -1897,14 +1902,14 @@ class WebBrowser extends LitElement {
|
|||||||
const btcWalletBalanceDecimals = Number(btcWalletBalance)
|
const btcWalletBalanceDecimals = Number(btcWalletBalance)
|
||||||
const btcAmountDecimals = Number(amount) * QORT_DECIMALS
|
const btcAmountDecimals = Number(amount) * QORT_DECIMALS
|
||||||
const balance = (Number(btcWalletBalance) / 1e8).toFixed(8)
|
const balance = (Number(btcWalletBalance) / 1e8).toFixed(8)
|
||||||
const fee = 50000
|
const fee = feePerByte * 500 // default 0.00050000
|
||||||
|
|
||||||
if (btcAmountDecimals + fee > btcWalletBalanceDecimals) {
|
if (btcAmountDecimals + (fee * QORT_DECIMALS) > btcWalletBalanceDecimals) {
|
||||||
this.loader.hide()
|
this.loader.hide()
|
||||||
let errorMsg = "Insufficient Funds!"
|
let errorMsg = "Insufficient Funds!"
|
||||||
let failedMsg = get("walletpage.wchange26")
|
let failedMsg = get("walletpage.wchange26")
|
||||||
let pleaseMsg = get("walletpage.wchange44")
|
let pleaseMsg = get("walletpage.wchange44")
|
||||||
showErrorAndWait("INSSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
|
showErrorAndWait("INSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
|
||||||
let obj = {}
|
let obj = {}
|
||||||
obj['error'] = errorMsg
|
obj['error'] = errorMsg
|
||||||
response = JSON.stringify(obj)
|
response = JSON.stringify(obj)
|
||||||
@ -1919,7 +1924,8 @@ class WebBrowser extends LitElement {
|
|||||||
amount,
|
amount,
|
||||||
recipient,
|
recipient,
|
||||||
coin,
|
coin,
|
||||||
balance
|
balance,
|
||||||
|
fee
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1939,7 +1945,7 @@ class WebBrowser extends LitElement {
|
|||||||
xprv58: xprv58,
|
xprv58: xprv58,
|
||||||
receivingAddress: recipient,
|
receivingAddress: recipient,
|
||||||
bitcoinAmount: amount,
|
bitcoinAmount: amount,
|
||||||
feePerByte: (this.btcFeePerByte / 1e8).toFixed(8)
|
feePerByte: feePerByte * QORT_DECIMALS
|
||||||
}
|
}
|
||||||
const response = await parentEpml.request('sendBtc', opts)
|
const response = await parentEpml.request('sendBtc', opts)
|
||||||
return response
|
return response
|
||||||
@ -1981,6 +1987,7 @@ class WebBrowser extends LitElement {
|
|||||||
const recipient = data.destinationAddress
|
const recipient = data.destinationAddress
|
||||||
const coin = data.coin
|
const coin = data.coin
|
||||||
const xprv58 = this.ltcWallet.derivedMasterPrivateKey
|
const xprv58 = this.ltcWallet.derivedMasterPrivateKey
|
||||||
|
const feePerByte = data.fee ? data.fee : this.ltcFeePerByte
|
||||||
|
|
||||||
const ltcWalletBalance = await parentEpml.request('apiCall', {
|
const ltcWalletBalance = await parentEpml.request('apiCall', {
|
||||||
url: `/crosschain/ltc/walletbalance?apiKey=${this.getApiKey()}`,
|
url: `/crosschain/ltc/walletbalance?apiKey=${this.getApiKey()}`,
|
||||||
@ -2003,14 +2010,14 @@ class WebBrowser extends LitElement {
|
|||||||
const ltcWalletBalanceDecimals = Number(ltcWalletBalance)
|
const ltcWalletBalanceDecimals = Number(ltcWalletBalance)
|
||||||
const ltcAmountDecimals = Number(amount) * QORT_DECIMALS
|
const ltcAmountDecimals = Number(amount) * QORT_DECIMALS
|
||||||
const balance = (Number(ltcWalletBalance) / 1e8).toFixed(8)
|
const balance = (Number(ltcWalletBalance) / 1e8).toFixed(8)
|
||||||
const fee = 30000
|
const fee = feePerByte * 1000 // default 0.00030000
|
||||||
|
|
||||||
if (ltcAmountDecimals + fee > ltcWalletBalanceDecimals) {
|
if (ltcAmountDecimals + (fee * QORT_DECIMALS) > ltcWalletBalanceDecimals) {
|
||||||
this.loader.hide()
|
this.loader.hide()
|
||||||
let errorMsg = "Insufficient Funds!"
|
let errorMsg = "Insufficient Funds!"
|
||||||
let failedMsg = get("walletpage.wchange26")
|
let failedMsg = get("walletpage.wchange26")
|
||||||
let pleaseMsg = get("walletpage.wchange44")
|
let pleaseMsg = get("walletpage.wchange44")
|
||||||
showErrorAndWait("INSSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
|
showErrorAndWait("INSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
|
||||||
let obj = {}
|
let obj = {}
|
||||||
obj['error'] = errorMsg
|
obj['error'] = errorMsg
|
||||||
response = JSON.stringify(obj)
|
response = JSON.stringify(obj)
|
||||||
@ -2025,7 +2032,8 @@ class WebBrowser extends LitElement {
|
|||||||
amount,
|
amount,
|
||||||
recipient,
|
recipient,
|
||||||
coin,
|
coin,
|
||||||
balance
|
balance,
|
||||||
|
fee
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -2045,7 +2053,7 @@ class WebBrowser extends LitElement {
|
|||||||
xprv58: xprv58,
|
xprv58: xprv58,
|
||||||
receivingAddress: recipient,
|
receivingAddress: recipient,
|
||||||
litecoinAmount: amount,
|
litecoinAmount: amount,
|
||||||
feePerByte: (this.ltcFeePerByte / 1e8).toFixed(8)
|
feePerByte: feePerByte * QORT_DECIMALS
|
||||||
}
|
}
|
||||||
const response = await parentEpml.request('sendLtc', opts)
|
const response = await parentEpml.request('sendLtc', opts)
|
||||||
return response
|
return response
|
||||||
@ -2087,6 +2095,7 @@ class WebBrowser extends LitElement {
|
|||||||
const recipient = data.destinationAddress
|
const recipient = data.destinationAddress
|
||||||
const coin = data.coin
|
const coin = data.coin
|
||||||
const xprv58 = this.dogeWallet.derivedMasterPrivateKey
|
const xprv58 = this.dogeWallet.derivedMasterPrivateKey
|
||||||
|
const feePerByte = data.fee ? data.fee : this.dogeFeePerByte
|
||||||
|
|
||||||
const dogeWalletBalance = await parentEpml.request('apiCall', {
|
const dogeWalletBalance = await parentEpml.request('apiCall', {
|
||||||
url: `/crosschain/doge/walletbalance?apiKey=${this.getApiKey()}`,
|
url: `/crosschain/doge/walletbalance?apiKey=${this.getApiKey()}`,
|
||||||
@ -2109,14 +2118,14 @@ class WebBrowser extends LitElement {
|
|||||||
const dogeWalletBalanceDecimals = Number(dogeWalletBalance)
|
const dogeWalletBalanceDecimals = Number(dogeWalletBalance)
|
||||||
const dogeAmountDecimals = Number(amount) * QORT_DECIMALS
|
const dogeAmountDecimals = Number(amount) * QORT_DECIMALS
|
||||||
const balance = (Number(dogeWalletBalance) / 1e8).toFixed(8)
|
const balance = (Number(dogeWalletBalance) / 1e8).toFixed(8)
|
||||||
const fee = 5000000
|
const fee = feePerByte * 5000 // default 0.05000000
|
||||||
|
|
||||||
if (dogeAmountDecimals + fee > dogeWalletBalanceDecimals) {
|
if (dogeAmountDecimals + (fee * QORT_DECIMALS) > dogeWalletBalanceDecimals) {
|
||||||
this.loader.hide()
|
this.loader.hide()
|
||||||
let errorMsg = "Insufficient Funds!"
|
let errorMsg = "Insufficient Funds!"
|
||||||
let failedMsg = get("walletpage.wchange26")
|
let failedMsg = get("walletpage.wchange26")
|
||||||
let pleaseMsg = get("walletpage.wchange44")
|
let pleaseMsg = get("walletpage.wchange44")
|
||||||
showErrorAndWait("INSSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
|
showErrorAndWait("INSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
|
||||||
let obj = {}
|
let obj = {}
|
||||||
obj['error'] = errorMsg
|
obj['error'] = errorMsg
|
||||||
response = JSON.stringify(obj)
|
response = JSON.stringify(obj)
|
||||||
@ -2131,7 +2140,8 @@ class WebBrowser extends LitElement {
|
|||||||
amount,
|
amount,
|
||||||
recipient,
|
recipient,
|
||||||
coin,
|
coin,
|
||||||
balance
|
balance,
|
||||||
|
fee
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -2151,7 +2161,7 @@ class WebBrowser extends LitElement {
|
|||||||
xprv58: xprv58,
|
xprv58: xprv58,
|
||||||
receivingAddress: recipient,
|
receivingAddress: recipient,
|
||||||
dogecoinAmount: amount,
|
dogecoinAmount: amount,
|
||||||
feePerByte: (this.dogeFeePerByte / 1e8).toFixed(8)
|
feePerByte: feePerByte * QORT_DECIMALS
|
||||||
}
|
}
|
||||||
const response = await parentEpml.request('sendDoge', opts)
|
const response = await parentEpml.request('sendDoge', opts)
|
||||||
return response
|
return response
|
||||||
@ -2193,6 +2203,7 @@ class WebBrowser extends LitElement {
|
|||||||
const recipient = data.destinationAddress
|
const recipient = data.destinationAddress
|
||||||
const coin = data.coin
|
const coin = data.coin
|
||||||
const xprv58 = this.dgbWallet.derivedMasterPrivateKey
|
const xprv58 = this.dgbWallet.derivedMasterPrivateKey
|
||||||
|
const feePerByte = data.fee ? data.fee : this.dgbFeePerByte
|
||||||
|
|
||||||
const dgbWalletBalance = await parentEpml.request('apiCall', {
|
const dgbWalletBalance = await parentEpml.request('apiCall', {
|
||||||
url: `/crosschain/dgb/walletbalance?apiKey=${this.getApiKey()}`,
|
url: `/crosschain/dgb/walletbalance?apiKey=${this.getApiKey()}`,
|
||||||
@ -2215,14 +2226,14 @@ class WebBrowser extends LitElement {
|
|||||||
const dgbWalletBalanceDecimals = Number(dgbWalletBalance)
|
const dgbWalletBalanceDecimals = Number(dgbWalletBalance)
|
||||||
const dgbAmountDecimals = Number(amount) * QORT_DECIMALS
|
const dgbAmountDecimals = Number(amount) * QORT_DECIMALS
|
||||||
const balance = (Number(dgbWalletBalance) / 1e8).toFixed(8)
|
const balance = (Number(dgbWalletBalance) / 1e8).toFixed(8)
|
||||||
const fee = 5000
|
const fee = feePerByte * 500 // default 0.00005000
|
||||||
|
|
||||||
if (dgbAmountDecimals + fee > dgbWalletBalanceDecimals) {
|
if (dgbAmountDecimals + (fee * QORT_DECIMALS) > dgbWalletBalanceDecimals) {
|
||||||
this.loader.hide()
|
this.loader.hide()
|
||||||
let errorMsg = "Insufficient Funds!"
|
let errorMsg = "Insufficient Funds!"
|
||||||
let failedMsg = get("walletpage.wchange26")
|
let failedMsg = get("walletpage.wchange26")
|
||||||
let pleaseMsg = get("walletpage.wchange44")
|
let pleaseMsg = get("walletpage.wchange44")
|
||||||
showErrorAndWait("INSSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
|
showErrorAndWait("INSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
|
||||||
let obj = {}
|
let obj = {}
|
||||||
obj['error'] = errorMsg
|
obj['error'] = errorMsg
|
||||||
response = JSON.stringify(obj)
|
response = JSON.stringify(obj)
|
||||||
@ -2237,7 +2248,8 @@ class WebBrowser extends LitElement {
|
|||||||
amount,
|
amount,
|
||||||
recipient,
|
recipient,
|
||||||
coin,
|
coin,
|
||||||
balance
|
balance,
|
||||||
|
fee
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -2257,7 +2269,7 @@ class WebBrowser extends LitElement {
|
|||||||
xprv58: xprv58,
|
xprv58: xprv58,
|
||||||
receivingAddress: recipient,
|
receivingAddress: recipient,
|
||||||
digibyteAmount: amount,
|
digibyteAmount: amount,
|
||||||
feePerByte: (this.dgbFeePerByte / 1e8).toFixed(8)
|
feePerByte: feePerByte * QORT_DECIMALS
|
||||||
}
|
}
|
||||||
const response = await parentEpml.request('sendDgb', opts)
|
const response = await parentEpml.request('sendDgb', opts)
|
||||||
return response
|
return response
|
||||||
@ -2299,6 +2311,7 @@ class WebBrowser extends LitElement {
|
|||||||
const recipient = data.destinationAddress
|
const recipient = data.destinationAddress
|
||||||
const coin = data.coin
|
const coin = data.coin
|
||||||
const xprv58 = this.rvnWallet.derivedMasterPrivateKey
|
const xprv58 = this.rvnWallet.derivedMasterPrivateKey
|
||||||
|
const feePerByte = data.fee ? data.fee : this.rvnFeePerByte
|
||||||
|
|
||||||
const rvnWalletBalance = await parentEpml.request('apiCall', {
|
const rvnWalletBalance = await parentEpml.request('apiCall', {
|
||||||
url: `/crosschain/rvn/walletbalance?apiKey=${this.getApiKey()}`,
|
url: `/crosschain/rvn/walletbalance?apiKey=${this.getApiKey()}`,
|
||||||
@ -2321,14 +2334,14 @@ class WebBrowser extends LitElement {
|
|||||||
const rvnWalletBalanceDecimals = Number(rvnWalletBalance)
|
const rvnWalletBalanceDecimals = Number(rvnWalletBalance)
|
||||||
const rvnAmountDecimals = Number(amount) * QORT_DECIMALS
|
const rvnAmountDecimals = Number(amount) * QORT_DECIMALS
|
||||||
const balance = (Number(rvnWalletBalance) / 1e8).toFixed(8)
|
const balance = (Number(rvnWalletBalance) / 1e8).toFixed(8)
|
||||||
const fee = 562500
|
const fee = feePerByte * 500 // default 0.00562500
|
||||||
|
|
||||||
if (rvnAmountDecimals + fee > rvnWalletBalanceDecimals) {
|
if (rvnAmountDecimals + (fee * QORT_DECIMALS) > rvnWalletBalanceDecimals) {
|
||||||
this.loader.hide()
|
this.loader.hide()
|
||||||
let errorMsg = "Insufficient Funds!"
|
let errorMsg = "Insufficient Funds!"
|
||||||
let failedMsg = get("walletpage.wchange26")
|
let failedMsg = get("walletpage.wchange26")
|
||||||
let pleaseMsg = get("walletpage.wchange44")
|
let pleaseMsg = get("walletpage.wchange44")
|
||||||
showErrorAndWait("INSSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
|
showErrorAndWait("INSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
|
||||||
let obj = {}
|
let obj = {}
|
||||||
obj['error'] = errorMsg
|
obj['error'] = errorMsg
|
||||||
response = JSON.stringify(obj)
|
response = JSON.stringify(obj)
|
||||||
@ -2343,7 +2356,8 @@ class WebBrowser extends LitElement {
|
|||||||
amount,
|
amount,
|
||||||
recipient,
|
recipient,
|
||||||
coin,
|
coin,
|
||||||
balance
|
balance,
|
||||||
|
fee
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -2363,7 +2377,7 @@ class WebBrowser extends LitElement {
|
|||||||
xprv58: xprv58,
|
xprv58: xprv58,
|
||||||
receivingAddress: recipient,
|
receivingAddress: recipient,
|
||||||
ravencoinAmount: amount,
|
ravencoinAmount: amount,
|
||||||
feePerByte: (this.rvnFeePerByte / 1e8).toFixed(8)
|
feePerByte: feePerByte * QORT_DECIMALS
|
||||||
}
|
}
|
||||||
const response = await parentEpml.request('sendRvn', opts)
|
const response = await parentEpml.request('sendRvn', opts)
|
||||||
return response
|
return response
|
||||||
@ -2428,14 +2442,14 @@ class WebBrowser extends LitElement {
|
|||||||
const arrrWalletBalanceDecimals = Number(arrrWalletBalance)
|
const arrrWalletBalanceDecimals = Number(arrrWalletBalance)
|
||||||
const arrrAmountDecimals = Number(amount) * QORT_DECIMALS
|
const arrrAmountDecimals = Number(amount) * QORT_DECIMALS
|
||||||
const balance = (Number(arrrWalletBalance) / 1e8).toFixed(8)
|
const balance = (Number(arrrWalletBalance) / 1e8).toFixed(8)
|
||||||
const fee = 10000
|
const fee = 0.00010000
|
||||||
|
|
||||||
if (arrrAmountDecimals + fee > arrrWalletBalanceDecimals) {
|
if (arrrAmountDecimals + (fee * QORT_DECIMALS) > arrrWalletBalanceDecimals) {
|
||||||
this.loader.hide()
|
this.loader.hide()
|
||||||
let errorMsg = "Insufficient Funds!"
|
let errorMsg = "Insufficient Funds!"
|
||||||
let failedMsg = get("walletpage.wchange26")
|
let failedMsg = get("walletpage.wchange26")
|
||||||
let pleaseMsg = get("walletpage.wchange44")
|
let pleaseMsg = get("walletpage.wchange44")
|
||||||
showErrorAndWait("INSSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
|
showErrorAndWait("INSUFFICIENT_FUNDS", failedMsg, pleaseMsg)
|
||||||
let obj = {}
|
let obj = {}
|
||||||
obj['error'] = errorMsg
|
obj['error'] = errorMsg
|
||||||
response = JSON.stringify(obj)
|
response = JSON.stringify(obj)
|
||||||
@ -2450,7 +2464,8 @@ class WebBrowser extends LitElement {
|
|||||||
amount,
|
amount,
|
||||||
recipient,
|
recipient,
|
||||||
coin,
|
coin,
|
||||||
balance
|
balance,
|
||||||
|
fee
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -2881,6 +2896,7 @@ async function showModalAndWait(type, data) {
|
|||||||
<p style="font-size: 16px;overflow-wrap: anywhere;" class="modal-paragraph"><span style="font-weight: bold">${get("walletpage.wchange19")}:</span> ${data.balance} ${data.coin}</p>
|
<p style="font-size: 16px;overflow-wrap: anywhere;" class="modal-paragraph"><span style="font-weight: bold">${get("walletpage.wchange19")}:</span> ${data.balance} ${data.coin}</p>
|
||||||
<p style="font-size: 16px;overflow-wrap: anywhere;" class="modal-paragraph"><span style="font-weight: bold">${get("walletpage.wchange10")}:</span> ${data.recipient}</p>
|
<p style="font-size: 16px;overflow-wrap: anywhere;" class="modal-paragraph"><span style="font-weight: bold">${get("walletpage.wchange10")}:</span> ${data.recipient}</p>
|
||||||
<p style="font-size: 16px;overflow-wrap: anywhere;" class="modal-paragraph"><span style="font-weight: bold">${get("walletpage.wchange11")}:</span> ${data.amount} ${data.coin}</p>
|
<p style="font-size: 16px;overflow-wrap: anywhere;" class="modal-paragraph"><span style="font-weight: bold">${get("walletpage.wchange11")}:</span> ${data.amount} ${data.coin}</p>
|
||||||
|
<p style="font-size: 16px;overflow-wrap: anywhere;" class="modal-paragraph"><span style="font-weight: bold">${get("walletpage.wchange36")}:</span> ~${data.fee} ${data.coin}</p>
|
||||||
</div>
|
</div>
|
||||||
` : ''}
|
` : ''}
|
||||||
|
|
||||||
@ -3026,7 +3042,7 @@ async function showErrorAndWait(type, data, data1) {
|
|||||||
</div>
|
</div>
|
||||||
` : ''}
|
` : ''}
|
||||||
|
|
||||||
${type === "INSSUFFICIENT_FUNDS" ? `
|
${type === "INSUFFICIENT_FUNDS" ? `
|
||||||
<div class="modal-subcontainer-error">
|
<div class="modal-subcontainer-error">
|
||||||
<p class="modal-paragraph-error">${data}</p>
|
<p class="modal-paragraph-error">${data}</p>
|
||||||
<p class="modal-paragraph-error">${data1}</p>
|
<p class="modal-paragraph-error">${data1}</p>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user