1
0
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-08-09 04:01:31 +00:00
Files
build
config
img
lib
locales
qortal-ui-core
qortal-ui-crypto
api
bitcoin
deps
transactions
arbitrary
chat
groups
names
reward-share
trade-portal
AirdropTransaction.js
DelegationTransaction.js
MessageTransaction.js
PaymentTransaction.js
PublicizeTransaction.js
TransactionBase.js
TransferPrivsTransaction.js
arbitraryV3.js
processTransaction.js
registerName_dnsthing.js
transactions.js
utils
wallet
PhraseWallet.js
api.js
constants.js
createTransaction.js
createWallet.js
decryptStoredWallet.js
fetch-request.js
kdf.js
registerUsername.js
storeWallet.js
tradeRequest.js
api.js
api_deps.js
config.js
package.json
qortal-ui-plugins
scripts
snap
.editorconfig
.eslintrc.json
.gitattributes
.gitignore
.travis.yml
CONTRIBUTING.md
LICENSE
README.md
build-setup.js
build.bat
build.js
build.sh
electron-builder.yml
electron.js
install-dependencies.sh
package.json
push-updates-with-travis-build.sh
run_server.bat
server.js
set-up-snap.sh
update-package-json.js
watch-inline.js
watch.js
qortal-ui/qortal-ui-crypto/api/transactions/MessageTransaction.js
2023-01-13 09:52:14 +01:00

48 lines
1.1 KiB
JavaScript

'use strict'
import PaymentTransaction from './PaymentTransaction.js'
import { QORT_DECIMALS } from '../constants.js'
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
}
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
}
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
]
}
}