@@ -374,11 +374,11 @@ const (
374
374
375
375
type BabbageTransactionOutputDatumOption struct {
376
376
hash * common.Blake2b256
377
- data * cbor. LazyValue
377
+ data * common. Datum
378
378
}
379
379
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 )
382
382
if err != nil {
383
383
return err
384
384
}
@@ -389,7 +389,7 @@ func (d *BabbageTransactionOutputDatumOption) UnmarshalCBOR(data []byte) error {
389
389
Type int
390
390
Hash common.Blake2b256
391
391
}
392
- if _ , err := cbor .Decode (data , & tmpDatumHash ); err != nil {
392
+ if _ , err := cbor .Decode (cborData , & tmpDatumHash ); err != nil {
393
393
return err
394
394
}
395
395
d .hash = & (tmpDatumHash .Hash )
@@ -399,14 +399,16 @@ func (d *BabbageTransactionOutputDatumOption) UnmarshalCBOR(data []byte) error {
399
399
Type int
400
400
DataCbor []byte
401
401
}
402
- if _ , err := cbor .Decode (data , & tmpDatumData ); err != nil {
402
+ if _ , err := cbor .Decode (cborData , & tmpDatumData ); err != nil {
403
403
return err
404
404
}
405
- var datumValue cbor. LazyValue
405
+ var datumValue common. Datum
406
406
if _ , err := cbor .Decode (tmpDatumData .DataCbor , & datumValue ); err != nil {
407
407
return err
408
408
}
409
- d .data = & (datumValue )
409
+ d .data = & common.Datum {
410
+ Data : datumValue .Data ,
411
+ }
410
412
default :
411
413
return fmt .Errorf ("unsupported datum option type: %d" , datumOptionType )
412
414
}
@@ -418,7 +420,11 @@ func (d *BabbageTransactionOutputDatumOption) MarshalCBOR() ([]byte, error) {
418
420
if d .hash != nil {
419
421
tmpObj = []any {DatumOptionTypeHash , d .hash }
420
422
} 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 }}
422
428
} else {
423
429
return nil , errors .New ("unknown datum option type" )
424
430
}
@@ -471,7 +477,7 @@ func (o BabbageTransactionOutput) MarshalJSON() ([]byte, error) {
471
477
Address common.Address `json:"address"`
472
478
Amount uint64 `json:"amount"`
473
479
Assets * common.MultiAsset [common.MultiAssetTypeOutput ] `json:"assets,omitempty"`
474
- Datum * cbor. LazyValue `json:"datum,omitempty"`
480
+ Datum * common. Datum `json:"datum,omitempty"`
475
481
DatumHash string `json:"datumHash,omitempty"`
476
482
}{
477
483
Address : o .OutputAddress ,
@@ -560,7 +566,7 @@ func (o BabbageTransactionOutput) DatumHash() *common.Blake2b256 {
560
566
return & common.Blake2b256 {}
561
567
}
562
568
563
- func (o BabbageTransactionOutput ) Datum () * cbor. LazyValue {
569
+ func (o BabbageTransactionOutput ) Datum () * common. Datum {
564
570
if o .DatumOption != nil {
565
571
return o .DatumOption .data
566
572
}
@@ -625,7 +631,7 @@ type BabbageTransactionWitnessSet struct {
625
631
WsNativeScripts []common.NativeScript `cbor:"1,keyasint,omitempty"`
626
632
BootstrapWitnesses []common.BootstrapWitness `cbor:"2,keyasint,omitempty"`
627
633
WsPlutusV1Scripts [][]byte `cbor:"3,keyasint,omitempty"`
628
- WsPlutusData []cbor. Value `cbor:"4,keyasint,omitempty"`
634
+ WsPlutusData []common. Datum `cbor:"4,keyasint,omitempty"`
629
635
WsRedeemers alonzo.AlonzoRedeemers `cbor:"5,keyasint,omitempty"`
630
636
WsPlutusV2Scripts [][]byte `cbor:"6,keyasint,omitempty"`
631
637
}
@@ -666,7 +672,7 @@ func (w BabbageTransactionWitnessSet) PlutusV3Scripts() [][]byte {
666
672
return nil
667
673
}
668
674
669
- func (w BabbageTransactionWitnessSet ) PlutusData () []cbor. Value {
675
+ func (w BabbageTransactionWitnessSet ) PlutusData () []common. Datum {
670
676
return w .WsPlutusData
671
677
}
672
678
0 commit comments