diff --git a/filter/chainsync/option.go b/filter/chainsync/option.go index eccd09e..4d5b7bf 100644 --- a/filter/chainsync/option.go +++ b/filter/chainsync/option.go @@ -30,7 +30,7 @@ func WithPolicies(policyIds []string) ChainSyncOptionFunc { } } -//WithAssetFingerprints specifies the asset fingerprint (asset1xxx) to filter on +// WithAssetFingerprints specifies the asset fingerprint (asset1xxx) to filter on func WithAssetFingerprints(assetFingerprints []string) ChainSyncOptionFunc { return func(c *ChainSync) { c.filterAssetFingerprints = assetFingerprints[:] diff --git a/go.mod b/go.mod index 010b813..36967f1 100644 --- a/go.mod +++ b/go.mod @@ -3,18 +3,21 @@ module github.com/blinklabs-io/snek go 1.19 require ( - github.com/blinklabs-io/gouroboros v0.51.0 + github.com/blinklabs-io/gouroboros v0.52.0 github.com/gen2brain/beeep v0.0.0-20230602101333-f384c29b62dd github.com/kelseyhightower/envconfig v1.4.0 go.uber.org/zap v1.25.0 gopkg.in/yaml.v2 v2.4.0 ) +// XXX: uncomment when testing local changes to gouroboros +// replace github.com/blinklabs-io/gouroboros v0.52.0 => ../gouroboros + require ( github.com/fxamacker/cbor/v2 v2.4.0 // indirect github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect - github.com/jinzhu/copier v0.3.5 // indirect + github.com/jinzhu/copier v0.4.0 // indirect github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect github.com/x448/float16 v0.8.4 // indirect diff --git a/go.sum b/go.sum index c83530a..6602b2b 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/blinklabs-io/gouroboros v0.51.0 h1:cgl2jgTsPAKC1Jdp44vvzKxDn5fYJNooRR2HpP/ZjkI= -github.com/blinklabs-io/gouroboros v0.51.0/go.mod h1:cQt3XVVG2b+cpIJh+DhID7ivsyBQmTsXqbTDZ+7esXI= +github.com/blinklabs-io/gouroboros v0.52.0 h1:5abdw2PXHKHxve26BITukfAzz7OJoTPKWylbyth9Sxk= +github.com/blinklabs-io/gouroboros v0.52.0/go.mod h1:2wCCNNsHNYMT4gQB+bXS0Y99Oeu8+EM96hi7hW22C2w= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/fxamacker/cbor/v2 v2.4.0 h1:ri0ArlOR+5XunOP8CRUowT0pSJOwhW098ZCUyskZD88= github.com/fxamacker/cbor/v2 v2.4.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= @@ -10,8 +10,8 @@ github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 h1:qZNfIGkIANxGv/Oq github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4/go.mod h1:kW3HQ4UdaAyrUCSSDR4xUzBKW6O2iA4uHhk7AtyYp10= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= -github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= +github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= diff --git a/input/chainsync/tx.go b/input/chainsync/tx.go index b11a7a4..e37ae1e 100644 --- a/input/chainsync/tx.go +++ b/input/chainsync/tx.go @@ -15,6 +15,7 @@ package chainsync import ( + "github.com/blinklabs-io/gouroboros/cbor" "github.com/blinklabs-io/gouroboros/ledger" ) @@ -26,19 +27,23 @@ type TransactionEvent struct { TransactionCbor byteSliceJsonHex `json:"transactionCbor,omitempty"` Inputs []ledger.TransactionInput `json:"inputs"` Outputs []ledger.TransactionOutput `json:"outputs"` + Metadata *cbor.Value `json:"metadata,omitempty"` } -func NewTransactionEvent(block ledger.Block, txBody ledger.TransactionBody, includeCbor bool) TransactionEvent { +func NewTransactionEvent(block ledger.Block, tx ledger.Transaction, includeCbor bool) TransactionEvent { evt := TransactionEvent{ BlockNumber: block.BlockNumber(), BlockHash: block.Hash(), SlotNumber: block.SlotNumber(), - TransactionHash: txBody.Hash(), - Inputs: txBody.Inputs(), - Outputs: txBody.Outputs(), + TransactionHash: tx.Hash(), + Inputs: tx.Inputs(), + Outputs: tx.Outputs(), } if includeCbor { - evt.TransactionCbor = txBody.Cbor() + evt.TransactionCbor = tx.Cbor() + } + if tx.Metadata() != nil { + evt.Metadata = tx.Metadata() } return evt }