Skip to content

Conversation

@bordalix
Copy link
Collaborator

@bordalix bordalix commented Aug 5, 2025

closes #135

Summary by CodeRabbit

  • Bug Fixes
    • Improved validation for Lightning invoices by ensuring that invoices without a defined amount now display an error message and cannot proceed.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 5, 2025

Walkthrough

A validation was added to the recipient input logic in the Send form to check for the presence of a non-zero amount in pasted Lightning invoices. If the invoice lacks a defined amount or specifies zero, an error message is set and further processing is halted, preventing the user from continuing.

Changes

Cohort / File(s) Change Summary
Lightning Invoice Validation
src/screens/Wallet/Send/Form.tsx
Added a check to ensure pasted Lightning invoices have a non-zero amount; sets error and blocks progress if not.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SendForm
    participant InvoiceParser

    User->>SendForm: Paste Lightning invoice
    SendForm->>InvoiceParser: Parse invoice
    InvoiceParser-->>SendForm: Return satoshis amount
    alt Amount undefined or zero
        SendForm->>User: Display error "Invoice must have amount defined"
        SendForm-->>User: Prevent continue
    else Amount valid
        SendForm->>User: Allow continue
    end
Loading

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Assessment against linked issues

Objective Addressed Explanation
Throw an error if Bolt11 invoice has no amount / 0 amount and prevent to tap Continue (#135)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 087d903 and abfc20e.

📒 Files selected for processing (1)
  • src/screens/Wallet/Send/Form.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: in src/lib/bolt11.ts, the code is copied from the original bitcoinjs/bolt11 library (https://github....
Learnt from: bordalix
PR: arkade-os/wallet#106
File: src/lib/bolt11.ts:153-155
Timestamp: 2025-07-07T14:41:35.991Z
Learning: In src/lib/bolt11.ts, the code is copied from the original bitcoinjs/bolt11 library (https://github.com/bitcoinjs/bolt11/blob/master/payreq.js) and should be kept unchanged to maintain compatibility with the upstream source, even if there are potential improvements or syntax issues.

Applied to files:

  • src/screens/Wallet/Send/Form.tsx
📚 Learning: in src/lib/asp.ts, only the collaborativeexit function should accept both iwallet and serviceworkerw...
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.

Applied to files:

  • src/screens/Wallet/Send/Form.tsx
📚 Learning: in src/screens/init/restore.tsx, the input component for private key restoration intentionally omits...
Learnt from: bordalix
PR: arkade-os/wallet#121
File: src/screens/Init/Restore.tsx:58-58
Timestamp: 2025-07-21T18:25:36.391Z
Learning: In src/screens/Init/Restore.tsx, the Input component for private key restoration intentionally omits the `value` prop to make it uncontrolled. This is a security feature to prevent the private key from being displayed if users navigate away and return to the screen, avoiding potential exposure of sensitive data in the UI.

Applied to files:

  • src/screens/Wallet/Send/Form.tsx
⏰ 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). (1)
  • GitHub Check: Cloudflare Pages: arkade-wallet
🔇 Additional comments (1)
src/screens/Wallet/Send/Form.tsx (1)

100-100: LGTM! Clean validation for invoices without amounts.

The validation correctly addresses the PR objective by checking for Lightning invoices without defined amounts and providing clear user feedback. The early return prevents further processing and the error message is user-friendly.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch invoice_no_amount

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cloudflare-workers-and-pages
Copy link

Deploying wallet-for-riga with  Cloudflare Pages  Cloudflare Pages

Latest commit: abfc20e
Status: ✅  Deploy successful!
Preview URL: https://eacf9c8f.wallet-23u.pages.dev
Branch Preview URL: https://invoice-no-amount.wallet-23u.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link

Deploying arkade-wallet with  Cloudflare Pages  Cloudflare Pages

Latest commit: abfc20e
Status: ✅  Deploy successful!
Preview URL: https://c2be1115.arkade-wallet.pages.dev
Branch Preview URL: https://invoice-no-amount.arkade-wallet.pages.dev

View logs

@tiero tiero merged commit a5408a3 into master Aug 5, 2025
4 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Aug 14, 2025
Closed
@coderabbitai coderabbitai bot mentioned this pull request Sep 19, 2025
@bordalix bordalix deleted the invoice_no_amount branch October 15, 2025 13:52
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.

Throw an error if Bolt11 invoice has no amount / 0 amount and prevent to tap Continue

3 participants