]> Untitled Git - bdk/commitdiff
Rename ToWalletDescriptor to IntoWalletDescriptor
authorSteve Myers <steve@notmandatory.org>
Sat, 13 Feb 2021 06:34:43 +0000 (22:34 -0800)
committerSteve Myers <steve@notmandatory.org>
Sat, 13 Feb 2021 07:23:20 +0000 (23:23 -0800)
CHANGELOG.md
src/descriptor/mod.rs
src/descriptor/policy.rs
src/descriptor/template.rs
src/wallet/mod.rs
src/wallet/signer.rs

index 59fc9a6aff502407d1b866885b4d495984f8e950..6c2e63eca2fa6bc4c7ed27ea753360e99f374ce8 100644 (file)
@@ -27,7 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Wallet
 #### Changed
 - Removed the explicit `id` argument from `Wallet::add_signer()` since that's now part of `Signer` itself
-- Renamed `ToWalletDescriptor::to_wallet_descriptor` to `ToWalletDescriptor::into_wallet_descriptor`
+- Renamed `ToWalletDescriptor::to_wallet_descriptor` to `IntoWalletDescriptor::into_wallet_descriptor`
 
 ### Policy 
 #### Changed
index 4b9aec469b9d564cdf89c21fb185121d6cd5d365..09c60e9fb2c384b15a907af6b020ca6ee0e94d6c 100644 (file)
@@ -72,7 +72,7 @@ pub type DerivedDescriptor<'s> = Descriptor<DerivedDescriptorKey<'s>>;
 pub type HDKeyPaths = BTreeMap<PublicKey, KeySource>;
 
 /// Trait for types which can be converted into an [`ExtendedDescriptor`] and a [`KeyMap`] usable by a wallet in a specific [`Network`]
-pub trait ToWalletDescriptor {
+pub trait IntoWalletDescriptor {
     /// Convert to wallet descriptor
     fn into_wallet_descriptor(
         self,
@@ -81,7 +81,7 @@ pub trait ToWalletDescriptor {
     ) -> Result<(ExtendedDescriptor, KeyMap), DescriptorError>;
 }
 
-impl ToWalletDescriptor for &str {
+impl IntoWalletDescriptor for &str {
     fn into_wallet_descriptor(
         self,
         secp: &SecpCtx,
@@ -107,7 +107,7 @@ impl ToWalletDescriptor for &str {
     }
 }
 
-impl ToWalletDescriptor for &String {
+impl IntoWalletDescriptor for &String {
     fn into_wallet_descriptor(
         self,
         secp: &SecpCtx,
@@ -117,7 +117,7 @@ impl ToWalletDescriptor for &String {
     }
 }
 
-impl ToWalletDescriptor for ExtendedDescriptor {
+impl IntoWalletDescriptor for ExtendedDescriptor {
     fn into_wallet_descriptor(
         self,
         secp: &SecpCtx,
@@ -127,7 +127,7 @@ impl ToWalletDescriptor for ExtendedDescriptor {
     }
 }
 
-impl ToWalletDescriptor for (ExtendedDescriptor, KeyMap) {
+impl IntoWalletDescriptor for (ExtendedDescriptor, KeyMap) {
     fn into_wallet_descriptor(
         self,
         secp: &SecpCtx,
@@ -160,7 +160,7 @@ impl ToWalletDescriptor for (ExtendedDescriptor, KeyMap) {
     }
 }
 
-impl ToWalletDescriptor for DescriptorTemplateOut {
+impl IntoWalletDescriptor for DescriptorTemplateOut {
     fn into_wallet_descriptor(
         self,
         _secp: &SecpCtx,
@@ -637,7 +637,7 @@ mod test {
         assert_eq!(wallet_desc.to_string(), "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)#y8p7e8kk");
     }
 
-    // test ToWalletDescriptor trait from &str with and without checksum appended
+    // test IntoWalletDescriptor trait from &str with and without checksum appended
     #[test]
     fn test_descriptor_from_str_with_checksum() {
         let secp = Secp256k1::new();
@@ -673,7 +673,7 @@ mod test {
         ));
     }
 
-    // test ToWalletDescriptor trait from &str with keys from right and wrong network
+    // test IntoWalletDescriptor trait from &str with keys from right and wrong network
     #[test]
     fn test_descriptor_from_str_with_keys_network() {
         let secp = Secp256k1::new();
@@ -717,7 +717,7 @@ mod test {
         ));
     }
 
-    // test ToWalletDescriptor trait from the output of the descriptor!() macro
+    // test IntoWalletDescriptor trait from the output of the descriptor!() macro
     #[test]
     fn test_descriptor_from_str_from_output_of_macro() {
         let secp = Secp256k1::new();
index 11f8ed861f8902e32d97f219a8b53917d758ac7c..f138dfdb96990da0e01bbed863cbbb3a0edd6e26 100644 (file)
@@ -888,7 +888,7 @@ impl ExtractPolicy for Descriptor<DescriptorPublicKey> {
 #[cfg(test)]
 mod test {
     use crate::descriptor;
-    use crate::descriptor::{ExtractPolicy, ToWalletDescriptor};
+    use crate::descriptor::{ExtractPolicy, IntoWalletDescriptor};
 
     use super::*;
     use crate::descriptor::policy::SatisfiableItem::{Multisig, Signature, Thresh};
index 95d0292155c6ab1478f9e1f8bca475aebdb10118..98103dc6e06e464a268c08764cde09570a58854f 100644 (file)
@@ -32,7 +32,7 @@ use bitcoin::Network;
 
 use miniscript::{Legacy, Segwitv0};
 
-use super::{ExtendedDescriptor, KeyMap, ToWalletDescriptor};
+use super::{ExtendedDescriptor, IntoWalletDescriptor, KeyMap};
 use crate::descriptor::DescriptorError;
 use crate::keys::{DerivableKey, ToDescriptorKey, ValidNetworks};
 use crate::wallet::utils::SecpCtx;
@@ -43,7 +43,7 @@ pub type DescriptorTemplateOut = (ExtendedDescriptor, KeyMap, ValidNetworks);
 
 /// Trait for descriptor templates that can be built into a full descriptor
 ///
-/// Since [`ToWalletDescriptor`] is implemented for any [`DescriptorTemplate`], they can also be
+/// Since [`IntoWalletDescriptor`] is implemented for any [`DescriptorTemplate`], they can also be
 /// passed directly to the [`Wallet`](crate::Wallet) constructor.
 ///
 /// ## Example
@@ -69,7 +69,7 @@ pub trait DescriptorTemplate {
 
 /// Turns a [`DescriptorTemplate`] into a valid wallet descriptor by calling its
 /// [`build`](DescriptorTemplate::build) method
-impl<T: DescriptorTemplate> ToWalletDescriptor for T {
+impl<T: DescriptorTemplate> IntoWalletDescriptor for T {
     fn into_wallet_descriptor(
         self,
         secp: &SecpCtx,
index f862b6e2c657aacfda27ee7319c7532dd83ce769..b2729ec77fd52a2aa500f6bc7e3f078acbd58436 100644 (file)
@@ -67,7 +67,7 @@ use crate::database::{BatchDatabase, BatchOperations, DatabaseUtils};
 use crate::descriptor::derived::AsDerived;
 use crate::descriptor::{
     get_checksum, DerivedDescriptor, DerivedDescriptorMeta, DescriptorMeta, DescriptorScripts,
-    ExtendedDescriptor, ExtractPolicy, Policy, ToWalletDescriptor, XKeyUtils,
+    ExtendedDescriptor, ExtractPolicy, IntoWalletDescriptor, Policy, XKeyUtils,
 };
 use crate::error::Error;
 use crate::psbt::PSBTUtils;
@@ -110,7 +110,7 @@ where
     D: BatchDatabase,
 {
     /// Create a new "offline" wallet
-    pub fn new_offline<E: ToWalletDescriptor>(
+    pub fn new_offline<E: IntoWalletDescriptor>(
         descriptor: E,
         change_descriptor: Option<E>,
         network: Network,
@@ -124,7 +124,7 @@ impl<B, D> Wallet<B, D>
 where
     D: BatchDatabase,
 {
-    fn _new<E: ToWalletDescriptor>(
+    fn _new<E: IntoWalletDescriptor>(
         descriptor: E,
         change_descriptor: Option<E>,
         network: Network,
@@ -1247,7 +1247,7 @@ where
 {
     /// Create a new "online" wallet
     #[maybe_async]
-    pub fn new<E: ToWalletDescriptor>(
+    pub fn new<E: IntoWalletDescriptor>(
         descriptor: E,
         change_descriptor: Option<E>,
         network: Network,
index 7199dbbd9ad69224e5a27ec4115ce6c342849b21..aad07a202b7ee965b7dbd18920dff0b124de497a 100644 (file)
@@ -560,7 +560,7 @@ impl Eq for SignersContainerKey {}
 mod signers_container_tests {
     use super::*;
     use crate::descriptor;
-    use crate::descriptor::ToWalletDescriptor;
+    use crate::descriptor::IntoWalletDescriptor;
     use crate::keys::{DescriptorKey, ToDescriptorKey};
     use bitcoin::secp256k1::{All, Secp256k1};
     use bitcoin::util::bip32;