hcs_handlers

package
v0.0.0-...-50bc6a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateTopicID = func(client *hedera.Client) func(c *gin.Context) {
	return func(c *gin.Context) {
		topic, err := hcs.CreateTopicID(c, client)
		if err != nil {
			c.JSON(http.StatusBadRequest, gin.H{"error": "failed to create topic-id"})
			return
		}
		c.JSON(http.StatusOK, gin.H{
			"topicID": topic,
		})
	}
}
View Source
var SubmitMessage = func(client *hedera.Client) func(c *gin.Context) {
	return func(c *gin.Context) {
		topicid := c.Param("topicid")
		htx := &hcs.HCSTx{}
		err := c.ShouldBindJSON(&htx)
		if err != nil {
			c.JSON(http.StatusBadRequest, gin.H{"error": "cannot bind the request"})
			return
		}

		tx, err := hcs.HCSSubmitMessage(c, client, topicid, htx.Message)
		if err != nil {
			c.JSON(http.StatusBadRequest, gin.H{"error": "hedera consenses service failed to submit message"})
			return
		}
		c.JSON(http.StatusOK, tx)
	}
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL