Transactions — HCS‑20 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
sdk.ts(Node) orbrowser.ts(wallet) clients.
Sources
- Module folder: https://github.com/hashgraph-online/standards-sdk/tree/main/src/hcs-20
- tx.ts: https://github.com/hashgraph-online/standards-sdk/blob/main/src/hcs-20/tx.ts
- types.ts: https://github.com/hashgraph-online/standards-sdk/blob/main/src/hcs-20/types.ts
Generic Submit (advanced)
import { buildHcs20SubmitMessageTx } from '@hashgraphonline/standards-sdk';
const tx = buildHcs20SubmitMessageTx({
topicId: '0.0.123',
payload: { /* raw HCS‑20 JSON */ },
transactionMemo: 'optional',
});
Parameters
topicIdstringpayloadobject|stringtransactionMemo?string
Returns
TopicMessageSubmitTransaction
Deploy
import { buildHcs20DeployTx } from '@hashgraphonline/standards-sdk';
const tx = buildHcs20DeployTx({
topicId: '0.0.100',
name: 'Loyalty Points',
tick: 'loyal',
max: '1000000000',
lim: '10000',
metadata: 'ipfs://…',
memo: 'deploy',
});
Parameters
topicIdstringnamestringtickstring (normalized to lowercase)maxstringlim?stringmetadata?stringmemo?string
Returns
TopicMessageSubmitTransaction
Mint
import { buildHcs20MintTx } from '@hashgraphonline/standards-sdk';
const tx = buildHcs20MintTx({
topicId: '0.0.100',
tick: 'loyal',
amt: '100',
to: '0.0.12345',
memo: 'reward',
});
Parameters
topicIdstringtickstringamtstringtostringmemo?string
Returns
TopicMessageSubmitTransaction
Transfer
import { buildHcs20TransferTx } from '@hashgraphonline/standards-sdk';
const tx = buildHcs20TransferTx({
topicId: '0.0.100',
tick: 'loyal',
amt: '10',
from: '0.0.111',
to: '0.0.222',
memo: 'tip',
});
Parameters
topicIdstringtickstringamtstringfromstringtostringmemo?string
Returns
TopicMessageSubmitTransaction
Burn
import { buildHcs20BurnTx } from '@hashgraphonline/standards-sdk';
const tx = buildHcs20BurnTx({
topicId: '0.0.100',
tick: 'loyal',
amt: '5',
from: '0.0.111',
memo: 'cleanup',
});
Parameters
topicIdstringtickstringamtstringfromstringmemo?string
Returns
TopicMessageSubmitTransaction
Register (Directory)
import { buildHcs20RegisterTx } from '@hashgraphonline/standards-sdk';
const tx = buildHcs20RegisterTx({
registryTopicId: '0.0.999',
name: 'Loyalty Points',
topicId: '0.0.100',
isPrivate: false,
metadata: 'ipfs://…',
memo: 'register',
});
Parameters
registryTopicIdstringnamestringtopicIdstringisPrivatebooleanmetadata?stringmemo?string
Returns
TopicMessageSubmitTransaction
Execution
- Node:
await tx.execute(client).then(r => r.getReceipt(client)) - Browser (advanced):
await (await tx.freezeWithSigner(signer)).executeWithSigner(signer)thengetReceiptWithSigner
Source