Skip to content

Commit 33af0cd

Browse files
committed
WIP: change from spark-wallet to breez-sdk-spark
1 parent fc1d440 commit 33af0cd

5 files changed

Lines changed: 408 additions & 595 deletions

File tree

examples/cli/src/main.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use rustyline::error::ReadlineError;
66

77
use orange_sdk::bitcoin_payment_instructions::amount::Amount;
88
use orange_sdk::{
9-
ChainSource, Event, ExtraConfig, Mnemonic, PaymentInfo, Seed, SparkWalletConfig, StorageConfig,
10-
Tunables, Wallet, WalletConfig, bitcoin::Network,
9+
ChainSource, Event, ExtraConfig, Mnemonic, PaymentInfo, Seed, SparkNetwork, SparkWalletConfig,
10+
StorageConfig, Tunables, Wallet, WalletConfig, bitcoin::Network,
1111
};
1212
use rand::RngCore;
1313
use std::fs;
@@ -89,9 +89,14 @@ fn get_config(network: Network) -> Result<WalletConfig> {
8989
network,
9090
seed,
9191
tunables: Tunables::default(),
92-
extra_config: ExtraConfig::Spark(SparkWalletConfig::default_config(
93-
network.try_into().expect("valid network"),
94-
)),
92+
extra_config: ExtraConfig::Spark(SparkWalletConfig {
93+
api_key: None,
94+
network: SparkNetwork::Regtest,
95+
sync_interval_secs: 60,
96+
max_deposit_claim_fee: None,
97+
lnurl_domain: None,
98+
prefer_spark_over_lightning: false,
99+
}),
95100
})
96101
},
97102
Network::Bitcoin => {
@@ -118,9 +123,14 @@ fn get_config(network: Network) -> Result<WalletConfig> {
118123
network,
119124
seed,
120125
tunables: Tunables::default(),
121-
extra_config: ExtraConfig::Spark(SparkWalletConfig::default_config(
122-
network.try_into().expect("valid network"),
123-
)),
126+
extra_config: ExtraConfig::Spark(SparkWalletConfig {
127+
api_key: None,
128+
network: SparkNetwork::Mainnet,
129+
sync_interval_secs: 60,
130+
max_deposit_claim_fee: None,
131+
lnurl_domain: None,
132+
prefer_spark_over_lightning: false,
133+
}),
124134
})
125135
},
126136
_ => Err(anyhow::anyhow!("Unsupported network: {network:?}")),

orange-sdk/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ name = "orange_sdk"
1010
[features]
1111
default = ["spark"]
1212
uniffi = ["dep:uniffi", "spark", "cashu"]
13-
spark = ["spark-wallet", "uuid"]
13+
spark = ["breez-sdk-spark", "uuid", "serde_json"]
1414
cashu = ["cdk", "serde_json"]
1515
_test-utils = ["corepc-node", "cashu", "uuid/v7", "rand"]
1616
_cashu-tests = ["_test-utils", "cdk-ldk-node", "cdk/mint", "cdk-sqlite", "cdk-axum", "axum"]
@@ -23,7 +23,7 @@ bitcoin-payment-instructions = { workspace = true }
2323
chrono = { version = "0.4", default-features = false }
2424
rand = { version = "0.8.5", optional = true }
2525
reqwest = { version = "0.12.23", default-features = false, features = ["rustls-tls"] }
26-
spark-wallet = { git = "https://github.com/breez/spark-sdk.git", rev = "6e12f98be3f100fca0411e3209a610decfa32279", default-features = false, features = ["rustls-tls"], optional = true }
26+
breez-sdk-spark = { git = "https://github.com/breez/spark-sdk.git", rev = "6994785e98c13191e6dc26146be6ce87c5c8d987", default-features = false, features = ["rustls-tls"], optional = true }
2727
tokio = { version = "1.0", default-features = false, features = ["rt-multi-thread", "sync"] }
2828
uuid = { version = "1.0", default-features = false, optional = true }
2929
cdk = { git = "https://github.com/benthecarman/cdk.git", rev = "7d25e9ae5ed7f47f9ae7e87d8a9ee16797fee8cd", default-features = false, features = ["wallet"], optional = true }

orange-sdk/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ use trusted_wallet::TrustedError;
6666
#[cfg(feature = "cashu")]
6767
pub use crate::trusted_wallet::cashu::CashuConfig;
6868
pub use bitcoin_payment_instructions;
69+
#[cfg(feature = "spark")]
70+
pub use breez_sdk_spark::{Config as SparkWalletConfig, Fee, Network as SparkNetwork};
6971
#[cfg(feature = "cashu")]
7072
pub use cdk::nuts::nut00::CurrencyUnit;
7173
pub use event::{Event, EventQueue};
7274
pub use ldk_node::bip39::Mnemonic;
7375
pub use ldk_node::bitcoin;
7476
pub use ldk_node::payment::ConfirmationStatus;
75-
#[cfg(feature = "spark")]
76-
pub use spark_wallet::{OperatorPoolConfig, ServiceProviderConfig, SparkWalletConfig};
7777
pub use store::{PaymentId, PaymentType, Transaction, TxStatus};
7878
pub use trusted_wallet::ExtraConfig;
7979

orange-sdk/src/trusted_wallet/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl<T: ?Sized + TrustedWalletInterface> graduated_rebalancer::TrustedWallet for
125125
pub enum ExtraConfig {
126126
/// Configuration for Spark wallet.
127127
#[cfg(feature = "spark")]
128-
Spark(crate::SparkWalletConfig),
128+
Spark(crate::SparkWalletConfig), // todo make my own reduced version
129129
/// Configuration for Cashu wallet.
130130
#[cfg(feature = "cashu")]
131131
Cashu(cashu::CashuConfig),

0 commit comments

Comments
 (0)