Skip to content

Conversation

@aniket866
Copy link

@aniket866 aniket866 commented Feb 2, 2026

screen-capture.16.webm
  • Auto select the network selected in user's wallet

  • Added Added the Citrea Testnet configuration to the active chains list in the main application file to register it as a supported network.

Closes #53
@kumawatkaran523 Please review

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Citrea Testnet network support with integrated RPC configuration and network switching
  • Improvements

    • Enhanced contract error reporting with more descriptive error types for improved transaction failure diagnostics

@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 2026

📝 Walkthrough

Walkthrough

This pull request introduces custom error types in the Chainvoice contract to replace string-based revert messages, updates corresponding test assertions, and enables Citrea Testnet support across the frontend application by adding chain configuration entries and UI icons.

Changes

Cohort / File(s) Summary
Contract Error Handling
contracts/src/Chainvoice.sol
Introduced 20 custom error declarations (Unauthorized, Reentrancy, ZeroAddress, etc.) replacing string-based require/revert messages throughout invoice creation, payment, cancellation, and withdrawal functions.
Contract Tests
contracts/test/Chainvoice.t.sol
Updated test expectations to use selector-based reverts (e.g., Chainvoice.NotAuthorizedPayer.selector) instead of string message matching for error assertions.
Frontend Chain Configuration
frontend/src/utils/chainConfig.js, frontend/src/page/CreateInvoice.jsx
Added Citrea Testnet to exported chain configuration and mapped its chain ID (5115) to public RPC endpoint.
Frontend UI Integration
frontend/src/App.jsx, frontend/src/components/NetworkSwitcher.jsx
Appended citreaTestnet to AllChains array, imported BatchPayment module, added Bitcoin icon (orange) for Citrea Testnet in network switcher component.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • Zahnentferner

Poem

🐰✨ Custom errors now declare with pride,
No more strings to hide and confide,
Citrea joins the chain of friends,
With Bitcoin icons and RPC ends,
The contract speaks in types so bright! 🌟

🚥 Pre-merge checks | ✅ 1 | ❌ 4
❌ Failed checks (3 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title describes automatic network detection from wallet, but changes include contract error refactoring unrelated to network selection. Consider revising the title to reflect both major changes (e.g., 'Refactor contracts with custom errors and auto-detect wallet network') or split into separate PRs.
Out of Scope Changes check ⚠️ Warning Contract error refactoring (20 new custom errors replacing string messages) appears unrelated to network selection feature requested in issue #53. Remove contract error changes from this PR or update linked issue to explicitly include error refactoring as a requirement.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive The PR addresses issue #53's requirement to auto-select user's wallet network, and includes Citrea Testnet configuration, but also contains unrelated contract error refactoring. Confirm whether contract error refactoring is required by issue #53 or should be split into a separate PR. Verify all commits are intentional.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Would it be possible to choose the network in a better way?

1 participant