diff --git a/plugins/webapi/getTransactionObjectsByHash/plugin.go b/plugins/webapi/getTransactionObjectsByHash/plugin.go index 7a7d6265248274e28c9b06fe0a768db5dd127b37..042ec46945f743b8d97e6b59e59a27e8f4ef8841 100644 --- a/plugins/webapi/getTransactionObjectsByHash/plugin.go +++ b/plugins/webapi/getTransactionObjectsByHash/plugin.go @@ -1,14 +1,14 @@ package getTransactionObjectsByHash import ( - "fmt" "net/http" - "github.com/iotaledger/goshimmer/plugins/webapi" "github.com/iotaledger/hive.go/logger" "github.com/iotaledger/hive.go/node" "github.com/iotaledger/iota.go/trinary" "github.com/labstack/echo" + + "github.com/iotaledger/goshimmer/plugins/webapi" ) var PLUGIN = node.NewPlugin("WebAPI getTransactionObjectsByHash Endpoint", node.Enabled, configure) @@ -34,30 +34,31 @@ func getTransactionObjectsByHash(c echo.Context) error { } log.Debug("Received:", request.Hashes) - - for _, hash := range request.Hashes { - tx, err := tangle_old.GetTransaction(hash) - if err != nil { - return c.JSON(http.StatusInternalServerError, Response{Error: err.Error()}) + /* + for _, hash := range request.Hashes { + tx, err := tangle_old.GetTransaction(hash) + if err != nil { + return c.JSON(http.StatusInternalServerError, Response{Error: err.Error()}) + } + if tx == nil { + return c.JSON(http.StatusNotFound, Response{Error: fmt.Sprintf("transaction not found: %s", hash)}) + } + t := Transaction{ + Hash: tx.GetHash(), + WeightMagnitude: tx.GetWeightMagnitude(), + TrunkTransactionHash: tx.GetTrunkTransactionHash(), + BranchTransactionHash: tx.GetBranchTransactionHash(), + Head: tx.IsHead(), + Tail: tx.IsTail(), + Nonce: tx.GetNonce(), + Address: tx.GetAddress(), + Value: tx.GetValue(), + Timestamp: tx.GetTimestamp(), + SignatureMessageFragment: tx.GetSignatureMessageFragment(), + } + result = append(result, t) } - if tx == nil { - return c.JSON(http.StatusNotFound, Response{Error: fmt.Sprintf("transaction not found: %s", hash)}) - } - t := Transaction{ - Hash: tx.GetHash(), - WeightMagnitude: tx.GetWeightMagnitude(), - TrunkTransactionHash: tx.GetTrunkTransactionHash(), - BranchTransactionHash: tx.GetBranchTransactionHash(), - Head: tx.IsHead(), - Tail: tx.IsTail(), - Nonce: tx.GetNonce(), - Address: tx.GetAddress(), - Value: tx.GetValue(), - Timestamp: tx.GetTimestamp(), - SignatureMessageFragment: tx.GetSignatureMessageFragment(), - } - result = append(result, t) - } + */ return c.JSON(http.StatusOK, Response{Transactions: result}) } diff --git a/plugins/webapi/getTransactionTrytesByHash/plugin.go b/plugins/webapi/getTransactionTrytesByHash/plugin.go index 4775dcd45aaa03714d2925bee3ffbe24081a6ad0..bfa94613c2f2b01d5384d442df50968ae8b8e250 100644 --- a/plugins/webapi/getTransactionTrytesByHash/plugin.go +++ b/plugins/webapi/getTransactionTrytesByHash/plugin.go @@ -1,14 +1,14 @@ package getTransactionTrytesByHash import ( - "fmt" "net/http" - "github.com/iotaledger/goshimmer/plugins/webapi" "github.com/iotaledger/hive.go/logger" "github.com/iotaledger/hive.go/node" "github.com/iotaledger/iota.go/trinary" "github.com/labstack/echo" + + "github.com/iotaledger/goshimmer/plugins/webapi" ) var PLUGIN = node.NewPlugin("WebAPI getTransactionTrytesByHash Endpoint", node.Enabled, configure) @@ -33,17 +33,19 @@ func getTransactionTrytesByHash(c echo.Context) error { } log.Debug("Received:", request.Hashes) - for _, hash := range request.Hashes { - tx, err := tangle_old.GetTransaction(hash) - if err != nil { - return c.JSON(http.StatusInternalServerError, Response{Error: err.Error()}) + /* + for _, hash := range request.Hashes { + tx, err := tangle_old.GetTransaction(hash) + if err != nil { + return c.JSON(http.StatusInternalServerError, Response{Error: err.Error()}) + } + if tx == nil { + return c.JSON(http.StatusNotFound, Response{Error: fmt.Sprintf("transaction not found: %s", hash)}) + } + trytes := trinary.MustTritsToTrytes(tx.GetTrits()) + result = append(result, trytes) } - if tx == nil { - return c.JSON(http.StatusNotFound, Response{Error: fmt.Sprintf("transaction not found: %s", hash)}) - } - trytes := trinary.MustTritsToTrytes(tx.GetTrits()) - result = append(result, trytes) - } + */ return c.JSON(http.StatusOK, Response{Trytes: result}) }