@@ -1467,6 +1671,234 @@ class MultiWallet extends LitElement {
${translate("general.close")}
+
+
+
+
+
![](/img/nmc.png)
+
${translate("walletpage.wchange17")} NMC
+
+
+
+ ${translate("walletpage.wchange18")}:
+ ${this.getSelectedWalletAddress()}
+
+
+ ${translate("walletpage.wchange19")}:
+ ${this.balanceString}
+
+
+ { this._checkAmount(e) }}"
+ id="nmcAmountInput"
+ label="${translate("walletpage.wchange11")} (NMC)"
+ type="number"
+ auto-validate="false"
+ value="${this.nmcAmount}"
+ >
+
+
+
+
+
+
+
+
+ ${translate("walletpage.wchange24")}: ${(this.nmcFeePerByte / 1e8).toFixed(8)} NMC
${translate("walletpage.wchange25")}
+
+
(this.nmcFeePerByte = e.target.value)}"
+ id="nmcFeeSlider"
+ min="${this.nmcSatMinFee}"
+ max="${this.nmcSatMaxFee}"
+ value="${this.nmcFeePerByte}"
+ >
+
+
+ ${this.renderClearSuccess()}
+ ${this.renderClearError()}
+ ${this.sendMoneyLoading ? html`
` : ''}
+
+
+ this.closeNmcDialog()}"
+ class="red"
+ >
+ ${translate("general.close")}
+
+
+
+
+
+
+
![](/img/dash.png)
+
${translate("walletpage.wchange17")} DASH
+
+
+
+ ${translate("walletpage.wchange18")}:
+ ${this.getSelectedWalletAddress()}
+
+
+ ${translate("walletpage.wchange19")}:
+ ${this.balanceString}
+
+
+ { this._checkAmount(e) }}"
+ id="dashAmountInput"
+ label="${translate("walletpage.wchange11")} (DASH)"
+ type="number"
+ auto-validate="false"
+ value="${this.dashAmount}"
+ >
+
+
+
+
+
+
+
+
+ ${translate("walletpage.wchange24")}: ${(this.dashFeePerByte / 1e8).toFixed(8)} DASH
${translate("walletpage.wchange25")}
+
+
(this.dashFeePerByte = e.target.value)}"
+ id="dashFeeSlider"
+ min="${this.dashSatMinFee}"
+ max="${this.dashSatMaxFee}"
+ value="${this.dashFeePerByte}"
+ >
+
+
+ ${this.renderClearSuccess()}
+ ${this.renderClearError()}
+ ${this.sendMoneyLoading ? html`
` : ''}
+
+
+ this.closeDashDialog()}"
+ class="red"
+ >
+ ${translate("general.close")}
+
+
+
+
+
+
+
![](/img/firo.png)
+
${translate("walletpage.wchange17")} FIRO
+
+
+
+ ${translate("walletpage.wchange18")}:
+ ${this.getSelectedWalletAddress()}
+
+
+ ${translate("walletpage.wchange19")}:
+ ${this.balanceString}
+
+
+ { this._checkAmount(e) }}"
+ id="firoAmountInput"
+ label="${translate("walletpage.wchange11")} (FIRO)"
+ type="number"
+ auto-validate="false"
+ value="${this.firoAmount}"
+ >
+
+
+
+
+
+
+
+
+ ${translate("walletpage.wchange24")}: ${(this.firoFeePerByte / 1e8).toFixed(8)} FIRO
${translate("walletpage.wchange25")}
+
+
(this.firoFeePerByte = e.target.value)}"
+ id="firoFeeSlider"
+ min="${this.firoSatMinFee}"
+ max="${this.firoSatMaxFee}"
+ value="${this.firoFeePerByte}"
+ >
+
+
+ ${this.renderClearSuccess()}
+ ${this.renderClearError()}
+ ${this.sendMoneyLoading ? html`
` : ''}
+
+
+ this.closeFiroDialog()}"
+ class="red"
+ >
+ ${translate("general.close")}
+
+
`
}
@@ -1791,6 +2223,144 @@ class MultiWallet extends LitElement {
}
}
checkSelectedTextAndShowMenu()
+ })
+
+ this.shadowRoot.getElementById('nmcAmountInput').addEventListener('contextmenu', (event) => {
+ const getSelectedText = () => {
+ var text = ''
+ if (typeof window.getSelection != 'undefined') {
+ text = window.getSelection().toString()
+ } else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
+ text = this.shadowRoot.selection.createRange().text
+ }
+ return text
+ }
+ const checkSelectedTextAndShowMenu = () => {
+ let selectedText = getSelectedText()
+ if (selectedText && typeof selectedText === 'string') {
+ } else {
+ this.pasteMenu(event, 'nmcAmountInput')
+ this.isPasteMenuOpen = true
+ event.preventDefault()
+ event.stopPropagation()
+ }
+ }
+ checkSelectedTextAndShowMenu()
+ })
+
+ this.shadowRoot.getElementById('nmcRecipient').addEventListener('contextmenu', (event) => {
+ const getSelectedText = () => {
+ var text = ''
+ if (typeof window.getSelection != 'undefined') {
+ text = window.getSelection().toString()
+ } else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
+ text = this.shadowRoot.selection.createRange().text
+ }
+ return text
+ }
+ const checkSelectedTextAndShowMenu = () => {
+ let selectedText = getSelectedText()
+ if (selectedText && typeof selectedText === 'string') {
+ } else {
+ this.pasteMenu(event, 'nmcRecipient')
+ this.isPasteMenuOpen = true
+ event.preventDefault()
+ event.stopPropagation()
+ }
+ }
+ checkSelectedTextAndShowMenu()
+ })
+
+ this.shadowRoot.getElementById('dashAmountInput').addEventListener('contextmenu', (event) => {
+ const getSelectedText = () => {
+ var text = ''
+ if (typeof window.getSelection != 'undefined') {
+ text = window.getSelection().toString()
+ } else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
+ text = this.shadowRoot.selection.createRange().text
+ }
+ return text
+ }
+ const checkSelectedTextAndShowMenu = () => {
+ let selectedText = getSelectedText()
+ if (selectedText && typeof selectedText === 'string') {
+ } else {
+ this.pasteMenu(event, 'dashAmountInput')
+ this.isPasteMenuOpen = true
+ event.preventDefault()
+ event.stopPropagation()
+ }
+ }
+ checkSelectedTextAndShowMenu()
+ })
+
+ this.shadowRoot.getElementById('dashRecipient').addEventListener('contextmenu', (event) => {
+ const getSelectedText = () => {
+ var text = ''
+ if (typeof window.getSelection != 'undefined') {
+ text = window.getSelection().toString()
+ } else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
+ text = this.shadowRoot.selection.createRange().text
+ }
+ return text
+ }
+ const checkSelectedTextAndShowMenu = () => {
+ let selectedText = getSelectedText()
+ if (selectedText && typeof selectedText === 'string') {
+ } else {
+ this.pasteMenu(event, 'dashRecipient')
+ this.isPasteMenuOpen = true
+ event.preventDefault()
+ event.stopPropagation()
+ }
+ }
+ checkSelectedTextAndShowMenu()
+ })
+
+ this.shadowRoot.getElementById('firoAmountInput').addEventListener('contextmenu', (event) => {
+ const getSelectedText = () => {
+ var text = ''
+ if (typeof window.getSelection != 'undefined') {
+ text = window.getSelection().toString()
+ } else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
+ text = this.shadowRoot.selection.createRange().text
+ }
+ return text
+ }
+ const checkSelectedTextAndShowMenu = () => {
+ let selectedText = getSelectedText()
+ if (selectedText && typeof selectedText === 'string') {
+ } else {
+ this.pasteMenu(event, 'firoAmountInput')
+ this.isPasteMenuOpen = true
+ event.preventDefault()
+ event.stopPropagation()
+ }
+ }
+ checkSelectedTextAndShowMenu()
+ })
+
+ this.shadowRoot.getElementById('firoRecipient').addEventListener('contextmenu', (event) => {
+ const getSelectedText = () => {
+ var text = ''
+ if (typeof window.getSelection != 'undefined') {
+ text = window.getSelection().toString()
+ } else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
+ text = this.shadowRoot.selection.createRange().text
+ }
+ return text
+ }
+ const checkSelectedTextAndShowMenu = () => {
+ let selectedText = getSelectedText()
+ if (selectedText && typeof selectedText === 'string') {
+ } else {
+ this.pasteMenu(event, 'firoRecipient')
+ this.isPasteMenuOpen = true
+ event.preventDefault()
+ event.stopPropagation()
+ }
+ }
+ checkSelectedTextAndShowMenu()
})
}
@@ -1864,6 +2434,24 @@ class MultiWallet extends LitElement {
this.errorMessage = ''
}
+ closeNmcDialog() {
+ this.shadowRoot.querySelector('#sendNmcDialog').close()
+ this.successMessage = ''
+ this.errorMessage = ''
+ }
+
+ closeDashDialog() {
+ this.shadowRoot.querySelector('#sendDashDialog').close()
+ this.successMessage = ''
+ this.errorMessage = ''
+ }
+
+ closeFiroDialog() {
+ this.shadowRoot.querySelector('#sendFiroDialog').close()
+ this.successMessage = ''
+ this.errorMessage = ''
+ }
+
renderFetchText() {
return html`${translate("walletpage.wchange1")}`
}
@@ -2331,6 +2919,144 @@ class MultiWallet extends LitElement {
this.showWallet()
}
+ async sendNmc() {
+ const nmcAmount = this.shadowRoot.getElementById('nmcAmountInput').value
+ let nmcRecipient = this.shadowRoot.getElementById('nmcRecipient').value
+ const xprv58 = this.wallets.get(this._selectedWallet).wallet.derivedMasterPrivateKey
+
+ this.sendMoneyLoading = true
+ this.btnDisable = true
+
+ const makeRequest = async () => {
+ const opts = {
+ xprv58: xprv58,
+ receivingAddress: nmcRecipient,
+ namecoinAmount: nmcAmount,
+ feePerByte: (this.nmcFeePerByte / 1e8).toFixed(8),
+ }
+ const response = await parentEpml.request('sendNmc', opts)
+ return response
+ }
+
+ const manageResponse = (response) => {
+ if (response.length === 64) {
+ this.shadowRoot.getElementById('nmcAmountInput').value = 0
+ this.shadowRoot.getElementById('nmcRecipient').value = ''
+ this.errorMessage = ''
+ this.nmcRecipient = ''
+ this.nmcAmount = 0
+ this.successMessage = this.renderSuccessText()
+ this.sendMoneyLoading = false
+ this.btnDisable = false
+ } else if (response === false) {
+ this.errorMessage = this.renderFailText()
+ this.sendMoneyLoading = false
+ this.btnDisable = false
+ throw new Error(txnResponse)
+ } else {
+ this.errorMessage = response.message
+ this.sendMoneyLoading = false
+ this.btnDisable = false
+ throw new Error(response)
+ }
+ }
+ const res = await makeRequest()
+ manageResponse(res)
+ this.showWallet()
+ }
+
+ async sendDash() {
+ const dashAmount = this.shadowRoot.getElementById('dashAmountInput').value
+ let dashRecipient = this.shadowRoot.getElementById('dashRecipient').value
+ const xprv58 = this.wallets.get(this._selectedWallet).wallet.derivedMasterPrivateKey
+
+ this.sendMoneyLoading = true
+ this.btnDisable = true
+
+ const makeRequest = async () => {
+ const opts = {
+ xprv58: xprv58,
+ receivingAddress: dashRecipient,
+ dashAmount: dashAmount,
+ feePerByte: (this.dashFeePerByte / 1e8).toFixed(8),
+ }
+ const response = await parentEpml.request('sendDash', opts)
+ return response
+ }
+
+ const manageResponse = (response) => {
+ if (response.length === 64) {
+ this.shadowRoot.getElementById('dashAmountInput').value = 0
+ this.shadowRoot.getElementById('dashRecipient').value = ''
+ this.errorMessage = ''
+ this.dashRecipient = ''
+ this.dashAmount = 0
+ this.successMessage = this.renderSuccessText()
+ this.sendMoneyLoading = false
+ this.btnDisable = false
+ } else if (response === false) {
+ this.errorMessage = this.renderFailText()
+ this.sendMoneyLoading = false
+ this.btnDisable = false
+ throw new Error(txnResponse)
+ } else {
+ this.errorMessage = response.message
+ this.sendMoneyLoading = false
+ this.btnDisable = false
+ throw new Error(response)
+ }
+ }
+ const res = await makeRequest()
+ manageResponse(res)
+ this.showWallet()
+ }
+
+ async sendFiro() {
+ const firoAmount = this.shadowRoot.getElementById('firoAmountInput').value
+ let firoRecipient = this.shadowRoot.getElementById('firoRecipient').value
+ const xprv58 = this.wallets.get(this._selectedWallet).wallet.derivedMasterPrivateKey
+
+ this.sendMoneyLoading = true
+ this.btnDisable = true
+
+ const makeRequest = async () => {
+ const opts = {
+ xprv58: xprv58,
+ receivingAddress: firoRecipient,
+ firoAmount: firoAmount,
+ feePerByte: (this.firoFeePerByte / 1e8).toFixed(8),
+ }
+ const response = await parentEpml.request('sendFiro', opts)
+ return response
+ }
+
+ const manageResponse = (response) => {
+ if (response.length === 64) {
+ this.shadowRoot.getElementById('firoAmountInput').value = 0
+ this.shadowRoot.getElementById('firoRecipient').value = ''
+ this.errorMessage = ''
+ this.firoRecipient = ''
+ this.firoAmount = 0
+ this.successMessage = this.renderSuccessText()
+ this.sendMoneyLoading = false
+ this.btnDisable = false
+ } else if (response === false) {
+ this.errorMessage = this.renderFailText()
+ this.sendMoneyLoading = false
+ this.btnDisable = false
+ throw new Error(txnResponse)
+ } else {
+ this.errorMessage = response.message
+ this.sendMoneyLoading = false
+ this.btnDisable = false
+ throw new Error(response)
+ }
+ }
+ const res = await makeRequest()
+ manageResponse(res)
+ this.showWallet()
+ }
+
async showWallet() {
this.transactionsDOM.hidden = true
this.loading = true
@@ -2383,6 +3109,9 @@ class MultiWallet extends LitElement {
case 'doge':
case 'dgb':
case 'rvn':
+ case 'nmc':
+ case 'dash':
+ case 'firo':
const walletName = `${coin}Wallet`
parentEpml.request('apiCall', {
url: `/crosschain/${coin}/walletbalance?apiKey=${this.getApiKey()}`,
@@ -2437,6 +3166,12 @@ class MultiWallet extends LitElement {
return html`
this.openSendDgb()}> ${translate("walletpage.wchange17")} DGB`
} else if ( this._selectedWallet === "rvn" ) {
return html`
this.openSendRvn()}> ${translate("walletpage.wchange17")} RVN`
+ } else if ( this._selectedWallet === "nmc" ) {
+ return html`
this.openSendNmc()}> ${translate("walletpage.wchange17")} NMC`
+ } else if ( this._selectedWallet === "dash" ) {
+ return html`
this.openSendDash()}> ${translate("walletpage.wchange17")} DASH`
+ } else if ( this._selectedWallet === "firo" ) {
+ return html`
this.openSendFiro()}> ${translate("walletpage.wchange17")} FIRO`
} else {
return html``
}
@@ -2466,6 +3201,18 @@ class MultiWallet extends LitElement {
this.shadowRoot.querySelector("#sendRvnDialog").show();
}
+ openSendNmc() {
+ this.shadowRoot.querySelector("#sendNmcDialog").show();
+ }
+
+ openSendDash() {
+ this.shadowRoot.querySelector("#sendDashDialog").show();
+ }
+
+ openSendFiro() {
+ this.shadowRoot.querySelector("#sendFiroDialog").show();
+ }
+
changeTheme() {
const checkTheme = localStorage.getItem('qortalTheme')
if (checkTheme === 'dark') {
@@ -2549,6 +3296,33 @@ class MultiWallet extends LitElement {
},
{ passive: true }
)
+ } else if (coin === 'nmc') {
+ this.transactionsGrid.addEventListener(
+ 'click',
+ (e) => {
+ let nmcItem = this.transactionsGrid.getEventContext(e).item
+ this.showNmcTransactionDetails(nmcItem, this.wallets.get(this._selectedWallet).transactions)
+ },
+ { passive: true }
+ )
+ } else if (coin === 'dash') {
+ this.transactionsGrid.addEventListener(
+ 'click',
+ (e) => {
+ let dashItem = this.transactionsGrid.getEventContext(e).item
+ this.showDashTransactionDetails(dashItem, this.wallets.get(this._selectedWallet).transactions)
+ },
+ { passive: true }
+ )
+ } else if (coin === 'firo') {
+ this.transactionsGrid.addEventListener(
+ 'click',
+ (e) => {
+ let firoItem = this.transactionsGrid.getEventContext(e).item
+ this.showFiroTransactionDetails(firoItem, this.wallets.get(this._selectedWallet).transactions)
+ },
+ { passive: true }
+ )
}
this.pagesControl = this.shadowRoot.querySelector('#pages')
@@ -2568,6 +3342,12 @@ class MultiWallet extends LitElement {
render(this.renderDgbTransactions(this.wallets.get(this._selectedWallet).transactions, this._selectedWallet), this.transactionsDOM)
} else if (this._selectedWallet === 'rvn') {
render(this.renderRvnTransactions(this.wallets.get(this._selectedWallet).transactions, this._selectedWallet), this.transactionsDOM)
+ } else if (this._selectedWallet === 'nmc') {
+ render(this.renderNmcTransactions(this.wallets.get(this._selectedWallet).transactions, this._selectedWallet), this.transactionsDOM)
+ } else if (this._selectedWallet === 'dash') {
+ render(this.renderDashTransactions(this.wallets.get(this._selectedWallet).transactions, this._selectedWallet), this.transactionsDOM)
+ } else if (this._selectedWallet === 'firo') {
+ render(this.renderFiroTransactions(this.wallets.get(this._selectedWallet).transactions, this._selectedWallet), this.transactionsDOM)
}
}
@@ -2953,6 +3733,201 @@ class MultiWallet extends LitElement {
`
}
+ renderNmcTransactions(transactions, coin) {
+ return html`
+
${translate("walletpage.wchange38")}
+
+ {
+ render(html`check`, root)
+ }}
+ >
+
+ {
+ render(html` ${translate("walletpage.wchange40")} ${data.item.inputs[0].address === this.wallets.get(this._selectedWallet).wallet.address ? html`${translate("walletpage.wchange7")}` : html`${translate("walletpage.wchange8")}`} `, root)
+ }}
+ >
+
+ {
+ render(html`${data.item.inputs[0].address}`, root)
+ }}
+ >
+
+ {
+ render(html`${data.item.outputs[0].address}`, root)
+ }}
+ >
+
+
+ {
+ const amount = (Number(data.item.totalAmount) / 1e8).toFixed(8)
+ render(html`${amount}`, root)
+ }}
+ >
+
+ {
+ const time = new Date(data.item.timestamp * 1000)
+ render(html` `, root)
+ }}
+ >
+
+
+
+ `
+ }
+
+ renderDashTransactions(transactions, coin) {
+ return html`
+
${translate("walletpage.wchange38")}
+
+ {
+ render(html`check`, root)
+ }}
+ >
+
+ {
+ render(html` ${translate("walletpage.wchange40")} ${data.item.inputs[0].address === this.wallets.get(this._selectedWallet).wallet.address ? html`${translate("walletpage.wchange7")}` : html`${translate("walletpage.wchange8")}`} `, root)
+ }}
+ >
+
+ {
+ render(html`${data.item.inputs[0].address}`, root)
+ }}
+ >
+
+ {
+ render(html`${data.item.outputs[0].address}`, root)
+ }}
+ >
+
+
+ {
+ const amount = (Number(data.item.totalAmount) / 1e8).toFixed(8)
+ render(html`${amount}`, root)
+ }}
+ >
+
+ {
+ const time = new Date(data.item.timestamp * 1000)
+ render(html` `, root)
+ }}
+ >
+
+
+
+ `
+ }
+
+ renderFiroTransactions(transactions, coin) {
+ return html`
+
${translate("walletpage.wchange38")}
+
+ {
+ render(html`check`, root)
+ }}
+ >
+
+ {
+ render(html` ${translate("walletpage.wchange40")} ${data.item.inputs[0].address === this.wallets.get(this._selectedWallet).wallet.address ? html`${translate("walletpage.wchange7")}` : html`${translate("walletpage.wchange8")}`} `, root)
+ }}
+ >
+
+ {
+ render(html`${data.item.inputs[0].address}`, root)
+ }}
+ >
+
+ {
+ render(html`${data.item.outputs[0].address}`, root)
+ }}
+ >
+
+
+ {
+ const amount = (Number(data.item.totalAmount) / 1e8).toFixed(8)
+ render(html`${amount}`, root)
+ }}
+ >
+
+ {
+ const time = new Date(data.item.timestamp * 1000)
+ render(html` `, root)
+ }}
+ >
+
+
+
+ `
+ }
+
async updateItemsFromPage(page, changeWallet = false) {
if (page === undefined) {
return
@@ -3153,6 +4128,48 @@ class MultiWallet extends LitElement {
})
}
+ showNmcTransactionDetails(myTransaction, allTransactions) {
+ allTransactions.forEach((transaction) => {
+ if (myTransaction.txHash === transaction.txHash) {
+ let nmcTxnFlow = myTransaction.inputs[0].address === this.wallets.get(this._selectedWallet).wallet.address ? 'OUT' : 'IN'
+ let nmcSender = myTransaction.inputs[0].address
+ let nmcReceiver = myTransaction.outputs[0].address
+ this.selectedTransaction = { ...transaction, nmcTxnFlow, nmcSender, nmcReceiver }
+ if (this.selectedTransaction.txHash.length != 0) {
+ this.shadowRoot.querySelector('#showNmcTransactionDetailsDialog').show()
+ }
+ }
+ })
+ }
+
+ showDashTransactionDetails(myTransaction, allTransactions) {
+ allTransactions.forEach((transaction) => {
+ if (myTransaction.txHash === transaction.txHash) {
+ let dashTxnFlow = myTransaction.inputs[0].address === this.wallets.get(this._selectedWallet).wallet.address ? 'OUT' : 'IN'
+ let dashSender = myTransaction.inputs[0].address
+ let dashReceiver = myTransaction.outputs[0].address
+ this.selectedTransaction = { ...transaction, dashTxnFlow, dashSender, dashReceiver }
+ if (this.selectedTransaction.txHash.length != 0) {
+ this.shadowRoot.querySelector('#showDashTransactionDetailsDialog').show()
+ }
+ }
+ })
+ }
+
+ showFiroTransactionDetails(myTransaction, allTransactions) {
+ allTransactions.forEach((transaction) => {
+ if (myTransaction.txHash === transaction.txHash) {
+ let firoTxnFlow = myTransaction.inputs[0].address === this.wallets.get(this._selectedWallet).wallet.address ? 'OUT' : 'IN'
+ let firoSender = myTransaction.inputs[0].address
+ let firoReceiver = myTransaction.outputs[0].address
+ this.selectedTransaction = { ...transaction, firoTxnFlow, firoSender, firoReceiver }
+ if (this.selectedTransaction.txHash.length != 0) {
+ this.shadowRoot.querySelector('#showFiroTransactionDetailsDialog').show()
+ }
+ }
+ })
+ }
+
isEmptyArray(arr) {
if (!arr) {
return true