-use crate::error::BDKCliError as Error;
-use crate::handlers::{broadcast_transaction, sync_wallet};
-use crate::utils::BlockchainClient;
+#![cfg(any(
+ feature = "electrum",
+ feature = "esplora",
+ feature = "rpc",
+ feature = "cbf"
+))]
+
+use crate::{
+ backend::BlockchainClient,
+ handlers::online::{broadcast_transaction, sync_wallet},
+};
use bdk_wallet::{
SignOptions, Wallet,
bitcoin::{FeeRate, Psbt, Txid, consensus::encode::serialize_hex},
use serde_json::{json, to_string_pretty};
use std::sync::{Arc, Mutex};
-use crate::payjoin::ohttp::{RelayManager, fetch_ohttp_keys};
+use crate::{
+ error::BDKCliError as Error,
+ payjoin::ohttp::{RelayManager, fetch_ohttp_keys},
+};
pub mod ohttp;
Ok(to_string_pretty(&json!({}))?)
}
+ #[cfg(any(
+ feature = "electrum",
+ feature = "esplora",
+ feature = "rpc",
+ feature = "cbf"
+ ))]
pub async fn send_payjoin(
&mut self,
uri: String,
+++ /dev/null
-use crate::error::BDKCliError;
-use bdk_wallet::WalletPersister;
-
-// Types of Persistence backends supported by bdk-cli
-pub(crate) enum Persister {
- #[cfg(feature = "sqlite")]
- Connection(bdk_wallet::rusqlite::Connection),
- #[cfg(feature = "redb")]
- RedbStore(bdk_redb::Store),
-}
-
-impl WalletPersister for Persister {
- type Error = BDKCliError;
-
- fn initialize(persister: &mut Self) -> Result<bdk_wallet::ChangeSet, Self::Error> {
- match persister {
- #[cfg(feature = "sqlite")]
- Persister::Connection(connection) => {
- WalletPersister::initialize(connection).map_err(BDKCliError::from)
- }
- #[cfg(feature = "redb")]
- Persister::RedbStore(store) => {
- WalletPersister::initialize(store).map_err(BDKCliError::from)
- }
- }
- }
-
- fn persist(persister: &mut Self, changeset: &bdk_wallet::ChangeSet) -> Result<(), Self::Error> {
- match persister {
- #[cfg(feature = "sqlite")]
- Persister::Connection(connection) => {
- WalletPersister::persist(connection, changeset).map_err(BDKCliError::from)
- }
- #[cfg(feature = "redb")]
- Persister::RedbStore(store) => {
- WalletPersister::persist(store, changeset).map_err(BDKCliError::from)
- }
- }
- }
-}
--- /dev/null
+use crate::error::BDKCliError;
+use bdk_wallet::WalletPersister;
+
+// Types of Persistence backends supported by bdk-cli
+pub(crate) enum Persister {
+ #[cfg(feature = "sqlite")]
+ Connection(bdk_wallet::rusqlite::Connection),
+ #[cfg(feature = "redb")]
+ RedbStore(bdk_redb::Store),
+}
+
+impl WalletPersister for Persister {
+ type Error = BDKCliError;
+
+ fn initialize(persister: &mut Self) -> Result<bdk_wallet::ChangeSet, Self::Error> {
+ match persister {
+ #[cfg(feature = "sqlite")]
+ Persister::Connection(connection) => {
+ WalletPersister::initialize(connection).map_err(BDKCliError::from)
+ }
+ #[cfg(feature = "redb")]
+ Persister::RedbStore(store) => {
+ WalletPersister::initialize(store).map_err(BDKCliError::from)
+ }
+ }
+ }
+
+ fn persist(persister: &mut Self, changeset: &bdk_wallet::ChangeSet) -> Result<(), Self::Error> {
+ match persister {
+ #[cfg(feature = "sqlite")]
+ Persister::Connection(connection) => {
+ WalletPersister::persist(connection, changeset).map_err(BDKCliError::from)
+ }
+ #[cfg(feature = "redb")]
+ Persister::RedbStore(store) => {
+ WalletPersister::persist(store, changeset).map_err(BDKCliError::from)
+ }
+ }
+ }
+}