Skip to content

Refactor HyperSync client to use abstracted client interface#1061

Merged
DZakh merged 3 commits into
release-v2.32.11from
claude/hypersync-block-hashes-99rvY
Mar 30, 2026
Merged

Refactor HyperSync client to use abstracted client interface#1061
DZakh merged 3 commits into
release-v2.32.11from
claude/hypersync-block-hashes-99rvY

Conversation

@DZakh
Copy link
Copy Markdown
Member

@DZakh DZakh commented Mar 30, 2026

Summary

Refactored the HyperSync integration to use an abstracted HyperSyncClient.t interface instead of passing raw serverUrl and apiToken parameters throughout the codebase. This improves encapsulation and simplifies the API surface.

Key Changes

  • Client abstraction: Replaced ~serverUrl and ~apiToken parameters with a single ~client: HyperSyncClient.t parameter in queryBlockData, queryBlockDataMulti, and related functions
  • Response type definitions: Added explicit type definitions for queryResponse and queryResponseData in HyperSyncClient.res to replace the previously opaque type
  • Simplified response handling: Refactored BlockData.convertResponse to work directly with the new response structure, removing nested flatMap operations and simplifying the data extraction logic
  • Updated type references: Changed from HyperSyncJsonApi.QueryTypes.postQueryBody to HyperSyncClient.QueryTypes.query and from HyperSyncJsonApi.ResponseTypes.queryResponse to HyperSyncClient.queryResponse
  • Added schema field: Added includeAllBlocks field to QueryTypes.query to support querying all blocks in a range regardless of transaction/log relevance
  • Removed retry logic: Simplified the query execution by removing the explicit Rest.fetch call with retry logic, delegating to the client's get method
  • Updated call sites: Modified HyperSyncSource.res to pass the client instance instead of individual connection parameters

Notable Implementation Details

  • The response conversion logic was significantly simplified by flattening the nested array operations and directly accessing res.data.blocks
  • The client instance now encapsulates connection details and retry logic, reducing parameter passing throughout the call chain
  • A typo fix: "hack caught up" → "have caught up" in a comment

https://claude.ai/code/session_01GdmmyVikrTScFWYinb8Ba4

claude added 3 commits March 30, 2026 08:30
The BlockData module was using raw HTTP requests via HyperSyncJsonApi +
Rest.fetch while all other queries used the HyperSyncClient. This switches
block hash/timestamp queries to use client.get(), leveraging the client's
built-in retries, auth handling, and connection pooling.

Changes:
- Add includeAllBlocks field and typed queryResponse to HyperSyncClient
- Rewrite BlockData module to use client.get() instead of Rest.fetch
- Update queryBlockData/queryBlockDataMulti signatures to accept ~client
- Update callers in HyperSyncSource to pass the existing client instance

https://claude.ai/code/session_01GdmmyVikrTScFWYinb8Ba4
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 30, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f09a1171-ad58-4102-aefc-25582322f0d0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/hypersync-block-hashes-99rvY

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@DZakh DZakh merged commit db56dc1 into release-v2.32.11 Mar 30, 2026
2 checks passed
@DZakh DZakh deleted the claude/hypersync-block-hashes-99rvY branch March 30, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants