From 714b8ef3b35690be759085d35ab9c72e6267e4cb Mon Sep 17 00:00:00 2001 From: Chris Gianelloni Date: Thu, 12 Oct 2023 17:19:06 -0400 Subject: [PATCH] chore(deps): update gouroboros to 0.55.0 Signed-off-by: Chris Gianelloni --- go.mod | 2 +- go.sum | 4 ++-- internal/api/api.go | 32 +++----------------------------- 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/go.mod b/go.mod index fa34df0..820a3e7 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/blinklabs-io/tx-submit-api go 1.20 require ( - github.com/blinklabs-io/gouroboros v0.54.0 + github.com/blinklabs-io/gouroboros v0.55.0 github.com/fxamacker/cbor/v2 v2.5.0 github.com/gin-contrib/zap v0.2.0 github.com/gin-gonic/gin v1.9.1 diff --git a/go.sum b/go.sum index 3228912..306e617 100644 --- a/go.sum +++ b/go.sum @@ -46,8 +46,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bits-and-blooms/bitset v1.2.0 h1:Kn4yilvwNtMACtf1eYDlG8H77R07mZSPbMjLyS07ChA= github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= -github.com/blinklabs-io/gouroboros v0.54.0 h1:ZRp+L7Xb2wRn3N02a7EQ8jpBfqL6FKjnpauJdCiHEqE= -github.com/blinklabs-io/gouroboros v0.54.0/go.mod h1:ID2Lq1XtYrBvmk/y+yQiX45sZiV8n+urOmT0s46d2+U= +github.com/blinklabs-io/gouroboros v0.55.0 h1:Sdjy8WwaeiVdnBys+xxYkUEWgNMN0QztlgOkFVzdNQU= +github.com/blinklabs-io/gouroboros v0.55.0/go.mod h1:D5YJka8EyVmiXNMbRvjH23H9lNMLA4+qSlNNC/j7R0k= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM= github.com/bytedance/sonic v1.10.0 h1:qtNZduETEIWJVIyDl01BeNxur2rW9OwTQ/yBqFRkKEk= diff --git a/internal/api/api.go b/internal/api/api.go index 786d092..5df68f9 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -47,8 +47,8 @@ import ( // @contact.url https://blinklabs.io // @contact.email support@blinklabs.io -// @license.name Apache 2.0 -// @license.url http://www.apache.org/licenses/LICENSE-2.0.html +// @license.name Apache 2.0 +// @license.url http://www.apache.org/licenses/LICENSE-2.0.html func Start(cfg *config.Config) error { // Disable gin debug and color output gin.SetMode(gin.ReleaseMode) @@ -321,7 +321,7 @@ func handleSubmitTx(c *gin.Context) { oConn.Close() }() // Determine transaction type (era) - txType, err := determineTransactionType(txRawBytes) + txType, err := ledger.DetermineTransactionType(txRawBytes) if err != nil { c.JSON(400, "could not parse transaction to determine type") return @@ -343,29 +343,3 @@ func handleSubmitTx(c *gin.Context) { // Increment custom metric _ = ginmetrics.GetMonitor().GetMetric("tx_submit_count").Inc(nil) } - -func determineTransactionType(data []byte) (uint16, error) { - // TODO: uncomment this once the following issue is resolved: - // https://github.com/blinklabs-io/gouroboros/issues/206 - /* - if _, err := ledger.NewByronTransactionFromCbor(data); err == nil { - return ledger.TX_TYPE_BYRON, nil - } - */ - if _, err := ledger.NewShelleyTransactionFromCbor(data); err == nil { - return ledger.TX_TYPE_SHELLEY, nil - } - if _, err := ledger.NewAllegraTransactionFromCbor(data); err == nil { - return ledger.TX_TYPE_ALLEGRA, nil - } - if _, err := ledger.NewMaryTransactionFromCbor(data); err == nil { - return ledger.TX_TYPE_MARY, nil - } - if _, err := ledger.NewAlonzoTransactionFromCbor(data); err == nil { - return ledger.TX_TYPE_ALONZO, nil - } - if _, err := ledger.NewBabbageTransactionFromCbor(data); err == nil { - return ledger.TX_TYPE_BABBAGE, nil - } - return 0, fmt.Errorf("unknown transaction type") -}