1
0
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-08-13 14:11:31 +00:00
Files
build
config
core
crypto
api
bitcoin
deps
transactions
arbitrary
chat
ChatBase.js
ChatTransaction.js
GroupChatTransaction.js
decryptChatMessage.js
signChat.js
groups
names
polls
reward-share
trade-portal
AirdropTransaction.js
DelegationTransaction.js
DeployAtTransaction.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
img
lib
locales
plugins
scripts
snap
splash
.editorconfig
.gitattributes
.gitignore
CONTRIBUTING.md
LICENSE
README.md
build-setup.js
build.bat
build.js
build.sh
electron-builder.yml
electron.js
package-lock.json
package.json
run_server.bat
server.js
set-up-snap.sh
watch-inline.js
watch.js
qortal-ui/crypto/api/transactions/chat/GroupChatTransaction.js
2024-05-10 18:00:47 +02:00

69 lines
1.7 KiB
JavaScript

import ChatBase from './ChatBase'
import { CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP } from '../../constants'
export default class GroupChatTransaction extends ChatBase {
constructor() {
super();
this.type = 18
this.fee = 0
}
set proofOfWorkNonce(proofOfWorkNonce) {
this._proofOfWorkNonce = this.constructor.utils.int32ToBytes(proofOfWorkNonce)
}
set hasReceipient(hasReceipient) {
this._hasReceipient = new Uint8Array(1)
this._hasReceipient[0] = hasReceipient
}
set message(message) {
this.messageText = message
this._message = this.constructor.utils.stringtoUTF8Array(message)
this._messageLength = this.constructor.utils.int32ToBytes(this._message.length)
}
set hasChatReference(hasChatReference) {
this._hasChatReference = new Uint8Array(1)
this._hasChatReference[0] = hasChatReference
}
set chatReference(chatReference) {
this._chatReference = chatReference instanceof Uint8Array ? chatReference : this.constructor.Base58.decode(chatReference)
}
set isEncrypted(isEncrypted) {
this._isEncrypted = new Uint8Array(1)
this._isEncrypted[0] = isEncrypted
}
set isText(isText) {
this._isText = new Uint8Array(1)
this._isText[0] = isText
}
get params() {
const params = super.params
params.push(
this._proofOfWorkNonce,
this._hasReceipient,
this._messageLength,
this._message,
this._isEncrypted,
this._isText,
this._feeBytes
)
// After the feature trigger timestamp we need to include chat reference
if (new Date(this._timestamp).getTime() >= CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP) {
params.push(this._hasChatReference)
if (this._hasChatReference[0] == 1) {
params.push(this._chatReference)
}
}
return params
}
}