Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions cmd/gouroboros/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,33 @@ func testQuery(f *globalFlags) {
fmt.Printf("Assets: %s\n", assetsJson)
}
}
case "utxo-whole-result":
utxos, err := o.LocalStateQuery().Client.GetUTxOWhole()
if err != nil {
fmt.Printf("ERROR: failure querying UTxO whole: %s\n", err)
os.Exit(1)
}

for utxoId, utxo := range utxos.Results {
fmt.Println("---")
fmt.Printf("UTxO ID: %s#%d\n", utxoId.Hash.String(), utxoId.Idx)
fmt.Printf("Address: %x\n", utxo.Address())
fmt.Printf("Amount: %d\n", utxo.Amount())

assets := utxo.Assets()
if assets != nil {
fmt.Printf("Assets: %+v\n", assets)
}

datum := utxo.Datum()
if datum != nil {
if cborData := datum.Cbor(); cborData != nil {
fmt.Printf("Datum CBOR: %x\n", cborData)
} else {
fmt.Printf("Datum present (error decoding)")
}
}
}
default:
fmt.Printf("ERROR: unknown query: %s\n", queryFlags.flagset.Args()[0])
os.Exit(1)
Expand Down
5 changes: 4 additions & 1 deletion protocol/localstatequery/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,10 @@ func (u *UtxoId) MarshalCBOR() ([]byte, error) {
/*
result [{* utxo => value }]
*/
type UTxOWholeResult any
type UTxOWholeResult struct {
cbor.StructAsArray
Results map[UtxoId]ledger.BabbageTransactionOutput
}

// TODO (#863)
type DebugEpochStateResult any
Expand Down