浏览代码

feat: remove legacy wrapper (#1591)

tsk 1 月之前
父节点
当前提交
1fa24aa5e6

+ 7 - 1
crates/cdk-cli/src/sub_commands/melt.rs

@@ -254,7 +254,13 @@ pub async fn pay(
                 let melted = if let Some(mint_url) = selected_mint {
                     // User selected a specific mint - use the new mint-specific functions
                     let quote = multi_mint_wallet
-                        .melt_quote(&mint_url, bolt11_str.clone(), options)
+                        .melt_quote(
+                            &mint_url,
+                            PaymentMethod::BOLT11,
+                            bolt11_str.clone(),
+                            options,
+                            None,
+                        )
                         .await?;
 
                     println!("Melt quote created:");

+ 13 - 3
crates/cdk-ffi/src/multi_mint_wallet.rs

@@ -352,13 +352,21 @@ impl MultiMintWallet {
     pub async fn mint_quote(
         &self,
         mint_url: MintUrl,
-        amount: Amount,
+        payment_method: PaymentMethod,
+        amount: Option<Amount>,
         description: Option<String>,
+        extra: Option<String>,
     ) -> Result<MintQuote, FfiError> {
         let cdk_mint_url: cdk::mint_url::MintUrl = mint_url.try_into()?;
         let quote = self
             .inner
-            .mint_quote(&cdk_mint_url, amount.into(), description)
+            .mint_quote(
+                &cdk_mint_url,
+                payment_method,
+                amount.map(Into::into),
+                description,
+                extra,
+            )
             .await?;
         Ok(quote.into())
     }
@@ -432,14 +440,16 @@ impl MultiMintWallet {
     pub async fn melt_quote(
         &self,
         mint_url: MintUrl,
+        payment_method: PaymentMethod,
         request: String,
         options: Option<MeltOptions>,
+        extra: Option<String>,
     ) -> Result<MeltQuote, FfiError> {
         let cdk_mint_url: cdk::mint_url::MintUrl = mint_url.try_into()?;
         let cdk_options = options.map(Into::into);
         let quote = self
             .inner
-            .melt_quote(&cdk_mint_url, request, cdk_options)
+            .melt_quote(&cdk_mint_url, payment_method, request, cdk_options, extra)
             .await?;
         Ok(quote.into())
     }

+ 0 - 54
crates/cdk-ffi/src/wallet.rs

@@ -250,20 +250,6 @@ impl Wallet {
         Ok(proofs.into_iter().map(|p| p.into()).collect())
     }
 
-    /// Get a melt quote
-    pub async fn melt_bolt11_quote(
-        &self,
-        request: String,
-        options: Option<MeltOptions>,
-    ) -> Result<MeltQuote, FfiError> {
-        let cdk_options = options.map(Into::into);
-        let quote = self
-            .inner
-            .melt_quote(cdk::nuts::PaymentMethod::BOLT11, request, cdk_options, None)
-            .await?;
-        Ok(quote.into())
-    }
-
     /// Prepare a melt operation
     ///
     /// Returns a `PreparedMelt` that can be confirmed or cancelled.
@@ -305,33 +291,6 @@ impl Wallet {
         Ok(PreparedMelt::new(Arc::clone(&self.inner), &prepared))
     }
 
-    /// Get a mint quote using a unified interface for any payment method
-    ///
-    /// This method supports bolt11, bolt12, and custom payment methods.
-    /// For custom methods, you can pass extra JSON data that will be forwarded
-    /// to the payment processor.
-    ///
-    /// # Arguments
-    /// * `amount` - Optional amount to mint (required for bolt11)
-    /// * `method` - Payment method to use (bolt11, bolt12, or custom)
-    /// * `description` - Optional description for the quote
-    /// * `extra` - Optional JSON string with extra payment-method-specific fields (for custom methods)
-    pub async fn mint_quote_unified(
-        &self,
-        amount: Option<Amount>,
-        method: PaymentMethod,
-        description: Option<String>,
-        extra: Option<String>,
-    ) -> Result<MintQuote, FfiError> {
-        let method: cdk::nuts::PaymentMethod = method.into();
-
-        let quote = self
-            .inner
-            .mint_quote(method, amount.map(Into::into), description, extra)
-            .await?;
-        Ok(quote.into())
-    }
-
     pub async fn mint_unified(
         &self,
         quote_id: String,
@@ -347,19 +306,6 @@ impl Wallet {
 
         Ok(proofs.into_iter().map(|p| p.into()).collect())
     }
-    /// Get a quote for a bolt12 melt
-    pub async fn melt_bolt12_quote(
-        &self,
-        request: String,
-        options: Option<MeltOptions>,
-    ) -> Result<MeltQuote, FfiError> {
-        let cdk_options = options.map(Into::into);
-        let quote = self
-            .inner
-            .melt_quote(cdk::nuts::PaymentMethod::BOLT12, request, cdk_options, None)
-            .await?;
-        Ok(quote.into())
-    }
     /// Get a melt quote using a unified interface for any payment method
     ///
     /// This method supports bolt11, bolt12, and custom payment methods.

+ 8 - 2
crates/cdk-integration-tests/tests/async_melt.rs

@@ -37,7 +37,10 @@ async fn test_async_melt_returns_pending() {
     .expect("failed to create new wallet");
 
     // Step 1: Mint some tokens
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
     let _proofs = proof_streams
@@ -106,7 +109,10 @@ async fn test_sync_melt_completes_fully() {
     .expect("failed to create new wallet");
 
     // Step 1: Mint some tokens
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
     let _proofs = proof_streams

+ 10 - 5
crates/cdk-integration-tests/tests/fake_auth.rs

@@ -333,7 +333,10 @@ async fn test_mint_with_auth() {
 
     let mint_amount: Amount = 100.into();
 
-    let quote = wallet.mint_bolt11_quote(mint_amount, None).await.unwrap();
+    let quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(mint_amount), None, None)
+        .await
+        .unwrap();
 
     let proofs = wallet
         .wait_and_mint_quote(
@@ -516,7 +519,7 @@ async fn test_reuse_auth_proof() {
 
     {
         let quote = wallet
-            .mint_bolt11_quote(10.into(), None)
+            .mint_quote(PaymentMethod::BOLT11, Some(10.into()), None, None)
             .await
             .expect("Quote should be allowed");
 
@@ -530,7 +533,9 @@ async fn test_reuse_auth_proof() {
         .unwrap();
 
     {
-        let quote_res = wallet.mint_bolt11_quote(10.into(), None).await;
+        let quote_res = wallet
+            .mint_quote(PaymentMethod::BOLT11, Some(10.into()), None, None)
+            .await;
         assert!(
             matches!(quote_res, Err(Error::TokenAlreadySpent)),
             "Expected AuthRequired error, got {:?}",
@@ -647,7 +652,7 @@ async fn test_refresh_access_token() {
 
     // Try to get a mint quote with the refreshed token
     let mint_quote = wallet
-        .mint_bolt11_quote(mint_amount, None)
+        .mint_quote(PaymentMethod::BOLT11, Some(mint_amount), None, None)
         .await
         .expect("failed to get mint quote with refreshed token");
 
@@ -733,7 +738,7 @@ async fn test_auth_token_spending_order() {
     // Use tokens and verify they're used in the expected order (FIFO)
     for i in 0..3 {
         let mint_quote = wallet
-            .mint_bolt11_quote(10.into(), None)
+            .mint_quote(PaymentMethod::BOLT11, Some(10.into()), None, None)
             .await
             .expect("failed to get mint quote");
 

+ 127 - 34
crates/cdk-integration-tests/tests/fake_wallet.rs

@@ -45,7 +45,10 @@ async fn test_fake_tokens_pending() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -101,7 +104,10 @@ async fn test_fake_melt_payment_fail() {
     )
     .expect("Failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -176,7 +182,10 @@ async fn test_fake_melt_payment_fail_and_check() {
     )
     .expect("Failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -231,7 +240,10 @@ async fn test_fake_melt_payment_return_fail_status() {
     )
     .expect("Failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -322,7 +334,10 @@ async fn test_fake_melt_payment_error_unknown() {
     )
     .unwrap();
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -401,7 +416,10 @@ async fn test_fake_melt_payment_err_paid() {
     )
     .expect("Failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -463,7 +481,10 @@ async fn test_fake_melt_change_in_quote() {
     )
     .expect("Failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -543,7 +564,10 @@ async fn test_fake_mint_with_witness() {
         None,
     )
     .expect("failed to create new wallet");
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -570,7 +594,10 @@ async fn test_fake_mint_without_witness() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut payment_streams = wallet.payment_stream(&mint_quote);
 
@@ -622,7 +649,10 @@ async fn test_fake_mint_with_wrong_witness() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut payment_streams = wallet.payment_stream(&mint_quote);
 
@@ -680,7 +710,10 @@ async fn test_fake_mint_inflated() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut payment_streams = wallet.payment_stream(&mint_quote);
 
@@ -753,7 +786,10 @@ async fn test_fake_mint_multiple_units() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut payment_streams = wallet.payment_stream(&mint_quote);
 
@@ -853,7 +889,10 @@ async fn test_fake_mint_multiple_unit_swap() {
 
     wallet.refresh_keysets().await.unwrap();
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -874,7 +913,7 @@ async fn test_fake_mint_multiple_unit_swap() {
     wallet_usd.refresh_keysets().await.unwrap();
 
     let mint_quote = wallet_usd
-        .mint_bolt11_quote(100.into(), None)
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
         .await
         .unwrap();
 
@@ -981,7 +1020,10 @@ async fn test_fake_mint_multiple_unit_melt() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -1003,7 +1045,7 @@ async fn test_fake_mint_multiple_unit_melt() {
     .expect("failed to create new wallet");
 
     let mint_quote = wallet_usd
-        .mint_bolt11_quote(100.into(), None)
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
         .await
         .unwrap();
     println!("Minted quote usd");
@@ -1127,7 +1169,10 @@ async fn test_fake_mint_input_output_mismatch() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -1186,7 +1231,10 @@ async fn test_fake_mint_swap_inflated() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
     let fee_and_amounts = (0, ((0..32).map(|x| 2u64.pow(x)).collect::<Vec<_>>())).into();
@@ -1236,7 +1284,10 @@ async fn test_fake_mint_swap_spend_after_fail() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -1323,7 +1374,10 @@ async fn test_fake_mint_melt_spend_after_fail() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -1414,7 +1468,10 @@ async fn test_fake_mint_duplicate_proofs_swap() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -1495,7 +1552,10 @@ async fn test_fake_mint_duplicate_proofs_melt() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -1551,7 +1611,10 @@ async fn test_wallet_proof_recovery_after_failed_melt() {
     .expect("failed to create new wallet");
 
     // Mint 100 sats
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
     let _roof_streams = wallet
         .wait_and_mint_quote(
             mint_quote.clone(),
@@ -1641,7 +1704,10 @@ async fn test_concurrent_melt_same_invoice() {
 
     // Mint proofs for all wallets
     for (i, wallet) in wallets.iter().enumerate() {
-        let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+        let mint_quote = wallet
+            .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+            .await
+            .unwrap();
         let mut proof_streams =
             wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
         proof_streams
@@ -1738,7 +1804,10 @@ async fn test_wallet_proof_recovery_after_failed_swap() {
     .expect("failed to create new wallet");
 
     // Mint 100 sats
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
     let initial_proofs = proof_streams
         .next()
@@ -1825,7 +1894,7 @@ async fn test_melt_proofs_external() {
     .expect("failed to create sender wallet");
 
     let mint_quote = wallet_sender
-        .mint_bolt11_quote(100.into(), None)
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
         .await
         .unwrap();
 
@@ -1922,7 +1991,10 @@ async fn test_melt_with_swap_for_exact_amount() {
     .expect("failed to create new wallet");
 
     // Mint 100 sats - this will give us proofs in standard denominations
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -2005,7 +2077,10 @@ async fn test_melt_exact_proofs_no_swap_needed() {
     .expect("failed to create new wallet");
 
     // Mint a larger amount to have more denomination options
-    let mint_quote = wallet.mint_bolt11_quote(1000.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(1000.into()), None, None)
+        .await
+        .unwrap();
 
     let mut proof_streams = wallet.proof_stream(mint_quote.clone(), SplitTarget::default(), None);
 
@@ -2061,7 +2136,10 @@ async fn test_check_all_mint_quotes_bolt11() {
     .expect("failed to create new wallet");
 
     // Create first mint quote and pay it (using proof_stream triggers fake wallet payment)
-    let mint_quote_1 = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote_1 = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     // Wait for the payment to be registered (fake wallet auto-pays)
     let mut payment_stream_1 = wallet.payment_stream(&mint_quote_1);
@@ -2072,7 +2150,10 @@ async fn test_check_all_mint_quotes_bolt11() {
         .expect("no error");
 
     // Create second mint quote and pay it
-    let mint_quote_2 = wallet.mint_bolt11_quote(50.into(), None).await.unwrap();
+    let mint_quote_2 = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(50.into()), None, None)
+        .await
+        .unwrap();
 
     let mut payment_stream_2 = wallet.payment_stream(&mint_quote_2);
     payment_stream_2
@@ -2117,10 +2198,16 @@ async fn test_get_unissued_mint_quotes_wallet() {
     .expect("failed to create new wallet");
 
     // Create a quote but don't pay it (stays unpaid)
-    let unpaid_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let unpaid_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     // Create another quote and pay it but don't mint
-    let paid_quote = wallet.mint_bolt11_quote(50.into(), None).await.unwrap();
+    let paid_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(50.into()), None, None)
+        .await
+        .unwrap();
     let mut payment_stream = wallet.payment_stream(&paid_quote);
     payment_stream
         .next()
@@ -2129,7 +2216,10 @@ async fn test_get_unissued_mint_quotes_wallet() {
         .expect("no error");
 
     // Create a third quote and fully mint it
-    let minted_quote = wallet.mint_bolt11_quote(25.into(), None).await.unwrap();
+    let minted_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(25.into()), None, None)
+        .await
+        .unwrap();
     let mut proof_stream = wallet.proof_stream(minted_quote.clone(), SplitTarget::default(), None);
     proof_stream
         .next()
@@ -2181,7 +2271,10 @@ async fn test_refresh_mint_quote_status_updates_after_minting() {
     .expect("failed to create new wallet");
 
     let mint_amount = Amount::from(100);
-    let mint_quote = wallet.mint_bolt11_quote(mint_amount, None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(mint_amount), None, None)
+        .await
+        .unwrap();
 
     // Get the quote from localstore before minting
     let quote_before = wallet

+ 44 - 11
crates/cdk-integration-tests/tests/happy_path_mint_wallet.rs

@@ -109,7 +109,10 @@ async fn test_happy_mint_melt_round_trip() {
     .expect("Failed to connect");
     let (mut write, mut reader) = ws_stream.split();
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let invoice = Bolt11Invoice::from_str(&mint_quote.request).unwrap();
     pay_if_regtest(&get_test_temp_dir(), &invoice)
@@ -249,7 +252,10 @@ async fn test_happy_mint() {
 
     let mint_amount = Amount::from(100);
 
-    let mint_quote = wallet.mint_bolt11_quote(mint_amount, None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(mint_amount), None, None)
+        .await
+        .unwrap();
 
     assert_eq!(mint_quote.amount, Some(mint_amount));
 
@@ -299,7 +305,10 @@ async fn test_restore() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let invoice = Bolt11Invoice::from_str(&mint_quote.request).unwrap();
     pay_if_regtest(&get_test_temp_dir(), &invoice)
@@ -392,7 +401,10 @@ async fn test_restore_large_proof_count() {
     while remaining > 0 {
         let batch = remaining.min(batch_size);
 
-        let mint_quote = wallet.mint_bolt11_quote(batch.into(), None).await.unwrap();
+        let mint_quote = wallet
+            .mint_quote(PaymentMethod::BOLT11, Some(batch.into()), None, None)
+            .await
+            .unwrap();
 
         let invoice = Bolt11Invoice::from_str(&mint_quote.request).unwrap();
         pay_if_regtest(&get_test_temp_dir(), &invoice)
@@ -490,7 +502,10 @@ async fn test_restore_with_counter_gap() {
     .expect("failed to create new wallet");
 
     // Mint first batch of proofs (uses counters starting at 0)
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
     let invoice = Bolt11Invoice::from_str(&mint_quote.request).unwrap();
     pay_if_regtest(&get_test_temp_dir(), &invoice)
         .await
@@ -523,7 +538,10 @@ async fn test_restore_with_counter_gap() {
         .unwrap();
 
     // Mint second batch of proofs (uses counters after the gap)
-    let mint_quote2 = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote2 = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
     let invoice2 = Bolt11Invoice::from_str(&mint_quote2.request).unwrap();
     pay_if_regtest(&get_test_temp_dir(), &invoice2)
         .await
@@ -626,7 +644,10 @@ async fn test_melt_quote_status_after_melt() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let invoice = Bolt11Invoice::from_str(&mint_quote.request).unwrap();
     pay_if_regtest(&get_test_temp_dir(), &invoice)
@@ -709,7 +730,13 @@ async fn test_melt_quote_status_after_melt_multi_mint_wallet() {
         .expect("failed to add mint");
 
     let mint_quote = multi_mint_wallet
-        .mint_quote(&mint_url, 100.into(), None)
+        .mint_quote(
+            &mint_url,
+            PaymentMethod::BOLT11,
+            Some(100.into()),
+            None,
+            None,
+        )
         .await
         .unwrap();
 
@@ -735,7 +762,7 @@ async fn test_melt_quote_status_after_melt_multi_mint_wallet() {
     let invoice = create_invoice_for_env(Some(50)).await.unwrap();
 
     let melt_quote = multi_mint_wallet
-        .melt_quote(&mint_url, invoice, None)
+        .melt_quote(&mint_url, PaymentMethod::BOLT11, invoice, None, None)
         .await
         .unwrap();
 
@@ -791,7 +818,10 @@ async fn test_fake_melt_change_in_quote() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let bolt11 = Bolt11Invoice::from_str(&mint_quote.request).unwrap();
 
@@ -873,7 +903,10 @@ async fn test_pay_invoice_twice() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     pay_if_regtest(&get_test_temp_dir(), &mint_quote.request.parse().unwrap())
         .await

+ 21 - 6
crates/cdk-integration-tests/tests/multi_mint_wallet.rs

@@ -17,7 +17,7 @@ use bip39::Mnemonic;
 use cdk::amount::{Amount, SplitTarget};
 use cdk::mint_url::MintUrl;
 use cdk::nuts::nut00::ProofsMethods;
-use cdk::nuts::{CurrencyUnit, MeltQuoteState, MintQuoteState, Token};
+use cdk::nuts::{CurrencyUnit, MeltQuoteState, MintQuoteState, PaymentMethod, Token};
 use cdk::wallet::{MultiMintReceiveOptions, MultiMintWallet, SendOptions};
 use cdk_integration_tests::{create_invoice_for_env, get_mint_url_from_env, pay_if_regtest};
 use cdk_sqlite::wallet::memory;
@@ -47,7 +47,10 @@ async fn fund_multi_mint_wallet(
     mint_url: &MintUrl,
     amount: Amount,
 ) -> Amount {
-    let mint_quote = wallet.mint_quote(mint_url, amount, None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(mint_url, PaymentMethod::BOLT11, Some(amount), None, None)
+        .await
+        .unwrap();
 
     let invoice = Bolt11Invoice::from_str(&mint_quote.request).unwrap();
     pay_if_regtest(&get_test_temp_dir(), &invoice)
@@ -88,7 +91,13 @@ async fn test_multi_mint_wallet_mint() {
 
     // Create mint quote
     let mint_quote = multi_mint_wallet
-        .mint_quote(&mint_url, 100.into(), None)
+        .mint_quote(
+            &mint_url,
+            PaymentMethod::BOLT11,
+            Some(100.into()),
+            None,
+            None,
+        )
         .await
         .unwrap();
 
@@ -482,7 +491,13 @@ async fn test_multi_mint_wallet_check_all_mint_quotes() {
 
     // Create a mint quote
     let mint_quote = multi_mint_wallet
-        .mint_quote(&mint_url, 100.into(), None)
+        .mint_quote(
+            &mint_url,
+            PaymentMethod::BOLT11,
+            Some(100.into()),
+            None,
+            None,
+        )
         .await
         .unwrap();
 
@@ -603,7 +618,7 @@ async fn test_multi_mint_wallet_melt_with_mint() {
 
     // Create melt quote at specific mint
     let melt_quote = multi_mint_wallet
-        .melt_quote(&mint_url, invoice, None)
+        .melt_quote(&mint_url, PaymentMethod::BOLT11, invoice, None, None)
         .await
         .unwrap();
 
@@ -674,7 +689,7 @@ async fn test_multi_mint_wallet_list_transactions() {
     // Create an invoice and melt (this creates a melt transaction)
     let invoice = create_invoice_for_env(Some(50)).await.unwrap();
     let melt_quote = multi_mint_wallet
-        .melt_quote(&mint_url, invoice, None)
+        .melt_quote(&mint_url, PaymentMethod::BOLT11, invoice, None, None)
         .await
         .unwrap();
     multi_mint_wallet

+ 36 - 9
crates/cdk-integration-tests/tests/regtest.rs

@@ -47,7 +47,10 @@ async fn test_internal_payment() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     ln_client
         .pay_invoice(mint_quote.request.clone())
@@ -75,7 +78,10 @@ async fn test_internal_payment() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet_2.mint_bolt11_quote(10.into(), None).await.unwrap();
+    let mint_quote = wallet_2
+        .mint_quote(PaymentMethod::BOLT11, Some(10.into()), None, None)
+        .await
+        .unwrap();
 
     let melt = wallet
         .melt_quote(
@@ -162,7 +168,10 @@ async fn test_websocket_connection() {
     .expect("failed to create new wallet");
 
     // Create a small mint quote to test notifications
-    let mint_quote = wallet.mint_bolt11_quote(10.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(10.into()), None, None)
+        .await
+        .unwrap();
 
     // Subscribe to notifications for this quote
     let mut subscription = wallet
@@ -238,7 +247,10 @@ async fn test_multimint_melt() {
     let mint_amount = Amount::from(100);
 
     // Fund the wallets
-    let quote = wallet1.mint_bolt11_quote(mint_amount, None).await.unwrap();
+    let quote = wallet1
+        .mint_quote(PaymentMethod::BOLT11, Some(mint_amount), None, None)
+        .await
+        .unwrap();
     ln_client
         .pay_invoice(quote.request.clone())
         .await
@@ -254,7 +266,10 @@ async fn test_multimint_melt() {
         .await
         .expect("payment");
 
-    let quote = wallet2.mint_bolt11_quote(mint_amount, None).await.unwrap();
+    let quote = wallet2
+        .mint_quote(PaymentMethod::BOLT11, Some(mint_amount), None, None)
+        .await
+        .unwrap();
     ln_client
         .pay_invoice(quote.request.clone())
         .await
@@ -334,7 +349,10 @@ async fn test_cached_mint() {
 
     let mint_amount = Amount::from(100);
 
-    let quote = wallet.mint_bolt11_quote(mint_amount, None).await.unwrap();
+    let quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(mint_amount), None, None)
+        .await
+        .unwrap();
     ln_client
         .pay_invoice(quote.request.clone())
         .await
@@ -399,7 +417,10 @@ async fn test_regtest_melt_amountless() {
 
     let mint_amount = Amount::from(100);
 
-    let mint_quote = wallet.mint_bolt11_quote(mint_amount, None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(mint_amount), None, None)
+        .await
+        .unwrap();
 
     assert_eq!(mint_quote.amount, Some(mint_amount));
 
@@ -448,7 +469,10 @@ async fn test_attempt_to_mint_unpaid() {
 
     let mint_amount = Amount::from(100);
 
-    let mint_quote = wallet.mint_bolt11_quote(mint_amount, None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(mint_amount), None, None)
+        .await
+        .unwrap();
 
     assert_eq!(mint_quote.amount, Some(mint_amount));
 
@@ -472,7 +496,10 @@ async fn test_attempt_to_mint_unpaid() {
         }
     }
 
-    let mint_quote = wallet.mint_bolt11_quote(mint_amount, None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(mint_amount), None, None)
+        .await
+        .unwrap();
 
     let state = wallet
         .refresh_mint_quote_status(&mint_quote.id)

+ 8 - 2
crates/cdk-integration-tests/tests/test_fees.rs

@@ -28,7 +28,10 @@ async fn test_swap() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let invoice = Bolt11Invoice::from_str(&mint_quote.request).unwrap();
     pay_if_regtest(&get_temp_dir(), &invoice).await.unwrap();
@@ -89,7 +92,10 @@ async fn test_fake_melt_change_in_quote() {
     )
     .expect("failed to create new wallet");
 
-    let mint_quote = wallet.mint_bolt11_quote(100.into(), None).await.unwrap();
+    let mint_quote = wallet
+        .mint_quote(PaymentMethod::BOLT11, Some(100.into()), None, None)
+        .await
+        .unwrap();
 
     let bolt11 = Bolt11Invoice::from_str(&mint_quote.request).unwrap();
 

+ 2 - 2
crates/cdk/README.md

@@ -53,7 +53,7 @@ use std::time::Duration;
 #[cfg(feature = "wallet")]
 use cdk::amount::SplitTarget;
 use cdk_sqlite::wallet::memory;
-use cdk::nuts::{CurrencyUnit, MintQuoteState};
+use cdk::nuts::{CurrencyUnit, MintQuoteState, PaymentMethod};
 #[cfg(feature = "wallet")]
 use cdk::wallet::Wallet;
 #[cfg(feature = "wallet")]
@@ -76,7 +76,7 @@ async fn main() {
 
         let wallet = Wallet::new(mint_url, unit, Arc::new(localstore), seed, None).unwrap();
 
-        let quote = wallet.mint_bolt11_quote(amount, None).await.unwrap();
+        let quote = wallet.mint_quote(PaymentMethod::BOLT11, Some(amount), None, None).await.unwrap();
 
         println!("Pay request: {}", quote.request);
 

+ 17 - 3
crates/cdk/examples/multi-mint-wallet.rs

@@ -9,7 +9,7 @@ use bip39::Mnemonic;
 use cdk::amount::SplitTarget;
 use cdk::mint_url::MintUrl;
 use cdk::nuts::nut00::ProofsMethods;
-use cdk::nuts::CurrencyUnit;
+use cdk::nuts::{CurrencyUnit, PaymentMethod};
 use cdk::wallet::multi_mint_wallet::MultiMintWallet;
 use cdk::wallet::{MultiMintReceiveOptions, SendOptions};
 use cdk::Amount;
@@ -53,7 +53,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     println!("\n--- MINT ---");
     println!("Creating mint quote for {} sats...", mint_amount);
 
-    let mint_quote = wallet.mint_quote(&mint_url, mint_amount, None).await?;
+    let mint_quote = wallet
+        .mint_quote(
+            &mint_url,
+            PaymentMethod::BOLT11,
+            Some(mint_amount),
+            None,
+            None,
+        )
+        .await?;
     println!("Invoice to pay: {}", mint_quote.request);
 
     // Wait for quote to be paid and mint proofs
@@ -128,7 +136,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
 
     // Create melt quote
     let melt_quote = wallet
-        .melt_quote(&mint_url, invoice.to_string(), None)
+        .melt_quote(
+            &mint_url,
+            PaymentMethod::BOLT11,
+            invoice.to_string(),
+            None,
+            None,
+        )
         .await?;
     println!(
         "Melt quote: {} sats + {} fee reserve",

+ 10 - 2
crates/cdk/examples/revoke_send.rs

@@ -7,7 +7,7 @@ use std::time::Duration;
 use bip39::Mnemonic;
 use cdk::amount::SplitTarget;
 use cdk::mint_url::MintUrl;
-use cdk::nuts::CurrencyUnit;
+use cdk::nuts::{CurrencyUnit, PaymentMethod};
 use cdk::wallet::multi_mint_wallet::MultiMintWallet;
 use cdk::wallet::SendOptions;
 use cdk::Amount;
@@ -48,7 +48,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     println!("\n--- 1. FUNDING WALLET ---");
     println!("Minting {} sats...", mint_amount);
 
-    let mint_quote = wallet.mint_quote(&mint_url, mint_amount, None).await?;
+    let mint_quote = wallet
+        .mint_quote(
+            &mint_url,
+            PaymentMethod::BOLT11,
+            Some(mint_amount),
+            None,
+            None,
+        )
+        .await?;
 
     // Wait for quote to be paid (automatic with fake mint)
     let _proofs = wallet

+ 0 - 10
crates/cdk/src/wallet/issue/mod.rs

@@ -112,16 +112,6 @@ impl Wallet {
         Ok(quote)
     }
 
-    /// Mint Bolt11 Quote (Legacy Wrapper)
-    pub async fn mint_bolt11_quote(
-        &self,
-        amount: Amount,
-        description: Option<String>,
-    ) -> Result<MintQuote, Error> {
-        self.mint_quote(PaymentMethod::BOLT11, Some(amount), description, None)
-            .await
-    }
-
     /// Checks the state of a mint quote with the mint
     async fn check_state(&self, mint_quote: &mut MintQuote) -> Result<(), Error> {
         match mint_quote.payment_method {

+ 21 - 14
crates/cdk/src/wallet/multi_mint_wallet.rs

@@ -1617,21 +1617,24 @@ impl MultiMintWallet {
     }
 
     /// Mint quote for wallet
-    #[instrument(skip(self))]
-    pub async fn mint_quote(
+    #[instrument(skip(self, method))]
+    pub async fn mint_quote<T>(
         &self,
         mint_url: &MintUrl,
-        amount: Amount,
+        method: T,
+        amount: Option<Amount>,
         description: Option<String>,
-    ) -> Result<MintQuote, Error> {
+        extra: Option<String>,
+    ) -> Result<MintQuote, Error>
+    where
+        T: Into<PaymentMethod>,
+    {
         let wallets = self.wallets.read().await;
         let wallet = wallets.get(mint_url).ok_or(Error::UnknownMint {
             mint_url: mint_url.to_string(),
         })?;
 
-        wallet
-            .mint_quote(PaymentMethod::BOLT11, Some(amount), description, None)
-            .await
+        wallet.mint_quote(method, amount, description, extra).await
     }
 
     /// Refresh a specific mint quote status from the mint.
@@ -2130,21 +2133,25 @@ impl MultiMintWallet {
     }
 
     /// Create a melt quote for a specific mint
-    #[instrument(skip(self, bolt11))]
-    pub async fn melt_quote(
+    #[instrument(skip(self, method, request))]
+    pub async fn melt_quote<T, R>(
         &self,
         mint_url: &MintUrl,
-        bolt11: String,
+        method: T,
+        request: R,
         options: Option<MeltOptions>,
-    ) -> Result<crate::wallet::types::MeltQuote, Error> {
+        extra: Option<String>,
+    ) -> Result<MeltQuote, Error>
+    where
+        T: Into<PaymentMethod> + std::fmt::Debug,
+        R: std::fmt::Display,
+    {
         let wallets = self.wallets.read().await;
         let wallet = wallets.get(mint_url).ok_or(Error::UnknownMint {
             mint_url: mint_url.to_string(),
         })?;
 
-        wallet
-            .melt_quote(PaymentMethod::BOLT11, bolt11, options, None)
-            .await
+        wallet.melt_quote(method, request, options, extra).await
     }
 
     /// Melt (pay invoice) from a specific mint using a quote ID