@@ -125,7 +125,7 @@ func (h *BabbageBlockHeader) Era() Era {
125125
126126type BabbageTransactionBody struct {
127127 AlonzoTransactionBody
128- Outputs []BabbageTransactionOutput `cbor:"1,keyasint,omitempty"`
128+ TxOutputs []BabbageTransactionOutput `cbor:"1,keyasint,omitempty"`
129129 CollateralReturn BabbageTransactionOutput `cbor:"16,keyasint,omitempty"`
130130 TotalCollateral uint64 `cbor:"17,keyasint,omitempty"`
131131 ReferenceInputs []ShelleyTransactionInput `cbor:"18,keyasint,omitempty"`
@@ -135,28 +135,48 @@ func (b *BabbageTransactionBody) UnmarshalCBOR(cborData []byte) error {
135135 return b .UnmarshalCbor (cborData , b )
136136}
137137
138+ func (b * BabbageTransactionBody ) Outputs () []TransactionOutput {
139+ ret := []TransactionOutput {}
140+ for _ , output := range b .TxOutputs {
141+ ret = append (ret , output )
142+ }
143+ return ret
144+ }
145+
138146type BabbageTransactionOutput struct {
139- Address Blake2b256 `cbor:"0,keyasint,omitempty"`
140- Amount MaryTransactionOutputValue `cbor:"1,keyasint,omitempty"`
141- DatumOption []cbor.RawMessage `cbor:"2,keyasint,omitempty"`
142- ScriptRef cbor.Tag `cbor:"3,keyasint,omitempty"`
143- legacyOutput bool
147+ OutputAddress [] byte `cbor:"0,keyasint,omitempty"`
148+ OutputAmount MaryTransactionOutputValue `cbor:"1,keyasint,omitempty"`
149+ DatumOption []cbor.RawMessage `cbor:"2,keyasint,omitempty"`
150+ ScriptRef cbor.Tag `cbor:"3,keyasint,omitempty"`
151+ legacyOutput bool
144152}
145153
146154func (o * BabbageTransactionOutput ) UnmarshalCBOR (cborData []byte ) error {
147155 // Try to parse as legacy output first
148156 var tmpOutput AlonzoTransactionOutput
149157 if _ , err := cbor .Decode (cborData , & tmpOutput ); err == nil {
150158 // Copy from temp legacy object to Babbage format
151- o .Address = tmpOutput .Address
152- o .Amount = tmpOutput .Amount
159+ o .OutputAddress = tmpOutput .OutputAddress
160+ o .OutputAmount = tmpOutput .OutputAmount
153161 o .legacyOutput = true
154162 } else {
155163 return cbor .DecodeGeneric (cborData , o )
156164 }
157165 return nil
158166}
159167
168+ func (o BabbageTransactionOutput ) Address () []byte {
169+ return o .OutputAddress
170+ }
171+
172+ func (o BabbageTransactionOutput ) Amount () uint64 {
173+ return o .OutputAmount .Amount
174+ }
175+
176+ func (o BabbageTransactionOutput ) Assets () interface {} {
177+ return o .OutputAmount .Assets
178+ }
179+
160180type BabbageTransactionWitnessSet struct {
161181 AlonzoTransactionWitnessSet
162182 PlutusV2Scripts []cbor.RawMessage `cbor:"6,keyasint,omitempty"`
0 commit comments