fix: route provider auto-selection by operation capability (#17) - #25
Open
meridianmindx wants to merge 1 commit into
Open
fix: route provider auto-selection by operation capability (#17)#25meridianmindx wants to merge 1 commit into
meridianmindx wants to merge 1 commit into
Conversation
When resolving providers for an operation (e.g. getBalance on Solana), filter out providers that declare the capability as unsupported so that keyless/fallback providers with capability support (like solscan) are chosen rather than throwing UnsupportedOperationError from a configured provider that lacks the operation (like helius). - Add `capabilities` to built-in provider metadata in `src/providers/index.ts` - Expose `supportsCapability(name, capability)` from core registry - Pass requested capability to `resolveProvider()` across CLI commands, MCP server, and extensions - Verify built-in metadata matches loaded class capabilities in registry unit tests - Add resolution test verifying `balances` on Solana skips Helius while `txHistory` retains it - Guard JSON.parse reviver context for node < 21 compatibility
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.
Closes #17
Problem
When
HELIUS_API_KEYis present in the environment and a user queriesexplorers_balancefor Solana (or runs balance without an explicit provider), auto-selection routed tohelius. However, Helius Enhanced Transactions v0 does not expose an address balance endpoint, causinggetBalance()to throwUnsupportedOperationError("getBalance", "helius").Solution
capabilitiesto built-in provider metadata insrc/providers/index.ts(evaluated statically without loading provider implementation modules).supportsCapability(name, capability)to core registry.resolveProvider(preferred?, chain?, capability?)to consider operation capability when resolving candidate providers.balance,tx,contract,tokens,transfers,gas,block), MCP tool handlers, and Pi/OMP extensions.balanceson Solana skips Helius and selects Solscan, whiletxHistoryandtxDetailstill route to Helius.JSON.parsereviver context to maintain compatibility with Node < 21.Verification
pnpm test:run→ 23/23 test files passed, 237/237 tests passing green.pnpm typecheck(tsc --noEmit) → 0 errors.pnpm build(obuild) → Clean bundle generation with 0 B side effects across all provider chunks.npx oxlint&npx oxfmt --check→ 0 warnings, 0 errors, 100% formatted.Base EVM Payout Address:
0xcFDa9f32d292661740a6d0B4c00867E34c05c56D