Repository navigation
feat(adapter): add Zcash data layer - #406
Merged
Merged
Conversation
8 of 12 tasks
8 tasks
Zebra calls throw a typed ZcashRpcError instead of returning empty data, retry after a 429 with backoff, and report unsupported methods so address pages can degrade on hosted gateways.
MatiasOS
force-pushed
the
issue-398-zcash-core
branch
from
November 20, 2026 22:11
76da72f to
3712ede
Compare
|
🚀 Preview: https://pr-406--openscan.netlify.app |
1.3.0-alpha.0 publishes the Zcash RPC lists (rpcs/zec/mainnet.json, rpcs/zec/testnet.json) and the Zcash network logo, so the explorer now loads both from metadata instead of falling back. It adds no other files. The metadata RPC cache is keyed by version and refreshes itself.
- Classify a definitive JSON-RPC answer before any 429, so a self-hosted "not found" no longer waits on Tatum's rate limit and ends as rateLimited. - Calls take an AbortSignal: retry waits and unsent calls stop on abort. - Remember methods the endpoints reject for the session (shared per network and endpoint list), so pages stop probing blocked methods. - getAddress asks getaddressbalance first and skips utxos/txids when the address index is unavailable. - getBlockSummaries reports failed heights instead of dropping them, and stops once a block stays rate limited. - resolveTransparentInputs spends no calls over the cap, keeps inputs resolved before a failure, and resumes from them. - computeFee returns coinbase | unknown | known instead of number | null. - Blocks carry the shielded coinbase reward. - Address detection is network-aware and accepts uppercase Bech32m. - Pool unions derive from as-const lists; raw Zebra types pick from the connector's types; parallel metadata is transformed per provider. - Drop unused getBlockTransactions and formatZatoshis.
This was referenced Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds the Zcash data layer:
ZcashAdapterover the Zebra RPC.DataServicebuilds that adapter fortype: "zcash"networks.There is no UI yet; the pages land in the next PRs of the stack.
The adapter is designed around hosted gateway limits. Tatum allows about 5 requests per minute per IP and blocks the address index:
getblockas decimal strings, so one block costs one call, with nogetblockhashor header round trip.ZcashRpcError(unsupported,rateLimitedorfailed) instead of returning empty data.ok,unsupportedorerror), so pages can degrade when the address index is blocked.Related Issue
Part of #398. Stacked on #405.
Type of Change
Changes Made
src/types/index.ts:NetworkTypegains"zcash", plus new Zcash types for blocks, transactions, shielded bundles, the mempool and addresses. Amounts are zatoshi integers.src/services/adapters/ZcashAdapter/:src/utils/zcashUtils.ts:t1/t3/tm/t2,zs/ztestsapling,u/utest,zc/ztandtex/textestprefixes.src/utils/zcashFormatters.tsandsrc/config/zcashConstants.ts.AdapterFactory.createZcashAdapter.DataServicebuilds aZcashClientthroughClientFactory(registry routing), and exposesisZcash()andgetZcashAdapter().isZcashNetwork()helper.MetadataService: Zcash genesis hashes now map torpcs/zec/{mainnet,testnet}.json. Before, they were dropped because they didn't match the BTC mapping.rpcStorage: built-in Tatum zebrad defaults for both networks..claude/rules/architecture.md: documentsZcashClientandZcashAdapter.Screenshots (if applicable)
N/A (no UI changes)
Checklist
npm run format:fixandnpm run lint:fixnpm run typecheckwith no errorsnpm run test:runAdditional Notes
36a167f6…ce2e3is Ironwood only, with emptyvinandvout. Fee: 10,000 zat.c973d2f1…4aa7dbis Sapling plus Ironwood. Fee: 20,000 zat.zcashUtils.test.ts, 16 inZcashAdapter.test.ts). The full suite passes with 148 tests.zecandtzecnetwork entries.trees.ironwoodaren't modelled.RPC errordrops the JSON-RPC error code.Review follow-up
rpcs/zec/*.json, which only exists from@openscan/metadata@1.3.0-alpha.0; with1.2.1-alpha.0those requests returned 404.rateLimited.{ signal }. Retry waits and calls not yet sent stop on abort; a request already in flight finishes (the connector can't cancel it) and its result is dropped.getZcashSession), so pages stop re-probing methods a gateway blocks.getAddressasksgetaddressbalancefirst and skips UTXOs and history when the index is unavailable: one probe instead of three, on a ~5 requests/min budget.failedHeightsinstead of dropping blocks, and stop once a block stays rate limited.computeFeereturnscoinbase | unknown | known, so pages can tell a coinbase from an unknown fee.coinbaseShieldedZat, the reward a shielded coinbase pays into Sapling or Orchard.tm…isn't accepted on mainnet) and accepts all-uppercase Bech32m.as constlists; raw Zebra types are picked from the connector's types; parallel-strategy metadata is transformed per provider; unusedgetBlockTransactionsandformatZatoshisare gone;patterns.mdnow says non-EVM adapters are standalone classes.zcashFormattersstill re-exports the shared formatters, so Zcash UI imports from one module rather than the Bitcoin one.issue-<n>-<slug>convention used for the whole stack; renaming would close the PRs.Tests after the follow-up
npm run test:run: 190 passing.