]> Untitled Git - bdk/commitdiff
chore: fix imports
authorvalued mammal <valuedmammal@protonmail.com>
Mon, 4 Nov 2024 23:10:47 +0000 (18:10 -0500)
committervalued mammal <valuedmammal@protonmail.com>
Tue, 5 Nov 2024 18:29:59 +0000 (13:29 -0500)
crates/wallet/src/wallet/mod.rs
crates/wallet/tests/wallet.rs

index 58b504dc9d9d24093f0e93d792816d67457d5d5d..5ffbe01eeaedb66e43cc13b8bfd5f83514297780 100644 (file)
 //! Wallet
 //!
 //! This module defines the [`Wallet`].
-use crate::{
-    collections::{BTreeMap, HashMap},
-    descriptor::check_wallet_descriptor,
-};
+
 use alloc::{
     boxed::Box,
     string::{String, ToString},
     sync::Arc,
     vec::Vec,
 };
-pub use bdk_chain::Balance;
+use core::{cmp::Ordering, fmt, mem, ops::Deref};
+
 use bdk_chain::{
     indexed_tx_graph,
     indexer::keychain_txout::KeychainTxOutIndex,
@@ -33,63 +31,62 @@ use bdk_chain::{
         FullScanRequest, FullScanRequestBuilder, FullScanResult, SyncRequest, SyncRequestBuilder,
         SyncResult,
     },
-    tx_graph::{CanonicalTx, TxGraph, TxNode, TxUpdate},
+    tx_graph::{CalculateFeeError, CanonicalTx, TxGraph, TxNode, TxUpdate},
     BlockId, ChainPosition, ConfirmationBlockTime, DescriptorExt, FullTxOut, Indexed,
     IndexedTxGraph, Merge,
 };
-use bitcoin::sighash::{EcdsaSighashType, TapSighashType};
 use bitcoin::{
-    absolute, psbt, Address, Block, FeeRate, Network, OutPoint, ScriptBuf, Sequence, Transaction,
-    TxOut, Txid, Witness,
+    absolute,
+    consensus::encode::serialize,
+    constants::genesis_block,
+    psbt,
+    secp256k1::Secp256k1,
+    sighash::{EcdsaSighashType, TapSighashType},
+    transaction, Address, Amount, Block, BlockHash, FeeRate, Network, OutPoint, Psbt, ScriptBuf,
+    Sequence, Transaction, TxOut, Txid, Weight, Witness,
 };
-use bitcoin::{consensus::encode::serialize, transaction, BlockHash, Psbt};
-use bitcoin::{constants::genesis_block, Amount};
-use bitcoin::{secp256k1::Secp256k1, Weight};
-use core::cmp::Ordering;
-use core::fmt;
-use core::mem;
-use core::ops::Deref;
-use rand_core::RngCore;
-
-use descriptor::error::Error as DescriptorError;
 use miniscript::{
     descriptor::KeyMap,
     psbt::{PsbtExt, PsbtInputExt, PsbtInputSatisfier},
 };
-
-use bdk_chain::tx_graph::CalculateFeeError;
+use rand_core::RngCore;
 
 mod changeset;
 pub mod coin_selection;
+pub mod error;
 pub mod export;
 mod params;
+mod persisted;
 pub mod signer;
 pub mod tx_builder;
-pub use changeset::*;
-pub use params::*;
-mod persisted;
-pub use persisted::*;
 pub(crate) mod utils;
 
-pub mod error;
-
-pub use utils::IsDust;
-
-use coin_selection::{DefaultCoinSelectionAlgorithm, InsufficientFunds};
-use signer::{SignOptions, SignerOrdering, SignersContainer, TransactionSigner};
-use tx_builder::{FeePolicy, TxBuilder, TxParams};
-use utils::{check_nsequence_rbf, After, Older, SecpCtx};
-
-use crate::descriptor::policy::BuildSatisfaction;
+use crate::collections::{BTreeMap, HashMap};
 use crate::descriptor::{
-    self, DerivedDescriptor, DescriptorMeta, ExtendedDescriptor, ExtractPolicy,
-    IntoWalletDescriptor, Policy, XKeyUtils,
+    check_wallet_descriptor, error::Error as DescriptorError, policy::BuildSatisfaction,
+    DerivedDescriptor, DescriptorMeta, ExtendedDescriptor, ExtractPolicy, IntoWalletDescriptor,
+    Policy, XKeyUtils,
 };
 use crate::psbt::PsbtUtils;
-use crate::signer::SignerError;
 use crate::types::*;
-use crate::wallet::coin_selection::Excess::{self, Change, NoChange};
-use crate::wallet::error::{BuildFeeBumpError, CreateTxError, MiniscriptPsbtError};
+use crate::wallet::{
+    coin_selection::{
+        DefaultCoinSelectionAlgorithm,
+        Excess::{self, Change, NoChange},
+        InsufficientFunds,
+    },
+    error::{BuildFeeBumpError, CreateTxError, MiniscriptPsbtError},
+    signer::{SignOptions, SignerError, SignerOrdering, SignersContainer, TransactionSigner},
+    tx_builder::{FeePolicy, TxBuilder, TxParams},
+    utils::{check_nsequence_rbf, After, Older, SecpCtx},
+};
+
+// re-exports
+pub use bdk_chain::Balance;
+pub use changeset::ChangeSet;
+pub use params::*;
+pub use persisted::*;
+pub use utils::IsDust;
 
 const COINBASE_MATURITY: u32 = 100;
 
index 168b03d126ed2f273465f8804008e38ee6e2b1b0..96c0cb19581e7be3992b121bf8762089f568a30a 100644 (file)
@@ -1,7 +1,6 @@
-extern crate alloc;
-
 use std::path::Path;
 use std::str::FromStr;
+use std::sync::Arc;
 
 use anyhow::Context;
 use assert_matches::assert_matches;
@@ -925,8 +924,6 @@ fn test_create_tx_drain_to_dust_amount() {
 
 #[test]
 fn test_create_tx_ordering_respected() {
-    use alloc::sync::Arc;
-
     let (mut wallet, _) = get_funded_wallet_wpkh();
     let addr = wallet.next_unused_address(KeychainKind::External);