4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-12 02:05:51 +00:00
qortal-ui/crypto/api/transactions/MessageTransaction.js

47 lines
1.0 KiB
JavaScript
Raw Normal View History

'use strict'
import PaymentTransaction from './PaymentTransaction.js'
2021-12-25 14:39:47 +01:00
export default class MessageTransaction extends PaymentTransaction {
constructor() {
super()
this.type = 17
this._key = this.constructor.utils.int64ToBytes(0);
this._isEncrypted = new Uint8Array(1); // Defaults to false
this._isText = new Uint8Array(1); // Defaults to false
}
2021-12-25 14:39:47 +01:00
set message(message /* UTF8 String */) {
// ...yes? no?
this.messageText = message
// Not sure about encoding here...
this._message = this.constructor.utils.stringtoUTF8Array(message)
this._messageLength = this.constructor.utils.int64ToBytes(this._message.length)
}
set isEncrypted(isEncrypted) {
this._isEncrypted[0] = isEncrypted
}
2021-12-25 14:39:47 +01:00
set isText(isText) {
this._isText[0] = isText
}
get _params() {
return [
this._typeBytes,
this._timestampBytes,
this._lastReference,
this._keyPair.publicKey,
this._recipient,
this._key,
this._amountBytes,
this._messageLength,
this._message,
this._isEncrypted,
this._isText,
this._feeBytes
]
}
}