Transactions — HCS‑16 Builders
HCS‑16 centralizes all transaction construction in builders to keep payloads canonical across Node, browser, and Go.
Sources
Create Flora TopicDirect link to Create Flora Topic
- TypeScript
- Go
import { buildHcs16CreateFloraTopicTx } from '@hashgraphonline/standards-sdk';
const tx = buildHcs16CreateFloraTopicTx({
floraAccountId: '0.0.500',
topicType: 0, // 0=communication, 1=transaction, 2=state
adminKey: true,
submitKey: true,
});
import "github.com/hashgraph-online/standards-sdk-go/pkg/hcs16"
tx, err := hcs16.BuildCreateFloraTopicTx(hcs16.CreateFloraTopicOptions{
FloraAccountID: "0.0.500",
TopicType: hcs16.FloraTopicTypeCommunication, // 0
AdminKey: operatorPublicKey,
SubmitKey: operatorPublicKey,
})
Create Flora AccountDirect link to Create Flora Account
- TypeScript
- Go
import { buildHcs16CreateAccountTx } from '@hashgraphonline/standards-sdk';
const tx = buildHcs16CreateAccountTx({
keyList,
initialBalanceHbar: 5,
maxAutomaticTokenAssociations: -1,
});
keyList := hedera.KeyListWithThreshold(2).Add(key1.PublicKey()).Add(key2.PublicKey())
tx, err := hcs16.BuildCreateFloraAccountTx(keyList, 5.0, -1, "flora account")
Generic Flora MessageDirect link to Generic Flora Message
- TypeScript
- Go
import { FloraOperation, buildHcs16MessageTx } from '@hashgraphonline/standards-sdk';
const tx = buildHcs16MessageTx({
topicId: '0.0.600',
operatorId: '0.0.123',
op: FloraOperation.TRANSACTION,
body: { schedule_id: '0.0.12345' },
});
tx, err := hcs16.BuildMessageTx(
"0.0.600",
"0.0.123",
hcs16.FloraOperationTransaction,
map[string]any{"schedule_id": "0.0.12345"},
"",
)
Flora CreatedDirect link to Flora Created
- TypeScript
- Go
buildHcs16FloraCreatedTx({ topicId, operatorId, floraAccountId, topics });
tx, err := hcs16.BuildFloraCreatedTx("0.0.600", "0.0.123", "0.0.500", hcs16.FloraTopics{
Communication: "0.0.601",
Transaction: "0.0.602",
State: "0.0.603",
})
State UpdateDirect link to State Update
- TypeScript
- Go
buildHcs16StateUpdateTx({ topicId, operatorId, hash, epoch, accountId, topics, memo });
epoch := int64(1)
tx, err := hcs16.BuildStateUpdateTx(
"0.0.603", // state topic
"0.0.123", // operator
"hash123", // state hash
&epoch, // epoch (optional)
"0.0.500", // account ID
[]string{"0.0.601"}, // topics
"state memo", // memo
"", // tx memo
)
Join Request / Vote / AcceptedDirect link to Join Request / Vote / Accepted
- TypeScript
- Go
buildHcs16FloraJoinRequestTx({ topicId, operatorId, accountId, connectionRequestId, connectionTopicId, connectionSeq });
buildHcs16FloraJoinVoteTx({ topicId, operatorId, accountId, approve, connectionRequestId, connectionSeq });
buildHcs16FloraJoinAcceptedTx({ topicId, operatorId, members, epoch });
// Join Request
tx, _ := hcs16.BuildFloraJoinRequestTx("0.0.601", "0.0.123", "0.0.456", 1, "0.0.700", 1)
// Join Vote
tx, _ := hcs16.BuildFloraJoinVoteTx("0.0.601", "0.0.123", "0.0.456", true, 1, 1)
// Join Accepted
epoch := int64(2)
tx, _ := hcs16.BuildFloraJoinAcceptedTx("0.0.601", "0.0.123", []string{"0.0.456"}, &epoch)