Rename ToWalletDescriptor to IntoWalletDescriptor

This commit is contained in:
Steve Myers
2021-02-12 22:34:43 -08:00
parent 2f7513753c
commit d638da2f10
6 changed files with 19 additions and 19 deletions

View 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();

View 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};

View 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,