Import wallet client and chains from viem#72
Import wallet client and chains from viem#72aniket866 wants to merge 2 commits intoDjedAlliance:mainfrom
Conversation
📝 WalkthroughWalkthroughAdded Changes
Sequence Diagram(s)(omitted — change is a small validation addition and does not introduce a multi-component sequential flow) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
stablepay-sdk/src/core/Wallet.js (1)
20-40: Guard against unsupportedchainIdbefore creating the client.
getChainConfigreturnsundefinedfor anychainIdnot in the map, which can lead to a misconfigured client or runtime errors. Consider throwing a clear error when the chain isn’t supported.✅ Proposed fix
getChainConfig(chainId) { const chains = { // Add other chains as needed }; - return chains[chainId]; + const chain = chains[chainId]; + if (!chain) { + throw new Error(`Unsupported chainId: ${chainId}`); + } + return chain; }
Add error handling for unsupported chain IDs in Wallet.js
Changes:
File:
stablepay-sdk/src/core/Wallet.jsAction: Added missing imports from viem and viem/chains.
Impact: The Wallet class can now be instantiated and connected without crashing.
@Zahnentferner , a Patch but crucial , Please review
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.