Skip to main content

Transactions — HCS‑2 Builders

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 Registry — buildHcs2CreateRegistryTxDirect link to Create Registry — buildHcs2CreateRegistryTx

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

const tx = buildHcs2CreateRegistryTx({ registryType: 0, ttl: 86400, adminKey: true, submitKey: true });
await (await tx.execute(client)).getReceipt(client);

Memo

  • Defaults to hcs-2:<type>:<ttl> unless memoOverride is provided.

Register Entry — buildHcs2RegisterTxDirect link to Register Entry — buildHcs2RegisterTx

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

const tx = buildHcs2RegisterTx({
registryTopicId: '0.0.111',
targetTopicId: '0.0.222',
metadata: 'https://example.com/metadata.json',
memo: 'register',
});
await (await tx.execute(client)).getReceipt(client);

Update Entry — buildHcs2UpdateTxDirect link to Update Entry — buildHcs2UpdateTx

buildHcs2UpdateTx({
registryTopicId: '0.0.111',
uid: '1', // sequence number to update
targetTopicId: '0.0.333',
metadata: 'https://example.com/new.json',
memo: 'updated',
});

Delete Entry — buildHcs2DeleteTxDirect link to Delete Entry — buildHcs2DeleteTx

buildHcs2DeleteTx({
registryTopicId: '0.0.111',
uid: '1', // sequence number to delete
memo: 'removed',
});

Migrate Registry — buildHcs2MigrateTxDirect link to Migrate Registry — buildHcs2MigrateTx

buildHcs2MigrateTx({
registryTopicId: '0.0.111',
targetTopicId: '0.0.999', // new registry topic id
metadata: 'migration v2',
memo: 'migrate',
});