Skip to content

Commit

Permalink
Merge pull request #1 from SimiHunjan/update-examples-1
Browse files Browse the repository at this point in the history
Update script-hcs-topic.js
  • Loading branch information
SimiHunjan authored Jul 19, 2024
2 parents 031adf7 + f128545 commit aaf2f90
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hcs-topic/script-hcs-topic.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ async function scriptHcsTopic() {
const operatorKey = PrivateKey.fromStringECDSA(operatorKeyStr);
client = Client.forTestnet().setOperator(operatorId, operatorKey);

// NOTE: Create a HCS topic
// NOTE: Create a Hedera Consensus Service topic
// Step (1) in the accompanying tutorial
blueLog('Creating new HCS topic');
const topicCreateTx = await new TopicCreateTransaction()
//Set the transaction memo with the hellow future world ID
.setTransactionMemo(hfwId)
//Set the topic memo
.setTopicMemo(`HFW-HCS topic by ${yourName}`)
// Freeze the transaction to prepare for signing
.freezeWith(client);
Expand All @@ -65,8 +67,11 @@ async function scriptHcsTopic() {
// NOTE: Publish a message to the HCS topic
// Step (2) in the accompanying tutorial
const topicMsgSubmitTx = await new TopicMessageSubmitTransaction()
//Set the transaction memo with the hello future world ID
.setTransactionMemo(hfwId)
//The ID of the topic that was created in the previous step
.setTopicId(topicId)
//Set the topic message contents
.setMessage(`Hello HCS! - ${yourName}`)
// Freeze the transaction to prepare for signing
.freezeWith(client);
Expand Down

0 comments on commit aaf2f90

Please # to comment.