mirror of https://github.com/qortal/qortal-ui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.4 KiB
64 lines
1.4 KiB
2 years ago
|
'use strict'
|
||
3 years ago
|
import TransactionBase from './TransactionBase.js'
|
||
|
import Base58 from '../deps/Base58.js'
|
||
|
import { store } from '../../api.js'
|
||
|
|
||
|
export default class PaymentTransaction extends TransactionBase {
|
||
2 years ago
|
constructor() {
|
||
|
super()
|
||
|
this.type = 2
|
||
|
}
|
||
3 years ago
|
|
||
2 years ago
|
render(html) {
|
||
|
const conf = store.getState().config
|
||
|
return html`
|
||
|
<table>
|
||
|
<tr>
|
||
|
<th>${this._dialogto}:</th>
|
||
|
</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>
|
||
|
<th>${this._dialogamount}</th>
|
||
|
<td>${this._amount / conf.coin.decimals} ${conf.coin.symbol}</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
`
|
||
|
}
|
||
2 years ago
|
|
||
2 years ago
|
set recipient(recipient) {
|
||
|
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
||
|
}
|
||
2 years ago
|
|
||
2 years ago
|
set dialogto(dialogto) {
|
||
|
this._dialogto = dialogto
|
||
|
}
|
||
2 years ago
|
|
||
2 years ago
|
set dialogamount(dialogamount) {
|
||
|
this._dialogamount = dialogamount
|
||
|
}
|
||
3 years ago
|
|
||
2 years ago
|
set amount(amount) {
|
||
|
this._amount = Math.round(amount * store.getState().config.coin.decimals)
|
||
|
this._amountBytes = this.constructor.utils.int64ToBytes(this._amount)
|
||
|
}
|
||
|
|
||
|
get params() {
|
||
|
const params = super.params
|
||
|
params.push(
|
||
|
this._recipient,
|
||
|
this._amountBytes,
|
||
|
this._feeBytes
|
||
|
)
|
||
|
return params
|
||
|
}
|
||
3 years ago
|
}
|