From 1cc3fa794a7415fa5d558cfc52d7a5e42de83179 Mon Sep 17 00:00:00 2001 From: thesimplekid Date: Sat, 8 Jun 2024 20:24:20 +0100 Subject: [PATCH] refactor: remove unneeded wallet mutablity --- crates/cdk/examples/mint-token.rs | 2 +- crates/cdk/examples/p2pk.rs | 2 +- crates/cdk/src/wallet/mod.rs | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/cdk/examples/mint-token.rs b/crates/cdk/examples/mint-token.rs index 42f78b9f..e6a7be42 100644 --- a/crates/cdk/examples/mint-token.rs +++ b/crates/cdk/examples/mint-token.rs @@ -20,7 +20,7 @@ async fn main() -> Result<(), Error> { let unit = CurrencyUnit::Sat; let amount = Amount::from(10); - let mut wallet = Wallet::new(Arc::new(localstore), &seed, vec![]); + let wallet = Wallet::new(Arc::new(localstore), &seed, vec![]); let quote = wallet .mint_quote(mint_url.clone(), amount, unit.clone()) diff --git a/crates/cdk/examples/p2pk.rs b/crates/cdk/examples/p2pk.rs index 0043ad85..8f1a349a 100644 --- a/crates/cdk/examples/p2pk.rs +++ b/crates/cdk/examples/p2pk.rs @@ -20,7 +20,7 @@ async fn main() -> Result<(), Error> { let unit = CurrencyUnit::Sat; let amount = Amount::from(10); - let mut wallet = Wallet::new(Arc::new(localstore), &seed, vec![]); + let wallet = Wallet::new(Arc::new(localstore), &seed, vec![]); let quote = wallet .mint_quote(mint_url.clone(), amount, unit.clone()) diff --git a/crates/cdk/src/wallet/mod.rs b/crates/cdk/src/wallet/mod.rs index ff669370..b89e38b8 100644 --- a/crates/cdk/src/wallet/mod.rs +++ b/crates/cdk/src/wallet/mod.rs @@ -420,7 +420,7 @@ impl Wallet { /// Mint Quote #[instrument(skip(self), fields(mint_url = %mint_url))] pub async fn mint_quote( - &mut self, + &self, mint_url: UncheckedUrl, amount: Amount, unit: CurrencyUnit, @@ -532,7 +532,7 @@ impl Wallet { #[instrument(skip(self), fields(mint_url = %mint_url))] async fn active_keys( - &mut self, + &self, mint_url: &UncheckedUrl, unit: &CurrencyUnit, ) -> Result, Error> { @@ -670,7 +670,7 @@ impl Wallet { /// Swap #[instrument(skip(self, input_proofs), fields(mint_url = %mint_url))] pub async fn swap( - &mut self, + &self, mint_url: &UncheckedUrl, unit: &CurrencyUnit, amount: Option, @@ -876,7 +876,7 @@ impl Wallet { /// Send #[instrument(skip(self), fields(mint_url = %mint_url))] pub async fn send( - &mut self, + &self, mint_url: &UncheckedUrl, unit: CurrencyUnit, memo: Option, @@ -963,7 +963,7 @@ impl Wallet { /// Melt Quote #[instrument(skip(self), fields(mint_url = %mint_url))] pub async fn melt_quote( - &mut self, + &self, mint_url: UncheckedUrl, unit: CurrencyUnit, request: String, @@ -1144,7 +1144,7 @@ impl Wallet { /// Melt #[instrument(skip(self, quote_id), fields(mint_url = %mint_url))] pub async fn melt( - &mut self, + &self, mint_url: &UncheckedUrl, quote_id: &str, amount_split_target: SplitTarget, @@ -1499,7 +1499,7 @@ impl Wallet { } #[instrument(skip(self), fields(mint_url = %mint_url))] - pub async fn restore(&mut self, mint_url: UncheckedUrl) -> Result { + pub async fn restore(&self, mint_url: UncheckedUrl) -> Result { // Check that mint is in store of mints if self.localstore.get_mint(mint_url.clone()).await?.is_none() { self.add_mint(mint_url.clone()).await?;