Skip to main content

HCS-18 Transactions

Note

  • These builders are for direct transaction construction (e.g., with the Standards Agent Kit or custom pipelines).
  • For most applications, prefer the higher‑level client (Node/Go) or browser client (wallet).

Sources

Create Discovery TopicDirect link to Create Discovery Topic

import { buildHcs18CreateDiscoveryTopicTx } from '@hashgraphonline/standards-sdk';

const tx = buildHcs18CreateDiscoveryTopicTx({
ttlSeconds: 300,
adminKey: true,
submitKey: true,
});

Submit Discovery MessageDirect link to Submit Discovery Message

import { buildHcs18SubmitDiscoveryMessageTx } from '@hashgraphonline/standards-sdk';

const tx = buildHcs18SubmitDiscoveryMessageTx({
topicId: '0.0.555',
message: msg, // a DiscoveryMessage from one of the builders below
transactionMemo: 'optional',
});

AnnounceDirect link to Announce

import { buildHcs18AnnounceMessage } from '@hashgraphonline/standards-sdk';

const msg = buildHcs18AnnounceMessage({
account: '0.0.123',
petal: { name: 'A', priority: 700 },
capabilities: { protocols: ['hcs-16', 'hcs-18'] },
valid_for: 300,
});

ProposeDirect link to Propose

import { buildHcs18ProposeMessage } from '@hashgraphonline/standards-sdk';

const msg = buildHcs18ProposeMessage({
proposer: '0.0.1',
members: [{ account: '0.0.2', priority: 500 }],
config: { name: 'Demo Flora', threshold: 2 },
});

RespondDirect link to Respond

import { buildHcs18RespondMessage } from '@hashgraphonline/standards-sdk';

const msg = buildHcs18RespondMessage({
responder: '0.0.2',
proposal_seq: 10,
decision: 'accept',
});

CompleteDirect link to Complete

import { buildHcs18CompleteMessage } from '@hashgraphonline/standards-sdk';

const msg = buildHcs18CompleteMessage({
proposer: '0.0.1',
proposal_seq: 10,
flora_account: '0.0.500',
topics: { communication: '0.0.600', transaction: '0.0.601', state: '0.0.602' },
});

WithdrawDirect link to Withdraw

import { buildHcs18WithdrawMessage } from '@hashgraphonline/standards-sdk';

const msg = buildHcs18WithdrawMessage({
account: '0.0.2',
announce_seq: 42,
reason: 'going offline',
});

Notes

  • Use the builders to ensure the p: 'hcs-18' and op fields are correct.
  • Builders return typed messages; pair with BuildSubmitDiscoveryMessageTx to create a signed transaction.