@@ -12,15 +12,6 @@ use bitcoin::{
12
12
13
13
use { MiniscriptKey , ToPublicKey } ;
14
14
15
- /// Single public key without any origin or range information
16
- #[ derive( Debug , Eq , PartialEq , Clone , Ord , PartialOrd , Hash ) ]
17
- pub enum SinglePubKey {
18
- /// FullKey (compressed or uncompressed)
19
- FullKey ( bitcoin:: PublicKey ) ,
20
- /// XOnlyPublicKey
21
- XOnly ( XOnlyPublicKey ) ,
22
- }
23
-
24
15
/// The MiniscriptKey corresponding to Descriptors. This can
25
16
/// either be Single public key or a Xpub
26
17
#[ derive( Debug , Eq , PartialEq , Clone , Ord , PartialOrd , Hash ) ]
@@ -31,6 +22,15 @@ pub enum DescriptorPublicKey {
31
22
XPub ( DescriptorXKey < bip32:: ExtendedPubKey > ) ,
32
23
}
33
24
25
+ /// A Secret Key that can be either a single key or an Xprv
26
+ #[ derive( Debug ) ]
27
+ pub enum DescriptorSecretKey {
28
+ /// Single Secret Key
29
+ SinglePriv ( DescriptorSinglePriv ) ,
30
+ /// Xprv
31
+ XPrv ( DescriptorXKey < bip32:: ExtendedPrivKey > ) ,
32
+ }
33
+
34
34
/// A Single Descriptor Key with optional origin information
35
35
#[ derive( Debug , Eq , PartialEq , Clone , Ord , PartialOrd , Hash ) ]
36
36
pub struct DescriptorSinglePub {
@@ -49,13 +49,26 @@ pub struct DescriptorSinglePriv {
49
49
pub key : bitcoin:: PrivateKey ,
50
50
}
51
51
52
- /// A Secret Key that can be either a single key or an Xprv
53
- #[ derive( Debug ) ]
54
- pub enum DescriptorSecretKey {
55
- /// Single Secret Key
56
- SinglePriv ( DescriptorSinglePriv ) ,
57
- /// Xprv
58
- XPrv ( DescriptorXKey < bip32:: ExtendedPrivKey > ) ,
52
+ /// Instance of an extended key with origin and derivation path
53
+ #[ derive( Debug , Eq , PartialEq , Clone , Ord , PartialOrd , Hash ) ]
54
+ pub struct DescriptorXKey < K : InnerXKey > {
55
+ /// Origin information
56
+ pub origin : Option < ( bip32:: Fingerprint , bip32:: DerivationPath ) > ,
57
+ /// The extended key
58
+ pub xkey : K ,
59
+ /// The derivation path
60
+ pub derivation_path : bip32:: DerivationPath ,
61
+ /// Whether the descriptor is wildcard
62
+ pub wildcard : Wildcard ,
63
+ }
64
+
65
+ /// Single public key without any origin or range information
66
+ #[ derive( Debug , Eq , PartialEq , Clone , Ord , PartialOrd , Hash ) ]
67
+ pub enum SinglePubKey {
68
+ /// FullKey (compressed or uncompressed)
69
+ FullKey ( bitcoin:: PublicKey ) ,
70
+ /// XOnlyPublicKey
71
+ XOnly ( XOnlyPublicKey ) ,
59
72
}
60
73
61
74
impl fmt:: Display for DescriptorSecretKey {
@@ -124,19 +137,6 @@ pub enum Wildcard {
124
137
Hardened ,
125
138
}
126
139
127
- /// Instance of an extended key with origin and derivation path
128
- #[ derive( Debug , Eq , PartialEq , Clone , Ord , PartialOrd , Hash ) ]
129
- pub struct DescriptorXKey < K : InnerXKey > {
130
- /// Origin information
131
- pub origin : Option < ( bip32:: Fingerprint , bip32:: DerivationPath ) > ,
132
- /// The extended key
133
- pub xkey : K ,
134
- /// The derivation path
135
- pub derivation_path : bip32:: DerivationPath ,
136
- /// Whether the descriptor is wildcard
137
- pub wildcard : Wildcard ,
138
- }
139
-
140
140
impl DescriptorSinglePriv {
141
141
/// Returns the public key of this key
142
142
fn as_public < C : Signing > (
0 commit comments