@@ -374,11 +374,11 @@ const (
374374
375375type BabbageTransactionOutputDatumOption struct {
376376 hash * common.Blake2b256
377- data * cbor. LazyValue
377+ data * common. Datum
378378}
379379
380- func (d * BabbageTransactionOutputDatumOption ) UnmarshalCBOR (data []byte ) error {
381- datumOptionType , err := cbor .DecodeIdFromList (data )
380+ func (d * BabbageTransactionOutputDatumOption ) UnmarshalCBOR (cborData []byte ) error {
381+ datumOptionType , err := cbor .DecodeIdFromList (cborData )
382382 if err != nil {
383383 return err
384384 }
@@ -389,7 +389,7 @@ func (d *BabbageTransactionOutputDatumOption) UnmarshalCBOR(data []byte) error {
389389 Type int
390390 Hash common.Blake2b256
391391 }
392- if _ , err := cbor .Decode (data , & tmpDatumHash ); err != nil {
392+ if _ , err := cbor .Decode (cborData , & tmpDatumHash ); err != nil {
393393 return err
394394 }
395395 d .hash = & (tmpDatumHash .Hash )
@@ -399,14 +399,16 @@ func (d *BabbageTransactionOutputDatumOption) UnmarshalCBOR(data []byte) error {
399399 Type int
400400 DataCbor []byte
401401 }
402- if _ , err := cbor .Decode (data , & tmpDatumData ); err != nil {
402+ if _ , err := cbor .Decode (cborData , & tmpDatumData ); err != nil {
403403 return err
404404 }
405- var datumValue cbor. LazyValue
405+ var datumValue common. Datum
406406 if _ , err := cbor .Decode (tmpDatumData .DataCbor , & datumValue ); err != nil {
407407 return err
408408 }
409- d .data = & (datumValue )
409+ d .data = & common.Datum {
410+ Data : datumValue .Data ,
411+ }
410412 default :
411413 return fmt .Errorf ("unsupported datum option type: %d" , datumOptionType )
412414 }
@@ -418,7 +420,11 @@ func (d *BabbageTransactionOutputDatumOption) MarshalCBOR() ([]byte, error) {
418420 if d .hash != nil {
419421 tmpObj = []any {DatumOptionTypeHash , d .hash }
420422 } else if d .data != nil {
421- tmpObj = []any {DatumOptionTypeData , cbor.Tag {Number : 24 , Content : d .data .Cbor ()}}
423+ tmpContent , err := cbor .Encode (d .data )
424+ if err != nil {
425+ return nil , err
426+ }
427+ tmpObj = []any {DatumOptionTypeData , cbor.Tag {Number : 24 , Content : tmpContent }}
422428 } else {
423429 return nil , errors .New ("unknown datum option type" )
424430 }
@@ -471,7 +477,7 @@ func (o BabbageTransactionOutput) MarshalJSON() ([]byte, error) {
471477 Address common.Address `json:"address"`
472478 Amount uint64 `json:"amount"`
473479 Assets * common.MultiAsset [common.MultiAssetTypeOutput ] `json:"assets,omitempty"`
474- Datum * cbor. LazyValue `json:"datum,omitempty"`
480+ Datum * common. Datum `json:"datum,omitempty"`
475481 DatumHash string `json:"datumHash,omitempty"`
476482 }{
477483 Address : o .OutputAddress ,
@@ -560,7 +566,7 @@ func (o BabbageTransactionOutput) DatumHash() *common.Blake2b256 {
560566 return & common.Blake2b256 {}
561567}
562568
563- func (o BabbageTransactionOutput ) Datum () * cbor. LazyValue {
569+ func (o BabbageTransactionOutput ) Datum () * common. Datum {
564570 if o .DatumOption != nil {
565571 return o .DatumOption .data
566572 }
@@ -625,7 +631,7 @@ type BabbageTransactionWitnessSet struct {
625631 WsNativeScripts []common.NativeScript `cbor:"1,keyasint,omitempty"`
626632 BootstrapWitnesses []common.BootstrapWitness `cbor:"2,keyasint,omitempty"`
627633 WsPlutusV1Scripts [][]byte `cbor:"3,keyasint,omitempty"`
628- WsPlutusData []cbor. Value `cbor:"4,keyasint,omitempty"`
634+ WsPlutusData []common. Datum `cbor:"4,keyasint,omitempty"`
629635 WsRedeemers alonzo.AlonzoRedeemers `cbor:"5,keyasint,omitempty"`
630636 WsPlutusV2Scripts [][]byte `cbor:"6,keyasint,omitempty"`
631637}
@@ -666,7 +672,7 @@ func (w BabbageTransactionWitnessSet) PlutusV3Scripts() [][]byte {
666672 return nil
667673}
668674
669- func (w BabbageTransactionWitnessSet ) PlutusData () []cbor. Value {
675+ func (w BabbageTransactionWitnessSet ) PlutusData () []common. Datum {
670676 return w .WsPlutusData
671677}
672678
0 commit comments