Skip to content

Fix: Update ChainvoiceABI.js to include batch invoice functions#175

Open
Atharva0506 wants to merge 2 commits into
StabilityNexus:mainfrom
Atharva0506:fix/update-chainvoice-abi
Open

Fix: Update ChainvoiceABI.js to include batch invoice functions#175
Atharva0506 wants to merge 2 commits into
StabilityNexus:mainfrom
Atharva0506:fix/update-chainvoice-abi

Conversation

@Atharva0506

@Atharva0506 Atharva0506 commented Jun 26, 2026

Copy link
Copy Markdown
Member

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 function error that prevented users from creating batch invoices in the UI.

Additional Notes:

  • The changes in ChainvoiceABI.js were synced directly from the latest Chainvoice.json artifact compiled by Foundry (forge build).
  • No UI logic was changed; this purely patches the ethers/wagmi contract interface so the frontend correctly recognizes the batch functions.

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:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: TODO

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • New Features

    • Added support for batch invoice creation and payment.
    • Introduced ownership transfer, Waku public key registration, and expanded fee/treasury management options.
  • Bug Fixes

    • Updated invoice data fields and related responses for better consistency across invoice views and lookups.
    • Expanded contract error handling to provide clearer feedback when actions fail.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Atharva0506, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8a292158-ad27-4588-8a1e-b097dccc4bf2

📥 Commits

Reviewing files that changed from the base of the PR and between 4ddc43a and 2572b09.

📒 Files selected for processing (1)
  • frontend/src/contractsABI/ChainvoiceABI.js

Walkthrough

The 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.

Changes

Chainvoice ABI surface expansion

Layer / File(s) Summary
Invoice and ownership methods
frontend/src/contractsABI/ChainvoiceABI.js
The ABI adds batch invoice methods, ownership-transfer calls, Waku key lookups, and updated invoice getter shapes using invoiceDataHash.
Treasury and Waku config methods
frontend/src/contractsABI/ChainvoiceABI.js
The ABI adds Waku key registration plus fee, treasury, and withdrawal methods and getters.
Events for invoices and ownership
frontend/src/contractsABI/ChainvoiceABI.js
The ABI adds fee, batch, ownership-transfer, treasury, and Waku events and aligns existing invoice events to the updated shapes.
Custom errors
frontend/src/contractsABI/ChainvoiceABI.js
The ABI adds custom error definitions for validation, authorization, payment, token, and withdrawal failures.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

Typescript Lang

Poem

A bunny hopped through ABI pages bright,
Adding batch spells for invoices tonight 🐰
Fees, keys, and events now chime,
Errors hop in right on time,
The contract sings in tidy code delight.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the ABI update and batch invoice function addition, matching the main change.
Linked Issues check ✅ Passed The ABI now includes createInvoicesBatch and payInvoicesBatch, so the reported batch-invoice failure should be resolved.
Out of Scope Changes check ✅ Passed The added functions, events, and errors appear to come from syncing the full contract ABI artifact, not unrelated frontend logic.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between a429f12 and 4ddc43a.

📒 Files selected for processing (1)
  • frontend/src/contractsABI/ChainvoiceABI.js

Comment thread frontend/src/contractsABI/ChainvoiceABI.js
Comment thread frontend/src/contractsABI/ChainvoiceABI.js

@DeveloperAmrit DeveloperAmrit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated frontend ABI contains several functions, events, and errors that do not exist in the actual Chainvoice.sol smart contract.

Extra items:

  1. Functions:
    • getWakuPublicKey(address)
    • registerWakuPublicKey(bytes)
    • wakuPublicKeys(address)
  2. Events:
    • WakuKeyRegistered(address,bytes)
  3. 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.

@Atharva0506

Copy link
Copy Markdown
Member Author

@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.

@DeveloperAmrit DeveloperAmrit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved from my side

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.

[BUG]: Frontend batch invoice creation fails due to missing createInvoicesBatch in ABI

2 participants