@@ -22,6 +22,7 @@ import (
22
22
utxorpc "github.com/utxorpc/go-codegen/utxorpc/v1alpha/cardano"
23
23
24
24
"github.com/blinklabs-io/gouroboros/cbor"
25
+ "github.com/blinklabs-io/gouroboros/ledger/common"
25
26
)
26
27
27
28
const (
@@ -363,11 +364,11 @@ func (o *BabbageTransactionOutput) MarshalCBOR() ([]byte, error) {
363
364
364
365
func (o BabbageTransactionOutput ) MarshalJSON () ([]byte , error ) {
365
366
tmpObj := struct {
366
- Address Address `json:"address"`
367
- Amount uint64 `json:"amount"`
368
- Assets * MultiAsset [MultiAssetTypeOutput ] `json:"assets,omitempty"`
369
- Datum * cbor.LazyValue `json:"datum,omitempty"`
370
- DatumHash string `json:"datumHash,omitempty"`
367
+ Address Address `json:"address"`
368
+ Amount uint64 `json:"amount"`
369
+ Assets * common. MultiAsset [common. MultiAssetTypeOutput ] `json:"assets,omitempty"`
370
+ Datum * cbor.LazyValue `json:"datum,omitempty"`
371
+ DatumHash string `json:"datumHash,omitempty"`
371
372
}{
372
373
Address : o .OutputAddress ,
373
374
Amount : o .OutputAmount .Amount ,
@@ -392,7 +393,7 @@ func (o BabbageTransactionOutput) Amount() uint64 {
392
393
return o .OutputAmount .Amount
393
394
}
394
395
395
- func (o BabbageTransactionOutput ) Assets () * MultiAsset [MultiAssetTypeOutput ] {
396
+ func (o BabbageTransactionOutput ) Assets () * common. MultiAsset [common. MultiAssetTypeOutput ] {
396
397
return o .OutputAmount .Assets
397
398
}
398
399
@@ -420,13 +421,15 @@ func (o BabbageTransactionOutput) Utxorpc() *utxorpc.TxOutput {
420
421
421
422
var assets []* utxorpc.Multiasset
422
423
if o .Assets () != nil {
423
- for policyId , policyData := range o .Assets ().data {
424
+ tmpAssets := o .Assets ()
425
+ for _ , policyId := range tmpAssets .Policies () {
424
426
var ma = & utxorpc.Multiasset {
425
427
PolicyId : policyId .Bytes (),
426
428
}
427
- for assetName , amount := range policyData {
429
+ for _ , assetName := range tmpAssets .Assets (policyId ) {
430
+ amount := tmpAssets .Asset (policyId , assetName )
428
431
asset := & utxorpc.Asset {
429
- Name : assetName . Bytes () ,
432
+ Name : assetName ,
430
433
OutputCoin : amount ,
431
434
}
432
435
ma .Assets = append (ma .Assets , asset )
@@ -540,7 +543,7 @@ func (t BabbageTransaction) RequiredSigners() []Blake2b224 {
540
543
return t .Body .RequiredSigners ()
541
544
}
542
545
543
- func (t BabbageTransaction ) AssetMint () * MultiAsset [MultiAssetTypeMint ] {
546
+ func (t BabbageTransaction ) AssetMint () * common. MultiAsset [common. MultiAssetTypeMint ] {
544
547
return t .Body .AssetMint ()
545
548
}
546
549
0 commit comments