Skip to content

fix: redirect v3 tx id and block hash params missing the 0x prefix - #2712

Merged
rafa-stacks merged 2 commits into
mainfrom
claude/v3-endpoint-0x-redirects-818441
Oct 8, 2026
Merged

rafa-stacks merged 2 commits into
mainfrom
claude/v3-endpoint-0x-redirects-818441

Conversation

@rafa-stacks

@rafa-stacks rafa-stacks commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Every v3 endpoint that takes a transaction id or block hash now answers a hash supplied without the 0x prefix with a 302 to the same URL with the prefix added. This matches the v1 behavior (/extended/v1/tx/:tx_id, /extended/v1/block/:hash).

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.70115% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/api/query-helpers.ts 97.22% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Percent-encoded hashes bypass redirects and can still cause datastore serialization failures.

1 open finding
What changed in this PR

Aligns v3 transaction and block hash handling with v1 by redirecting unprefixed hashes to prefixed URLs.

Changes:

  • Adds a shared redirect hook before validation and caching.
  • Applies it to six v3 endpoints.
  • Adds redirect and pass-through regression tests.
File Description
tests/​api/​transactions/​v3-hash-redirects.test.ts Tests redirects, preserved queries, and unchanged inputs.
src/​api/​routes/​v3/​transactions.ts Hooks transaction detail, events, and batch routes.
src/​api/​routes/​v3/​principals.ts Hooks both balance-change routes.
src/​api/​routes/​v3/​blocks.ts Hooks block transaction lookups.
src/​api/​query-helpers.ts Adds shared path and query hash redirects.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/api/query-helpers.ts Resolved
@rafa-stacks
rafa-stacks marked this pull request as ready for review October 8, 2026 17:30
@rafa-stacks
rafa-stacks merged commit fb04c8d into main Oct 8, 2026
26 checks passed
@rafa-stacks
rafa-stacks deleted the claude/v3-endpoint-0x-redirects-818441 branch October 8, 2026 19:16

This branch was successfully deployed

1 active deployment
Production — 6065b928 Deployed Oct 8, 2026 by rafa-stacks via build-publish #3827
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants