Skip to content

feat: filter transactions#2464

Open
Wutche wants to merge 2 commits into
getAlby:masterfrom
Wutche:fix/2463-transaction-filters
Open

feat: filter transactions#2464
Wutche wants to merge 2 commits into
getAlby:masterfrom
Wutche:fix/2463-transaction-filters

Conversation

@Wutche

@Wutche Wutche commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

Adds basic transaction list filtering.

This adds backend-supported filters for:

  • minimum transaction amount in sats
  • showing or hiding failed payments

The filters are applied before counting and pagination, so filtered transaction totals and pages stay correct.

The frontend exposes these filters inside the existing transaction list menu to avoid adding extra clutter to the wallet screen.

Fixes #2463.

Summary by CodeRabbit

  • New Features
    • Transaction filtering: Users can now filter payments by minimum amount and choose whether to show failed transactions.
    • Filter-aware empty state: When filters are active, the list shows “No matching payments” with guidance to adjust filters.
    • Filter management: Added filter controls to the transactions menu, including “Clear filters”.
    • Pagination behavior: Page resets to 1 when relevant filters change.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6c36feca-bc64-480b-9aea-b55abbefe0b4

📥 Commits

Reviewing files that changed from the base of the PR and between 21576ed and 037bcce.

📒 Files selected for processing (2)
  • http/http_service.go
  • wails/wails_handlers.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • http/http_service.go

📝 Walkthrough

Walkthrough

Adds transaction filtering by minimum amount and failed-payment visibility across the service, API, HTTP and Wails handlers, and frontend transaction list UI. Filter state is now managed in the wallet screens and passed through the menu, hook, and list components.

Changes

Transaction Filtering End-to-End

Layer / File(s) Summary
Service filter type and predicates
transactions/transactions_service.go, transactions/list_transactions_test.go
Adds ListTransactionsFilter with MinAmountMsat and ShowFailed, applies both conditions in transaction queries, and adds tests for minimum amount and hiding failed transactions.
API contract and request parsing
api/models.go, api/transactions.go, http/http_service.go, wails/wails_handlers.go
Extends the API ListTransactions contract with ListTransactionsFilters, forwards filters into the service, parses minAmountSat and showFailed from HTTP and Wails transaction-list requests, and updates InfoResponse field alignment.
Frontend filter types and URL builder
frontend/src/hooks/useTransactions.ts
Adds TransactionFilters and defaultTransactionFilters, builds transaction URLs with optional filter query params, and threads filters through useTransactions.
Transactions menu filter UI
frontend/src/components/TransactionsListMenu.tsx
Adds filter props and renders minimum-amount and failed-payment controls, clear-filters behavior, and active-filter styling alongside export actions.
Filtered transaction list state and empty state
frontend/src/components/TransactionsList.tsx
Passes filters into transaction fetching, resets pagination when filters change, and changes empty-state text when filters are active.
Screen-level filter state wiring
frontend/src/screens/wallet/Lightning.tsx, frontend/src/components/connections/AppTransactionList.tsx
Creates local transaction filter state in both screens and wires it into the menu and transaction list components.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant TransactionsListMenu
  participant Lightning_or_AppTransactionList as Lightning / AppTransactionList
  participant useTransactions
  participant HTTPHandler as listTransactionsHandler
  participant TransactionsService

  User->>TransactionsListMenu: Select minimum amount or toggle failed payments
  TransactionsListMenu->>Lightning_or_AppTransactionList: onFiltersChange(updatedFilters)
  Lightning_or_AppTransactionList->>useTransactions: render with filters
  useTransactions->>HTTPHandler: GET /api/transactions?minAmountSat=X&showFailed=false
  HTTPHandler->>TransactionsService: ListTransactions(..., ListTransactionsFilter)
  TransactionsService-->>HTTPHandler: filtered rows
  HTTPHandler-->>useTransactions: response data
  useTransactions-->>Lightning_or_AppTransactionList: updated list
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • im-adithya
  • rolznz

Poem

🐇 Hop, hop — the filters bloom bright,
Sats and failed flags hop into sight.
One checkbox, one slider, a list that can change,
Tiny rabbit paws sorting payments arranged.

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately describes the main change: transaction filtering.
Linked Issues check ✅ Passed The PR implements both requested filters from #2463: minimum amount and failed-payment visibility.
Out of Scope Changes check ✅ Passed The changes stay focused on transaction filtering, related UI plumbing, and tests, with no clear unrelated scope.

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

✨ 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: 1

🤖 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 `@http/http_service.go`:
- Around line 771-775: In the minAmountSatParam parsing block, after
successfully parsing the query parameter into parsedMinAmountSat using
strconv.ParseUint, add an upper-bound validation check to ensure the parsed
value does not exceed a reasonable maximum threshold before performing the
multiplication by 1000 to convert to minAmountMsat. Only assign the converted
value to filters.MinAmountMsat if the value passes both the existing
greater-than-zero check and the new upper-bound guard, otherwise skip the
assignment to reject oversized user inputs.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: f285392e-7341-4828-8cd3-90931bb6cf54

📥 Commits

Reviewing files that changed from the base of the PR and between 222031a and 21576ed.

📒 Files selected for processing (10)
  • api/models.go
  • api/transactions.go
  • frontend/src/components/TransactionsList.tsx
  • frontend/src/components/TransactionsListMenu.tsx
  • frontend/src/components/connections/AppTransactionList.tsx
  • frontend/src/hooks/useTransactions.ts
  • frontend/src/screens/wallet/Lightning.tsx
  • http/http_service.go
  • transactions/list_transactions_test.go
  • transactions/transactions_service.go

Comment thread http/http_service.go
@rolznz

rolznz commented Jun 26, 2026

Copy link
Copy Markdown
Member

I haven't reviewed it yet, but thanks for the PR! I also added another idea which would be useful is to be able to search by keyword.

@Wutche

Wutche commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

I haven't reviewed it yet, but thanks for the PR! I also added another idea which would be useful is to be able to search by keyword.

Okay should I proceed with the search by keyword implementation?

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.

Basic filtering in transaction list

2 participants