Skip to content

feat(gl-sdk): add list_invoices, list_pays, and unified list_payments API#689

Open
angelix wants to merge 2 commits intomainfrom
ave-list-payments
Open

feat(gl-sdk): add list_invoices, list_pays, and unified list_payments API#689
angelix wants to merge 2 commits intomainfrom
ave-list-payments

Conversation

@angelix
Copy link
Copy Markdown
Contributor

@angelix angelix commented Apr 1, 2026

Summary

  • Add list_invoices() and list_pays() methods on Node, wrapping CLN's native gRPC RPCs with full filter and pagination support
  • Add unified list_payments() that merges invoices and pays into a single chronological timeline, defaulting to COMPLETE status
  • New types: Invoice, InvoiceStatus, Pay, Payment, PaymentDirection, PaymentStatus, ListIndex, and response wrappers
  • Payment includes optional invoice/pay fields for drill-down access to CLN-specific details
  • Kotlin extension functions for idiomatic default-parameter API
  • Python integration tests and Android instrumented tests

Note: This PR includes the auth API commit (5cb9e0a) as a dependency. That work should land first or be reviewed alongside.

API

// Low-level — full CLN filter/pagination params, all optional
node.listInvoices(label = "my-invoice")
node.listPays(status = PayStatus.COMPLETE)

// Unified — defaults to COMPLETE, sorted newest-first
node.listPayments()
node.listPayments(PaymentStatus.PENDING)

Test plan

  • Python: type construction, empty lists, invoice visibility in list_invoices and list_payments, status filtering (COMPLETE default, explicit PENDING/EXPIRED)
  • Android: enum values, invoice appears in list_invoices and list_payments, default filter excludes unpaid, PENDING filter includes unpaid
  • cargo build -p gl-sdk and cargo build -p gl-sdk-node compile clean
  • cargo test -p gl-sdk passes

High-level auth API: Config type (network + optional DeveloperCert)
and four free functions — register(), recover(), connect(),
register_or_recover() — replacing the multi-object auth ceremony.

Node gains credentials(), disconnect() with AtomicBool guard on all
RPC methods, and with_signer() internal constructor. Handle::spawn()
runs signers on a dedicated tokio runtime to avoid block_on deadlock.

NAPI fix: Node lost Clone when AtomicBool was added. Wrap inner
GlNode in Arc at the NAPI wrapper level for spawn_blocking, matching
the existing NodeEventStream pattern.

Includes Python and Android instrumented tests for the auth API.
@angelix angelix force-pushed the ave-list-payments branch from 14b284f to ae1c1fa Compare April 1, 2026 22:33
… API

Three new Node methods for querying payment history:

- list_invoices(): wraps CLN ListInvoices with full native filtering
  (label, invstring, payment_hash, offer_id) and pagination (index,
  start, limit)
- list_pays(): wraps CLN ListPays with native filtering (bolt11,
  payment_hash, status) and pagination
- list_payments(): merges both into a unified Payment timeline sorted
  newest-first, defaults to COMPLETE status filter

New types: Invoice, InvoiceStatus, Pay, ListInvoicesResponse,
ListPaysResponse, Payment, PaymentDirection, PaymentStatus,
ListPaymentsResponse, ListIndex. Payment includes optional invoice/pay
fields for drill-down access to full CLN-specific details.

Kotlin extensions provide default null parameters for idiomatic API.
Includes Python integration tests and Android instrumented tests.
@angelix angelix force-pushed the ave-list-payments branch from ae1c1fa to 61a46c6 Compare April 2, 2026 07:28
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.

1 participant