Skip to content

[Beginner]: Improve typing consistency of AccountInfoQuery #3791

@exploreriii

Description

@exploreriii

🐥 Beginner Friendly

This issue is a great fit for contributors who are ready to explore the Hiero JavaScript
codebase a little more and take on slightly more independent work. We strongly recommend
completing a Good First Issue before tackling a Beginner Issue.

Beginner Issues often involve reading existing JavaScript code, understanding how
different parts of the SDK fit together, and making small, thoughtful updates
that follow established patterns.

The goal is to support skill growth while keeping the experience approachable,
well-scoped, and enjoyable.

👾 Description of the Issue

AccountInfoQuery currently has some typing inconsistencies and lint
workarounds that should be improved for better clarity and consistency
across the Query layer.

In particular:

  • The Client typedef uses a wildcard generic form (<*, *>), which is
    too loose and does not reflect the SDK’s actual Client<Channel, MirrorChannel>
    structure.
  • The getCost method uses an inline generic type instead of the shared
    Client typedef.
  • QUERY_REGISTRY.set(...) uses a direct static method reference that may
    require special handling depending on ESLint rules.
  • There are existing ESLint disable comments for unused parameters.
    The goal is to align this file with the improved patterns already used
    elsewhere in the SDK — without changing runtime behavior.

This issue focuses purely on type definition cleanup and registry
consistency.

💡 Proposed Solution

By the end of this issue:

  1. The Client typedef should use the explicit generic form:
@typedef {import("../client/Client.js").default<Channel, MirrorChannel>} Client
  1. Channel and MirrorChannel should be properly typedef’d.

  2. getCost(...) should use the shared Client typedef rather than
    redefining the generic inline.

  3. QUERY_REGISTRY.set(...) should follow the project’s preferred
    static method pattern (ensure lint passes cleanly).

  4. The file should not introduce new ESLint disables.

  5. Runtime behavior must remain unchanged.

👩‍💻 Implementation Steps

This is intentionally not a step-by-step mechanical fix.

You should:

  • Compare this file to other Query implementations that already use
    the improved generic Client pattern.
  • Identify where type definitions differ and align them.
  • Ensure the registry registration follows the consistent pattern used
    elsewhere in the codebase.
  • Run npm run lint and confirm no new warnings are introduced.
  • Run npm test to ensure behavior remains identical.
    Take time to understand how Query, Client, and QUERY_REGISTRY
    interact before making changes.

✅ Acceptance Criteria

To merge a pull request for this issue:

  • Scope: Changes are limited to typing and registry cleanup in AccountInfoQuery

  • Typing: Client<Channel, MirrorChannel> is used consistently

  • Consistency: Registry registration matches project standards

  • Linting: No new ESLint suppressions introduced

  • Behavior: No runtime or public API changes

  • Tests: Existing CI checks pass

  • Review: All code review feedback addressed

📋 Step-by-Step Contribution Guide

To help keep contributions consistent and easy to review, remember these key steps:

  • Comment /assign to request the issue and get assigned. Only one assignment at a time.
  • Fork the repository and create a branch from an updated main
  • Make the requested changes and sign each commit using -s -S
  • Push your branch and open a pull request

Here are some best practices to follow:

  • Follow the existing project conventions and examples
  • Avoid breaking public APIs
  • Include tests and/or example updates where appropriate
  • Address all code review feedback

Read Workflow Guide for step-by-step workflow guidance.
Read README.md for setup instructions.

❗ Pull requests cannot be merged without signed commits (use -s -S).
See the Signing Guide.

🤔 Additional Information

This issue is part of a broader effort to improve type consistency across
the Query layer.

Unlike Good First Issues, this task encourages contributors to explore
existing patterns in the codebase and make thoughtful improvements
rather than following exact instructions.

If you have questions while working on this issue, feel free to ask!

You can reach the community and maintainers here:
Hiero-SDK-JavaScript Discord

Metadata

Metadata

Assignees

Labels

approvedbeginnerSimple tasks requiring basic Javascript and SDK familiarity. May touch 1-2 files.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions