From e70c03e48990aa7132aaa790c1d68cc7ca995b81 Mon Sep 17 00:00:00 2001 From: thesimplekid Date: Tue, 11 Feb 2025 23:31:25 +0000 Subject: [PATCH] feat: custome der paths to builder --- crates/cdk/src/mint/builder.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/cdk/src/mint/builder.rs b/crates/cdk/src/mint/builder.rs index 723cf290..9ef1deef 100644 --- a/crates/cdk/src/mint/builder.rs +++ b/crates/cdk/src/mint/builder.rs @@ -4,6 +4,7 @@ use std::collections::HashMap; use std::sync::Arc; use anyhow::anyhow; +use bitcoin::bip32::DerivationPath; use cdk_common::database::{self, MintDatabase}; use super::nut17::SupportedMethods; @@ -29,6 +30,7 @@ pub struct MintBuilder { ln: Option + Send + Sync>>>, seed: Option>, supported_units: HashMap, + custom_paths: HashMap, } impl MintBuilder { @@ -206,6 +208,15 @@ impl MintBuilder { self } + /// Set custom derivation paths for mint units + pub fn add_custom_derivation_paths( + mut self, + custom_paths: HashMap, + ) -> Self { + self.custom_paths = custom_paths; + self + } + /// Build mint pub async fn build(&self) -> anyhow::Result { let localstore = self @@ -218,7 +229,7 @@ impl MintBuilder { localstore, self.ln.clone().ok_or(anyhow!("Ln backends not set"))?, self.supported_units.clone(), - HashMap::new(), + self.custom_paths.clone(), ) .await?) }