qortal-ui/crypto/api/transactions/names/BuyNameTransacion.js

71 lines
1.7 KiB
JavaScript
Raw Normal View History

'use strict'
2022-12-31 18:54:54 +01:00
import TransactionBase from '../TransactionBase.js'
import { QORT_DECIMALS } from '../../constants.js'
export default class BuyNameTransacion extends TransactionBase {
constructor() {
super()
this.type = 7
}
2022-12-31 18:54:54 +01:00
render(html) {
return html`
${this._buyNameDialog1}
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.nameText}</span>
</div>
${this._buyNameDialog2}
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.showSellPrice}</span>
</div>
${this._buyNameDialog3}
`
}
2022-12-31 18:54:54 +01:00
set buyNameDialog1(buyNameDialog1) {
this._buyNameDialog1 = buyNameDialog1
}
2022-12-31 18:54:54 +01:00
set buyNameDialog2(buyNameDialog2) {
this._buyNameDialog2 = buyNameDialog2
}
2022-12-31 18:54:54 +01:00
set buyNameDialog3(buyNameDialog3) {
this._buyNameDialog3 = buyNameDialog3
}
2022-12-31 18:54:54 +01:00
set fee(fee) {
this._fee = fee * QORT_DECIMALS
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
}
2022-12-31 18:54:54 +01:00
set name(name) {
this.nameText = name
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name)
this._nameLength = this.constructor.utils.int32ToBytes(this._nameBytes.length)
}
2022-12-31 18:54:54 +01:00
set sellPrice(sellPrice) {
this.showSellPrice = sellPrice
this._sellPrice = sellPrice * QORT_DECIMALS
this._sellPriceBytes = this.constructor.utils.int64ToBytes(this._sellPrice)
}
2022-12-31 18:54:54 +01:00
set recipient(recipient) {
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
this.theRecipient = recipient
}
2022-12-31 18:54:54 +01:00
get params() {
const params = super.params
params.push(
this._nameLength,
this._nameBytes,
this._sellPriceBytes,
this._recipient,
this._feeBytes
)
return params
}
}