4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-11 17:55:51 +00:00

add name to transaction dialog

This commit is contained in:
Phillip Lang Martinez 2022-09-02 01:45:47 +03:00
parent fc78fa9225
commit afc02e364f
2 changed files with 38 additions and 4 deletions

View File

@ -34,7 +34,7 @@ export default class PaymentTransaction extends TransactionBase {
set dialogamount(dialogamount) { set dialogamount(dialogamount) {
this._dialogamount = dialogamount this._dialogamount = dialogamount
} }
set amount(amount) { set amount(amount) {
this._amount = Math.round(amount * store.getState().config.coin.decimals) this._amount = Math.round(amount * store.getState().config.coin.decimals)
this._amountBytes = this.constructor.utils.int64ToBytes(this._amount) this._amountBytes = this.constructor.utils.int64ToBytes(this._amount)
@ -55,9 +55,21 @@ export default class PaymentTransaction extends TransactionBase {
return html` return html`
<table> <table>
<tr> <tr>
<th>${this._dialogto}</th> <th>${this._dialogto}:</th>
<td>${Base58.encode(this._recipient)}</td>
</tr> </tr>
<tr>
<td>${this.dialogAddress} ${' '}-</td>
<td>${Base58.encode(this._recipient)}</td>
</tr>
${this.recipientName ? html`
<tr>
<td>${this.dialogName} ${' '}-</td>
<td>${this.recipientName}</td>
</tr>
` : ''}
<tr> <tr>
<th>${this._dialogamount}</th> <th>${this._dialogamount}</th>
<td>${this._amount / conf.coin.decimals} ${conf.coin.symbol}</td> <td>${this._amount / conf.coin.decimals} ${conf.coin.symbol}</td>

View File

@ -3954,22 +3954,44 @@ class MultiWallet extends LitElement {
} }
} }
const getName = async (recipient)=> {
try {
const getNames = await parentEpml.request("apiCall", {
type: "api",
url: `/names/address/${recipient}`,
})
if(getNames?.length > 0 ){
return getNames[0].name
} else {
return ''
}
} catch (error) {
return ""
}
}
const makeTransactionRequest = async (receiver, lastRef) => { const makeTransactionRequest = async (receiver, lastRef) => {
let myReceiver = receiver let myReceiver = receiver
let mylastRef = lastRef let mylastRef = lastRef
let dialogamount = get("transactions.amount") let dialogamount = get("transactions.amount")
let dialogAddress = get("login.address")
let dialogName = get("login.name")
let dialogto = get("transactions.to") let dialogto = get("transactions.to")
let recipientName = await getName(myReceiver)
let myTxnrequest = await parentEpml.request('transaction', { let myTxnrequest = await parentEpml.request('transaction', {
type: 2, type: 2,
nonce: this.wallets.get(this._selectedWallet).wallet.nonce, nonce: this.wallets.get(this._selectedWallet).wallet.nonce,
params: { params: {
recipient: myReceiver, recipient: myReceiver,
recipientName: recipientName,
amount: amount, amount: amount,
lastReference: mylastRef, lastReference: mylastRef,
fee: 0.001, fee: 0.001,
dialogamount: dialogamount, dialogamount: dialogamount,
dialogto: dialogto, dialogto: dialogto,
dialogAddress,
dialogName
}, },
}) })
return myTxnrequest return myTxnrequest