Skip to content

feat(ffi): expose mint quote query methods - #2217

Closed
j-kon wants to merge 1 commit into
cashubtc:mainfrom
j-kon:feat/ffi-mint-quote-query-methods
Closed

j-kon wants to merge 1 commit into
cashubtc:mainfrom
j-kon:feat/ffi-mint-quote-query-methods

Conversation

@j-kon

@j-kon j-kon commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR exposes existing wallet mint quote query methods through the FFI Wallet.

Recent FFI work exposed quote recovery/sync methods such as check_all_mint_quotes and mint_unissued_quotes. This PR adds the complementary query methods so generated bindings can inspect active and unissued mint quotes.

Changes

  • Add Wallet::get_active_mint_quotes to crates/cdk-ffi
  • Add Wallet::get_unissued_mint_quotes to crates/cdk-ffi
  • Convert core return values into existing FFI-compatible quote types
  • Keep generated binding outputs out of this PR

Testing

  • cargo fmt
  • cargo test -p cdk-ffi

Partially addresses #1767

@github-project-automation github-project-automation Bot moved this to Backlog in CDK Jul 9, 2026
@codecov

codecov Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.83%. Comparing base (cc02d2d) to head (6b44700).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2217      +/-   ##
==========================================
+ Coverage   75.81%   75.83%   +0.02%     
==========================================
  Files         369      369              
  Lines       89594    89615      +21     
==========================================
+ Hits        67924    67958      +34     
+ Misses      21670    21657      -13     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@j-kon

j-kon commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@cdk-bot review

@asmogo
asmogo self-requested a review July 15, 2026 15:30
@asmogo

asmogo commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Hi @j-kon. Thanks for extending this. Do you need those functions for a specific use case? There are already similar functions available in the database trait, which are exported to the FFI layer.

async fn get_mint_quotes(&self) -> Result<Vec<MintQuote>, FfiError>;

and
async fn get_unissued_mint_quotes(&self) -> Result<Vec<MintQuote>, FfiError>;

@j-kon

j-kon commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @j-kon. Thanks for extending this. Do you need those functions for a specific use case? There are already similar functions available in the database trait, which are exported to the FFI layer.

async fn get_mint_quotes(&self) -> Result<Vec<MintQuote>, FfiError>;

and

async fn get_unissued_mint_quotes(&self) -> Result<Vec<MintQuote>, FfiError>;

Thanks, I checked the existing database methods.

The wallet methods add wallet-scoped filtering beyond the raw database queries:

  • get_active_mint_quotes limits results to the wallet’s current mint and unit, excludes issued quotes, and excludes expired quotes.
  • get_unissued_mint_quotes limits stored unissued quotes to the current mint and unit.

The use case I had in mind is a Flutter wallet pending-deposits view, where the app can request quotes belonging to that specific wallet context without reimplementing CDK’s filtering rules in Dart.

That said, I understand the database API already exposes the underlying data. Would you prefer keeping these wallet-level convenience methods, narrowing the PR to only get_active_mint_quotes, or using the database methods from the binding instead?

@j-kon
j-kon force-pushed the feat/ffi-mint-quote-query-methods branch from 414108b to 72dc6c4 Compare July 27, 2026 12:48

@cdk-bot cdk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified findings approved for disclosure:

  • FFI doc for get_unissued_mint_quotes misstates return semantics (includes issued bolt12 and expired quotes) (low) - see inline comment

Comment thread crates/cdk-ffi/src/wallet.rs
@j-kon
j-kon force-pushed the feat/ffi-mint-quote-query-methods branch from 72dc6c4 to 6b44700 Compare August 11, 2026 12:14
@j-kon

j-kon commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Hi @asmogo, I noticed #2479 is now restructuring the wallet and FFI APIs around resumable workflows.

Given that direction, I wanted to check before rebasing this PR. The original use case here was a Flutter pending-deposits view, where the app needs wallet-scoped visibility into active/unissued mint quotes without reimplementing CDK filtering rules.

With the new API in #2479, would you prefer that use case to go through operations() / resume_mint() / synchronization instead of exposing these quote-query methods directly?

If so, I’m happy to close this PR rather than rebase an API that is being replaced. If these helpers are still useful on the new surface, I can adapt the contribution to the new architecture.

@j-kon

j-kon commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Closing this for now in light of the ongoing wallet and FFI refactoring in #2479. Once the new resumable operations architecture lands, I will revisit whether these query helpers or equivalent operation-scoped inspection methods are needed on the new surface. Thanks!

@j-kon j-kon closed this Sep 21, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in CDK Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants