Skip to content

Commit 4da0d0a

Browse files
author
Jenita
committed
feat: added changes to implementutxoWholeResult
Signed-off-by: Jenita <[email protected]>
1 parent a6c4a3b commit 4da0d0a

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

cmd/gouroboros/query.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,18 @@ func testQuery(f *globalFlags) {
278278
fmt.Printf("Assets: %s\n", assetsJson)
279279
}
280280
}
281+
case "utxo-whole-result":
282+
result, err := o.LocalStateQuery().Client.GetUTxOWhole()
283+
if err != nil {
284+
fmt.Printf("ERROR: failure querying UTxO whole: %s\n", err)
285+
os.Exit(1)
286+
}
287+
jsonData, err := json.MarshalIndent(result, "", " ")
288+
if err != nil {
289+
fmt.Printf("ERROR: failed to marshal UTxO whole to JSON: %s\n", err)
290+
os.Exit(1)
291+
}
292+
fmt.Println(string(jsonData))
281293
default:
282294
fmt.Printf("ERROR: unknown query: %s\n", queryFlags.flagset.Args()[0])
283295
os.Exit(1)

protocol/localstatequery/client.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package localstatequery
1616

1717
import (
18+
"encoding/json"
1819
"errors"
1920
"fmt"
2021
"sync"
@@ -499,6 +500,12 @@ func (c *Client) GetUTxOWhole() (*UTxOWholeResult, error) {
499500
if err := c.runQuery(query, &result); err != nil {
500501
return nil, err
501502
}
503+
jsonData, err := json.MarshalIndent(result, "", " ")
504+
if err != nil {
505+
return nil, fmt.Errorf("error marshaling UTxOWhole result to JSON: %s", err)
506+
}
507+
fmt.Println("UTxOWhole Result:")
508+
fmt.Println(string(jsonData))
502509
return &result, nil
503510
}
504511

0 commit comments

Comments
 (0)