1#[cfg(feature = "backup")]
11pub mod account_custody;
12pub mod allocation;
13mod backup;
14#[cfg(feature = "backup")]
15mod custody_codec;
16pub mod discovery;
17#[cfg(feature = "backup")]
18pub mod full_backup;
19mod hd;
20pub mod metadata;
21#[cfg(feature = "payments")]
22pub mod payment_allocation;
23pub mod qi_addresses;
24#[cfg(feature = "backup")]
25pub mod qi_custody;
26pub mod qi_keys;
27mod selection;
28#[cfg(feature = "backup")]
29mod state;
30#[cfg(feature = "backup")]
33pub use state::{ReservationId, ReservationState};
34#[cfg(all(feature = "sqlite", not(target_arch = "wasm32")))]
35pub mod storage;
36pub use selection::{
37 AggregationPolicy, CandidateCoin, CoinSelection, SelectionError, SelectionRequest, SweepMode,
38 denominate_largest, preserves_denominations, select_aggregate, select_fewest,
39 select_fewest_converting, select_sweep, select_with_fee,
40};
41mod mnemonic;
42pub mod wordlist;
43
44pub use backup::{BackupError, BackupKdf, EncryptedSeedBackup, SeedBackup};
45
46pub use hd::{
47 AccountPublic, CoinType, DerivedAddress, ExtendedKeyMetadata, ExtendedPrivateKey,
48 ExtendedPublicKey, Grinding, HdWallet, Search, SearchResult, SearchWindow, WindowStop,
49};
50pub use mnemonic::{Language, Mnemonic, MnemonicEntropy, SecretString, Seed};
51use thiserror::Error;
52
53#[derive(Clone, Debug, PartialEq, Eq, Error)]
55#[non_exhaustive]
56pub enum WalletError {
57 #[error("invalid mnemonic")]
59 InvalidMnemonic,
60 #[error("invalid mnemonic entropy length")]
62 InvalidEntropy,
63 #[error("secure operating-system randomness unavailable")]
65 RandomnessUnavailable,
66 #[error("invalid BIP32 seed length")]
68 InvalidSeed,
69 #[error("invalid extended key")]
71 InvalidExtendedKey,
72 #[error("index must be below 2^31")]
74 InvalidIndex,
75 #[error("cannot derive a hardened child from an extended public key")]
77 HardenedPublicChild,
78 #[error("invalid derivation path or non-master starting node")]
80 InvalidPath,
81 #[error("HD key derivation failed")]
83 Derivation,
84 #[error("account xpub must have depth three and the declared hardened account index")]
86 InvalidAccountOrigin,
87 #[error("derived address does not match the wallet ledger or a known zone")]
89 InvalidDerivedAddress,
90 #[error("invalid address search limit")]
92 InvalidSearchLimit,
93 #[error("address search cancelled after {attempts} attempts")]
95 Cancelled {
96 attempts: u32,
98 next_index: u32,
100 },
101 #[error("address search exhausted after {attempts} attempts")]
103 SearchExhausted {
104 attempts: u32,
106 next_index: Option<u32>,
108 },
109}