hiero-ledger / hiero-ledger/hiero-sdk-python
feat(tck): implement getAddressBook JSON-RPC method
- Dominant language
- Python
- Stars
- 63
- Forks
- 298
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 38
Description
**Problem**
The TCK server does not implement `getAddressBook`, so the TCK driver's `AddressBookQuery` suite cannot run against the Python SDK.
**This one has an SDK prerequisite.** The spec's `getAddressBook` is the standard mirror-node address book query (the mirror node's `NetworkService.getNodes` gRPC stream, as in the other SDKs' `AddressBookQuery`). The Python SDK currently only has `RegisteredNodeAddressBookQuery` (`src/hiero_sdk_python/address_book/registered_node_address_book_query.py`), which is the HIP-1137 *registered-node* REST query — a different thing. The mirror protos are already generated (`src/hiero_sdk_python/hapi/mirror/mirror_network_service_pb2*.py`), so the query class is implementable today.
**Before you start — required reading**
TCK handlers are contract work: the TCK driver validates exact parameter names, optionality, defaults, and error semantics against the published spec. Please do not code from this issue title alone (or paste it into an AI tool and ship the first thing that runs) — read these first:
1. **The spec page linked below**, in full — especially the parameter table, the expected response shape, and the error/edge-case tests. If your handler's behavior differs from the spec table, the TCK suite will fail even if the happy path works.
2. [`tck/README.md`](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/tck/README.md) — how the JSON-RPC server, param dataclasses, handler registry, and responses fit together, and how to run the TCK driver locally against your handler. Run the actual TCK suite before opening a PR; unit tests alone are not enough.
3. **An existing handler as your pattern** — pick the closest one in `tck/handlers/` with its matching `tck/param/` dataclass and follow its structure, naming, and error handling exactly. Do not invent a new style, and do not re-implement SDK logic in the handler — handlers only wire validated params onto the existing SDK transaction/query.
4. **The SDK class you are wrapping** (path in the Problem section) — read its setters and defaults so you know what the SDK already handles for you.
5. [`CONTRIBUTING.md`](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/CONTRIBUTING.md) — test and PR conventions.
**Solution**
- [ ] **Part 1 (SDK):** implement `AddressBookQuery` against the mirror node's `NetworkService.getNodes`, returning `NodeAddress` entries (`src/hiero_sdk_python/address_book/node_address.py` exists). Follow the structure of the other SDKs' `AddressBookQuery` and this repo's existing query conventions. This part may be worth splitting into its own SDK issue/PR first.
- [ ] **Part 2 (TCK):** add `GetAddressBookParams` to `tck/param/node.py` and a `getAddressBook` handler in `tck/handlers/node.py` registered via `@rpc_method("getAddressBook")`, mapping the response fields per the spec.
- [ ] Add unit tests under `tests/tck/`, then run the TCK driver's AddressBookQuery suite locally.
**Acceptance criteria**
- [ ] SDK `AddressBookQuery` implemented against the mirror node gRPC API
- [ ] `getAddressBook` registered and dispatchable; response fields match the spec
- [ ] Spec error cases behave as specified
- [ ] Unit tests added and the TCK `AddressBookQuery` suite passes
Spec: https://github.com/hiero-ledger/hiero-sdk-tck/blob/main/docs/test-specifications/node-service/AddressBookQuery.md
JS reference: https://github.com/hiero-ledger/hiero-sdk-js/blob/main/tck/methods/network.ts (`getAddressBook`)
Contributor guide
Research direction
Read the AddressBookQuery spec and tck/README.md first, then compare an existing handler in tck/handlers/ with its matching tck/param/ dataclass. Inspect src/hiero_sdk_python/address_book/registered_node_address_book_query.py, the generated mirror service protos, and src/hiero_sdk_python/address_book/node_address.py. Add the SDK query, TCK params and handler, tests under tests/tck/, and verify the TCK AddressBookQuery suite passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, blockchain, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100