Skip to main content

Transactions — HCS‑16 Builders

HCS‑16 centralizes all transaction construction in tx.ts to keep payloads canonical across Node and browser.

Execution

  • Node: await (await tx.execute(client)).getReceipt(client)
  • Browser: await (await tx.freezeWithSigner(signer)).executeWithSigner(signer) then getReceiptWithSigner

Create Flora Topic — buildHcs16CreateFloraTopicTx

Signature

buildHcs16CreateFloraTopicTx(params: {
floraAccountId: string;
topicType: FloraTopicType; // 0=communication,1=transaction,2=state
adminKey?: MaybeKey;
submitKey?: MaybeKey;
operatorPublicKey?: PublicKey;
autoRenewAccountId?: string;
}): TopicCreateTransaction

Example

import { buildHcs16CreateFloraTopicTx } from '@hashgraphonline/standards-sdk';
const tx = buildHcs16CreateFloraTopicTx({ floraAccountId: '0.0.500', topicType: 0, adminKey: true, submitKey: true });

Create Transaction Topic (HIP‑991) — buildHcs16CreateTransactionTopicTx

Signature

buildHcs16CreateTransactionTopicTx(params: {
memo: string;
adminKey?: KeyList | PublicKey;
submitKey?: KeyList | PublicKey;
feeScheduleKey?: KeyList | PublicKey;
customFees?: Array<{ amount: number; feeCollectorAccountId: string; denominatingTokenId?: string }>;
feeExemptKeys?: PublicKey[];
}): TopicCreateTransaction

Example

const tx = buildHcs16CreateTransactionTopicTx({ memo: 'hcs-16:tx', adminKey, submitKey, customFees: [{ amount: 1, feeCollectorAccountId: '0.0.500' }] });

Create Flora Account — buildHcs16CreateAccountTx

Signature

buildHcs16CreateAccountTx(params: {
keyList: KeyList;
initialBalanceHbar?: number;
maxAutomaticTokenAssociations?: number;
}): AccountCreateTransaction

Example

const tx = buildHcs16CreateAccountTx({ keyList, initialBalanceHbar: 5, maxAutomaticTokenAssociations: -1 });

Generic Message — buildHcs16MessageTx

Signature

buildHcs16MessageTx(params: {
topicId: string;
operatorId: string;
op: FloraOperation | string;
body?: Record<string, unknown>;
analyticsMemo?: string;
}): TopicMessageSubmitTransaction

Example

const tx = buildHcs16MessageTx({ topicId: '0.0.600', operatorId: '0.0.123', op: 'custom', body: { hello: 'world' } });

Flora Created — buildHcs16FloraCreatedTx

buildHcs16FloraCreatedTx({ topicId, operatorId, floraAccountId, analyticsMemo? }): TopicMessageSubmitTransaction

Tx Proposal — buildHcs16TxProposalTx

buildHcs16TxProposalTx({ topicId, operatorId, scheduledTxId, memo?, analyticsMemo? }): TopicMessageSubmitTransaction

State Update — buildHcs16StateUpdateTx

buildHcs16StateUpdateTx({ topicId, operatorId, stateHash, epoch?, memo?, analyticsMemo? }): TopicMessageSubmitTransaction

Flora Create Request — buildHcs16FloraCreateRequestTx

buildHcs16FloraCreateRequestTx({ topicId, operatorId, members, threshold, purpose?, analyticsMemo? }): TopicMessageSubmitTransaction

Flora Create Accepted — buildHcs16FloraCreateAcceptedTx

buildHcs16FloraCreateAcceptedTx({ topicId, operatorId, analyticsMemo? }): TopicMessageSubmitTransaction

Join Request — buildHcs16FloraJoinRequestTx

buildHcs16FloraJoinRequestTx({ topicId, operatorId, candidateAccountId, analyticsMemo? }): TopicMessageSubmitTransaction

Join Vote — buildHcs16FloraJoinVoteTx

buildHcs16FloraJoinVoteTx({ topicId, operatorId, candidateAccountId, approve, analyticsMemo? }): TopicMessageSubmitTransaction

Join Accepted — buildHcs16FloraJoinAcceptedTx

buildHcs16FloraJoinAcceptedTx({ topicId, operatorId, members, epoch?, analyticsMemo? }): TopicMessageSubmitTransaction

Source