-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: disable rango from ui on unsupported networks #590
base: develop
Are you sure you want to change the base?
fix: disable rango from ui on unsupported networks #590
Conversation
WalkthroughThis pull request introduces improvements to error handling and network support validation across multiple files in the swap providers. The changes focus on enhancing error logging in the ParaSwap provider, refining network support checks in the Rango provider, and making minor code cleanup in the test suite. The modifications aim to provide more informative error messages and improve the robustness of network validation logic. Changes
Suggested reviewers
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
💼 Build Files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
packages/swap/src/providers/paraswap/index.ts (3)
201-201
: Use structured error logging.
Rather than printing the entire error object, consider including a structured mapping (e.g., error code, message) to facilitate potential automatic handling or metrics capturing.
248-248
: Avoid swallowing rejection reasons.
If you suppress promise rejections here, debugging becomes more challenging. Consider rethrowing or returning a meaningful error that can be handled upstream or by the caller.
335-335
: Handle partial fallback for quotes.
While logging an error is helpful for debugging, returningnull
from the catch block ends the flow silently. Consider providing a fallback result or user notification if partial data is acceptable.packages/swap/src/providers/rango/index.ts (2)
314-320
: Add user feedback for unsupported networks.
Currently, the method logs a message and returns early, which is a good start. For better UX, consider providing a user-visible notification or an explicit error so that clients can gracefully handle unsupported networks.
439-444
: Ensure real-time tracking of newly supported networks.
You're using a static map (supportedNetworkInfoByName
) to check Enkrypt's support. If your system supports dynamic updates, consider refreshing this map periodically or at runtime to handle newly supported networks without redeployment.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
packages/swap/src/providers/paraswap/index.ts
(4 hunks)packages/swap/src/providers/rango/index.ts
(2 hunks)packages/swap/src/providers/rango/supported.ts
(1 hunks)packages/swap/tests/changelly.test.ts
(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- packages/swap/tests/changelly.test.ts
- packages/swap/src/providers/rango/supported.ts
🔇 Additional comments (2)
packages/swap/src/providers/paraswap/index.ts (1)
286-297
: ValidatepriceRoute
behavior.
The added checks forpriceRoute
help clarify different error paths, which is good. Ensure any upstream logic handles these throws, or you'll encounter unhandled promise rejections in some frameworks.
[approve]packages/swap/src/providers/rango/index.ts (1)
448-448
: Keep naming consistent across providers.
Renaming this method toisNetworkSupportedByEnkryptAndRango
clarifies its purpose. Ensure the code references, config, and docs across the repo reflect the new nomenclature to avoid confusion.
Summary by CodeRabbit
New Features
Bug Fixes
Refactor