PSE Clearing accounts balances Query#29
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new gRPC query endpoint ClearingAccountBalances to retrieve the current balances of all PSE clearing accounts in the bond denomination. The implementation follows established patterns within the codebase and includes comprehensive test coverage.
Key changes:
- Added new protobuf message types for querying clearing account balances
- Implemented keeper logic to fetch balances for all 6 clearing accounts
- Added gRPC service handler with REST endpoint support at
/tx/pse/v1/clearing_account_balances
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| proto/tx/pse/v1/query.proto | Defines new RPC method, request/response messages, and ClearingAccountBalance structure for the query endpoint |
| x/pse/types/query.pb.go | Generated protobuf code with message types, gRPC client/server interfaces, and marshaling logic |
| x/pse/types/query.pb.gw.go | Generated gRPC-gateway code for HTTP REST endpoint routing and request/response handling |
| x/pse/keeper/keeper.go | Implements GetClearingAccountBalances to fetch balances for all clearing accounts, handling missing accounts gracefully |
| x/pse/keeper/grpc.go | Adds ClearingAccountBalances gRPC handler that delegates to keeper implementation |
| x/pse/keeper/grpc_query_test.go | Comprehensive tests covering both zero-balance and funded account scenarios |
| docs/api.md | Updated API documentation with new message types and query endpoint details |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ysv
left a comment
There was a problem hiding this comment.
@ysv reviewed 7 of 7 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @masihyeganeh and @miladz68)
proto/tx/pse/v1/query.proto line 26 at r1 (raw file):
option (google.api.http).get = "/tx/pse/v1/score/{address}"; }
nit: whitespaces
proto/tx/pse/v1/query.proto line 72 at r1 (raw file):
(gogoproto.moretags) = "yaml:\"clearing_account\"" ];
nit: whitespaces
TxCorpi0x
left a comment
There was a problem hiding this comment.
Reviewable status: 6 of 7 files reviewed, all discussions resolved (waiting on @masihyeganeh, @miladz68, and @ysv)
proto/tx/pse/v1/query.proto line 72 at r1 (raw file):
Previously, ysv (Yaroslav Savchuk) wrote…
nit: whitespaces
Done
ysv
left a comment
There was a problem hiding this comment.
@ysv reviewed 1 of 1 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh and @miladz68)
miladz68
left a comment
There was a problem hiding this comment.
@miladz68 reviewed 6 of 7 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh)
Description
This pull request introduces a new gRPC query endpoint to retrieve the current balances of all PSE clearing accounts. The changes span the API documentation, protobuf definitions, keeper logic, gRPC service implementation, and test coverage. The most important changes are grouped below:
API and Protobuf Enhancements:
ClearingAccountBalance,QueryClearingAccountBalancesRequest, andQueryClearingAccountBalancesResponse) and documented them in bothproto/tx/pse/v1/query.protoanddocs/api.md, enabling structured querying of clearing account balances.ClearingAccountBalancesin theQueryservice, including REST endpoint mapping (GET /tx/pse/v1/clearing_account_balances) and updated documentation.Keeper and Query Logic:
GetClearingAccountBalancesinx/pse/keeper/keeper.goto fetch balances for all clearing accounts in the bond denom, handling missing accounts and zero balances gracefully.x/pse/keeper/grpc.goto expose this functionality via the new query endpoint.Testing and Gateway Updates:
x/pse/keeper/grpc_query_test.goto verify the new query returns correct balances for all clearing accounts, both when balances are zero and when some are funded.x/pse/types/query.pb.gw.goto support HTTP requests for the new endpoint, including handler registration and response forwarding.Reviewers checklist:
Authors checklist
This change is