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.
47 lines
1.0 KiB
47 lines
1.0 KiB
2 years ago
|
'use strict'
|
||
|
import PaymentTransaction from './PaymentTransaction.js'
|
||
3 years ago
|
|
||
2 years ago
|
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
|
||
|
}
|
||
3 years ago
|
|
||
2 years ago
|
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
|
||
|
}
|
||
3 years ago
|
|
||
2 years ago
|
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
|
||
|
]
|
||
|
}
|
||
|
}
|