|
8 | 8 | use alloc::collections::BTreeMap; |
9 | 9 |
|
10 | 10 | use bitcoin::address::NetworkUnchecked; |
| 11 | +use bitcoin::bip32::{Xpriv, Xpub}; |
11 | 12 | use bitcoin::hashes::hash160; |
12 | 13 | use bitcoin::{ |
13 | 14 | bip32, sign_message, Address, Amount, BlockHash, FeeRate, PrivateKey, Psbt, PublicKey, |
@@ -284,6 +285,35 @@ pub struct GetBalancesWatchOnly { |
284 | 285 | pub immature: Amount, |
285 | 286 | } |
286 | 287 |
|
| 288 | +/// Models the result of JSON-RPC method `gethdkeys`. |
| 289 | +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] |
| 290 | +#[serde(deny_unknown_fields)] |
| 291 | +pub struct GetHdKeys(pub Vec<HdKey>); |
| 292 | + |
| 293 | +/// An HD key entry returned by `gethdkeys`. |
| 294 | +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] |
| 295 | +#[serde(deny_unknown_fields)] |
| 296 | +pub struct HdKey { |
| 297 | + /// The extended public key. |
| 298 | + pub xpub: Xpub, |
| 299 | + /// Whether the wallet has the private key for this xpub. |
| 300 | + pub has_private: bool, |
| 301 | + /// The extended private key if "private" is true. |
| 302 | + pub xpriv: Option<Xpriv>, |
| 303 | + /// Array of descriptor objects that use this HD key. |
| 304 | + pub descriptors: Vec<HdKeyDescriptor>, |
| 305 | +} |
| 306 | + |
| 307 | +/// Descriptor object used in `gethdkeys` result. |
| 308 | +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] |
| 309 | +#[serde(deny_unknown_fields)] |
| 310 | +pub struct HdKeyDescriptor { |
| 311 | + /// Descriptor string representation. |
| 312 | + pub descriptor: String, |
| 313 | + /// Whether this descriptor is currently used to generate new addresses. |
| 314 | + pub active: bool, |
| 315 | +} |
| 316 | + |
287 | 317 | /// Models the result of JSON-RPC method `getnewaddress`. |
288 | 318 | #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] |
289 | 319 | #[serde(deny_unknown_fields)] |
|
0 commit comments