Skip to content

Commit

Permalink
chore(deps): update gouroboros to 0.55.0
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
  • Loading branch information
wolf31o2 committed Oct 12, 2023
1 parent c8fe25d commit 714b8ef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 32 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
32 changes: 3 additions & 29 deletions internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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")
}

0 comments on commit 714b8ef

Please sign in to comment.