Skip to content

Commit 43cb033

Browse files
committed
Rename the crate to just "magical"
1 parent ac06e35 commit 43cb033

File tree

16 files changed

+63
-63
lines changed

16 files changed

+63
-63
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "magical-bitcoin-wallet"
2+
name = "magical"
33
version = "0.1.0"
44
edition = "2018"
55
authors = ["Alekos Filini <[email protected]>", "Riccardo Casatta <[email protected]>"]

examples/address_validator.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424

2525
use std::sync::Arc;
2626

27-
use magical_bitcoin_wallet::bitcoin;
28-
use magical_bitcoin_wallet::database::MemoryDatabase;
29-
use magical_bitcoin_wallet::descriptor::HDKeyPaths;
30-
use magical_bitcoin_wallet::wallet::address_validator::{AddressValidator, AddressValidatorError};
31-
use magical_bitcoin_wallet::ScriptType;
32-
use magical_bitcoin_wallet::{OfflineWallet, Wallet};
27+
use magical::bitcoin;
28+
use magical::database::MemoryDatabase;
29+
use magical::descriptor::HDKeyPaths;
30+
use magical::wallet::address_validator::{AddressValidator, AddressValidatorError};
31+
use magical::ScriptType;
32+
use magical::{OfflineWallet, Wallet};
3333

3434
use bitcoin::hashes::hex::FromHex;
3535
use bitcoin::util::bip32::Fingerprint;
@@ -57,7 +57,7 @@ impl AddressValidator for DummyValidator {
5757
}
5858
}
5959

60-
fn main() -> Result<(), magical_bitcoin_wallet::Error> {
60+
fn main() -> Result<(), magical::Error> {
6161
let descriptor = "sh(and_v(v:pk(tpubDDpWvmUrPZrhSPmUzCMBHffvC3HyMAPnWDSAQNBTnj1iZeJa7BZQEttFiP4DS4GCcXQHezdXhn86Hj6LHX5EDstXPWrMaSneRWM8yUf6NFd/*),after(630000)))";
6262
let mut wallet: OfflineWallet<_> =
6363
Wallet::new_offline(descriptor, None, Network::Regtest, MemoryDatabase::new())?;

examples/compiler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
extern crate bitcoin;
2626
extern crate clap;
2727
extern crate log;
28-
extern crate magical_bitcoin_wallet;
28+
extern crate magical;
2929
extern crate miniscript;
3030
extern crate serde_json;
3131

@@ -39,8 +39,8 @@ use bitcoin::Network;
3939
use miniscript::policy::Concrete;
4040
use miniscript::Descriptor;
4141

42-
use magical_bitcoin_wallet::database::memory::MemoryDatabase;
43-
use magical_bitcoin_wallet::{OfflineWallet, ScriptType, Wallet};
42+
use magical::database::memory::MemoryDatabase;
43+
use magical::{OfflineWallet, ScriptType, Wallet};
4444

4545
fn main() {
4646
env_logger::init_from_env(

examples/parse_descriptor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2323
// SOFTWARE.
2424

25-
extern crate magical_bitcoin_wallet;
25+
extern crate magical;
2626
extern crate serde_json;
2727

2828
use std::sync::Arc;
2929

30-
use magical_bitcoin_wallet::bitcoin::util::bip32::ChildNumber;
31-
use magical_bitcoin_wallet::bitcoin::*;
32-
use magical_bitcoin_wallet::descriptor::*;
30+
use magical::bitcoin::util::bip32::ChildNumber;
31+
use magical::bitcoin::*;
32+
use magical::descriptor::*;
3333

3434
fn main() {
3535
let desc = "wsh(or_d(\

examples/repl.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ use log::{debug, error, info, trace, LevelFilter};
3636

3737
use bitcoin::Network;
3838

39-
use magical_bitcoin_wallet::bitcoin;
40-
use magical_bitcoin_wallet::blockchain::compact_filters::*;
41-
use magical_bitcoin_wallet::cli;
42-
use magical_bitcoin_wallet::sled;
43-
use magical_bitcoin_wallet::Wallet;
39+
use magical::bitcoin;
40+
use magical::blockchain::compact_filters::*;
41+
use magical::cli;
42+
use magical::sled;
43+
use magical::Wallet;
4444

4545
fn prepare_home_dir() -> PathBuf {
4646
let mut dir = PathBuf::new();

src/blockchain/compact_filters/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
//! ```no_run
4343
//! # use std::sync::Arc;
4444
//! # use bitcoin::*;
45-
//! # use magical_bitcoin_wallet::*;
46-
//! # use magical_bitcoin_wallet::blockchain::compact_filters::*;
45+
//! # use magical::*;
46+
//! # use magical::blockchain::compact_filters::*;
4747
//! let num_threads = 4;
4848
//!
4949
//! let mempool = Arc::new(Mempool::default());
@@ -55,7 +55,7 @@
5555
//! ))
5656
//! .collect::<Result<_, _>>()?;
5757
//! let blockchain = CompactFiltersBlockchain::new(peers, "./wallet-filters", Some(500_000))?;
58-
//! # Ok::<(), magical_bitcoin_wallet::error::Error>(())
58+
//! # Ok::<(), magical::error::Error>(())
5959
//! ```
6060
6161
use std::collections::HashSet;

src/blockchain/electrum.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
//! ## Example
3232
//!
3333
//! ```no_run
34-
//! # use magical_bitcoin_wallet::blockchain::electrum::ElectrumBlockchain;
34+
//! # use magical::blockchain::electrum::ElectrumBlockchain;
3535
//! let client = electrum_client::Client::new("ssl://electrum.blockstream.info:50002", None)?;
3636
//! let blockchain = ElectrumBlockchain::from(client);
37-
//! # Ok::<(), magical_bitcoin_wallet::Error>(())
37+
//! # Ok::<(), magical::Error>(())
3838
//! ```
3939
4040
use std::collections::HashSet;

src/blockchain/esplora.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
//! ## Example
3131
//!
3232
//! ```no_run
33-
//! # use magical_bitcoin_wallet::blockchain::esplora::EsploraBlockchain;
33+
//! # use magical::blockchain::esplora::EsploraBlockchain;
3434
//! let blockchain = EsploraBlockchain::new("https://blockstream.info/testnet/");
35-
//! # Ok::<(), magical_bitcoin_wallet::Error>(())
35+
//! # Ok::<(), magical::Error>(())
3636
//! ```
3737
3838
use std::collections::{HashMap, HashSet};

src/descriptor/policy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
//!
3232
//! ```
3333
//! # use std::sync::Arc;
34-
//! # use magical_bitcoin_wallet::descriptor::*;
34+
//! # use magical::descriptor::*;
3535
//! let desc = "wsh(and_v(v:pk(cV3oCth6zxZ1UVsHLnGothsWNsaoxRhC6aeNi5VbSdFpwUkgkEci),or_d(pk(cVMTy7uebJgvFaSBwcgvwk8qn8xSLc97dKow4MBetjrrahZoimm2),older(12960))))";
3636
//!
3737
//! let (extended_desc, key_map) = ExtendedDescriptor::parse_secret(desc)?;
@@ -40,7 +40,7 @@
4040
//! let signers = Arc::new(key_map.into());
4141
//! let policy = extended_desc.extract_policy(signers)?;
4242
//! println!("policy: {}", serde_json::to_string(&policy)?);
43-
//! # Ok::<(), magical_bitcoin_wallet::Error>(())
43+
//! # Ok::<(), magical::Error>(())
4444
//! ```
4545
4646
use std::cmp::max;

src/wallet/address_validator.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
//! ```
4343
//! # use std::sync::Arc;
4444
//! # use bitcoin::*;
45-
//! # use magical_bitcoin_wallet::address_validator::*;
46-
//! # use magical_bitcoin_wallet::database::*;
47-
//! # use magical_bitcoin_wallet::*;
45+
//! # use magical::address_validator::*;
46+
//! # use magical::database::*;
47+
//! # use magical::*;
4848
//! struct PrintAddressAndContinue;
4949
//!
5050
//! impl AddressValidator for PrintAddressAndContinue {
@@ -71,7 +71,7 @@
7171
//!
7272
//! let address = wallet.get_new_address()?;
7373
//! println!("Address: {}", address);
74-
//! # Ok::<(), magical_bitcoin_wallet::Error>(())
74+
//! # Ok::<(), magical::Error>(())
7575
//! ```
7676
7777
use std::fmt;

src/wallet/coin_selection.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
//! # use std::str::FromStr;
4444
//! # use bitcoin::*;
4545
//! # use bitcoin::consensus::serialize;
46-
//! # use magical_bitcoin_wallet::wallet::coin_selection::*;
47-
//! # use magical_bitcoin_wallet::*;
46+
//! # use magical::wallet::coin_selection::*;
47+
//! # use magical::*;
4848
//! #[derive(Debug)]
4949
//! struct AlwaysSpendEverything;
5050
//!
@@ -57,7 +57,7 @@
5757
//! amount_needed: u64,
5858
//! input_witness_weight: usize,
5959
//! fee_amount: f32,
60-
//! ) -> Result<CoinSelectionResult, magical_bitcoin_wallet::Error> {
60+
//! ) -> Result<CoinSelectionResult, magical::Error> {
6161
//! let selected_amount = utxos.iter().fold(0, |acc, utxo| acc + utxo.txout.value);
6262
//! let all_utxos_selected = utxos
6363
//! .into_iter()
@@ -77,7 +77,7 @@
7777
//! let additional_fees = additional_weight as f32 * fee_rate.as_sat_vb() / 4.0;
7878
//!
7979
//! if (fee_amount + additional_fees).ceil() as u64 + amount_needed > selected_amount {
80-
//! return Err(magical_bitcoin_wallet::Error::InsufficientFunds);
80+
//! return Err(magical::Error::InsufficientFunds);
8181
//! }
8282
//!
8383
//! Ok(CoinSelectionResult {
@@ -88,7 +88,7 @@
8888
//! }
8989
//! }
9090
//!
91-
//! # let wallet: OfflineWallet<_> = Wallet::new_offline("", None, Network::Testnet, magical_bitcoin_wallet::database::MemoryDatabase::default())?;
91+
//! # let wallet: OfflineWallet<_> = Wallet::new_offline("", None, Network::Testnet, magical::database::MemoryDatabase::default())?;
9292
//! // create wallet, sync, ...
9393
//!
9494
//! let to_address = Address::from_str("2N4eQYCbKUHCCTUjBJeHcJp9ok6J2GZsTDt").unwrap();
@@ -99,7 +99,7 @@
9999
//!
100100
//! // inspect, sign, broadcast, ...
101101
//!
102-
//! # Ok::<(), magical_bitcoin_wallet::Error>(())
102+
//! # Ok::<(), magical::Error>(())
103103
//! ```
104104
105105
use bitcoin::consensus::encode::serialize;

src/wallet/export.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
//! ```
3434
//! # use std::str::FromStr;
3535
//! # use bitcoin::*;
36-
//! # use magical_bitcoin_wallet::database::*;
37-
//! # use magical_bitcoin_wallet::wallet::export::*;
38-
//! # use magical_bitcoin_wallet::*;
36+
//! # use magical::database::*;
37+
//! # use magical::wallet::export::*;
38+
//! # use magical::*;
3939
//! let import = r#"{
4040
//! "descriptor": "wpkh([c258d2e4\/84h\/1h\/0h]tpubDD3ynpHgJQW8VvWRzQ5WFDCrs4jqVFGHB3vLC3r49XHJSqP8bHKdK4AriuUKLccK68zfzowx7YhmDN8SiSkgCDENUFx9qVw65YyqM78vyVe\/0\/*)",
4141
//! "blockheight":1782088,
@@ -44,15 +44,15 @@
4444
//!
4545
//! let import = WalletExport::from_str(import)?;
4646
//! let wallet: OfflineWallet<_> = Wallet::new_offline(&import.descriptor(), import.change_descriptor().as_deref(), Network::Testnet, MemoryDatabase::default())?;
47-
//! # Ok::<_, magical_bitcoin_wallet::Error>(())
47+
//! # Ok::<_, magical::Error>(())
4848
//! ```
4949
//!
5050
//! ### Export a `Wallet`
5151
//! ```
5252
//! # use bitcoin::*;
53-
//! # use magical_bitcoin_wallet::database::*;
54-
//! # use magical_bitcoin_wallet::wallet::export::*;
55-
//! # use magical_bitcoin_wallet::*;
53+
//! # use magical::database::*;
54+
//! # use magical::wallet::export::*;
55+
//! # use magical::*;
5656
//! let wallet: OfflineWallet<_> = Wallet::new_offline(
5757
//! "wpkh([c258d2e4/84h/1h/0h]tpubDD3ynpHgJQW8VvWRzQ5WFDCrs4jqVFGHB3vLC3r49XHJSqP8bHKdK4AriuUKLccK68zfzowx7YhmDN8SiSkgCDENUFx9qVw65YyqM78vyVe/0/*)",
5858
//! Some("wpkh([c258d2e4/84h/1h/0h]tpubDD3ynpHgJQW8VvWRzQ5WFDCrs4jqVFGHB3vLC3r49XHJSqP8bHKdK4AriuUKLccK68zfzowx7YhmDN8SiSkgCDENUFx9qVw65YyqM78vyVe/1/*)"),
@@ -61,10 +61,10 @@
6161
//! )?;
6262
//! let export = WalletExport::export_wallet(&wallet, "exported wallet", true)
6363
//! .map_err(ToString::to_string)
64-
//! .map_err(magical_bitcoin_wallet::Error::Generic)?;
64+
//! .map_err(magical::Error::Generic)?;
6565
//!
6666
//! println!("Exported: {}", export.to_string());
67-
//! # Ok::<_, magical_bitcoin_wallet::Error>(())
67+
//! # Ok::<_, magical::Error>(())
6868
//! ```
6969
7070
use std::str::FromStr;

src/wallet/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,16 @@ where
229229
/// ```no_run
230230
/// # use std::str::FromStr;
231231
/// # use bitcoin::*;
232-
/// # use magical_bitcoin_wallet::*;
233-
/// # use magical_bitcoin_wallet::database::*;
232+
/// # use magical::*;
233+
/// # use magical::database::*;
234234
/// # let descriptor = "wpkh(tpubD6NzVbkrYhZ4Xferm7Pz4VnjdcDPFyjVu5K4iZXQ4pVN8Cks4pHVowTBXBKRhX64pkRyJZJN5xAKj4UDNnLPb5p2sSKXhewoYx5GbTdUFWq/*)";
235235
/// # let wallet: OfflineWallet<_> = Wallet::new_offline(descriptor, None, Network::Testnet, MemoryDatabase::default())?;
236236
/// # let to_address = Address::from_str("2N4eQYCbKUHCCTUjBJeHcJp9ok6J2GZsTDt").unwrap();
237237
/// let (psbt, details) = wallet.create_tx(
238238
/// TxBuilder::with_recipients(vec![(to_address.script_pubkey(), 50_000)])
239239
/// )?;
240240
/// // sign and broadcast ...
241-
/// # Ok::<(), magical_bitcoin_wallet::Error>(())
241+
/// # Ok::<(), magical::Error>(())
242242
/// ```
243243
pub fn create_tx<Cs: coin_selection::CoinSelectionAlgorithm>(
244244
&self,
@@ -453,8 +453,8 @@ where
453453
/// ```no_run
454454
/// # use std::str::FromStr;
455455
/// # use bitcoin::*;
456-
/// # use magical_bitcoin_wallet::*;
457-
/// # use magical_bitcoin_wallet::database::*;
456+
/// # use magical::*;
457+
/// # use magical::database::*;
458458
/// # let descriptor = "wpkh(tpubD6NzVbkrYhZ4Xferm7Pz4VnjdcDPFyjVu5K4iZXQ4pVN8Cks4pHVowTBXBKRhX64pkRyJZJN5xAKj4UDNnLPb5p2sSKXhewoYx5GbTdUFWq/*)";
459459
/// # let wallet: OfflineWallet<_> = Wallet::new_offline(descriptor, None, Network::Testnet, MemoryDatabase::default())?;
460460
/// let txid = Txid::from_str("faff0a466b70f5d5f92bd757a92c1371d4838bdd5bc53a06764e2488e51ce8f8").unwrap();
@@ -463,7 +463,7 @@ where
463463
/// TxBuilder::new().fee_rate(FeeRate::from_sat_per_vb(5.0)),
464464
/// )?;
465465
/// // sign and broadcast ...
466-
/// # Ok::<(), magical_bitcoin_wallet::Error>(())
466+
/// # Ok::<(), magical::Error>(())
467467
/// ```
468468
// TODO: support for merging multiple transactions while bumping the fees
469469
// TODO: option to force addition of an extra output? seems bad for privacy to update the
@@ -691,13 +691,13 @@ where
691691
/// ```no_run
692692
/// # use std::str::FromStr;
693693
/// # use bitcoin::*;
694-
/// # use magical_bitcoin_wallet::*;
695-
/// # use magical_bitcoin_wallet::database::*;
694+
/// # use magical::*;
695+
/// # use magical::database::*;
696696
/// # let descriptor = "wpkh(tpubD6NzVbkrYhZ4Xferm7Pz4VnjdcDPFyjVu5K4iZXQ4pVN8Cks4pHVowTBXBKRhX64pkRyJZJN5xAKj4UDNnLPb5p2sSKXhewoYx5GbTdUFWq/*)";
697697
/// # let wallet: OfflineWallet<_> = Wallet::new_offline(descriptor, None, Network::Testnet, MemoryDatabase::default())?;
698698
/// # let (psbt, _) = wallet.create_tx(TxBuilder::new())?;
699699
/// let (signed_psbt, finalized) = wallet.sign(psbt, None)?;
700-
/// # Ok::<(), magical_bitcoin_wallet::Error>(())
700+
/// # Ok::<(), magical::Error>(())
701701
pub fn sign(&self, mut psbt: PSBT, assume_height: Option<u32>) -> Result<(PSBT, bool), Error> {
702702
// this helps us doing our job later
703703
self.add_input_hd_keypaths(&mut psbt)?;

src/wallet/signer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
//! # use bitcoin::*;
3434
//! # use bitcoin::util::psbt;
3535
//! # use bitcoin::util::bip32::Fingerprint;
36-
//! # use magical_bitcoin_wallet::signer::*;
37-
//! # use magical_bitcoin_wallet::database::*;
38-
//! # use magical_bitcoin_wallet::*;
36+
//! # use magical::signer::*;
37+
//! # use magical::database::*;
38+
//! # use magical::*;
3939
//! # #[derive(Debug)]
4040
//! # struct CustomHSM;
4141
//! # impl CustomHSM {
@@ -85,7 +85,7 @@
8585
//! Arc::new(Box::new(custom_signer))
8686
//! );
8787
//!
88-
//! # Ok::<_, magical_bitcoin_wallet::Error>(())
88+
//! # Ok::<_, magical::Error>(())
8989
//! ```
9090
9191
use std::cmp::Ordering;

src/wallet/tx_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
//! ```
3030
//! # use std::str::FromStr;
3131
//! # use bitcoin::*;
32-
//! # use magical_bitcoin_wallet::*;
32+
//! # use magical::*;
3333
//! # let to_address = Address::from_str("2N4eQYCbKUHCCTUjBJeHcJp9ok6J2GZsTDt").unwrap();
3434
//! // Create a transaction with one output to `to_address` of 50_000 satoshi, with a custom fee rate
3535
//! // of 5.0 satoshi/vbyte, only spending non-change outputs and with RBF signaling

testutils-macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn magical_blockchain_tests(attr: TokenStream, item: TokenStream) -> TokenSt
4444
}
4545
}
4646
} else {
47-
parse2::<syn::ExprPath>(quote! { magical_bitcoin_wallet }).unwrap()
47+
parse2::<syn::ExprPath>(quote! { magical }).unwrap()
4848
};
4949

5050
match parse::<syn::ItemFn>(item) {

0 commit comments

Comments
 (0)