Fix: Update ChainvoiceABI.js to include batch invoice functions#175
Fix: Update ChainvoiceABI.js to include batch invoice functions#175Atharva0506 wants to merge 2 commits into
Conversation
|
Warning Review limit reached
More reviews will be available in 51 minutes. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe frontend ABI definition is updated to match the contract’s expanded interface. It adds batch invoice, ownership-transfer, Waku key, fee, and treasury entries, updates invoice field shapes, and includes the corresponding events and custom errors. ChangesChainvoice ABI surface expansion
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/src/contractsABI/ChainvoiceABI.js`:
- Around line 190-198: The invoice tuple field order changed, so consumers are
reading the wrong values for decryption and rendering. Update SentInvoice.jsx
and any other invoice consumers to treat index 7 as invoiceDataHash and index 8
as encryptedHash, then swap the assignments/usage accordingly wherever the tuple
is decoded. Make sure the decryption path uses the encrypted payload from the
correct field and the hash comparison/reference uses invoiceDataHash, and apply
the same fix to the other affected tuple read sites referenced by the ABI
change.
- Around line 112-120: The batch-create call order is mismatched between the ABI
and the UI, causing `CreateInvoicesBatch` to pass `encryptedPayloads` into the
`bytes32[]` slot. Update the argument ordering in the `CreateInvoicesBatch` call
path so `encryptedHashes` is passed before `encryptedPayloads`, matching the
`batch-create` signature exposed by `ChainvoiceABI`. If the deployed contract
uses a different order, regenerate or correct the ABI so the named arguments and
types stay aligned with the contract.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: c90836a6-7999-42b0-8424-ffc99a2c5827
📒 Files selected for processing (1)
frontend/src/contractsABI/ChainvoiceABI.js
DeveloperAmrit
left a comment
There was a problem hiding this comment.
The updated frontend ABI contains several functions, events, and errors that do not exist in the actual Chainvoice.sol smart contract.
Extra items:
- Functions:
- getWakuPublicKey(address)
- registerWakuPublicKey(bytes)
- wakuPublicKeys(address)
- Events:
- WakuKeyRegistered(address,bytes)
- Errors:
- InvalidInvoiceHash()
- InvalidWakuKey()
If the frontend uses this updated ABI to interact with the deployed Chainvoice contract and attempts to call any of these functions, the transaction will revert because these functions are completely absent from the actual contract code.
|
@DeveloperAmrit thanks for the review. I actually kept those changes intentionally because we are migrating from Lit Protocol to Waku. I have already created a separate PR for that, but it contains a lot of file changes. Based on @kumawatkaran523 suggestions, I am trying to break it down into smaller PRs. You can take a look at the Smart Contract PR (#169). For now, let's wait for @kumawatkaran523 review and suggestions before making further changes. |
Addressed Issues:
Fixes #172
Screenshots/Recordings:
TODO: If applicable, add screenshots or recordings that demonstrate the interface before and after the changes.
Description
Updates the frontend's contract ABI configuration to include the newly implemented batch transaction functions from the smart contract (
createInvoicesBatch,payInvoicesBatch, etc.).This resolves the
TypeError: N.createInvoicesBatch is not a functionerror that prevented users from creating batch invoices in the UI.Additional Notes:
ChainvoiceABI.jswere synced directly from the latestChainvoice.jsonartifact compiled by Foundry (forge build).AI Usage Disclosure:
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.
Check one of the checkboxes below:
I have used the following AI models and tools: TODO
Checklist
Summary by CodeRabbit
New Features
Bug Fixes