Skip to content

Commit b2993fe

Browse files
committed
Documenting functions and properties
1 parent 8df972a commit b2993fe

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

api/handlers/transactionHandler.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828

2929
var TendermintClient abcicli.Client
3030

31+
// ConstructBfTx function to create a BFTX via API
3132
func ConstructBfTx(transaction bf_tx.BF_TX) (interface{}, error) {
3233

3334
resInfo, err := TendermintClient.InfoSync(abciTypes.RequestInfo{})
@@ -66,6 +67,7 @@ func ConstructBfTx(transaction bf_tx.BF_TX) (interface{}, error) {
6667
return transaction, nil
6768
}
6869

70+
// SignBfTx function to sign a BFTX via API
6971
func SignBfTx(idBftx string) (interface{}, error) {
7072
transaction, err := leveldb.GetBfTx(idBftx)
7173

@@ -107,6 +109,7 @@ func SignBfTx(idBftx string) (interface{}, error) {
107109
return transaction, nil
108110
}
109111

112+
// EncryptBfTx function to encrypt a BFTX via API
110113
func EncryptBfTx(idBftx string) (interface{}, error) {
111114
transaction, err := leveldb.GetBfTx(idBftx)
112115

@@ -148,6 +151,7 @@ func EncryptBfTx(idBftx string) (interface{}, error) {
148151
return bftxold, nil
149152
}
150153

154+
// DecryptBfTx function to decrypt a BFTX via API
151155
func DecryptBfTx(idBftx string) (interface{}, error) {
152156
transaction, err := leveldb.GetBfTx(idBftx)
153157

@@ -189,6 +193,7 @@ func DecryptBfTx(idBftx string) (interface{}, error) {
189193
return bftxold, nil
190194
}
191195

196+
// BroadcastBfTx function to broadcast a BFTX via API
192197
func BroadcastBfTx(idBftx string) (interface{}, error) {
193198
rpcClient := rpc.NewHTTP(os.Getenv("LOCAL_RPC_CLIENT_ADDRESS"), "/websocket")
194199
err := rpcClient.Start()
@@ -241,6 +246,7 @@ func BroadcastBfTx(idBftx string) (interface{}, error) {
241246
return transaction, nil
242247
}
243248

249+
// GetInfo function to get info about the network via API
244250
func GetInfo() (interface{}, error) {
245251
rpcClient := rpc.NewHTTP(os.Getenv("LOCAL_RPC_CLIENT_ADDRESS"), "/websocket")
246252
err := rpcClient.Start()
@@ -262,6 +268,7 @@ func GetInfo() (interface{}, error) {
262268
return abciInfo.Response, nil
263269
}
264270

271+
// GetTotal function to get the total amount of transactions via API
265272
func GetTotal() (interface{}, error) {
266273
// Query the total of BF_TX in DB
267274
total, err := leveldb.Total()
@@ -272,6 +279,7 @@ func GetTotal() (interface{}, error) {
272279
return total, nil
273280
}
274281

282+
// GetTransaction function to get a transaction, from the local database, by id via API
275283
func GetTransaction(idBftx string) (interface{}, error) {
276284
transaction, err := leveldb.GetBfTx(idBftx)
277285
if err != nil {
@@ -286,6 +294,7 @@ func GetTransaction(idBftx string) (interface{}, error) {
286294
return transaction, nil
287295
}
288296

297+
// QueryTransaction function to query a transaction, from the network, by id via API
289298
func QueryTransaction(idBftx string) (interface{}, error) {
290299
rpcClient := rpc.NewHTTP(os.Getenv("LOCAL_RPC_CLIENT_ADDRESS"), "/websocket")
291300
err := rpcClient.Start()

0 commit comments

Comments
 (0)