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
- TypeScript
- Go
import { buildHcs2CreateRegistryTx } from '@hashgraphonline/standards-sdk';
const tx = buildHcs2CreateRegistryTx({ registryType: 0, ttl: 86400, adminKey: true, submitKey: true });
await (await tx.execute(client)).getReceipt(client);
import "github.com/hashgraph-online/standards-sdk-go/pkg/hcs2"
tx := hcs2.BuildHCS2CreateRegistryTx(hcs2.CreateRegistryTxParams{
RegistryType: hcs2.RegistryTypeIndexed,
TTL: 86400,
AdminKey: operatorPublicKey, // hedera.Key
SubmitKey: operatorPublicKey,
})
response, err := tx.Execute(hederaClient)
receipt, err := response.GetReceipt(hederaClient)
Memo
- Defaults to
hcs-2:<type>:<ttl>unlessmemoOverrideis provided.
Register Entry — buildHcs2RegisterTxDirect link to Register Entry — buildHcs2RegisterTx
- TypeScript
- Go
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);
tx, err := hcs2.BuildHCS2RegisterTx(hcs2.RegisterTxParams{
RegistryTopicID: "0.0.111",
TargetTopicID: "0.0.222",
Metadata: "https://example.com/metadata.json",
Memo: "register",
})
if err != nil {
log.Fatal(err)
}
response, err := tx.Execute(hederaClient)
receipt, err := response.GetReceipt(hederaClient)
Update Entry — buildHcs2UpdateTxDirect link to Update Entry — buildHcs2UpdateTx
- TypeScript
- Go
buildHcs2UpdateTx({
registryTopicId: '0.0.111',
uid: '1', // sequence number to update
targetTopicId: '0.0.333',
metadata: 'https://example.com/new.json',
memo: 'updated',
});
tx, err := hcs2.BuildHCS2UpdateTx(hcs2.UpdateTxParams{
RegistryTopicID: "0.0.111",
UID: "1",
TargetTopicID: "0.0.333",
Metadata: "https://example.com/new.json",
Memo: "updated",
})
Delete Entry — buildHcs2DeleteTxDirect link to Delete Entry — buildHcs2DeleteTx
- TypeScript
- Go
buildHcs2DeleteTx({
registryTopicId: '0.0.111',
uid: '1', // sequence number to delete
memo: 'removed',
});
tx, err := hcs2.BuildHCS2DeleteTx(hcs2.DeleteTxParams{
RegistryTopicID: "0.0.111",
UID: "1",
Memo: "removed",
})
Migrate Registry — buildHcs2MigrateTxDirect link to Migrate Registry — buildHcs2MigrateTx
- TypeScript
- Go
buildHcs2MigrateTx({
registryTopicId: '0.0.111',
targetTopicId: '0.0.999', // new registry topic id
metadata: 'migration v2',
memo: 'migrate',
});
tx, err := hcs2.BuildHCS2MigrateTx(hcs2.MigrateTxParams{
RegistryTopicID: "0.0.111",
TargetTopicID: "0.0.999",
Metadata: "migration v2",
Memo: "migrate",
})