Skip to content

fix: destructure chainId from useAccount in CreateInvoicesBatch#119

Merged
kumawatkaran523 merged 1 commit intoStabilityNexus:mainfrom
sach2004:fix/batch-invoice-chainid
Feb 18, 2026
Merged

fix: destructure chainId from useAccount in CreateInvoicesBatch#119
kumawatkaran523 merged 1 commit intoStabilityNexus:mainfrom
sach2004:fix/batch-invoice-chainid

Conversation

@sach2004
Copy link
Contributor

@sach2004 sach2004 commented Feb 12, 2026

chainId was undefined when building the contract address key,
causing 'Unsupported network' error on all chains.

Addressed Issues:

Fixes #107

Screenshots/Recordings:

No UI changes — this is a one-line variable destructuring fix.

Before:

const { isConnected } = useAccount(); // chainId not destructured

After:

const { isConnected, chainId } = useAccount(); // chainId now available

Without this fix, import.meta.env[VITE_CONTRACT_ADDRESS_${chainId}] evaluates to VITE_CONTRACT_ADDRESS_undefined, which is always undefined, causing the "Unsupported network" error on every chain.

Additional Notes:

Other components like SentInvoice.jsx and GenerateLink.jsx already destructure chainId correctly — this component just missed it.

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 Stability Nexus's 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.

Summary by CodeRabbit

  • Enhancement
    • The application now dynamically selects the correct contract address based on the blockchain network you are connected to, enabling seamless support for multiple networks during batch invoice creation.

@kumawatkaran523 please check this out!!
thankyou!

chainId was undefined when building the contract address key,
causing 'Unsupported network' error on all chains. Fixes StabilityNexus#107.
@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

This PR fixes a bug in batch invoice creation by adding chainId to the useAccount() destructuring and using it to dynamically select network-appropriate contract addresses based on the connected chain.

Changes

Cohort / File(s) Summary
ChainId Destructuring
frontend/src/page/CreateInvoicesBatch.jsx
Extended useAccount() destructuring to include chainId, enabling environment-specific contract address selection via VITE_CONTRACT_ADDRESS_${chainId} lookup.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • Feature: Multi chain Support #48: Both PRs address multi-chain contract address selection by destructuring and using chainId from useAccount() for environment variable lookups in invoice creation flows.

Poem

🐰 A hop and a fix, so simple and neat,
ChainId now flows in the batch beat,
Networks align with addresses true,
Invoices batch—now the chain knows what to do! ✨

🚥 Pre-merge checks | ✅ 5 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
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.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: destructuring chainId from useAccount in CreateInvoicesBatch component.
Linked Issues check ✅ Passed The PR changes directly address the root cause in issue #107 by adding chainId to the destructured values from useAccount(), enabling correct contract address lookup.
Out of Scope Changes check ✅ Passed All changes are scoped to the specific fix: adding chainId to useAccount destructuring; no unrelated modifications detected.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main
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.

@kumawatkaran523 kumawatkaran523 merged commit 06f75f0 into StabilityNexus:main Feb 18, 2026
1 check passed
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] chainId undefined in CreateInvoicesBatch.jsx

2 participants