Browse Source

feat: remove unused arg on melt

thesimplekid 9 months ago
parent
commit
140ec21883

+ 1 - 0
CHANGELOG.md

@@ -36,6 +36,7 @@
 - cdk(mint): On `swap` verify correct number of sigs on outputs when `SigAll` ([thesimplekid]).
 
 ### Removed
+- cdk(wallet): Remove unused argument `SplitTarget` on `melt` ([thesimplekid]).
 
 ## [v0.2.0]
 

+ 2 - 10
bindings/cdk-js/src/wallet.rs

@@ -167,16 +167,8 @@ impl JsWallet {
     }
 
     #[wasm_bindgen(js_name = melt)]
-    pub async fn melt(
-        &mut self,
-        quote_id: String,
-        split_target_amount: Option<JsAmount>,
-    ) -> Result<JsMelted> {
-        let target = split_target_amount
-            .map(|a| SplitTarget::Value(*a.deref()))
-            .unwrap_or_default();
-
-        let melted = self.inner.melt(&quote_id, target).await.map_err(into_err)?;
+    pub async fn melt(&mut self, quote_id: String) -> Result<JsMelted> {
+        let melted = self.inner.melt(&quote_id).await.map_err(into_err)?;
 
         Ok(melted.into())
     }

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

@@ -4,7 +4,6 @@ use std::str::FromStr;
 use std::{io, println};
 
 use anyhow::{bail, Result};
-use cdk::amount::SplitTarget;
 use cdk::wallet::Wallet;
 use cdk::{Bolt11Invoice, UncheckedUrl};
 
@@ -47,7 +46,7 @@ pub async fn pay(wallets: HashMap<UncheckedUrl, Wallet>) -> Result<()> {
 
     println!("{:?}", quote);
 
-    let melt = wallet.melt(&quote.id, SplitTarget::default()).await?;
+    let melt = wallet.melt(&quote.id).await?;
 
     println!("Paid invoice: {}", melt.state);
     if let Some(preimage) = melt.preimage {

+ 1 - 5
crates/cdk/src/wallet/mod.rs

@@ -1189,11 +1189,7 @@ impl Wallet {
 
     /// Melt
     #[instrument(skip(self))]
-    pub async fn melt(
-        &self,
-        quote_id: &str,
-        amount_split_target: SplitTarget,
-    ) -> Result<Melted, Error> {
+    pub async fn melt(&self, quote_id: &str) -> Result<Melted, Error> {
         let quote_info = self.localstore.get_melt_quote(quote_id).await?;
 
         let quote_info = if let Some(quote) = quote_info {

+ 1 - 1
crates/cdk/src/wallet/multi_mint_wallet.rs

@@ -267,7 +267,7 @@ impl MultiMintWallet {
             }
         }
 
-        wallet.melt(&quote.id, SplitTarget::default()).await
+        wallet.melt(&quote.id).await
     }
 
     /// Restore