Skip to content

Update cdk portal wallet#2

Open
denmeh wants to merge 381 commits intoPortalTechnologiesInc:mainfrom
denmeh:cdk-portal
Open

Update cdk portal wallet#2
denmeh wants to merge 381 commits intoPortalTechnologiesInc:mainfrom
denmeh:cdk-portal

Conversation

@denmeh
Copy link
Member

@denmeh denmeh commented Dec 1, 2025

thesimplekid and others added 30 commits August 18, 2025 16:25
* feat: uuid version

* feat: rustls version
* Add PostgreSQL support for mint and wallet

* Fixed bug to avoid empty calls `get_proofs_states`

* Fixed SQL bug

* Avoid redudant clone()

* Add more tests for the storage layer

* Minor enhacements

* Add a generic function to execute db operations

This function would log slow operations and log errors

* Provision a postgres db for tests

* Update deps for msrv

* Add postgres to pipeline

* feat: add psgl to example and docker

* feat: db url fmt

---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
* feat(cdk): add Bolt12 mint quote subscription support

Extends subscription to handle Bolt12 payment method alongside existing Bolt11 support across wallet, mint, and CLI components.
Co-authored-by: thesimplekid <tsk@thesimplekid.com>
Http retry should only happen at Http Error (which are transport errors)
* feat: refresh keysets

* feat: rename get_mint_info to fetch_mint_info
…shubtc#978)

* refactor(cdk): defer BOLT12 invoice fetching to payment execution

Move BOLT12 invoice generation from quote creation to payment time, make
request_lookup_id optional for offers, and simplify payment structures by
removing unnecessary boxing and intermediate storage of invoices.
* fix: lnbits payment check and units

---------

Co-authored-by: asmo <asmogo@protonmail.com>
* feat: cln as msats

* fix(logging): correct bolt12 payment amount units and reduce log noise

- Fix CLN bolt12 payment logging to display msats instead of sats
- Add tower_http filter to reduce integration test log verbosity
- Use correct payment amount variable in mint quote pubsub notifications
implement zeroize on Drop for Secret, Wallet, and MultiMintWallet
this erases sensitive memory addresses before deallocation
…cations

Fixed bolt12 missing payments notifications
feat: zeroize cryptographic secrets on drop
cashubtc#987)

* refactor(cdk-lnbits): migrate to LNbits v1 websocket API and remove webhook support

- Remove webhook-based payment notifications in favor of v1 websocket API
- Add explicit documentation that only LNbits v1 API is supported
- Remove webhook_url parameter and related router setup code
- Simplify payment status handling by removing pending status logic
- Switch to local lnbits-rs dependency for development
- Remove unused axum dependency and clean up imports
- Update configuration documentation and examples

* refactor(cdk-lnbits): extract payment processing logic into helper methods

Improve code readability by separating message processing, payment response
creation, and payment hash decoding into dedicated methods. This reduces
complexity in the main payment waiting loop while maintaining identical
functionality

* chore: bump lnbits-rs
* feat: add LDK Node Lightning backend with comprehensive integration

- Add new cdk-ldk-node crate implementing Lightning backend using LDK Node
- Extend MintPayment trait with start/stop methods for processor lifecycle management
- Add LDK Node configuration support to cdk-mintd with chain source and gossip options
- Enhance mint startup/shutdown to properly manage payment processor lifecycle

---------

Co-authored-by: Erik <78821053+swedishfrenchpress@users.noreply.github.com>
* fix: refund keys must sign after locktime

* fix: custom tags

* refactor: locktime verification and refund
crodas and others added 25 commits November 23, 2025 18:35
Extract duplicate SQL query logic into generic inline helper functions that
work with both database connections and transactions. This reduces code
duplication and improves maintainability by centralizing query definitions.
Refactor the get_notification helper to get_notifications to read multiple
websocket messages at once, improving test reliability when multiple
notifications arrive in quick succession.
* Remove max_order from keyset database schema

Fixes cashubtc#1074

Remove the max_order column from the keyset table across the mint database
layer, replacing it with the amounts field that was already being used. This
simplifies the schema by eliminating redundant data.

* Extract standard keyset amounts generation to reusable function

Consolidates repeated pattern of `(0..32).map(|n| 2u64.pow(n)).collect()` into
a single reusable helper function. This reduces code duplication and makes the
keyset amount generation pattern more maintainable.
* fix: use the client id from mint configuration
When selecting proofs with fee inclusion, adding extra proofs to cover
the fee shortfall also adds new fees. The previous single-pass approach
could leave the net amount below the requested amount. This changes to
an iterative loop that continues selecting additional proofs until the
net amount (total - fees) meets or exceeds the target.

refactor: remove swap before melt
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* feat(cdk): add get_proofs_for_transaction method to multi-mint wallet

Enables retrieving all proofs associated with a transaction ID across
multiple mint wallets. The method searches all wallets to locate the
transaction and returns its proofs from the correct wallet.
Allows melting proofs that are not stored in the wallet's database,
enabling external proof handling similar to receive_proofs.
  The duplicate melt quote check now happens during melt execution (when
  transitioning to PENDING state) rather than during quote creation.

  This allows wallets to create multiple quotes for the same invoice,
  which is useful for retry scenarios. The constraint that only one
  quote per request_lookup_id can be PENDING or PAID is still enforced,
  but at melt time via FOR UPDATE row locking.
…ubtc#1367)

Fixes two issues in SQLite connection handling:

**Connection Pool Resource Initialization:**
- Move resource creation before incrementing connection counter in pool.rs
- Ensures counter is only incremented after successful resource creation
- Prevents counter increment on resource creation failure
- Fixes potential resource leak where counter could be incremented without a
  valid resource

**Path Validation:**
- Add empty string check before parent directory existence validation
- Allows relative paths like "test.db" to work correctly
- Prevents false negative errors for valid relative database paths
- Only validates parent directory existence for non-empty paths

**Test Coverage:**
- Add test case `bug_opening_relative_path()` to verify relative path handling
- Ensures databases can be created with simple filenames like "test.db"

These changes fix issues where:
1. Connection pool counter could become inconsistent with actual connections
2. Relative database paths were incorrectly rejected
* Add Python wallet test suite with CI integration

Adds comprehensive Python test suite for CDK FFI wallet database operations
with full CI/CD integration.

Test Infrastructure:
- Add 6 wallet operation tests covering core functionality:
  - Wallet creation with SQLite backend
  - Mint management (add/query/retrieve)
  - Keyset management (add/query by ID or mint)
  - Keyset counter operations (increment/read)
  - Quote operations (mint/melt queries)
  - Proof retrieval by Y values
- Automatic path resolution and library loading from target/ directories
- Isolated test execution with temporary SQLite databases
- Proper cleanup with try/finally blocks

Build Integration:
- Add `just ffi-test` command for convenient test execution
- Automatically generates Python bindings before running tests
- Clear output with test progress and results summary

CI Integration:
- Add `ffi-tests` job to GitHub Actions workflow
- Runs after pre-commit-checks with 30-minute timeout
- Ubuntu runner with Python 3.11
- Nix development environment with caching
- Rust cache for faster builds
…cashubtc#1361)

* feat(cdk): add get_token_data and get_mint_keysets to MultiMintWallet

Add methods to extract token data (mint URL, proofs, memo) and retrieve
keysets for a specific mint. Includes FFI bindings and example usage
@denmeh denmeh marked this pull request as ready for review December 10, 2025 15:58
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.