Skip to content

fix: serialise Buffer as hex string#120

Draft
ns212 wants to merge 3 commits intomainfrom
json-hex
Draft

fix: serialise Buffer as hex string#120
ns212 wants to merge 3 commits intomainfrom
json-hex

Conversation

@ns212
Copy link
Contributor

@ns212 ns212 commented Aug 11, 2025

This pull request introduces new endpoints for block information and improves serialisation of byte Buffer.

BigInt and JSON Handling Improvements:

  • Removed the json-bigint dependency and its usage throughout the codebase, simplifying JSON serialization logic. [1] [2] [3]
  • Added a global toJSON method to the BigInt prototype, ensuring that bigint values are serialized as strings in JSON outputs.
  • Configured Express with a custom JSON replacer to convert Buffer objects to hexadecimal strings during JSON serialization.

New API Endpoints for Block Data:

  • Added /tip/height endpoint to retrieve the current tip block height, using cache when available and falling back to a live query if necessary.
  • Added /:height/header endpoint to fetch block header information for a specific height, including the block hash and height.

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.

1 participant