Repository navigation
Conversation
…ake and DRep probes
Mesh's BlockfrostProvider.get rejects with a JSON string
({"data":…,"status":404}), not an Error. fetchStakeAccountStatus and
fetchDrepStatus only recognised err.status / Error messages, so the normal
"never seen on chain" answer was rethrown as a lookup failure:
- GET /api/v1/stakeAccountInfo answered 500 for every never-registered
stake account (a fresh wallet), and drepInfo 500 for an unregistered DRep.
- MCP transaction_preview with certificates failed 502 STAKE_LOOKUP_FAILED
for exactly the wallets that need a registration, and a vote draft for an
unregistered DRep failed 502 DREP_LOOKUP_FAILED instead of the
"register first" refusal.
Both probes now use the shape-tolerant check the DRep explorer already had,
moved to src/utils/blockfrost-not-found.ts (re-exported from drep-profile).
stakeAccountInfo also spliced the raw query value into Blockfrost's
/accounts/{stake} path with the server key; it now accepts only a
lowercase bech32 reward address shape (key or script) and derives the
network from its prefix, answering 400 otherwise.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rkSXDaEvnprpYppMe53rd
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
What & why
Mesh's
BlockfrostProvider.getrejects with a JSON string (parseHttpError→{"data":…,"headers":…,"status":404}), not anError.fetchStakeAccountStatusandfetchDrepStatusonly recognisederr.status === 404or anErrormessage, so Blockfrost's normal "never seen on chain" 404 was rethrown as a lookup failure. Reproduced against the realBlockfrostProviderwith a local 404 server: the probe threw a string.Impact on
preprodtoday:GET /api/v1/stakeAccountInfo, never-registered stake account (every fresh wallet){active:false, poolId:null}GET /api/v1/drepInfo, unregistered DRep{active:false}transaction_previewwith certificates, unregistered stake credentialSTAKE_LOOKUP_FAILEDDREP_LOOKUP_FAILEDvote-drep-unregistered("register first")Fix: both probes use the shape-tolerant
isBlockfrostNotFoundthat the DRep explorer already had. It moved tosrc/utils/blockfrost-not-found.tsand is re-exported fromdrep-profile.ts, so the explorer's behaviour is unchanged. Non-404 failures (500, network) are still rethrown, so they still map to 500/502.Hardening in the same route:
stakeAccountInfospliced the rawstakeAddressquery into Blockfrost's/accounts/{stake}path, using the server's project key. Values likestake_test1…/../../addresses/…,…/historyand…?page=2reached other Blockfrost endpoints. Now the route only accepts a lowercase bech32 reward-address shape, for both key and script credentials. It takes the network from the prefix and answers 400 for anything else, before any Blockfrost call.Tests
src/__tests__/stakeAccountInfo.test.ts(13 tests) covers:stakeAccountStatus.test.tsanddrepStatus.test.tscover:BlockfrostProviderand a local HTTP 404, which pins the shape to the library versionnpx tsc --noEmit: cleannode scripts/run-tests.mjs:Not verified / notes
scripts/ci) send lowercasestake…addresses. The auth-negative CI check still gets its 401 because auth runs first.Errorwhose message contains "404" as not-found.https://claude.ai/code/session_017rkSXDaEvnprpYppMe53rd
Generated by Claude Code