Skip to content

feat: add payment-method abstraction - #1131

Open
a1denvalu3 wants to merge 9 commits into
cashubtc:mainfrom
a1denvalu3:feat/payment-method-agnostic
Open

feat: add payment-method abstraction#1131
a1denvalu3 wants to merge 9 commits into
cashubtc:mainfrom
a1denvalu3:feat/payment-method-agnostic

Conversation

@a1denvalu3

Copy link
Copy Markdown
Collaborator

Summary

  • add a typed, allowlisted payment-method plugin registry with BOLT11 as the built-in adapter
  • generalize mint quote, melt quote, settlement, feature discovery, wallet APIs, persistence, and CLI method selection
  • retain the existing /v1/.../bolt11 endpoints, defaults, wire fields, and legacy wallet tables for older clients
  • add method-specific metadata storage and safe response projection so internal quote fields are never exposed as plugin extras

This establishes the abstraction boundary for methods such as BOLT12 or on-chain payments without adding or advertising a new production payment rail.

Compatibility

  • existing BOLT11 routes and public wallet methods remain available
  • BOLT11 remains the default method
  • legacy BOLT11 quote tables remain canonical for existing clients
  • new database changes are additive
  • method-specific request/response data is validated by the selected plugin

Validation

  • BOLT11 mint/melt: 41 passed, 1 skipped
  • wallet: 32 passed, 1 skipped
  • payment-method regression tests: 7 passed
  • Ruff: passed
  • git diff --check: passed

make check still reports two unrelated existing Optional-path mypy errors in cashu/mint/management_rpc/management_rpc.py.

Review notes

This includes additive schema and protocol-boundary work, so it requires maintainer review under the repository contribution policy.

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.27957% with 295 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.03%. Comparing base (3282be2) to head (260bedc).
⚠️ Report is 6 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
cashu/payment/grpc/payment_processor_pb2.py 12.90% 81 Missing ⚠️
cashu/payment/grpc_processor.py 74.87% 49 Missing ⚠️
cashu/payment/grpc/payment_processor_pb2_grpc.py 59.74% 31 Missing ⚠️
cashu/mint/startup.py 21.62% 29 Missing ⚠️
cashu/payment/registry.py 62.00% 19 Missing ⚠️
cashu/wallet/crud.py 43.75% 18 Missing ⚠️
cashu/wallet/cli/cli.py 62.79% 16 Missing ⚠️
cashu/mint/router.py 78.43% 11 Missing ⚠️
cashu/payment/base.py 85.93% 9 Missing ⚠️
cashu/wallet/v1_api.py 86.44% 8 Missing ⚠️
... and 9 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1131      +/-   ##
==========================================
- Coverage   74.85%   74.03%   -0.82%     
==========================================
  Files         112      119       +7     
  Lines       12589    13492     +903     
==========================================
+ Hits         9423     9989     +566     
- Misses       3166     3503     +337     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant