15
15
package chainsync
16
16
17
17
import (
18
+ "github.com/blinklabs-io/gouroboros/cbor"
18
19
"github.com/blinklabs-io/gouroboros/ledger"
19
20
)
20
21
@@ -26,19 +27,27 @@ type TransactionEvent struct {
26
27
TransactionCbor byteSliceJsonHex `json:"transactionCbor,omitempty"`
27
28
Inputs []ledger.TransactionInput `json:"inputs"`
28
29
Outputs []ledger.TransactionOutput `json:"outputs"`
30
+ Metadata * cbor.Value `json:"metadata,omitempty"`
31
+ MetadataCbor byteSliceJsonHex `json:"metadataCbor,omitempty"`
29
32
}
30
33
31
- func NewTransactionEvent (block ledger.Block , txBody ledger.TransactionBody , includeCbor bool ) TransactionEvent {
34
+ func NewTransactionEvent (block ledger.Block , tx ledger.Transaction , includeCbor bool ) TransactionEvent {
32
35
evt := TransactionEvent {
33
36
BlockNumber : block .BlockNumber (),
34
37
BlockHash : block .Hash (),
35
38
SlotNumber : block .SlotNumber (),
36
- TransactionHash : txBody .Hash (),
37
- Inputs : txBody .Inputs (),
38
- Outputs : txBody .Outputs (),
39
+ TransactionHash : tx .Hash (),
40
+ Inputs : tx .Inputs (),
41
+ Outputs : tx .Outputs (),
39
42
}
40
43
if includeCbor {
41
- evt .TransactionCbor = txBody .Cbor ()
44
+ evt .TransactionCbor = tx .Cbor ()
45
+ }
46
+ if tx .Metadata () != nil {
47
+ evt .Metadata = tx .Metadata ()
48
+ if includeCbor {
49
+ evt .MetadataCbor = tx .Metadata ().Cbor ()
50
+ }
42
51
}
43
52
return evt
44
53
}
0 commit comments