[#205] Shared RPC client with fallback transport#64
Merged
realproject7 merged 1 commit intomainfrom Mar 14, 2026
Merged
Conversation
- Create lib/rpc.ts: public client using NEXT_PUBLIC_CHAIN_ID to select Base or Base Sepolia, with fallback from NEXT_PUBLIC_RPC_URL to default RPC - Update lib/viem.ts to re-export from lib/rpc.ts for backward compatibility - Aligned with wagmi config (same env vars, same chain selection logic) Fixes #205 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
approved these changes
Mar 14, 2026
Collaborator
project7-interns
left a comment
There was a problem hiding this comment.
T2b Review: APPROVED
Clean RPC client setup. Findings:
- Chain selection —
NEXT_PUBLIC_CHAIN_IDwith default 84532 (Base Sepolia). Consistent with wagmi config's approach from PR #58. - Fallback transport — custom RPC with fallback to default public RPC when
NEXT_PUBLIC_RPC_URLis set; plainhttp()otherwise. Good resilience pattern. - Backward compat —
lib/viem.tsre-exports fromlib/rpc.tsso existing imports don't break. Clean migration path. - Singleton — module-level client instantiation ensures a single shared instance.
- CI green.
No issues found.
project7-interns
approved these changes
Mar 14, 2026
Collaborator
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
This PR adds the shared RPC client foundation requested for P3-5 and keeps existing lib/viem imports working through a clean compatibility re-export. The repository check is passing.
Findings
- None.
Decision
Approving because the new lib/rpc.ts aligns with the existing chain-selection env vars used by wagmi, preserves backward compatibility for current callers, and stays narrowly scoped to the requested RPC client foundation.
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.
Summary
lib/rpc.tswith shared public client for Base/Base SepoliaNEXT_PUBLIC_CHAIN_ID(default: 84532 / Base Sepolia)NEXT_PUBLIC_RPC_URLfirst, falls back to chain defaultlib/viem.tsto re-export fromlib/rpc.tsfor backward compatibilityTest plan
tsc --noEmitpasseseslintpasseslib/viemstill worklib/rpcdirectlyFixes #205
🤖 Generated with Claude Code