Conversation
|
💼 Build Files |
WalkthroughUpdated URL construction in the Blockscout asset handler to strip any trailing or embedded Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
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: 1
🧹 Nitpick comments (1)
packages/extension/src/providers/ethereum/libs/assets-handlers/blockscout.ts (1)
31-32: Consider URL utility for more robust endpoint handling.The current string replace approach works for the immediate fix, but consider using the URL API or a dedicated URL utility for more robust endpoint manipulation in the future. This would handle edge cases like:
- Preserving legitimate query parameters
- Handling trailing slashes consistently
- Case-insensitive matching if needed
For example, using the URL API:
const buildBlockscoutUrl = (base: string, path: string): string => { // Remove 'api?' if present (case-insensitive) const cleanBase = base.replace(/api\?/i, ''); // Ensure no double slashes when joining const normalizedBase = cleanBase.endsWith('/') ? cleanBase.slice(0, -1) : cleanBase; return `${normalizedBase}/${path}`; }; const nativeTokenUrl = buildBlockscoutUrl( NetworkEndpoints[chain], `api/v2/addresses/${encodedAddress}` ); const tokenBalancesUrl = buildBlockscoutUrl( NetworkEndpoints[chain], `api/v2/addresses/${encodedAddress}/tokens?type=ERC-20` );
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/extension/src/providers/ethereum/libs/assets-handlers/blockscout.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: buildAll
- GitHub Check: test
- GitHub Check: test
Summary by CodeRabbit
Bug Fixes
Chores