Added memo field to the send ARRR dialog

added a memo text field to be set while sending ARRR to another wallets
This commit is contained in:
proto 2022-08-17 17:51:21 +01:00
parent 59fb31f84d
commit 1503b84a73
2 changed files with 44 additions and 2 deletions

View File

@ -235,7 +235,9 @@
"wchange42":"Confirmations", "wchange42":"Confirmations",
"wchange43":"Your transaction will not show until confirmed, be patient...", "wchange43":"Your transaction will not show until confirmed, be patient...",
"wchange44":"Please try again...", "wchange44":"Please try again...",
"wchange45":"Send all" "wchange45":"Send all",
"wchange46":"Memo"
}, },
"tradepage":{ "tradepage":{
"tchange1":"Trade Portal", "tchange1":"Trade Portal",

View File

@ -56,6 +56,7 @@ class MultiWallet extends LitElement {
rvnAmount: { type: Number }, rvnAmount: { type: Number },
arrrRecipient: { type: String }, arrrRecipient: { type: String },
arrrAmount: { type: Number }, arrrAmount: { type: Number },
arrrMemo: { type: String },
errorMessage: { type: String }, errorMessage: { type: String },
arrrWalletAddress: { type: String }, arrrWalletAddress: { type: String },
successMessage: { type: String }, successMessage: { type: String },
@ -616,6 +617,7 @@ class MultiWallet extends LitElement {
this.dgbRecipient = '' this.dgbRecipient = ''
this.rvnRecipient = '' this.rvnRecipient = ''
this.arrrRecipient = '' this.arrrRecipient = ''
this.arrrMemo = ''
this.arrrWalletAddress = '' this.arrrWalletAddress = ''
this.errorMessage = '' this.errorMessage = ''
this.successMessage = '' this.successMessage = ''
@ -1598,6 +1600,17 @@ class MultiWallet extends LitElement {
> >
</mwc-textfield> </mwc-textfield>
</p> </p>
<p>
<mwc-textfield
style="width: 100%;"
required
id="arrrMemo"
label="${translate("walletpage.wchange46")}"
type="text"
value="${this.arrrMemo}"
>
</mwc-textfield>
</p>
<p style="color: red;">${this.errorMessage}</p> <p style="color: red;">${this.errorMessage}</p>
<p style="color: green;">${this.successMessage}</p> <p style="color: green;">${this.successMessage}</p>
${this.sendMoneyLoading ? html` <paper-progress indeterminate style="width: 100%; margin: 4px;"></paper-progress> ` : ''} ${this.sendMoneyLoading ? html` <paper-progress indeterminate style="width: 100%; margin: 4px;"></paper-progress> ` : ''}
@ -1989,6 +2002,29 @@ class MultiWallet extends LitElement {
} }
checkSelectedTextAndShowMenu() checkSelectedTextAndShowMenu()
}) })
this.shadowRoot.getElementById('arrrMemo').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, 'arrrMemo')
this.isPasteMenuOpen = true
event.preventDefault()
event.stopPropagation()
}
}
checkSelectedTextAndShowMenu()
})
} }
renderClearSuccess() { renderClearSuccess() {
@ -2571,6 +2607,7 @@ class MultiWallet extends LitElement {
async sendArrr() { async sendArrr() {
const arrrAmount = this.shadowRoot.getElementById('arrrAmountInput').value const arrrAmount = this.shadowRoot.getElementById('arrrAmountInput').value
let arrrRecipient = this.shadowRoot.getElementById('arrrRecipient').value let arrrRecipient = this.shadowRoot.getElementById('arrrRecipient').value
let arrrMemo = this.shadowRoot.getElementById('arrrMemo').value
const seed58 = this.wallets.get(this._selectedWallet).wallet.seed58 const seed58 = this.wallets.get(this._selectedWallet).wallet.seed58
this.sendMoneyLoading = true this.sendMoneyLoading = true
@ -2581,6 +2618,7 @@ class MultiWallet extends LitElement {
entropy58: seed58, entropy58: seed58,
receivingAddress: arrrRecipient, receivingAddress: arrrRecipient,
arrrAmount: arrrAmount, arrrAmount: arrrAmount,
arrrMemo: arrrMemo
//feePerByte: (this.arrrFeePerByte / 1e8).toFixed(8), // Not supported in ARRR //feePerByte: (this.arrrFeePerByte / 1e8).toFixed(8), // Not supported in ARRR
} }
const response = await parentEpml.request('sendArrr', opts) const response = await parentEpml.request('sendArrr', opts)
@ -2591,8 +2629,10 @@ class MultiWallet extends LitElement {
if (response.length === 64) { if (response.length === 64) {
this.shadowRoot.getElementById('arrrAmountInput').value = 0 this.shadowRoot.getElementById('arrrAmountInput').value = 0
this.shadowRoot.getElementById('arrrRecipient').value = '' this.shadowRoot.getElementById('arrrRecipient').value = ''
this.shadowRoot.getElementById('arrrMemo').value = ''
this.errorMessage = '' this.errorMessage = ''
this.arrrRecipient = '' this.arrrRecipient = ''
this.arrrMemo=''
this.arrrAmount = 0 this.arrrAmount = 0
this.successMessage = this.renderSuccessText() this.successMessage = this.renderSuccessText()
this.sendMoneyLoading = false this.sendMoneyLoading = false