diff --git a/protocol/localstatequery/client.go b/protocol/localstatequery/client.go index 14cd73fc..1c938362 100644 --- a/protocol/localstatequery/client.go +++ b/protocol/localstatequery/client.go @@ -450,7 +450,7 @@ func (c *Client) GetStakeDistribution() (*StakeDistributionResult, error) { // GetUTxOByAddress returns the UTxOs for a given list of ledger.Address structs func (c *Client) GetUTxOByAddress( addrs []ledger.Address, -) (*UTxOByAddressResult, error) { +) (*UTxOsResult, error) { c.Protocol.Logger(). Debug(fmt.Sprintf("calling GetUTxOByAddress(addrs: %+v)", addrs), "component", "network", @@ -469,7 +469,7 @@ func (c *Client) GetUTxOByAddress( QueryTypeShelleyUtxoByAddress, addrs, ) - var result UTxOByAddressResult + var result UTxOsResult if err := c.runQuery(query, &result); err != nil { return nil, err } @@ -477,7 +477,7 @@ func (c *Client) GetUTxOByAddress( } // GetUTxOWhole returns the current UTxO set -func (c *Client) GetUTxOWhole() (*UTxOWholeResult, error) { +func (c *Client) GetUTxOWhole() (*UTxOsResult, error) { c.Protocol.Logger(). Debug("calling GetUTxOWhole()", "component", "network", @@ -495,7 +495,7 @@ func (c *Client) GetUTxOWhole() (*UTxOWholeResult, error) { currentEra, QueryTypeShelleyUtxoWhole, ) - var result UTxOWholeResult + var result UTxOsResult if err := c.runQuery(query, &result); err != nil { return nil, err } diff --git a/protocol/localstatequery/client_test.go b/protocol/localstatequery/client_test.go index 5135d76b..ca87dc39 100644 --- a/protocol/localstatequery/client_test.go +++ b/protocol/localstatequery/client_test.go @@ -1,4 +1,4 @@ -// Copyright 2024 Blink Labs Software +// Copyright 2025 Blink Labs Software // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -234,7 +234,7 @@ func TestGetUTxOByAddress(t *testing.T) { Hash: ledger.NewBlake2b256([]byte{0x1, 0x2}), Idx: 7, } - expectedResult := localstatequery.UTxOByAddressResult{ + expectedResult := localstatequery.UTxOsResult{ Results: map[localstatequery.UtxoId]ledger.BabbageTransactionOutput{ expectedUtxoId: { OutputAddress: testAddress, diff --git a/protocol/localstatequery/queries.go b/protocol/localstatequery/queries.go index ce633b6b..cf2fb093 100644 --- a/protocol/localstatequery/queries.go +++ b/protocol/localstatequery/queries.go @@ -1,4 +1,4 @@ -// Copyright 2023 Blink Labs Software +// Copyright 2025 Blink Labs Software // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -533,11 +533,16 @@ type StakeDistributionResult struct { } } -type UTxOByAddressResult struct { +type UTxOsResult struct { cbor.StructAsArray Results map[UtxoId]ledger.BabbageTransactionOutput } +type ( + UTxOByAddressResult = UTxOsResult + UTxOWholeResult = UTxOsResult +) + type UtxoId struct { cbor.StructAsArray Hash ledger.Blake2b256 @@ -592,15 +597,6 @@ func (u *UtxoId) MarshalCBOR() ([]byte, error) { return cbor.Encode(tmpData) } -// TODO (#862) -/* -result [{* utxo => value }] -*/ -type UTxOWholeResult struct { - cbor.StructAsArray - Results map[UtxoId]ledger.BabbageTransactionOutput -} - // TODO (#863) type DebugEpochStateResult any