From 9724b571d32c6c2e5b35a4c416d24cd97291bef2 Mon Sep 17 00:00:00 2001 From: Aurora Gaffney Date: Fri, 17 May 2024 13:44:48 -0500 Subject: [PATCH] chore: update blinklabs-io/gouroboros to v0.85.0 (#212) --- go.mod | 2 +- go.sum | 4 ++-- input/chainsync/tx.go | 2 +- output/push/push.go | 6 +++++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 50e63c4..9f2972e 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 toolchain go1.21.6 require ( - github.com/blinklabs-io/gouroboros v0.84.0 + github.com/blinklabs-io/gouroboros v0.85.0 github.com/gen2brain/beeep v0.0.0-20230602101333-f384c29b62dd github.com/gin-gonic/gin v1.10.0 github.com/kelseyhightower/envconfig v1.4.0 diff --git a/go.sum b/go.sum index ad25664..643a36b 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= -github.com/blinklabs-io/gouroboros v0.84.0 h1:uVKfYA4VBnrTle2mr85TpJNS1WkZTz31OOF0K4bJ1MU= -github.com/blinklabs-io/gouroboros v0.84.0/go.mod h1:EZe1WcIWfZNESlwHPGLStB6HluXGTkf/ZFUbBi5bCvs= +github.com/blinklabs-io/gouroboros v0.85.0 h1:KLB7prQpDq3IRIS7Oxl8cz8nABSjU8UoOp0TvBhSyAc= +github.com/blinklabs-io/gouroboros v0.85.0/go.mod h1:EZe1WcIWfZNESlwHPGLStB6HluXGTkf/ZFUbBi5bCvs= github.com/blinklabs-io/ouroboros-mock v0.3.0 h1:6VRWyhAv0k7nQEgzFpuqhS/n8OM+OAaLN/sCT5K2Hbc= github.com/blinklabs-io/ouroboros-mock v0.3.0/go.mod h1:0dzTNEk/Kvqa7qYHDy7/Nn3OTt+EOosMknB37FRzI1k= github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= diff --git a/input/chainsync/tx.go b/input/chainsync/tx.go index b1392d5..d5007b6 100644 --- a/input/chainsync/tx.go +++ b/input/chainsync/tx.go @@ -34,7 +34,7 @@ type TransactionEvent struct { Inputs []ledger.TransactionInput `json:"inputs"` Outputs []ledger.TransactionOutput `json:"outputs"` Certificates []ledger.Certificate `json:"certificates"` - Metadata *cbor.Value `json:"metadata,omitempty"` + Metadata *cbor.LazyValue `json:"metadata,omitempty"` Fee uint64 `json:"fee"` TTL uint64 `json:"ttl,omitempty"` } diff --git a/output/push/push.go b/output/push/push.go index 0c4cde8..535ce9a 100644 --- a/output/push/push.go +++ b/output/push/push.go @@ -298,11 +298,15 @@ func (p *PushOutput) OutputChan() <-chan event.Event { // This should probably go in gouroboros module // extractCIP20FromMetadata extracts the CIP20 message from the transaction metadata // and returns it as a JSON string. -func extractCIP20FromMetadata(metadata *cbor.Value) (string, error) { +func extractCIP20FromMetadata(metadata *cbor.LazyValue) (string, error) { if metadata == nil { return "", fmt.Errorf("metadata is nil") } + if _, err := metadata.Decode(); err != nil { + return "", fmt.Errorf("could not decode metadata: %w", err) + } + metadataMap, ok := metadata.Value().(map[any]any) if !ok { return "", fmt.Errorf("metadata value is not of the expected map type")