Skip to content

feat(search): route Zcash addresses and block hashes - #411

Open
MatiasOS wants to merge 3 commits into
issue-398-zcash-mempoolfrom
issue-398-zcash-search
Open

MatiasOS wants to merge 3 commits into
issue-398-zcash-mempoolfrom
issue-398-zcash-search

Conversation

@MatiasOS

Copy link
Copy Markdown
Member

Description

Makes the network search box work on Zcash networks.

  • Addresses: transparent (t1/t3, tm/t2), Sapling (zs1, ztestsapling1), unified (u1, utest1), Sprout (zc, zt) and TEX (tex1, textest1) addresses go to /{network}/address/:address. Before this change they were rejected as an invalid search. They're only recognized while a Zcash network is selected.
  • Heights: go to the block page, as before.
  • 64-character hashes: Zcash block hashes and txids have the same shape, so a hash still goes to the transaction page. When no transaction matches, that page now looks the hash up as a block and redirects to it.

Related Issue

Part of #398. Stacked on #410.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactoring
  • Performance improvement
  • Other (please describe):

Changes Made

  • useSearch: recognizes Zcash addresses, using the existing isZcashAddress util, when the selected network is Zcash.
  • ZcashTransactionPage: if getrawtransaction fails for a 64-character hex hash, it tries getblock with that hash and redirects to the block page. Otherwise it shows the original error.
  • e2e/fixtures/rpcMock.ts: function handlers can now return rpcError(code, message), which answers with a JSON-RPC error instead of a result.
  • The Zcash RPC mock now fails the way Zebra does for unknown transactions and block hashes. It still serves:
    • the transactions spent by the fixture's inputs
    • pending transactions for mempool txids
  • A hermetic e2e spec at e2e/tests/shared/mocked/zcash-search.spec.ts. It covers:
    • searching by height and by txid
    • a block-hash redirect
    • a hash that matches nothing
    • an invalid search term

Screenshots (if applicable)

N/A (no visual changes)

Checklist

  • I have run npm run format:fix and npm run lint:fix
  • I have run npm run typecheck with no errors
  • I have run tests with npm run test:run
  • I have tested my changes locally
  • I have updated documentation if needed
  • My code follows the project's architecture patterns

Additional Notes

  • Redirect cost: redirecting a block hash takes at most three calls: the failed transaction lookup, the block lookup, and the block page's own fetch.
  • Address pages: address search now routes correctly, but the address page itself arrives in the next PR of the stack. Its e2e coverage lands there too.
  • Tests:
    • npm run test:run: 151 passing.
    • Hermetic Zcash e2e specs (dashboard, blocks, transactions, mempool, search): 16 passed.

Zcash block hashes and txids are both 64 hex characters, so search keeps sending hashes to the transaction page, which now looks the hash up as a block and redirects when no transaction matches.
@MatiasOS
MatiasOS added this pull request to stack #414 September 15, 2026 00:17
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