### 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
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,
) -> Result<(ExtendedDescriptor, KeyMap), DescriptorError>;
}
-impl ToWalletDescriptor for &str {
+impl IntoWalletDescriptor for &str {
fn into_wallet_descriptor(
self,
secp: &SecpCtx,
}
}
-impl ToWalletDescriptor for &String {
+impl IntoWalletDescriptor for &String {
fn into_wallet_descriptor(
self,
secp: &SecpCtx,
}
}
-impl ToWalletDescriptor for ExtendedDescriptor {
+impl IntoWalletDescriptor for ExtendedDescriptor {
fn into_wallet_descriptor(
self,
secp: &SecpCtx,
}
}
-impl ToWalletDescriptor for (ExtendedDescriptor, KeyMap) {
+impl IntoWalletDescriptor for (ExtendedDescriptor, KeyMap) {
fn into_wallet_descriptor(
self,
secp: &SecpCtx,
}
}
-impl ToWalletDescriptor for DescriptorTemplateOut {
+impl IntoWalletDescriptor for DescriptorTemplateOut {
fn into_wallet_descriptor(
self,
_secp: &SecpCtx,
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();
));
}
- // 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();
));
}
- // 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();
#[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};
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;
/// 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
/// 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,
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;
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,
where
D: BatchDatabase,
{
- fn _new<E: ToWalletDescriptor>(
+ fn _new<E: IntoWalletDescriptor>(
descriptor: E,
change_descriptor: Option<E>,
network: Network,
{
/// 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,
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;