File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -134,14 +134,18 @@ func (o *AlonzoTransactionOutput) UnmarshalCBOR(cborData []byte) error {
134134
135135func (o AlonzoTransactionOutput ) MarshalJSON () ([]byte , error ) {
136136 tmpObj := struct {
137- Address Address `json:"address"`
138- Amount uint64 `json:"amount"`
139- Assets * MultiAsset [MultiAssetTypeOutput ] `json:"assets,omitempty"`
137+ Address Address `json:"address"`
138+ Amount uint64 `json:"amount"`
139+ Assets * MultiAsset [MultiAssetTypeOutput ] `json:"assets,omitempty"`
140+ DatumHash string `json:"datumHash,omitempty"`
140141 }{
141142 Address : o .OutputAddress ,
142143 Amount : o .OutputAmount .Amount ,
143144 Assets : o .OutputAmount .Assets ,
144145 }
146+ if o .TxOutputDatumHash != nil {
147+ tmpObj .DatumHash = o .TxOutputDatumHash .String ()
148+ }
145149 return json .Marshal (& tmpObj )
146150}
147151
Original file line number Diff line number Diff line change @@ -237,14 +237,24 @@ func (o *BabbageTransactionOutput) UnmarshalCBOR(cborData []byte) error {
237237
238238func (o BabbageTransactionOutput ) MarshalJSON () ([]byte , error ) {
239239 tmpObj := struct {
240- Address Address `json:"address"`
241- Amount uint64 `json:"amount"`
242- Assets * MultiAsset [MultiAssetTypeOutput ] `json:"assets,omitempty"`
240+ Address Address `json:"address"`
241+ Amount uint64 `json:"amount"`
242+ Assets * MultiAsset [MultiAssetTypeOutput ] `json:"assets,omitempty"`
243+ Datum * cbor.LazyValue `json:"datum,omitempty"`
244+ DatumHash string `json:"datumHash,omitempty"`
243245 }{
244246 Address : o .OutputAddress ,
245247 Amount : o .OutputAmount .Amount ,
246248 Assets : o .OutputAmount .Assets ,
247249 }
250+ if o .DatumOption != nil {
251+ if o .DatumOption .hash != nil {
252+ tmpObj .DatumHash = o .DatumOption .hash .String ()
253+ }
254+ if o .DatumOption .data != nil {
255+ tmpObj .Datum = o .DatumOption .data
256+ }
257+ }
248258 return json .Marshal (& tmpObj )
249259}
250260
You can’t perform that action at this time.
0 commit comments