'use strict' import TransactionBase from './TransactionBase.js' import Base58 from '../deps/Base58.js' import {store} from '../../api.js' export default class PaymentTransaction extends TransactionBase { constructor() { super() this.type = 2 } render(html) { const conf = store.getState().config return html` ${this.recipientName ? html` ` : ''}
${this._dialogto}:
${this.dialogAddress} ${' '}- ${Base58.encode(this._recipient)}
${this.dialogName} ${' '}- ${this.recipientName}
${this._dialogamount} ${this._amount / conf.coin.decimals} ${conf.coin.symbol}
` } set recipient(recipient) { this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient) } set dialogto(dialogto) { this._dialogto = dialogto } set dialogamount(dialogamount) { this._dialogamount = dialogamount } 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 } }