@@ -100,15 +100,42 @@ func (h *ByronMainBlockHeader) Era() Era {
100100 return eras [ERA_ID_BYRON ]
101101}
102102
103- // TODO: flesh this out
104- type ByronTransactionBody interface {}
103+ type ByronTransaction struct {
104+ cbor.DecodeStoreCbor
105+ // TODO: flesh these out
106+ TxInputs []any
107+ TxOutputs []any
108+ Attributes cbor.Value
109+ }
105110
106- // TODO: flesh this out
107- type ByronTransaction interface {}
111+ func (t * ByronTransaction ) Hash () string {
112+ // TODO
113+ return ""
114+ }
115+
116+ func (t * ByronTransaction ) Inputs () []TransactionInput {
117+ // TODO
118+ return nil
119+ }
120+
121+ func (t * ByronTransaction ) Outputs () []TransactionOutput {
122+ // TODO
123+ return nil
124+ }
125+
126+ func (t * ByronTransaction ) Metadata () cbor.Value {
127+ return t .Attributes
128+ }
108129
109130type ByronMainBlockBody struct {
110131 cbor.StructAsArray
111- TxPayload []ByronTransactionBody
132+ // TODO: split this to its own type
133+ TxPayload []struct {
134+ cbor.StructAsArray
135+ Transaction ByronTransaction
136+ // TODO: figure out what this field actually is
137+ Twit []cbor.Value
138+ }
112139 SscPayload cbor.Value
113140 DlgPayload []interface {}
114141 UpdPayload []interface {}
@@ -257,14 +284,6 @@ func NewByronMainBlockHeaderFromCbor(data []byte) (*ByronMainBlockHeader, error)
257284 return & byronMainBlockHeader , nil
258285}
259286
260- func NewByronTransactionBodyFromCbor (data []byte ) (* ByronTransactionBody , error ) {
261- var byronTx ByronTransactionBody
262- if _ , err := cbor .Decode (data , & byronTx ); err != nil {
263- return nil , fmt .Errorf ("Byron transaction body decode error: %s" , err )
264- }
265- return & byronTx , nil
266- }
267-
268287func NewByronTransactionFromCbor (data []byte ) (* ByronTransaction , error ) {
269288 var byronTx ByronTransaction
270289 if _ , err := cbor .Decode (data , & byronTx ); err != nil {
0 commit comments