Skip to main content

ethos_bitcoind/types/
responses.rs

1//! Generated version-specific RPC response types
2//!
3//! Generated for Bitcoin Core v30.2
4//!
5//! These types are version-specific and may not match other versions.
6use std::collections::HashMap;
7use std::str::FromStr;
8
9use serde::{Deserialize, Serialize};
10
11#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
12pub struct DecodedScriptPubKey {
13    /// Disassembly of the output script
14    pub asm: String,
15    /// Inferred descriptor for the output
16    pub desc: String,
17    /// The raw output script bytes, hex-encoded
18    pub hex: String,
19    /// The Bitcoin address (only if a well-defined address exists)
20    pub address: Option<String>,
21    /// The type (one of: nonstandard, anchor, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_scripthash, witness_v0_keyhash, witness_v1_taproot, witness_unknown)
22    #[serde(rename = "type")]
23    pub r#type: String,
24}
25
26/// Script sig in decoded tx input.
27/// See: <https://github.com/bitcoin/bitcoin/blob/744d47fcee0d32a71154292699bfdecf954a6065/src/core_io.cpp#L458-L461>
28#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
29pub struct DecodedScriptSig {
30    /// scriptSig in human-readable assembly form.
31    pub asm: String,
32    /// scriptSig serialized as hex.
33    pub hex: String,
34}
35
36/// Previous output (prevout) in decoded tx input; present for getblock verbosity 3.
37#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
38pub struct DecodedPrevout {
39    /// True if the prevout was created by a coinbase transaction.
40    pub generated: bool,
41    /// Block height where the prevout was created.
42    pub height: i64,
43    /// Decoded script pubkey of the prevout output.
44    #[serde(rename = "scriptPubKey")]
45    pub script_pub_key: DecodedScriptPubKey,
46    /// Value of the prevout output in BTC.
47    pub value: f64,
48}
49
50/// Transaction input in decoded tx; prevout is None for getblock verbosity 2, Some for verbosity 3.
51#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
52pub struct DecodedVin {
53    /// Transaction id of the previous output being spent.
54    pub txid: String,
55    /// Index of the previous output being spent.
56    pub vout: u32,
57    /// Decoded scriptSig for this input, when present.
58    #[serde(rename = "scriptSig", default, skip_serializing_if = "Option::is_none")]
59    pub script_sig: Option<DecodedScriptSig>,
60    /// Input sequence number.
61    pub sequence: u64,
62    /// Witness stack items for this input (if any).
63    #[serde(rename = "txinwitness", default, skip_serializing_if = "Option::is_none")]
64    pub tx_in_witness: Option<Vec<String>>,
65    /// Decoded details of the previous output when verbosity includes prevout.
66    #[serde(default, skip_serializing_if = "Option::is_none")]
67    pub prevout: Option<DecodedPrevout>,
68}
69
70/// Transaction output in decoded tx; mirrors Core vout object.
71/// See: <https://github.com/bitcoin/bitcoin/blob/744d47fcee0d32a71154292699bfdecf954a6065/src/core_io.cpp#L495-L519>
72#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
73pub struct DecodedVout {
74    /// Value in BTC of this output.
75    pub value: f64,
76    /// Index of this output within the transaction.
77    pub n: u32,
78    /// Decoded script pubkey of this output.
79    #[serde(rename = "scriptPubKey")]
80    pub script_pub_key: DecodedScriptPubKey,
81}
82
83/// Decoded transaction details (getblock verbosity 2/3 and getrawtransaction verbose).
84#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
85pub struct DecodedTxDetails {
86    /// Transaction id.
87    pub txid: String,
88    /// Witness transaction id (wtxid).
89    pub hash: String,
90    /// Transaction version.
91    pub version: i32,
92    /// Total serialized size of the transaction in bytes.
93    pub size: u32,
94    /// Virtual transaction size (vsize) as defined in BIP 141.
95    pub vsize: u32,
96    /// Transaction weight as defined in BIP 141.
97    pub weight: u32,
98    /// Transaction locktime.
99    pub locktime: u32,
100    /// List of transaction inputs.
101    pub vin: Vec<DecodedVin>,
102    /// List of transaction outputs.
103    pub vout: Vec<DecodedVout>,
104    /// Fee paid by the transaction, when undo data is available.
105    pub fee: f64,
106    /// Raw transaction serialized as hex (consistent with getrawtransaction verbose output).
107    pub hex: String,
108}
109
110/// Hex-encoded block data returned by getblock with verbosity 0.
111#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
112pub struct GetBlockV0 {
113    /// Serialized block as a hex string.
114    pub hex: String,
115}
116
117/// Verbose block view with decoded transactions (built from getblock verbosities 1 and 2).
118#[derive(Debug, Clone, PartialEq, Serialize)]
119pub struct GetBlockWithTxsResponse {
120    /// Block header and summary information from getblock verbosity 1.
121    pub base: GetBlockResponse,
122    /// Fully decoded transactions in the block, matching getblock verbosity 2.
123    pub decoded_txs: Vec<DecodedTxDetails>,
124}
125
126/// Verbose block view with decoded transactions and prevout metadata (getblock verbosity 3).
127#[derive(Debug, Clone, PartialEq, Serialize)]
128pub struct GetBlockWithPrevoutResponse {
129    /// Verbose block view with prevout-rich inputs; wraps the verbosity-2 representation.
130    pub inner: GetBlockWithTxsResponse,
131}
132
133/// One transaction entry in getblocktemplate "transactions" array (BIP 22/23/145).
134#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
135pub struct GetBlockTemplateTransaction {
136    /// Transaction data encoded in hexadecimal (byte-for-byte).
137    pub data: String,
138    /// 1-based indexes of transactions in the 'transactions' list that must be present before this one.
139    pub depends: Vec<i64>,
140    /// Difference in value between inputs and outputs (satoshis); absent when unknown.
141    #[serde(default, skip_serializing_if = "Option::is_none")]
142    pub fee: Option<i64>,
143    /// Transaction hash including witness data (byte-reversed hex).
144    pub hash: String,
145    /// Total SigOps cost for block limits; absent when unknown.
146    #[serde(default, skip_serializing_if = "Option::is_none")]
147    pub sigops: Option<i64>,
148    /// Transaction hash excluding witness data (byte-reversed hex).
149    pub txid: String,
150    /// Total transaction weight for block limits.
151    pub weight: i64,
152}
153
154/// Response for the `AbandonTransaction` RPC method
155///
156/// This method returns a primitive value wrapped in a transparent struct.
157#[derive(Debug, Clone, PartialEq, Serialize)]
158pub struct AbandonTransactionResponse {
159    /// Wrapped primitive value
160    pub value: (),
161}
162
163impl<'de> serde::Deserialize<'de> for AbandonTransactionResponse {
164    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
165    where
166        D: serde::Deserializer<'de>,
167    {
168        use std::fmt;
169
170        use serde::de::{self, Visitor};
171
172        struct PrimitiveWrapperVisitor;
173
174        #[allow(unused_variables, clippy::needless_lifetimes)]
175        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
176            type Value = AbandonTransactionResponse;
177
178            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
179                formatter.write_str("a primitive value or an object with 'value' field")
180            }
181
182            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
183            where
184                E: de::Error,
185            {
186                Ok(AbandonTransactionResponse { value: () })
187            }
188
189            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
190            where
191                E: de::Error,
192            {
193                Ok(AbandonTransactionResponse { value: () })
194            }
195
196            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
197            where
198                E: de::Error,
199            {
200                Ok(AbandonTransactionResponse { value: () })
201            }
202
203            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
204            where
205                E: de::Error,
206            {
207                Ok(AbandonTransactionResponse { value: () })
208            }
209
210            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
211            where
212                E: de::Error,
213            {
214                Ok(AbandonTransactionResponse { value: () })
215            }
216
217            fn visit_none<E>(self) -> Result<Self::Value, E>
218            where
219                E: de::Error,
220            {
221                Ok(AbandonTransactionResponse { value: () })
222            }
223
224            fn visit_unit<E>(self) -> Result<Self::Value, E>
225            where
226                E: de::Error,
227            {
228                Ok(AbandonTransactionResponse { value: () })
229            }
230
231            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
232            where
233                M: de::MapAccess<'de>,
234            {
235                let mut value = None;
236                while let Some(key) = map.next_key::<String>()? {
237                    if key == "value" {
238                        if value.is_some() {
239                            return Err(de::Error::duplicate_field("value"));
240                        }
241                        value = Some(map.next_value::<()>()?);
242                    } else {
243                        let _ = map.next_value::<de::IgnoredAny>()?;
244                    }
245                }
246                value.ok_or_else(|| de::Error::missing_field("value"))?;
247                Ok(AbandonTransactionResponse { value: () })
248            }
249        }
250
251        deserializer.deserialize_any(PrimitiveWrapperVisitor)
252    }
253}
254
255impl std::ops::Deref for AbandonTransactionResponse {
256    type Target = ();
257    fn deref(&self) -> &Self::Target { &self.value }
258}
259
260impl std::ops::DerefMut for AbandonTransactionResponse {
261    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
262}
263
264impl AsRef<()> for AbandonTransactionResponse {
265    fn as_ref(&self) -> &() { &self.value }
266}
267
268impl From<()> for AbandonTransactionResponse {
269    fn from(value: ()) -> Self { Self { value } }
270}
271
272impl From<AbandonTransactionResponse> for () {
273    fn from(wrapper: AbandonTransactionResponse) -> Self { wrapper.value }
274}
275
276/// Response for the `AbortRescan` RPC method
277///
278/// This method returns a primitive value wrapped in a transparent struct.
279#[derive(Debug, Clone, PartialEq, Serialize)]
280pub struct AbortRescanResponse {
281    /// Wrapped primitive value
282    pub value: bool,
283}
284
285impl<'de> serde::Deserialize<'de> for AbortRescanResponse {
286    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
287    where
288        D: serde::Deserializer<'de>,
289    {
290        use std::fmt;
291
292        use serde::de::{self, Visitor};
293
294        struct PrimitiveWrapperVisitor;
295
296        #[allow(unused_variables, clippy::needless_lifetimes)]
297        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
298            type Value = AbortRescanResponse;
299
300            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
301                formatter.write_str("a primitive value or an object with 'value' field")
302            }
303
304            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
305            where
306                E: de::Error,
307            {
308                Ok(AbortRescanResponse { value: v != 0 })
309            }
310
311            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
312            where
313                E: de::Error,
314            {
315                Ok(AbortRescanResponse { value: v != 0 })
316            }
317
318            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
319            where
320                E: de::Error,
321            {
322                Ok(AbortRescanResponse { value: v != 0.0 })
323            }
324
325            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
326            where
327                E: de::Error,
328            {
329                let value = v.parse::<bool>().map_err(de::Error::custom)?;
330                Ok(AbortRescanResponse { value })
331            }
332
333            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
334            where
335                E: de::Error,
336            {
337                Ok(AbortRescanResponse { value: v })
338            }
339
340            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
341            where
342                M: de::MapAccess<'de>,
343            {
344                let mut value = None;
345                while let Some(key) = map.next_key::<String>()? {
346                    if key == "value" {
347                        if value.is_some() {
348                            return Err(de::Error::duplicate_field("value"));
349                        }
350                        value = Some(map.next_value()?);
351                    } else {
352                        let _ = map.next_value::<de::IgnoredAny>()?;
353                    }
354                }
355                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
356                Ok(AbortRescanResponse { value })
357            }
358        }
359
360        deserializer.deserialize_any(PrimitiveWrapperVisitor)
361    }
362}
363
364impl std::ops::Deref for AbortRescanResponse {
365    type Target = bool;
366    fn deref(&self) -> &Self::Target { &self.value }
367}
368
369impl std::ops::DerefMut for AbortRescanResponse {
370    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
371}
372
373impl AsRef<bool> for AbortRescanResponse {
374    fn as_ref(&self) -> &bool { &self.value }
375}
376
377impl From<bool> for AbortRescanResponse {
378    fn from(value: bool) -> Self { Self { value } }
379}
380
381impl From<AbortRescanResponse> for bool {
382    fn from(wrapper: AbortRescanResponse) -> Self { wrapper.value }
383}
384
385/// Response for the `AddConnection` RPC method
386///
387#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
388#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
389pub struct AddConnectionResponse {
390    /// Address of newly added connection.
391    pub address: String,
392    /// Type of connection opened.
393    pub connection_type: String,
394}
395
396/// Response for the `AddNode` RPC method
397///
398/// This method returns a primitive value wrapped in a transparent struct.
399#[derive(Debug, Clone, PartialEq, Serialize)]
400pub struct AddNodeResponse {
401    /// Wrapped primitive value
402    pub value: (),
403}
404
405impl<'de> serde::Deserialize<'de> for AddNodeResponse {
406    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
407    where
408        D: serde::Deserializer<'de>,
409    {
410        use std::fmt;
411
412        use serde::de::{self, Visitor};
413
414        struct PrimitiveWrapperVisitor;
415
416        #[allow(unused_variables, clippy::needless_lifetimes)]
417        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
418            type Value = AddNodeResponse;
419
420            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
421                formatter.write_str("a primitive value or an object with 'value' field")
422            }
423
424            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
425            where
426                E: de::Error,
427            {
428                Ok(AddNodeResponse { value: () })
429            }
430
431            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
432            where
433                E: de::Error,
434            {
435                Ok(AddNodeResponse { value: () })
436            }
437
438            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
439            where
440                E: de::Error,
441            {
442                Ok(AddNodeResponse { value: () })
443            }
444
445            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
446            where
447                E: de::Error,
448            {
449                Ok(AddNodeResponse { value: () })
450            }
451
452            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
453            where
454                E: de::Error,
455            {
456                Ok(AddNodeResponse { value: () })
457            }
458
459            fn visit_none<E>(self) -> Result<Self::Value, E>
460            where
461                E: de::Error,
462            {
463                Ok(AddNodeResponse { value: () })
464            }
465
466            fn visit_unit<E>(self) -> Result<Self::Value, E>
467            where
468                E: de::Error,
469            {
470                Ok(AddNodeResponse { value: () })
471            }
472
473            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
474            where
475                M: de::MapAccess<'de>,
476            {
477                let mut value = None;
478                while let Some(key) = map.next_key::<String>()? {
479                    if key == "value" {
480                        if value.is_some() {
481                            return Err(de::Error::duplicate_field("value"));
482                        }
483                        value = Some(map.next_value::<()>()?);
484                    } else {
485                        let _ = map.next_value::<de::IgnoredAny>()?;
486                    }
487                }
488                value.ok_or_else(|| de::Error::missing_field("value"))?;
489                Ok(AddNodeResponse { value: () })
490            }
491        }
492
493        deserializer.deserialize_any(PrimitiveWrapperVisitor)
494    }
495}
496
497impl std::ops::Deref for AddNodeResponse {
498    type Target = ();
499    fn deref(&self) -> &Self::Target { &self.value }
500}
501
502impl std::ops::DerefMut for AddNodeResponse {
503    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
504}
505
506impl AsRef<()> for AddNodeResponse {
507    fn as_ref(&self) -> &() { &self.value }
508}
509
510impl From<()> for AddNodeResponse {
511    fn from(value: ()) -> Self { Self { value } }
512}
513
514impl From<AddNodeResponse> for () {
515    fn from(wrapper: AddNodeResponse) -> Self { wrapper.value }
516}
517
518/// Response for the `AddPeerAddress` RPC method
519///
520#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
521#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
522pub struct AddPeerAddressResponse {
523    /// whether the peer address was successfully added to the address manager table
524    pub success: bool,
525    /// error description, if the address could not be added
526    pub error: Option<String>,
527}
528
529/// Response for the `AnalyzePsbt` RPC method
530///
531#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
532#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
533pub struct AnalyzePsbtResponse {
534    pub inputs: Option<serde_json::Value>,
535    /// Estimated vsize of the final signed transaction
536    pub estimated_vsize: Option<u64>,
537    /// Estimated feerate of the final signed transaction in BTC/kvB. Shown only if all UTXO slots in the PSBT have been filled
538    pub estimated_feerate: Option<f64>,
539    /// The transaction fee paid. Shown only if all UTXO slots in the PSBT have been filled
540    #[serde(default)]
541    #[serde(deserialize_with = "option_amount_from_btc_float")]
542    pub fee: Option<bitcoin::Amount>,
543    /// Role of the next person that this psbt needs to go to
544    pub next: String,
545    /// Error message (if there is one)
546    pub error: Option<String>,
547}
548
549/// Response for the `BackupWallet` RPC method
550///
551/// This method returns a primitive value wrapped in a transparent struct.
552#[derive(Debug, Clone, PartialEq, Serialize)]
553pub struct BackupWalletResponse {
554    /// Wrapped primitive value
555    pub value: (),
556}
557
558impl<'de> serde::Deserialize<'de> for BackupWalletResponse {
559    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
560    where
561        D: serde::Deserializer<'de>,
562    {
563        use std::fmt;
564
565        use serde::de::{self, Visitor};
566
567        struct PrimitiveWrapperVisitor;
568
569        #[allow(unused_variables, clippy::needless_lifetimes)]
570        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
571            type Value = BackupWalletResponse;
572
573            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
574                formatter.write_str("a primitive value or an object with 'value' field")
575            }
576
577            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
578            where
579                E: de::Error,
580            {
581                Ok(BackupWalletResponse { value: () })
582            }
583
584            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
585            where
586                E: de::Error,
587            {
588                Ok(BackupWalletResponse { value: () })
589            }
590
591            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
592            where
593                E: de::Error,
594            {
595                Ok(BackupWalletResponse { value: () })
596            }
597
598            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
599            where
600                E: de::Error,
601            {
602                Ok(BackupWalletResponse { value: () })
603            }
604
605            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
606            where
607                E: de::Error,
608            {
609                Ok(BackupWalletResponse { value: () })
610            }
611
612            fn visit_none<E>(self) -> Result<Self::Value, E>
613            where
614                E: de::Error,
615            {
616                Ok(BackupWalletResponse { value: () })
617            }
618
619            fn visit_unit<E>(self) -> Result<Self::Value, E>
620            where
621                E: de::Error,
622            {
623                Ok(BackupWalletResponse { value: () })
624            }
625
626            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
627            where
628                M: de::MapAccess<'de>,
629            {
630                let mut value = None;
631                while let Some(key) = map.next_key::<String>()? {
632                    if key == "value" {
633                        if value.is_some() {
634                            return Err(de::Error::duplicate_field("value"));
635                        }
636                        value = Some(map.next_value::<()>()?);
637                    } else {
638                        let _ = map.next_value::<de::IgnoredAny>()?;
639                    }
640                }
641                value.ok_or_else(|| de::Error::missing_field("value"))?;
642                Ok(BackupWalletResponse { value: () })
643            }
644        }
645
646        deserializer.deserialize_any(PrimitiveWrapperVisitor)
647    }
648}
649
650impl std::ops::Deref for BackupWalletResponse {
651    type Target = ();
652    fn deref(&self) -> &Self::Target { &self.value }
653}
654
655impl std::ops::DerefMut for BackupWalletResponse {
656    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
657}
658
659impl AsRef<()> for BackupWalletResponse {
660    fn as_ref(&self) -> &() { &self.value }
661}
662
663impl From<()> for BackupWalletResponse {
664    fn from(value: ()) -> Self { Self { value } }
665}
666
667impl From<BackupWalletResponse> for () {
668    fn from(wrapper: BackupWalletResponse) -> Self { wrapper.value }
669}
670
671/// Response for the `BumpFee` RPC method
672///
673#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
674#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
675pub struct BumpFeeResponse {
676    /// The id of the new transaction.
677    pub txid: bitcoin::Txid,
678    /// The fee of the replaced transaction.
679    #[serde(rename = "origfee")]
680    #[serde(deserialize_with = "amount_from_btc_float")]
681    pub orig_fee: bitcoin::Amount,
682    /// The fee of the new transaction.
683    #[serde(deserialize_with = "amount_from_btc_float")]
684    pub fee: bitcoin::Amount,
685    /// Errors encountered during processing (may be empty).
686    pub errors: Vec<String>,
687}
688
689/// Response for the `ClearBanned` RPC method
690///
691/// This method returns a primitive value wrapped in a transparent struct.
692#[derive(Debug, Clone, PartialEq, Serialize)]
693pub struct ClearBannedResponse {
694    /// Wrapped primitive value
695    pub value: (),
696}
697
698impl<'de> serde::Deserialize<'de> for ClearBannedResponse {
699    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
700    where
701        D: serde::Deserializer<'de>,
702    {
703        use std::fmt;
704
705        use serde::de::{self, Visitor};
706
707        struct PrimitiveWrapperVisitor;
708
709        #[allow(unused_variables, clippy::needless_lifetimes)]
710        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
711            type Value = ClearBannedResponse;
712
713            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
714                formatter.write_str("a primitive value or an object with 'value' field")
715            }
716
717            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
718            where
719                E: de::Error,
720            {
721                Ok(ClearBannedResponse { value: () })
722            }
723
724            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
725            where
726                E: de::Error,
727            {
728                Ok(ClearBannedResponse { value: () })
729            }
730
731            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
732            where
733                E: de::Error,
734            {
735                Ok(ClearBannedResponse { value: () })
736            }
737
738            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
739            where
740                E: de::Error,
741            {
742                Ok(ClearBannedResponse { value: () })
743            }
744
745            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
746            where
747                E: de::Error,
748            {
749                Ok(ClearBannedResponse { value: () })
750            }
751
752            fn visit_none<E>(self) -> Result<Self::Value, E>
753            where
754                E: de::Error,
755            {
756                Ok(ClearBannedResponse { value: () })
757            }
758
759            fn visit_unit<E>(self) -> Result<Self::Value, E>
760            where
761                E: de::Error,
762            {
763                Ok(ClearBannedResponse { value: () })
764            }
765
766            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
767            where
768                M: de::MapAccess<'de>,
769            {
770                let mut value = None;
771                while let Some(key) = map.next_key::<String>()? {
772                    if key == "value" {
773                        if value.is_some() {
774                            return Err(de::Error::duplicate_field("value"));
775                        }
776                        value = Some(map.next_value::<()>()?);
777                    } else {
778                        let _ = map.next_value::<de::IgnoredAny>()?;
779                    }
780                }
781                value.ok_or_else(|| de::Error::missing_field("value"))?;
782                Ok(ClearBannedResponse { value: () })
783            }
784        }
785
786        deserializer.deserialize_any(PrimitiveWrapperVisitor)
787    }
788}
789
790impl std::ops::Deref for ClearBannedResponse {
791    type Target = ();
792    fn deref(&self) -> &Self::Target { &self.value }
793}
794
795impl std::ops::DerefMut for ClearBannedResponse {
796    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
797}
798
799impl AsRef<()> for ClearBannedResponse {
800    fn as_ref(&self) -> &() { &self.value }
801}
802
803impl From<()> for ClearBannedResponse {
804    fn from(value: ()) -> Self { Self { value } }
805}
806
807impl From<ClearBannedResponse> for () {
808    fn from(wrapper: ClearBannedResponse) -> Self { wrapper.value }
809}
810
811/// Response for the `CombinePsbt` RPC method
812///
813/// This method returns a primitive value wrapped in a transparent struct.
814#[derive(Debug, Clone, PartialEq, Serialize)]
815pub struct CombinePsbtResponse {
816    /// Wrapped primitive value
817    pub value: String,
818}
819
820impl<'de> serde::Deserialize<'de> for CombinePsbtResponse {
821    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
822    where
823        D: serde::Deserializer<'de>,
824    {
825        use std::fmt;
826
827        use serde::de::{self, Visitor};
828
829        struct PrimitiveWrapperVisitor;
830
831        #[allow(unused_variables, clippy::needless_lifetimes)]
832        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
833            type Value = CombinePsbtResponse;
834
835            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
836                formatter.write_str("a primitive value or an object with 'value' field")
837            }
838
839            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
840            where
841                E: de::Error,
842            {
843                Ok(CombinePsbtResponse { value: v.to_string() })
844            }
845
846            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
847            where
848                E: de::Error,
849            {
850                Ok(CombinePsbtResponse { value: v.to_string() })
851            }
852
853            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
854            where
855                E: de::Error,
856            {
857                Ok(CombinePsbtResponse { value: v.to_string() })
858            }
859
860            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
861            where
862                E: de::Error,
863            {
864                Ok(CombinePsbtResponse { value: v.to_string() })
865            }
866
867            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
868            where
869                E: de::Error,
870            {
871                Ok(CombinePsbtResponse { value: v.to_string() })
872            }
873
874            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
875            where
876                M: de::MapAccess<'de>,
877            {
878                let mut value = None;
879                while let Some(key) = map.next_key::<String>()? {
880                    if key == "value" {
881                        if value.is_some() {
882                            return Err(de::Error::duplicate_field("value"));
883                        }
884                        value = Some(map.next_value()?);
885                    } else {
886                        let _ = map.next_value::<de::IgnoredAny>()?;
887                    }
888                }
889                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
890                Ok(CombinePsbtResponse { value })
891            }
892        }
893
894        deserializer.deserialize_any(PrimitiveWrapperVisitor)
895    }
896}
897
898impl std::ops::Deref for CombinePsbtResponse {
899    type Target = String;
900    fn deref(&self) -> &Self::Target { &self.value }
901}
902
903impl std::ops::DerefMut for CombinePsbtResponse {
904    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
905}
906
907impl AsRef<String> for CombinePsbtResponse {
908    fn as_ref(&self) -> &String { &self.value }
909}
910
911impl From<String> for CombinePsbtResponse {
912    fn from(value: String) -> Self { Self { value } }
913}
914
915impl From<CombinePsbtResponse> for String {
916    fn from(wrapper: CombinePsbtResponse) -> Self { wrapper.value }
917}
918
919/// Response for the `CombineRawTransaction` RPC method
920///
921/// This method returns a primitive value wrapped in a transparent struct.
922#[derive(Debug, Clone, PartialEq, Serialize)]
923pub struct CombineRawTransactionResponse {
924    /// Wrapped primitive value
925    pub value: String,
926}
927
928impl<'de> serde::Deserialize<'de> for CombineRawTransactionResponse {
929    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
930    where
931        D: serde::Deserializer<'de>,
932    {
933        use std::fmt;
934
935        use serde::de::{self, Visitor};
936
937        struct PrimitiveWrapperVisitor;
938
939        #[allow(unused_variables, clippy::needless_lifetimes)]
940        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
941            type Value = CombineRawTransactionResponse;
942
943            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
944                formatter.write_str("a primitive value or an object with 'value' field")
945            }
946
947            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
948            where
949                E: de::Error,
950            {
951                Ok(CombineRawTransactionResponse { value: v.to_string() })
952            }
953
954            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
955            where
956                E: de::Error,
957            {
958                Ok(CombineRawTransactionResponse { value: v.to_string() })
959            }
960
961            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
962            where
963                E: de::Error,
964            {
965                Ok(CombineRawTransactionResponse { value: v.to_string() })
966            }
967
968            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
969            where
970                E: de::Error,
971            {
972                Ok(CombineRawTransactionResponse { value: v.to_string() })
973            }
974
975            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
976            where
977                E: de::Error,
978            {
979                Ok(CombineRawTransactionResponse { value: v.to_string() })
980            }
981
982            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
983            where
984                M: de::MapAccess<'de>,
985            {
986                let mut value = None;
987                while let Some(key) = map.next_key::<String>()? {
988                    if key == "value" {
989                        if value.is_some() {
990                            return Err(de::Error::duplicate_field("value"));
991                        }
992                        value = Some(map.next_value()?);
993                    } else {
994                        let _ = map.next_value::<de::IgnoredAny>()?;
995                    }
996                }
997                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
998                Ok(CombineRawTransactionResponse { value })
999            }
1000        }
1001
1002        deserializer.deserialize_any(PrimitiveWrapperVisitor)
1003    }
1004}
1005
1006impl std::ops::Deref for CombineRawTransactionResponse {
1007    type Target = String;
1008    fn deref(&self) -> &Self::Target { &self.value }
1009}
1010
1011impl std::ops::DerefMut for CombineRawTransactionResponse {
1012    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
1013}
1014
1015impl AsRef<String> for CombineRawTransactionResponse {
1016    fn as_ref(&self) -> &String { &self.value }
1017}
1018
1019impl From<String> for CombineRawTransactionResponse {
1020    fn from(value: String) -> Self { Self { value } }
1021}
1022
1023impl From<CombineRawTransactionResponse> for String {
1024    fn from(wrapper: CombineRawTransactionResponse) -> Self { wrapper.value }
1025}
1026
1027/// Response for the `ConvertToPsbt` RPC method
1028///
1029/// This method returns a primitive value wrapped in a transparent struct.
1030#[derive(Debug, Clone, PartialEq, Serialize)]
1031pub struct ConvertToPsbtResponse {
1032    /// Wrapped primitive value
1033    pub value: String,
1034}
1035
1036impl<'de> serde::Deserialize<'de> for ConvertToPsbtResponse {
1037    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1038    where
1039        D: serde::Deserializer<'de>,
1040    {
1041        use std::fmt;
1042
1043        use serde::de::{self, Visitor};
1044
1045        struct PrimitiveWrapperVisitor;
1046
1047        #[allow(unused_variables, clippy::needless_lifetimes)]
1048        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
1049            type Value = ConvertToPsbtResponse;
1050
1051            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
1052                formatter.write_str("a primitive value or an object with 'value' field")
1053            }
1054
1055            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
1056            where
1057                E: de::Error,
1058            {
1059                Ok(ConvertToPsbtResponse { value: v.to_string() })
1060            }
1061
1062            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
1063            where
1064                E: de::Error,
1065            {
1066                Ok(ConvertToPsbtResponse { value: v.to_string() })
1067            }
1068
1069            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
1070            where
1071                E: de::Error,
1072            {
1073                Ok(ConvertToPsbtResponse { value: v.to_string() })
1074            }
1075
1076            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
1077            where
1078                E: de::Error,
1079            {
1080                Ok(ConvertToPsbtResponse { value: v.to_string() })
1081            }
1082
1083            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
1084            where
1085                E: de::Error,
1086            {
1087                Ok(ConvertToPsbtResponse { value: v.to_string() })
1088            }
1089
1090            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
1091            where
1092                M: de::MapAccess<'de>,
1093            {
1094                let mut value = None;
1095                while let Some(key) = map.next_key::<String>()? {
1096                    if key == "value" {
1097                        if value.is_some() {
1098                            return Err(de::Error::duplicate_field("value"));
1099                        }
1100                        value = Some(map.next_value()?);
1101                    } else {
1102                        let _ = map.next_value::<de::IgnoredAny>()?;
1103                    }
1104                }
1105                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
1106                Ok(ConvertToPsbtResponse { value })
1107            }
1108        }
1109
1110        deserializer.deserialize_any(PrimitiveWrapperVisitor)
1111    }
1112}
1113
1114impl std::ops::Deref for ConvertToPsbtResponse {
1115    type Target = String;
1116    fn deref(&self) -> &Self::Target { &self.value }
1117}
1118
1119impl std::ops::DerefMut for ConvertToPsbtResponse {
1120    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
1121}
1122
1123impl AsRef<String> for ConvertToPsbtResponse {
1124    fn as_ref(&self) -> &String { &self.value }
1125}
1126
1127impl From<String> for ConvertToPsbtResponse {
1128    fn from(value: String) -> Self { Self { value } }
1129}
1130
1131impl From<ConvertToPsbtResponse> for String {
1132    fn from(wrapper: ConvertToPsbtResponse) -> Self { wrapper.value }
1133}
1134
1135/// Response for the `CreateMultisig` RPC method
1136///
1137#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
1138#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
1139pub struct CreateMultisigResponse {
1140    /// The value of the new multisig address.
1141    pub address: String,
1142    /// The string value of the hex-encoded redemption script.
1143    pub redeemScript: bitcoin::ScriptBuf,
1144    /// The descriptor for this multisig
1145    pub descriptor: String,
1146    /// Any warnings resulting from the creation of this multisig
1147    pub warnings: Option<Vec<String>>,
1148}
1149
1150/// Response for the `CreatePsbt` RPC method
1151///
1152/// This method returns a primitive value wrapped in a transparent struct.
1153#[derive(Debug, Clone, PartialEq, Serialize)]
1154pub struct CreatePsbtResponse {
1155    /// Wrapped primitive value
1156    pub value: String,
1157}
1158
1159impl<'de> serde::Deserialize<'de> for CreatePsbtResponse {
1160    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1161    where
1162        D: serde::Deserializer<'de>,
1163    {
1164        use std::fmt;
1165
1166        use serde::de::{self, Visitor};
1167
1168        struct PrimitiveWrapperVisitor;
1169
1170        #[allow(unused_variables, clippy::needless_lifetimes)]
1171        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
1172            type Value = CreatePsbtResponse;
1173
1174            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
1175                formatter.write_str("a primitive value or an object with 'value' field")
1176            }
1177
1178            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
1179            where
1180                E: de::Error,
1181            {
1182                Ok(CreatePsbtResponse { value: v.to_string() })
1183            }
1184
1185            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
1186            where
1187                E: de::Error,
1188            {
1189                Ok(CreatePsbtResponse { value: v.to_string() })
1190            }
1191
1192            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
1193            where
1194                E: de::Error,
1195            {
1196                Ok(CreatePsbtResponse { value: v.to_string() })
1197            }
1198
1199            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
1200            where
1201                E: de::Error,
1202            {
1203                Ok(CreatePsbtResponse { value: v.to_string() })
1204            }
1205
1206            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
1207            where
1208                E: de::Error,
1209            {
1210                Ok(CreatePsbtResponse { value: v.to_string() })
1211            }
1212
1213            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
1214            where
1215                M: de::MapAccess<'de>,
1216            {
1217                let mut value = None;
1218                while let Some(key) = map.next_key::<String>()? {
1219                    if key == "value" {
1220                        if value.is_some() {
1221                            return Err(de::Error::duplicate_field("value"));
1222                        }
1223                        value = Some(map.next_value()?);
1224                    } else {
1225                        let _ = map.next_value::<de::IgnoredAny>()?;
1226                    }
1227                }
1228                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
1229                Ok(CreatePsbtResponse { value })
1230            }
1231        }
1232
1233        deserializer.deserialize_any(PrimitiveWrapperVisitor)
1234    }
1235}
1236
1237impl std::ops::Deref for CreatePsbtResponse {
1238    type Target = String;
1239    fn deref(&self) -> &Self::Target { &self.value }
1240}
1241
1242impl std::ops::DerefMut for CreatePsbtResponse {
1243    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
1244}
1245
1246impl AsRef<String> for CreatePsbtResponse {
1247    fn as_ref(&self) -> &String { &self.value }
1248}
1249
1250impl From<String> for CreatePsbtResponse {
1251    fn from(value: String) -> Self { Self { value } }
1252}
1253
1254impl From<CreatePsbtResponse> for String {
1255    fn from(wrapper: CreatePsbtResponse) -> Self { wrapper.value }
1256}
1257
1258/// Response for the `CreateRawTransaction` RPC method
1259///
1260/// This method returns a primitive value wrapped in a transparent struct.
1261#[derive(Debug, Clone, PartialEq, Serialize)]
1262pub struct CreateRawTransactionResponse {
1263    /// Wrapped primitive value
1264    pub value: String,
1265}
1266
1267impl<'de> serde::Deserialize<'de> for CreateRawTransactionResponse {
1268    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1269    where
1270        D: serde::Deserializer<'de>,
1271    {
1272        use std::fmt;
1273
1274        use serde::de::{self, Visitor};
1275
1276        struct PrimitiveWrapperVisitor;
1277
1278        #[allow(unused_variables, clippy::needless_lifetimes)]
1279        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
1280            type Value = CreateRawTransactionResponse;
1281
1282            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
1283                formatter.write_str("a primitive value or an object with 'value' field")
1284            }
1285
1286            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
1287            where
1288                E: de::Error,
1289            {
1290                Ok(CreateRawTransactionResponse { value: v.to_string() })
1291            }
1292
1293            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
1294            where
1295                E: de::Error,
1296            {
1297                Ok(CreateRawTransactionResponse { value: v.to_string() })
1298            }
1299
1300            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
1301            where
1302                E: de::Error,
1303            {
1304                Ok(CreateRawTransactionResponse { value: v.to_string() })
1305            }
1306
1307            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
1308            where
1309                E: de::Error,
1310            {
1311                Ok(CreateRawTransactionResponse { value: v.to_string() })
1312            }
1313
1314            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
1315            where
1316                E: de::Error,
1317            {
1318                Ok(CreateRawTransactionResponse { value: v.to_string() })
1319            }
1320
1321            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
1322            where
1323                M: de::MapAccess<'de>,
1324            {
1325                let mut value = None;
1326                while let Some(key) = map.next_key::<String>()? {
1327                    if key == "value" {
1328                        if value.is_some() {
1329                            return Err(de::Error::duplicate_field("value"));
1330                        }
1331                        value = Some(map.next_value()?);
1332                    } else {
1333                        let _ = map.next_value::<de::IgnoredAny>()?;
1334                    }
1335                }
1336                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
1337                Ok(CreateRawTransactionResponse { value })
1338            }
1339        }
1340
1341        deserializer.deserialize_any(PrimitiveWrapperVisitor)
1342    }
1343}
1344
1345impl std::ops::Deref for CreateRawTransactionResponse {
1346    type Target = String;
1347    fn deref(&self) -> &Self::Target { &self.value }
1348}
1349
1350impl std::ops::DerefMut for CreateRawTransactionResponse {
1351    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
1352}
1353
1354impl AsRef<String> for CreateRawTransactionResponse {
1355    fn as_ref(&self) -> &String { &self.value }
1356}
1357
1358impl From<String> for CreateRawTransactionResponse {
1359    fn from(value: String) -> Self { Self { value } }
1360}
1361
1362impl From<CreateRawTransactionResponse> for String {
1363    fn from(wrapper: CreateRawTransactionResponse) -> Self { wrapper.value }
1364}
1365
1366/// Response for the `CreateWallet` RPC method
1367///
1368#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
1369#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
1370pub struct CreateWalletResponse {
1371    /// The wallet name if created successfully. If the wallet was created using a full path, the wallet_name will be the full path.
1372    pub name: String,
1373    /// Warning messages, if any, related to creating and loading the wallet.
1374    pub warnings: Option<Vec<String>>,
1375}
1376
1377/// Response for the `CreateWalletDescriptor` RPC method
1378///
1379#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
1380#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
1381pub struct CreateWalletDescriptorResponse {
1382    /// The public descriptors that were added to the wallet
1383    pub descs: Vec<String>,
1384}
1385
1386/// Response for the `DecodePsbt` RPC method
1387///
1388#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
1389#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
1390pub struct DecodePsbtResponse {
1391    /// The decoded network-serialized unsigned transaction.
1392    pub tx: serde_json::Value,
1393    pub global_xpubs: serde_json::Value,
1394    /// The PSBT version number. Not to be confused with the unsigned transaction version
1395    pub psbt_version: u64,
1396    /// The global proprietary map
1397    pub proprietary: serde_json::Value,
1398    /// The unknown global fields
1399    pub unknown: serde_json::Value,
1400    pub inputs: serde_json::Value,
1401    pub outputs: serde_json::Value,
1402    /// The transaction fee paid if all UTXOs slots in the PSBT have been filled.
1403    #[serde(default)]
1404    #[serde(deserialize_with = "option_amount_from_btc_float")]
1405    pub fee: Option<bitcoin::Amount>,
1406}
1407
1408/// Response for the `DecodeRawTransaction` RPC method
1409///
1410#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
1411#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
1412pub struct DecodeRawTransactionResponse {
1413    /// The transaction id
1414    pub txid: bitcoin::Txid,
1415    /// The transaction hash (differs from txid for witness transactions)
1416    pub hash: String,
1417    /// The serialized transaction size
1418    pub size: u64,
1419    /// The virtual transaction size (differs from size for witness transactions)
1420    pub vsize: u64,
1421    /// The transaction's weight (between vsize*4-3 and vsize*4)
1422    pub weight: u64,
1423    /// The version
1424    pub version: u32,
1425    /// The lock time
1426    #[serde(rename = "locktime")]
1427    pub lock_time: u64,
1428    pub vin: Vec<DecodedVin>,
1429    pub vout: Vec<DecodedVout>,
1430}
1431
1432/// Response for the `DecodeScript` RPC method
1433///
1434#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
1435#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
1436pub struct DecodeScriptResponse {
1437    /// Disassembly of the script
1438    pub asm: String,
1439    /// Inferred descriptor for the script
1440    pub desc: String,
1441    /// The output type (e.g. nonstandard, anchor, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_scripthash, witness_v0_keyhash, witness_v1_taproot, witness_unknown)
1442    #[serde(rename = "type")]
1443    pub r#type: String,
1444    /// The Bitcoin address (only if a well-defined address exists)
1445    pub address: Option<String>,
1446    /// address of P2SH script wrapping this redeem script (not returned for types that should not be wrapped)
1447    pub p2sh: Option<String>,
1448    /// Result of a witness output script wrapping this redeem script (not returned for types that should not be wrapped)
1449    pub segwit: Option<serde_json::Value>,
1450}
1451
1452/// Response for the `DeriveAddresses` RPC method
1453///
1454/// This method returns an array wrapped in a transparent struct.
1455#[derive(Debug, Clone, PartialEq, Serialize)]
1456pub struct DeriveAddressesResponse {
1457    /// Wrapped array value
1458    pub value: Vec<String>,
1459}
1460
1461impl<'de> serde::Deserialize<'de> for DeriveAddressesResponse {
1462    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1463    where
1464        D: serde::Deserializer<'de>,
1465    {
1466        let value = Vec::<String>::deserialize(deserializer)?;
1467        Ok(Self { value })
1468    }
1469}
1470
1471impl From<Vec<String>> for DeriveAddressesResponse {
1472    fn from(value: Vec<String>) -> Self { Self { value } }
1473}
1474
1475impl From<DeriveAddressesResponse> for Vec<String> {
1476    fn from(wrapper: DeriveAddressesResponse) -> Self { wrapper.value }
1477}
1478
1479/// Response for the `DescriptorProcessPsbt` RPC method
1480///
1481#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
1482#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
1483pub struct DescriptorProcessPsbtResponse {
1484    /// The base64-encoded partially signed transaction
1485    pub psbt: String,
1486    /// If the transaction has a complete set of signatures
1487    pub complete: bool,
1488    /// The hex-encoded network transaction if complete
1489    pub hex: Option<String>,
1490}
1491
1492/// Response for the `DisconnectNode` RPC method
1493///
1494/// This method returns a primitive value wrapped in a transparent struct.
1495#[derive(Debug, Clone, PartialEq, Serialize)]
1496pub struct DisconnectNodeResponse {
1497    /// Wrapped primitive value
1498    pub value: (),
1499}
1500
1501impl<'de> serde::Deserialize<'de> for DisconnectNodeResponse {
1502    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1503    where
1504        D: serde::Deserializer<'de>,
1505    {
1506        use std::fmt;
1507
1508        use serde::de::{self, Visitor};
1509
1510        struct PrimitiveWrapperVisitor;
1511
1512        #[allow(unused_variables, clippy::needless_lifetimes)]
1513        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
1514            type Value = DisconnectNodeResponse;
1515
1516            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
1517                formatter.write_str("a primitive value or an object with 'value' field")
1518            }
1519
1520            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
1521            where
1522                E: de::Error,
1523            {
1524                Ok(DisconnectNodeResponse { value: () })
1525            }
1526
1527            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
1528            where
1529                E: de::Error,
1530            {
1531                Ok(DisconnectNodeResponse { value: () })
1532            }
1533
1534            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
1535            where
1536                E: de::Error,
1537            {
1538                Ok(DisconnectNodeResponse { value: () })
1539            }
1540
1541            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
1542            where
1543                E: de::Error,
1544            {
1545                Ok(DisconnectNodeResponse { value: () })
1546            }
1547
1548            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
1549            where
1550                E: de::Error,
1551            {
1552                Ok(DisconnectNodeResponse { value: () })
1553            }
1554
1555            fn visit_none<E>(self) -> Result<Self::Value, E>
1556            where
1557                E: de::Error,
1558            {
1559                Ok(DisconnectNodeResponse { value: () })
1560            }
1561
1562            fn visit_unit<E>(self) -> Result<Self::Value, E>
1563            where
1564                E: de::Error,
1565            {
1566                Ok(DisconnectNodeResponse { value: () })
1567            }
1568
1569            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
1570            where
1571                M: de::MapAccess<'de>,
1572            {
1573                let mut value = None;
1574                while let Some(key) = map.next_key::<String>()? {
1575                    if key == "value" {
1576                        if value.is_some() {
1577                            return Err(de::Error::duplicate_field("value"));
1578                        }
1579                        value = Some(map.next_value::<()>()?);
1580                    } else {
1581                        let _ = map.next_value::<de::IgnoredAny>()?;
1582                    }
1583                }
1584                value.ok_or_else(|| de::Error::missing_field("value"))?;
1585                Ok(DisconnectNodeResponse { value: () })
1586            }
1587        }
1588
1589        deserializer.deserialize_any(PrimitiveWrapperVisitor)
1590    }
1591}
1592
1593impl std::ops::Deref for DisconnectNodeResponse {
1594    type Target = ();
1595    fn deref(&self) -> &Self::Target { &self.value }
1596}
1597
1598impl std::ops::DerefMut for DisconnectNodeResponse {
1599    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
1600}
1601
1602impl AsRef<()> for DisconnectNodeResponse {
1603    fn as_ref(&self) -> &() { &self.value }
1604}
1605
1606impl From<()> for DisconnectNodeResponse {
1607    fn from(value: ()) -> Self { Self { value } }
1608}
1609
1610impl From<DisconnectNodeResponse> for () {
1611    fn from(wrapper: DisconnectNodeResponse) -> Self { wrapper.value }
1612}
1613
1614/// Response for the `DumpTxOutSet` RPC method
1615///
1616#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
1617#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
1618pub struct DumpTxOutSetResponse {
1619    /// the number of coins written in the snapshot
1620    pub coins_written: u64,
1621    /// the hash of the base of the snapshot
1622    pub base_hash: String,
1623    /// the height of the base of the snapshot
1624    pub base_height: u64,
1625    /// the absolute path that the snapshot was written to
1626    pub path: String,
1627    /// the hash of the UTXO set contents
1628    pub txoutset_hash: String,
1629    /// the number of transactions in the chain up to and including the base block
1630    #[serde(rename = "nchaintx")]
1631    pub n_chain_tx: u64,
1632}
1633
1634/// Response for the `Echo` RPC method
1635///
1636/// This method returns arbitrary JSON (e.g. string, object, array) as a single value.
1637#[derive(Debug, Clone, PartialEq, Serialize)]
1638pub struct EchoResponse {
1639    /// Wrapped JSON value
1640    pub value: serde_json::Value,
1641}
1642
1643impl<'de> serde::Deserialize<'de> for EchoResponse {
1644    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1645    where
1646        D: serde::Deserializer<'de>,
1647    {
1648        let value = serde_json::Value::deserialize(deserializer)?;
1649        Ok(Self { value })
1650    }
1651}
1652
1653impl From<serde_json::Value> for EchoResponse {
1654    fn from(value: serde_json::Value) -> Self { Self { value } }
1655}
1656
1657/// Response for the `Echoipc` RPC method
1658///
1659/// This method returns a primitive value wrapped in a transparent struct.
1660#[derive(Debug, Clone, PartialEq, Serialize)]
1661pub struct EchoipcResponse {
1662    /// Wrapped primitive value
1663    pub value: String,
1664}
1665
1666impl<'de> serde::Deserialize<'de> for EchoipcResponse {
1667    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1668    where
1669        D: serde::Deserializer<'de>,
1670    {
1671        use std::fmt;
1672
1673        use serde::de::{self, Visitor};
1674
1675        struct PrimitiveWrapperVisitor;
1676
1677        #[allow(unused_variables, clippy::needless_lifetimes)]
1678        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
1679            type Value = EchoipcResponse;
1680
1681            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
1682                formatter.write_str("a primitive value or an object with 'value' field")
1683            }
1684
1685            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
1686            where
1687                E: de::Error,
1688            {
1689                Ok(EchoipcResponse { value: v.to_string() })
1690            }
1691
1692            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
1693            where
1694                E: de::Error,
1695            {
1696                Ok(EchoipcResponse { value: v.to_string() })
1697            }
1698
1699            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
1700            where
1701                E: de::Error,
1702            {
1703                Ok(EchoipcResponse { value: v.to_string() })
1704            }
1705
1706            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
1707            where
1708                E: de::Error,
1709            {
1710                Ok(EchoipcResponse { value: v.to_string() })
1711            }
1712
1713            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
1714            where
1715                E: de::Error,
1716            {
1717                Ok(EchoipcResponse { value: v.to_string() })
1718            }
1719
1720            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
1721            where
1722                M: de::MapAccess<'de>,
1723            {
1724                let mut value = None;
1725                while let Some(key) = map.next_key::<String>()? {
1726                    if key == "value" {
1727                        if value.is_some() {
1728                            return Err(de::Error::duplicate_field("value"));
1729                        }
1730                        value = Some(map.next_value()?);
1731                    } else {
1732                        let _ = map.next_value::<de::IgnoredAny>()?;
1733                    }
1734                }
1735                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
1736                Ok(EchoipcResponse { value })
1737            }
1738        }
1739
1740        deserializer.deserialize_any(PrimitiveWrapperVisitor)
1741    }
1742}
1743
1744impl std::ops::Deref for EchoipcResponse {
1745    type Target = String;
1746    fn deref(&self) -> &Self::Target { &self.value }
1747}
1748
1749impl std::ops::DerefMut for EchoipcResponse {
1750    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
1751}
1752
1753impl AsRef<String> for EchoipcResponse {
1754    fn as_ref(&self) -> &String { &self.value }
1755}
1756
1757impl From<String> for EchoipcResponse {
1758    fn from(value: String) -> Self { Self { value } }
1759}
1760
1761impl From<EchoipcResponse> for String {
1762    fn from(wrapper: EchoipcResponse) -> Self { wrapper.value }
1763}
1764
1765/// Response for the `Echojson` RPC method
1766///
1767/// This method returns arbitrary JSON (e.g. string, object, array) as a single value.
1768#[derive(Debug, Clone, PartialEq, Serialize)]
1769pub struct EchojsonResponse {
1770    /// Wrapped JSON value
1771    pub value: serde_json::Value,
1772}
1773
1774impl<'de> serde::Deserialize<'de> for EchojsonResponse {
1775    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1776    where
1777        D: serde::Deserializer<'de>,
1778    {
1779        let value = serde_json::Value::deserialize(deserializer)?;
1780        Ok(Self { value })
1781    }
1782}
1783
1784impl From<serde_json::Value> for EchojsonResponse {
1785    fn from(value: serde_json::Value) -> Self { Self { value } }
1786}
1787
1788/// Response for the `EncryptWallet` RPC method
1789///
1790/// This method returns a primitive value wrapped in a transparent struct.
1791#[derive(Debug, Clone, PartialEq, Serialize)]
1792pub struct EncryptWalletResponse {
1793    /// Wrapped primitive value
1794    pub value: String,
1795}
1796
1797impl<'de> serde::Deserialize<'de> for EncryptWalletResponse {
1798    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1799    where
1800        D: serde::Deserializer<'de>,
1801    {
1802        use std::fmt;
1803
1804        use serde::de::{self, Visitor};
1805
1806        struct PrimitiveWrapperVisitor;
1807
1808        #[allow(unused_variables, clippy::needless_lifetimes)]
1809        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
1810            type Value = EncryptWalletResponse;
1811
1812            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
1813                formatter.write_str("a primitive value or an object with 'value' field")
1814            }
1815
1816            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
1817            where
1818                E: de::Error,
1819            {
1820                Ok(EncryptWalletResponse { value: v.to_string() })
1821            }
1822
1823            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
1824            where
1825                E: de::Error,
1826            {
1827                Ok(EncryptWalletResponse { value: v.to_string() })
1828            }
1829
1830            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
1831            where
1832                E: de::Error,
1833            {
1834                Ok(EncryptWalletResponse { value: v.to_string() })
1835            }
1836
1837            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
1838            where
1839                E: de::Error,
1840            {
1841                Ok(EncryptWalletResponse { value: v.to_string() })
1842            }
1843
1844            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
1845            where
1846                E: de::Error,
1847            {
1848                Ok(EncryptWalletResponse { value: v.to_string() })
1849            }
1850
1851            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
1852            where
1853                M: de::MapAccess<'de>,
1854            {
1855                let mut value = None;
1856                while let Some(key) = map.next_key::<String>()? {
1857                    if key == "value" {
1858                        if value.is_some() {
1859                            return Err(de::Error::duplicate_field("value"));
1860                        }
1861                        value = Some(map.next_value()?);
1862                    } else {
1863                        let _ = map.next_value::<de::IgnoredAny>()?;
1864                    }
1865                }
1866                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
1867                Ok(EncryptWalletResponse { value })
1868            }
1869        }
1870
1871        deserializer.deserialize_any(PrimitiveWrapperVisitor)
1872    }
1873}
1874
1875impl std::ops::Deref for EncryptWalletResponse {
1876    type Target = String;
1877    fn deref(&self) -> &Self::Target { &self.value }
1878}
1879
1880impl std::ops::DerefMut for EncryptWalletResponse {
1881    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
1882}
1883
1884impl AsRef<String> for EncryptWalletResponse {
1885    fn as_ref(&self) -> &String { &self.value }
1886}
1887
1888impl From<String> for EncryptWalletResponse {
1889    fn from(value: String) -> Self { Self { value } }
1890}
1891
1892impl From<EncryptWalletResponse> for String {
1893    fn from(wrapper: EncryptWalletResponse) -> Self { wrapper.value }
1894}
1895
1896/// Response for the `EnumerateSigners` RPC method
1897///
1898#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
1899#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
1900pub struct EnumerateSignersResponse {
1901    pub signers: serde_json::Value,
1902}
1903
1904/// Response for the `EstimateRawFee` RPC method
1905///
1906/// Results are returned for any horizon which tracks blocks up to the confirmation target
1907#[derive(Debug, Clone, PartialEq, Serialize)]
1908pub struct EstimateRawFeeResponse {
1909    /// estimate for short time horizon
1910    pub short: Option<serde_json::Value>,
1911    /// estimate for medium time horizon
1912    pub medium: Option<serde_json::Value>,
1913    /// estimate for long time horizon
1914    pub long: Option<serde_json::Value>,
1915}
1916impl<'de> serde::Deserialize<'de> for EstimateRawFeeResponse {
1917    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1918    where
1919        D: serde::Deserializer<'de>,
1920    {
1921        use std::fmt;
1922
1923        use serde::de::{self, Visitor};
1924
1925        struct ConditionalResponseVisitor;
1926
1927        #[allow(clippy::needless_lifetimes)]
1928        impl<'de> Visitor<'de> for ConditionalResponseVisitor {
1929            type Value = EstimateRawFeeResponse;
1930
1931            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
1932                formatter.write_str("string or object")
1933            }
1934
1935            fn visit_str<E>(self, _v: &str) -> Result<Self::Value, E>
1936            where
1937                E: de::Error,
1938            {
1939                Ok(EstimateRawFeeResponse { short: None, medium: None, long: None })
1940            }
1941
1942            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
1943            where
1944                M: de::MapAccess<'de>,
1945            {
1946                let mut short = None;
1947                let mut medium = None;
1948                let mut long = None;
1949                while let Some(key) = map.next_key::<String>()? {
1950                    if key == "short" {
1951                        if short.is_some() {
1952                            return Err(de::Error::duplicate_field("short"));
1953                        }
1954                        short = Some(map.next_value::<serde_json::Value>()?);
1955                    }
1956                    if key == "medium" {
1957                        if medium.is_some() {
1958                            return Err(de::Error::duplicate_field("medium"));
1959                        }
1960                        medium = Some(map.next_value::<serde_json::Value>()?);
1961                    }
1962                    if key == "long" {
1963                        if long.is_some() {
1964                            return Err(de::Error::duplicate_field("long"));
1965                        }
1966                        long = Some(map.next_value::<serde_json::Value>()?);
1967                    } else {
1968                        let _ = map.next_value::<de::IgnoredAny>()?;
1969                    }
1970                }
1971                Ok(EstimateRawFeeResponse { short, medium, long })
1972            }
1973        }
1974
1975        deserializer.deserialize_any(ConditionalResponseVisitor)
1976    }
1977}
1978
1979/// Response for the `EstimateSmartFee` RPC method
1980///
1981#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
1982#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
1983pub struct EstimateSmartFeeResponse {
1984    /// estimate fee rate in BTC/kvB (only present if no errors were encountered)
1985    #[serde(rename = "feerate")]
1986    pub fee_rate: Option<f64>,
1987    /// Errors encountered during processing (if there are any)
1988    pub errors: Option<Vec<String>>,
1989    /// block number where estimate was found
1990    /// The request target will be clamped between 2 and the highest target
1991    /// fee estimation is able to return based on how long it has been running.
1992    /// An error is returned if not enough transactions and blocks
1993    /// have been observed to make an estimate for any number of blocks.
1994    pub blocks: u64,
1995}
1996
1997/// Response for the `FinalizePsbt` RPC method
1998///
1999#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2000#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2001pub struct FinalizePsbtResponse {
2002    /// The base64-encoded partially signed transaction if not extracted
2003    pub psbt: Option<String>,
2004    /// The hex-encoded network transaction if extracted
2005    pub hex: Option<String>,
2006    /// If the transaction has a complete set of signatures
2007    pub complete: bool,
2008}
2009
2010/// Response for the `FundRawTransaction` RPC method
2011///
2012#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2013#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2014pub struct FundRawTransactionResponse {
2015    /// The resulting raw transaction (hex-encoded string)
2016    pub hex: String,
2017    /// Fee in BTC the resulting transaction pays
2018    #[serde(deserialize_with = "amount_from_btc_float")]
2019    pub fee: bitcoin::Amount,
2020    /// The position of the added change output, or -1
2021    pub changepos: i64,
2022}
2023
2024/// Response for the `Generate` RPC method
2025///
2026/// This method returns no meaningful data.
2027#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2028pub struct GenerateResponse;
2029
2030/// Response for the `GenerateBlock` RPC method
2031///
2032#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2033#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2034pub struct GenerateBlockResponse {
2035    /// hash of generated block
2036    pub hash: String,
2037    /// hex of generated block, only present when submit=false
2038    pub hex: Option<String>,
2039}
2040
2041/// Response for the `GenerateToAddress` RPC method
2042///
2043/// This method returns an array wrapped in a transparent struct.
2044#[derive(Debug, Clone, PartialEq, Serialize)]
2045pub struct GenerateToAddressResponse {
2046    /// Wrapped array value
2047    pub value: Vec<serde_json::Value>,
2048}
2049
2050impl<'de> serde::Deserialize<'de> for GenerateToAddressResponse {
2051    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2052    where
2053        D: serde::Deserializer<'de>,
2054    {
2055        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
2056        Ok(Self { value })
2057    }
2058}
2059
2060impl From<Vec<serde_json::Value>> for GenerateToAddressResponse {
2061    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
2062}
2063
2064impl From<GenerateToAddressResponse> for Vec<serde_json::Value> {
2065    fn from(wrapper: GenerateToAddressResponse) -> Self { wrapper.value }
2066}
2067
2068/// Response for the `GenerateToDescriptor` RPC method
2069///
2070/// This method returns an array wrapped in a transparent struct.
2071#[derive(Debug, Clone, PartialEq, Serialize)]
2072pub struct GenerateToDescriptorResponse {
2073    /// Wrapped array value
2074    pub value: Vec<serde_json::Value>,
2075}
2076
2077impl<'de> serde::Deserialize<'de> for GenerateToDescriptorResponse {
2078    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2079    where
2080        D: serde::Deserializer<'de>,
2081    {
2082        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
2083        Ok(Self { value })
2084    }
2085}
2086
2087impl From<Vec<serde_json::Value>> for GenerateToDescriptorResponse {
2088    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
2089}
2090
2091impl From<GenerateToDescriptorResponse> for Vec<serde_json::Value> {
2092    fn from(wrapper: GenerateToDescriptorResponse) -> Self { wrapper.value }
2093}
2094
2095/// Response for the `GetAddedNodeInfo` RPC method
2096///
2097/// This method returns an array wrapped in a transparent struct.
2098#[derive(Debug, Clone, PartialEq, Serialize)]
2099pub struct GetAddedNodeInfoResponse {
2100    /// Wrapped array value
2101    pub value: Vec<serde_json::Value>,
2102}
2103
2104impl<'de> serde::Deserialize<'de> for GetAddedNodeInfoResponse {
2105    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2106    where
2107        D: serde::Deserializer<'de>,
2108    {
2109        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
2110        Ok(Self { value })
2111    }
2112}
2113
2114impl From<Vec<serde_json::Value>> for GetAddedNodeInfoResponse {
2115    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
2116}
2117
2118impl From<GetAddedNodeInfoResponse> for Vec<serde_json::Value> {
2119    fn from(wrapper: GetAddedNodeInfoResponse) -> Self { wrapper.value }
2120}
2121
2122/// Response for the `GetAddressesByLabel` RPC method
2123///
2124/// json object with addresses as keys
2125#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2126#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2127pub struct GetAddressesByLabelResponse {
2128    /// json object with information about address
2129    pub address: serde_json::Value,
2130}
2131
2132/// Response for the `GetAddressInfo` RPC method
2133///
2134#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2135#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2136pub struct GetAddressInfoResponse {
2137    /// The bitcoin address validated.
2138    pub address: String,
2139    /// The hex-encoded output script generated by the address.
2140    pub scriptPubKey: bitcoin::ScriptBuf,
2141    /// If the address is yours.
2142    pub ismine: bool,
2143    /// (DEPRECATED) Always false.
2144    pub iswatchonly: bool,
2145    /// If we know how to spend coins sent to this address, ignoring the possible lack of private keys.
2146    pub solvable: bool,
2147    /// A descriptor for spending coins sent to this address (only when solvable).
2148    pub desc: Option<String>,
2149    /// The descriptor used to derive this address if this is a descriptor wallet
2150    pub parent_desc: Option<String>,
2151    /// If the key is a script.
2152    pub isscript: Option<bool>,
2153    /// If the address was used for change output.
2154    pub ischange: bool,
2155    /// If the address is a witness address.
2156    #[serde(rename = "iswitness")]
2157    pub is_witness: bool,
2158    /// The version number of the witness program.
2159    pub witness_version: Option<u64>,
2160    /// The hex value of the witness program.
2161    pub witness_program: Option<String>,
2162    /// The output script type. Only if isscript is true and the redeemscript is known. Possible
2163    /// types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_keyhash,
2164    /// witness_v0_scripthash, witness_unknown.
2165    pub script: Option<bitcoin::ScriptBuf>,
2166    /// The redeemscript for the p2sh address.
2167    pub hex: Option<String>,
2168    /// Array of pubkeys associated with the known redeemscript (only if script is multisig).
2169    pub pubkeys: Option<Vec<String>>,
2170    /// The number of signatures required to spend multisig output (only if script is multisig).
2171    pub sigsrequired: Option<u64>,
2172    /// The hex value of the raw public key for single-key addresses (possibly embedded in P2SH or P2WSH).
2173    pub pubkey: Option<String>,
2174    /// Information about the address embedded in P2SH or P2WSH, if relevant and known.
2175    pub embedded: Option<serde_json::Value>,
2176    /// If the pubkey is compressed.
2177    pub iscompressed: Option<bool>,
2178    /// The creation time of the key, if available, expressed in UNIX epoch time.
2179    pub timestamp: Option<u64>,
2180    /// The HD keypath, if the key is HD and available.
2181    #[serde(rename = "hdkeypath")]
2182    pub hd_key_path: Option<String>,
2183    /// The Hash160 of the HD seed.
2184    pub hdseedid: Option<String>,
2185    /// The fingerprint of the master key.
2186    pub hdmasterfingerprint: Option<String>,
2187    /// Array of labels associated with the address. Currently limited to one label but returned
2188    /// as an array to keep the API stable if multiple labels are enabled in the future.
2189    pub labels: Vec<String>,
2190}
2191
2192/// Response for the `GetAddrManInfo` RPC method
2193///
2194/// json object with network type as keys
2195#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2196#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2197pub struct GetAddrManInfoResponse {
2198    /// the network (ipv4, ipv6, onion, i2p, cjdns, all_networks)
2199    #[serde(default)]
2200    pub network: Option<serde_json::Value>,
2201}
2202
2203/// Response for the `GetBalance` RPC method
2204///
2205/// This method returns a primitive value wrapped in a transparent struct.
2206#[derive(Debug, Clone, PartialEq, Serialize)]
2207pub struct GetBalanceResponse {
2208    /// Wrapped primitive value
2209    pub value: bitcoin::Amount,
2210}
2211
2212impl<'de> serde::Deserialize<'de> for GetBalanceResponse {
2213    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2214    where
2215        D: serde::Deserializer<'de>,
2216    {
2217        use std::fmt;
2218
2219        use serde::de::{self, Visitor};
2220
2221        struct PrimitiveWrapperVisitor;
2222
2223        #[allow(unused_variables, clippy::needless_lifetimes)]
2224        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
2225            type Value = GetBalanceResponse;
2226
2227            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
2228                formatter.write_str("a primitive value or an object with 'value' field")
2229            }
2230
2231            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
2232            where
2233                E: de::Error,
2234            {
2235                Ok(GetBalanceResponse { value: bitcoin::Amount::from_sat(v) })
2236            }
2237
2238            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
2239            where
2240                E: de::Error,
2241            {
2242                if v < 0 {
2243                    return Err(de::Error::custom(format!("Amount cannot be negative: {}", v)));
2244                }
2245                Ok(GetBalanceResponse { value: bitcoin::Amount::from_sat(v as u64) })
2246            }
2247
2248            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
2249            where
2250                E: de::Error,
2251            {
2252                let amount = bitcoin::Amount::from_btc(v)
2253                    .map_err(|e| de::Error::custom(format!("Invalid BTC amount: {}", e)))?;
2254                Ok(GetBalanceResponse { value: amount })
2255            }
2256
2257            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
2258            where
2259                E: de::Error,
2260            {
2261                let value = v.parse::<bitcoin::Amount>().map_err(de::Error::custom)?;
2262                Ok(GetBalanceResponse { value })
2263            }
2264
2265            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
2266            where
2267                E: de::Error,
2268            {
2269                Err(de::Error::custom("cannot convert bool to bitcoin::Amount"))
2270            }
2271
2272            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
2273            where
2274                M: de::MapAccess<'de>,
2275            {
2276                let mut value = None;
2277                while let Some(key) = map.next_key::<String>()? {
2278                    if key == "value" {
2279                        if value.is_some() {
2280                            return Err(de::Error::duplicate_field("value"));
2281                        }
2282                        value = Some(map.next_value()?);
2283                    } else {
2284                        let _ = map.next_value::<de::IgnoredAny>()?;
2285                    }
2286                }
2287                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
2288                Ok(GetBalanceResponse { value })
2289            }
2290        }
2291
2292        deserializer.deserialize_any(PrimitiveWrapperVisitor)
2293    }
2294}
2295
2296impl std::ops::Deref for GetBalanceResponse {
2297    type Target = bitcoin::Amount;
2298    fn deref(&self) -> &Self::Target { &self.value }
2299}
2300
2301impl std::ops::DerefMut for GetBalanceResponse {
2302    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
2303}
2304
2305impl AsRef<bitcoin::Amount> for GetBalanceResponse {
2306    fn as_ref(&self) -> &bitcoin::Amount { &self.value }
2307}
2308
2309impl From<bitcoin::Amount> for GetBalanceResponse {
2310    fn from(value: bitcoin::Amount) -> Self { Self { value } }
2311}
2312
2313impl From<GetBalanceResponse> for bitcoin::Amount {
2314    fn from(wrapper: GetBalanceResponse) -> Self { wrapper.value }
2315}
2316
2317/// Response for the `GetBalances` RPC method
2318///
2319#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2320#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2321pub struct GetBalancesResponse {
2322    /// balances from outputs that the wallet can sign
2323    pub mine: serde_json::Value,
2324    /// hash and height of the block this information was generated on
2325    pub lastprocessedblock: serde_json::Value,
2326}
2327
2328/// Response for the `GetBestBlockHash` RPC method
2329///
2330/// This method returns a primitive value wrapped in a transparent struct.
2331#[derive(Debug, Clone, PartialEq, Serialize)]
2332pub struct GetBestBlockHashResponse {
2333    /// Wrapped primitive value
2334    pub value: String,
2335}
2336
2337impl<'de> serde::Deserialize<'de> for GetBestBlockHashResponse {
2338    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2339    where
2340        D: serde::Deserializer<'de>,
2341    {
2342        use std::fmt;
2343
2344        use serde::de::{self, Visitor};
2345
2346        struct PrimitiveWrapperVisitor;
2347
2348        #[allow(unused_variables, clippy::needless_lifetimes)]
2349        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
2350            type Value = GetBestBlockHashResponse;
2351
2352            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
2353                formatter.write_str("a primitive value or an object with 'value' field")
2354            }
2355
2356            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
2357            where
2358                E: de::Error,
2359            {
2360                Ok(GetBestBlockHashResponse { value: v.to_string() })
2361            }
2362
2363            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
2364            where
2365                E: de::Error,
2366            {
2367                Ok(GetBestBlockHashResponse { value: v.to_string() })
2368            }
2369
2370            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
2371            where
2372                E: de::Error,
2373            {
2374                Ok(GetBestBlockHashResponse { value: v.to_string() })
2375            }
2376
2377            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
2378            where
2379                E: de::Error,
2380            {
2381                Ok(GetBestBlockHashResponse { value: v.to_string() })
2382            }
2383
2384            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
2385            where
2386                E: de::Error,
2387            {
2388                Ok(GetBestBlockHashResponse { value: v.to_string() })
2389            }
2390
2391            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
2392            where
2393                M: de::MapAccess<'de>,
2394            {
2395                let mut value = None;
2396                while let Some(key) = map.next_key::<String>()? {
2397                    if key == "value" {
2398                        if value.is_some() {
2399                            return Err(de::Error::duplicate_field("value"));
2400                        }
2401                        value = Some(map.next_value()?);
2402                    } else {
2403                        let _ = map.next_value::<de::IgnoredAny>()?;
2404                    }
2405                }
2406                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
2407                Ok(GetBestBlockHashResponse { value })
2408            }
2409        }
2410
2411        deserializer.deserialize_any(PrimitiveWrapperVisitor)
2412    }
2413}
2414
2415impl std::ops::Deref for GetBestBlockHashResponse {
2416    type Target = String;
2417    fn deref(&self) -> &Self::Target { &self.value }
2418}
2419
2420impl std::ops::DerefMut for GetBestBlockHashResponse {
2421    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
2422}
2423
2424impl AsRef<String> for GetBestBlockHashResponse {
2425    fn as_ref(&self) -> &String { &self.value }
2426}
2427
2428impl From<String> for GetBestBlockHashResponse {
2429    fn from(value: String) -> Self { Self { value } }
2430}
2431
2432impl From<GetBestBlockHashResponse> for String {
2433    fn from(wrapper: GetBestBlockHashResponse) -> Self { wrapper.value }
2434}
2435
2436/// Response for the `GetBlock` RPC method
2437///
2438#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2439#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2440pub struct GetBlockResponse {
2441    /// the block hash (same as provided)
2442    pub hash: String,
2443    /// The number of confirmations, or -1 if the block is not on the main chain
2444    pub confirmations: i64,
2445    /// The block size
2446    pub size: u64,
2447    /// The block size excluding witness data
2448    pub strippedsize: u64,
2449    /// The block weight as defined in BIP 141
2450    pub weight: u64,
2451    /// The block height or index
2452    pub height: u64,
2453    /// The block version
2454    pub version: u32,
2455    /// The block version formatted in hexadecimal
2456    pub versionHex: String,
2457    /// The merkle root
2458    #[serde(rename = "merkleroot")]
2459    pub merkle_root: String,
2460    /// The transaction ids
2461    pub tx: Vec<bitcoin::Txid>,
2462    /// The block time expressed in UNIX epoch time
2463    pub time: u64,
2464    /// The median block time expressed in UNIX epoch time
2465    pub mediantime: u64,
2466    /// The nonce
2467    pub nonce: u64,
2468    /// nBits: compact representation of the block difficulty target
2469    pub bits: String,
2470    /// The difficulty target
2471    pub target: String,
2472    /// The difficulty
2473    pub difficulty: f64,
2474    /// Expected number of hashes required to produce the chain up to this block (in hex)
2475    #[serde(rename = "chainwork")]
2476    pub chain_work: String,
2477    /// The number of transactions in the block
2478    pub nTx: u64,
2479    /// The hash of the previous block (if available)
2480    #[serde(rename = "previousblockhash")]
2481    pub previous_block_hash: Option<String>,
2482    /// The hash of the next block (if available)
2483    #[serde(rename = "nextblockhash")]
2484    pub next_block_hash: Option<String>,
2485}
2486
2487/// Response for the `GetBlockchainInfo` RPC method
2488///
2489#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2490#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2491pub struct GetBlockchainInfoResponse {
2492    /// current network name (main, test, testnet4, signet, regtest)
2493    pub chain: String,
2494    /// the height of the most-work fully-validated chain. The genesis block has height 0
2495    pub blocks: u64,
2496    /// the current number of headers we have validated
2497    pub headers: u64,
2498    /// the hash of the currently best block
2499    #[serde(rename = "bestblockhash")]
2500    pub best_block_hash: String,
2501    /// nBits: compact representation of the block difficulty target
2502    pub bits: String,
2503    /// The difficulty target
2504    pub target: String,
2505    /// the current difficulty
2506    pub difficulty: f64,
2507    /// The block time expressed in UNIX epoch time
2508    pub time: u64,
2509    /// The median block time expressed in UNIX epoch time
2510    pub mediantime: u64,
2511    /// estimate of verification progress \[0..1\]
2512    pub verificationprogress: f64,
2513    /// (debug information) estimate of whether this node is in Initial Block Download mode
2514    pub initialblockdownload: bool,
2515    /// total amount of work in active chain, in hexadecimal
2516    #[serde(rename = "chainwork")]
2517    pub chain_work: String,
2518    /// the estimated size of the block and undo files on disk
2519    pub size_on_disk: u64,
2520    /// if the blocks are subject to pruning
2521    pub pruned: bool,
2522    /// height of the last block pruned, plus one (only present if pruning is enabled)
2523    #[serde(rename = "pruneheight")]
2524    pub prune_height: Option<u64>,
2525    /// whether automatic pruning is enabled (only present if pruning is enabled)
2526    pub automatic_pruning: Option<bool>,
2527    /// the target size used by pruning (only present if automatic pruning is enabled)
2528    pub prune_target_size: Option<u64>,
2529    /// the block challenge (aka. block script), in hexadecimal (only present if the current network is a signet)
2530    pub signet_challenge: Option<String>,
2531    /// any network and blockchain warnings (run with `-deprecatedrpc=warnings` to return the latest warning as a single string)
2532    pub warnings: Vec<String>,
2533}
2534
2535/// Response for the `GetBlockCount` RPC method
2536///
2537/// This method returns a primitive value wrapped in a transparent struct.
2538#[derive(Debug, Clone, PartialEq, Serialize)]
2539pub struct GetBlockCountResponse {
2540    /// Wrapped primitive value
2541    pub value: u64,
2542}
2543
2544impl<'de> serde::Deserialize<'de> for GetBlockCountResponse {
2545    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2546    where
2547        D: serde::Deserializer<'de>,
2548    {
2549        use std::fmt;
2550
2551        use serde::de::{self, Visitor};
2552
2553        struct PrimitiveWrapperVisitor;
2554
2555        #[allow(unused_variables, clippy::needless_lifetimes)]
2556        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
2557            type Value = GetBlockCountResponse;
2558
2559            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
2560                formatter.write_str("a primitive value or an object with 'value' field")
2561            }
2562
2563            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
2564            where
2565                E: de::Error,
2566            {
2567                Ok(GetBlockCountResponse { value: v })
2568            }
2569
2570            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
2571            where
2572                E: de::Error,
2573            {
2574                Ok(GetBlockCountResponse { value: v as u64 })
2575            }
2576
2577            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
2578            where
2579                E: de::Error,
2580            {
2581                Ok(GetBlockCountResponse { value: v as u64 })
2582            }
2583
2584            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
2585            where
2586                E: de::Error,
2587            {
2588                let value = v.parse::<u64>().map_err(de::Error::custom)?;
2589                Ok(GetBlockCountResponse { value })
2590            }
2591
2592            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
2593            where
2594                E: de::Error,
2595            {
2596                Ok(GetBlockCountResponse { value: v as u64 })
2597            }
2598
2599            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
2600            where
2601                M: de::MapAccess<'de>,
2602            {
2603                let mut value = None;
2604                while let Some(key) = map.next_key::<String>()? {
2605                    if key == "value" {
2606                        if value.is_some() {
2607                            return Err(de::Error::duplicate_field("value"));
2608                        }
2609                        value = Some(map.next_value()?);
2610                    } else {
2611                        let _ = map.next_value::<de::IgnoredAny>()?;
2612                    }
2613                }
2614                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
2615                Ok(GetBlockCountResponse { value })
2616            }
2617        }
2618
2619        deserializer.deserialize_any(PrimitiveWrapperVisitor)
2620    }
2621}
2622
2623impl std::ops::Deref for GetBlockCountResponse {
2624    type Target = u64;
2625    fn deref(&self) -> &Self::Target { &self.value }
2626}
2627
2628impl std::ops::DerefMut for GetBlockCountResponse {
2629    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
2630}
2631
2632impl AsRef<u64> for GetBlockCountResponse {
2633    fn as_ref(&self) -> &u64 { &self.value }
2634}
2635
2636impl From<u64> for GetBlockCountResponse {
2637    fn from(value: u64) -> Self { Self { value } }
2638}
2639
2640impl From<GetBlockCountResponse> for u64 {
2641    fn from(wrapper: GetBlockCountResponse) -> Self { wrapper.value }
2642}
2643
2644/// Response for the `GetBlockFilter` RPC method
2645///
2646#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2647#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2648pub struct GetBlockFilterResponse {
2649    /// the hex-encoded filter data
2650    pub filter: String,
2651    /// the hex-encoded filter header
2652    pub header: String,
2653}
2654
2655/// Response for the `GetBlockFromPeer` RPC method
2656///
2657/// This method returns no meaningful data.
2658#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2659pub struct GetBlockFromPeerResponse;
2660
2661/// Response for the `GetBlockHash` RPC method
2662///
2663/// This method returns a primitive value wrapped in a transparent struct.
2664#[derive(Debug, Clone, PartialEq, Serialize)]
2665pub struct GetBlockHashResponse {
2666    /// Wrapped primitive value
2667    pub value: String,
2668}
2669
2670impl<'de> serde::Deserialize<'de> for GetBlockHashResponse {
2671    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2672    where
2673        D: serde::Deserializer<'de>,
2674    {
2675        use std::fmt;
2676
2677        use serde::de::{self, Visitor};
2678
2679        struct PrimitiveWrapperVisitor;
2680
2681        #[allow(unused_variables, clippy::needless_lifetimes)]
2682        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
2683            type Value = GetBlockHashResponse;
2684
2685            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
2686                formatter.write_str("a primitive value or an object with 'value' field")
2687            }
2688
2689            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
2690            where
2691                E: de::Error,
2692            {
2693                Ok(GetBlockHashResponse { value: v.to_string() })
2694            }
2695
2696            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
2697            where
2698                E: de::Error,
2699            {
2700                Ok(GetBlockHashResponse { value: v.to_string() })
2701            }
2702
2703            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
2704            where
2705                E: de::Error,
2706            {
2707                Ok(GetBlockHashResponse { value: v.to_string() })
2708            }
2709
2710            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
2711            where
2712                E: de::Error,
2713            {
2714                Ok(GetBlockHashResponse { value: v.to_string() })
2715            }
2716
2717            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
2718            where
2719                E: de::Error,
2720            {
2721                Ok(GetBlockHashResponse { value: v.to_string() })
2722            }
2723
2724            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
2725            where
2726                M: de::MapAccess<'de>,
2727            {
2728                let mut value = None;
2729                while let Some(key) = map.next_key::<String>()? {
2730                    if key == "value" {
2731                        if value.is_some() {
2732                            return Err(de::Error::duplicate_field("value"));
2733                        }
2734                        value = Some(map.next_value()?);
2735                    } else {
2736                        let _ = map.next_value::<de::IgnoredAny>()?;
2737                    }
2738                }
2739                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
2740                Ok(GetBlockHashResponse { value })
2741            }
2742        }
2743
2744        deserializer.deserialize_any(PrimitiveWrapperVisitor)
2745    }
2746}
2747
2748impl std::ops::Deref for GetBlockHashResponse {
2749    type Target = String;
2750    fn deref(&self) -> &Self::Target { &self.value }
2751}
2752
2753impl std::ops::DerefMut for GetBlockHashResponse {
2754    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
2755}
2756
2757impl AsRef<String> for GetBlockHashResponse {
2758    fn as_ref(&self) -> &String { &self.value }
2759}
2760
2761impl From<String> for GetBlockHashResponse {
2762    fn from(value: String) -> Self { Self { value } }
2763}
2764
2765impl From<GetBlockHashResponse> for String {
2766    fn from(wrapper: GetBlockHashResponse) -> Self { wrapper.value }
2767}
2768
2769/// Response for the `GetBlockHeader` RPC method
2770///
2771#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2772#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2773pub struct GetBlockHeaderResponse {
2774    /// the block hash (same as provided)
2775    pub hash: String,
2776    /// The number of confirmations, or -1 if the block is not on the main chain
2777    pub confirmations: i64,
2778    /// The block height or index
2779    pub height: u64,
2780    /// The block version
2781    pub version: u32,
2782    /// The block version formatted in hexadecimal
2783    pub versionHex: String,
2784    /// The merkle root
2785    #[serde(rename = "merkleroot")]
2786    pub merkle_root: String,
2787    /// The block time expressed in UNIX epoch time
2788    pub time: u64,
2789    /// The median block time expressed in UNIX epoch time
2790    pub mediantime: u64,
2791    /// The nonce
2792    pub nonce: u64,
2793    /// nBits: compact representation of the block difficulty target
2794    pub bits: String,
2795    /// The difficulty target
2796    pub target: String,
2797    /// The difficulty
2798    pub difficulty: f64,
2799    /// Expected number of hashes required to produce the current chain
2800    #[serde(rename = "chainwork")]
2801    pub chain_work: String,
2802    /// The number of transactions in the block
2803    pub nTx: u64,
2804    /// The hash of the previous block (if available)
2805    #[serde(rename = "previousblockhash")]
2806    pub previous_block_hash: Option<String>,
2807    /// The hash of the next block (if available)
2808    #[serde(rename = "nextblockhash")]
2809    pub next_block_hash: Option<String>,
2810}
2811
2812/// Response for the `GetBlockStats` RPC method
2813///
2814#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2815#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2816pub struct GetBlockStatsResponse {
2817    /// Average fee in the block
2818    pub avgfee: Option<u64>,
2819    /// Average feerate (in satoshis per virtual byte)
2820    #[serde(rename = "avgfeerate")]
2821    pub avg_fee_rate: Option<u64>,
2822    /// Average transaction size
2823    pub avgtxsize: Option<u64>,
2824    /// The block hash (to check for potential reorgs)
2825    #[serde(rename = "blockhash")]
2826    pub block_hash: Option<bitcoin::BlockHash>,
2827    /// Feerates at the 10th, 25th, 50th, 75th, and 90th percentile weight unit (in satoshis per virtual byte)
2828    pub feerate_percentiles: Option<serde_json::Value>,
2829    /// The height of the block
2830    pub height: Option<u64>,
2831    /// The number of inputs (excluding coinbase)
2832    pub ins: Option<u64>,
2833    /// Maximum fee in the block
2834    pub maxfee: Option<u64>,
2835    /// Maximum feerate (in satoshis per virtual byte)
2836    #[serde(rename = "maxfeerate")]
2837    pub max_fee_rate: Option<f64>,
2838    /// Maximum transaction size
2839    pub maxtxsize: Option<u64>,
2840    /// Truncated median fee in the block
2841    pub medianfee: Option<u64>,
2842    /// The block median time past
2843    pub mediantime: Option<u64>,
2844    /// Truncated median transaction size
2845    pub mediantxsize: Option<u64>,
2846    /// Minimum fee in the block
2847    pub minfee: Option<u64>,
2848    /// Minimum feerate (in satoshis per virtual byte)
2849    #[serde(rename = "minfeerate")]
2850    pub min_fee_rate: Option<u64>,
2851    /// Minimum transaction size
2852    pub mintxsize: Option<u64>,
2853    /// The number of outputs
2854    pub outs: Option<u64>,
2855    /// The block subsidy
2856    pub subsidy: Option<u64>,
2857    /// Total size of all segwit transactions
2858    pub swtotal_size: Option<u64>,
2859    /// Total weight of all segwit transactions
2860    pub swtotal_weight: Option<u64>,
2861    /// The number of segwit transactions
2862    pub swtxs: Option<u64>,
2863    /// The block time
2864    pub time: Option<u64>,
2865    /// Total amount in all outputs (excluding coinbase and thus reward \[ie subsidy + totalfee\])
2866    pub total_out: Option<u64>,
2867    /// Total size of all non-coinbase transactions
2868    pub total_size: Option<u64>,
2869    /// Total weight of all non-coinbase transactions
2870    pub total_weight: Option<u64>,
2871    /// The fee total
2872    pub totalfee: Option<u64>,
2873    /// The number of transactions (including coinbase)
2874    pub txs: Option<u64>,
2875    /// The increase/decrease in the number of unspent outputs (not discounting op_return and similar)
2876    pub utxo_increase: Option<u64>,
2877    /// The increase/decrease in size for the utxo index (not discounting op_return and similar)
2878    pub utxo_size_inc: Option<u64>,
2879    /// The increase/decrease in the number of unspent outputs, not counting unspendables
2880    pub utxo_increase_actual: Option<u64>,
2881    /// The increase/decrease in size for the utxo index, not counting unspendables
2882    pub utxo_size_inc_actual: Option<u64>,
2883}
2884
2885/// Response for the `GetBlockTemplate` RPC method
2886///
2887#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2888#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2889pub struct GetBlockTemplateResponse {
2890    #[serde(default)]
2891    pub field_0: Option<()>,
2892    /// The preferred block version
2893    pub version: u32,
2894    /// specific block rules that are to be enforced
2895    pub rules: Vec<String>,
2896    /// set of pending, supported versionbit (BIP 9) softfork deployments
2897    #[serde(rename = "vbavailable")]
2898    pub vb_available: HashMap<String, u32>,
2899    pub capabilities: Vec<String>,
2900    /// bit mask of versionbits the server requires set in submissions
2901    #[serde(rename = "vbrequired")]
2902    pub vb_required: u64,
2903    /// The hash of current highest block
2904    #[serde(rename = "previousblockhash")]
2905    pub previous_block_hash: String,
2906    /// contents of non-coinbase transactions that should be included in the next block
2907    pub transactions: Vec<GetBlockTemplateTransaction>,
2908    /// data that should be included in the coinbase's scriptSig content
2909    #[serde(rename = "coinbaseaux")]
2910    pub coinbase_aux: HashMap<String, String>,
2911    /// maximum allowable input to coinbase transaction, including the generation award and transaction fees (in satoshis)
2912    #[serde(rename = "coinbasevalue")]
2913    pub coinbase_value: u64,
2914    /// an id to include with a request to longpoll on an update to this template
2915    #[serde(rename = "longpollid")]
2916    pub longpoll_id: String,
2917    /// The hash target
2918    pub target: String,
2919    /// The minimum timestamp appropriate for the next block time, expressed in UNIX epoch time. Adjusted for the proposed BIP94 timewarp rule.
2920    pub mintime: u64,
2921    /// list of ways the block template may be changed
2922    pub mutable: Vec<String>,
2923    /// A range of valid nonces
2924    pub noncerange: String,
2925    /// limit of sigops in blocks
2926    pub sigoplimit: u64,
2927    /// limit of block size
2928    pub sizelimit: u64,
2929    /// limit of block weight
2930    pub weightlimit: Option<u64>,
2931    /// current timestamp in UNIX epoch time. Adjusted for the proposed BIP94 timewarp rule.
2932    #[serde(rename = "curtime")]
2933    pub cur_time: u64,
2934    /// compressed target of next block
2935    pub bits: String,
2936    /// The height of the next block
2937    pub height: u64,
2938    /// Only on signet
2939    pub signet_challenge: Option<String>,
2940    /// a valid witness commitment for the unmodified block template
2941    pub default_witness_commitment: Option<String>,
2942}
2943
2944/// Response for the `GetChainStates` RPC method
2945///
2946#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2947#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2948pub struct GetChainStatesResponse {
2949    /// the number of headers seen so far
2950    pub headers: u64,
2951    /// list of the chainstates ordered by work, with the most-work (active) chainstate last
2952    pub chainstates: serde_json::Value,
2953}
2954
2955/// Response for the `GetChainTips` RPC method
2956///
2957#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2958#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2959pub struct GetChainTipsResponse {
2960    pub field: serde_json::Value,
2961}
2962
2963/// Response for the `GetChainTxStats` RPC method
2964///
2965#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2966#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2967pub struct GetChainTxStatsResponse {
2968    /// The timestamp for the final block in the window, expressed in UNIX epoch time
2969    pub time: u64,
2970    /// The total number of transactions in the chain up to that point, if known. It may be unknown when using assumeutxo.
2971    pub txcount: Option<u64>,
2972    /// The hash of the final block in the window
2973    pub window_final_block_hash: String,
2974    /// The height of the final block in the window.
2975    pub window_final_block_height: u64,
2976    /// Size of the window in number of blocks
2977    pub window_block_count: u64,
2978    /// The elapsed time in the window in seconds. Only returned if "window_block_count" is &gt; 0
2979    pub window_interval: Option<u64>,
2980    /// The number of transactions in the window. Only returned if "window_block_count" is &gt; 0 and if txcount exists for the start and end of the window.
2981    pub window_tx_count: Option<u64>,
2982    /// The average rate of transactions per second in the window. Only returned if "window_interval" is &gt; 0 and if window_tx_count exists.
2983    pub txrate: Option<u64>,
2984}
2985
2986/// Response for the `GetConnectionCount` RPC method
2987///
2988/// This method returns a primitive value wrapped in a transparent struct.
2989#[derive(Debug, Clone, PartialEq, Serialize)]
2990pub struct GetConnectionCountResponse {
2991    /// Wrapped primitive value
2992    pub value: u64,
2993}
2994
2995impl<'de> serde::Deserialize<'de> for GetConnectionCountResponse {
2996    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2997    where
2998        D: serde::Deserializer<'de>,
2999    {
3000        use std::fmt;
3001
3002        use serde::de::{self, Visitor};
3003
3004        struct PrimitiveWrapperVisitor;
3005
3006        #[allow(unused_variables, clippy::needless_lifetimes)]
3007        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
3008            type Value = GetConnectionCountResponse;
3009
3010            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3011                formatter.write_str("a primitive value or an object with 'value' field")
3012            }
3013
3014            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
3015            where
3016                E: de::Error,
3017            {
3018                Ok(GetConnectionCountResponse { value: v })
3019            }
3020
3021            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
3022            where
3023                E: de::Error,
3024            {
3025                Ok(GetConnectionCountResponse { value: v as u64 })
3026            }
3027
3028            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
3029            where
3030                E: de::Error,
3031            {
3032                Ok(GetConnectionCountResponse { value: v as u64 })
3033            }
3034
3035            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
3036            where
3037                E: de::Error,
3038            {
3039                let value = v.parse::<u64>().map_err(de::Error::custom)?;
3040                Ok(GetConnectionCountResponse { value })
3041            }
3042
3043            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
3044            where
3045                E: de::Error,
3046            {
3047                Ok(GetConnectionCountResponse { value: v as u64 })
3048            }
3049
3050            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
3051            where
3052                M: de::MapAccess<'de>,
3053            {
3054                let mut value = None;
3055                while let Some(key) = map.next_key::<String>()? {
3056                    if key == "value" {
3057                        if value.is_some() {
3058                            return Err(de::Error::duplicate_field("value"));
3059                        }
3060                        value = Some(map.next_value()?);
3061                    } else {
3062                        let _ = map.next_value::<de::IgnoredAny>()?;
3063                    }
3064                }
3065                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
3066                Ok(GetConnectionCountResponse { value })
3067            }
3068        }
3069
3070        deserializer.deserialize_any(PrimitiveWrapperVisitor)
3071    }
3072}
3073
3074impl std::ops::Deref for GetConnectionCountResponse {
3075    type Target = u64;
3076    fn deref(&self) -> &Self::Target { &self.value }
3077}
3078
3079impl std::ops::DerefMut for GetConnectionCountResponse {
3080    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
3081}
3082
3083impl AsRef<u64> for GetConnectionCountResponse {
3084    fn as_ref(&self) -> &u64 { &self.value }
3085}
3086
3087impl From<u64> for GetConnectionCountResponse {
3088    fn from(value: u64) -> Self { Self { value } }
3089}
3090
3091impl From<GetConnectionCountResponse> for u64 {
3092    fn from(wrapper: GetConnectionCountResponse) -> Self { wrapper.value }
3093}
3094
3095/// Response for the `GetDeploymentInfo` RPC method
3096///
3097#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3098#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3099pub struct GetDeploymentInfoResponse {
3100    /// requested block hash (or tip)
3101    pub hash: String,
3102    /// requested block height (or tip)
3103    pub height: u64,
3104    /// script verify flags for the block
3105    pub script_flags: Vec<String>,
3106    pub deployments: serde_json::Value,
3107}
3108
3109/// Response for the `GetDescriptorActivity` RPC method
3110///
3111#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3112#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3113pub struct GetDescriptorActivityResponse {
3114    /// events
3115    pub activity: serde_json::Value,
3116}
3117
3118/// Response for the `GetDescriptorInfo` RPC method
3119///
3120#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3121#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3122pub struct GetDescriptorInfoResponse {
3123    /// The descriptor in canonical form, without private keys. For a multipath descriptor, only the first will be returned.
3124    pub descriptor: String,
3125    /// All descriptors produced by expanding multipath derivation elements. Only if the provided descriptor specifies multipath derivation elements.
3126    pub multipath_expansion: Option<Vec<String>>,
3127    /// The checksum for the input descriptor
3128    pub checksum: String,
3129    /// Whether the descriptor is ranged
3130    pub isrange: bool,
3131    /// Whether the descriptor is solvable
3132    pub issolvable: bool,
3133    /// Whether the input descriptor contained at least one private key
3134    pub hasprivatekeys: bool,
3135}
3136
3137/// Response for the `GetDifficulty` RPC method
3138///
3139/// This method returns a primitive value wrapped in a transparent struct.
3140#[derive(Debug, Clone, PartialEq, Serialize)]
3141pub struct GetDifficultyResponse {
3142    /// Wrapped primitive value
3143    pub value: u64,
3144}
3145
3146impl<'de> serde::Deserialize<'de> for GetDifficultyResponse {
3147    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3148    where
3149        D: serde::Deserializer<'de>,
3150    {
3151        use std::fmt;
3152
3153        use serde::de::{self, Visitor};
3154
3155        struct PrimitiveWrapperVisitor;
3156
3157        #[allow(unused_variables, clippy::needless_lifetimes)]
3158        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
3159            type Value = GetDifficultyResponse;
3160
3161            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3162                formatter.write_str("a primitive value or an object with 'value' field")
3163            }
3164
3165            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
3166            where
3167                E: de::Error,
3168            {
3169                Ok(GetDifficultyResponse { value: v })
3170            }
3171
3172            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
3173            where
3174                E: de::Error,
3175            {
3176                Ok(GetDifficultyResponse { value: v as u64 })
3177            }
3178
3179            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
3180            where
3181                E: de::Error,
3182            {
3183                Ok(GetDifficultyResponse { value: v as u64 })
3184            }
3185
3186            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
3187            where
3188                E: de::Error,
3189            {
3190                let value = v.parse::<u64>().map_err(de::Error::custom)?;
3191                Ok(GetDifficultyResponse { value })
3192            }
3193
3194            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
3195            where
3196                E: de::Error,
3197            {
3198                Ok(GetDifficultyResponse { value: v as u64 })
3199            }
3200
3201            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
3202            where
3203                M: de::MapAccess<'de>,
3204            {
3205                let mut value = None;
3206                while let Some(key) = map.next_key::<String>()? {
3207                    if key == "value" {
3208                        if value.is_some() {
3209                            return Err(de::Error::duplicate_field("value"));
3210                        }
3211                        value = Some(map.next_value()?);
3212                    } else {
3213                        let _ = map.next_value::<de::IgnoredAny>()?;
3214                    }
3215                }
3216                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
3217                Ok(GetDifficultyResponse { value })
3218            }
3219        }
3220
3221        deserializer.deserialize_any(PrimitiveWrapperVisitor)
3222    }
3223}
3224
3225impl std::ops::Deref for GetDifficultyResponse {
3226    type Target = u64;
3227    fn deref(&self) -> &Self::Target { &self.value }
3228}
3229
3230impl std::ops::DerefMut for GetDifficultyResponse {
3231    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
3232}
3233
3234impl AsRef<u64> for GetDifficultyResponse {
3235    fn as_ref(&self) -> &u64 { &self.value }
3236}
3237
3238impl From<u64> for GetDifficultyResponse {
3239    fn from(value: u64) -> Self { Self { value } }
3240}
3241
3242impl From<GetDifficultyResponse> for u64 {
3243    fn from(wrapper: GetDifficultyResponse) -> Self { wrapper.value }
3244}
3245
3246/// Response for the `GetHdKeys` RPC method
3247///
3248#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3249#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3250pub struct GetHdKeysResponse {
3251    pub field: serde_json::Value,
3252}
3253
3254/// Response for the `GetIndexInfo` RPC method
3255///
3256#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3257#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3258pub struct GetIndexInfoResponse {
3259    /// The name of the index
3260    #[serde(default)]
3261    pub name: Option<serde_json::Value>,
3262}
3263
3264/// Response for the `GetMemoryInfo` RPC method
3265///
3266#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3267#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3268pub struct GetMemoryInfoResponse {
3269    /// Information about locked memory manager
3270    pub locked: serde_json::Value,
3271}
3272
3273/// Response for the `GetMempoolAncestors` RPC method
3274///
3275#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3276#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3277pub struct GetMempoolAncestorsResponse {
3278    pub field_0: Vec<String>,
3279    #[serde(rename = "transactionid")]
3280    pub transaction_id: bitcoin::Txid,
3281}
3282
3283/// Response for the `GetMempoolCluster` RPC method
3284///
3285#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3286#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3287pub struct GetMempoolClusterResponse {
3288    /// total sigops-adjusted weight (as defined in BIP 141 and modified by '-bytespersigop')
3289    pub clusterweight: u64,
3290    /// number of transactions
3291    pub txcount: u64,
3292    /// chunks in this cluster (in mining order)
3293    pub chunks: serde_json::Value,
3294}
3295
3296/// Response for the `GetMempoolDescendants` RPC method
3297///
3298#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3299#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3300pub struct GetMempoolDescendantsResponse {
3301    pub field_0: Vec<String>,
3302    #[serde(rename = "transactionid")]
3303    pub transaction_id: bitcoin::Txid,
3304}
3305
3306/// Response for the `GetMempoolEntry` RPC method
3307///
3308#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3309#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3310pub struct GetMempoolEntryResponse {
3311    /// virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted.
3312    pub vsize: u64,
3313    /// transaction weight as defined in BIP 141.
3314    pub weight: u64,
3315    /// local time transaction entered pool in seconds since 1 Jan 1970 GMT
3316    pub time: u64,
3317    /// block height when transaction entered pool
3318    pub height: u64,
3319    /// number of in-mempool descendant transactions (including this one)
3320    pub descendantcount: u64,
3321    /// virtual transaction size of in-mempool descendants (including this one)
3322    pub descendantsize: u64,
3323    /// number of in-mempool ancestor transactions (including this one)
3324    pub ancestorcount: u64,
3325    /// virtual transaction size of in-mempool ancestors (including this one)
3326    pub ancestorsize: u64,
3327    /// sigops-adjusted weight (as defined in BIP 141 and modified by '-bytespersigop') of this transaction's chunk
3328    pub chunkweight: u64,
3329    /// hash of serialized transaction, including witness data
3330    pub wtxid: String,
3331    pub fees: serde_json::Value,
3332    /// unconfirmed transactions used as inputs for this transaction
3333    pub depends: Vec<String>,
3334    /// unconfirmed transactions spending outputs from this transaction
3335    pub spentby: Vec<String>,
3336    /// Whether this transaction signals BIP125 replaceability or has an unconfirmed ancestor signaling BIP125 replaceability. (DEPRECATED)
3337    #[serde(rename = "bip125-replaceable")]
3338    pub bip125_replaceable: bool,
3339    /// Whether this transaction is currently unbroadcast (initial broadcast not yet acknowledged by any peers)
3340    pub unbroadcast: bool,
3341}
3342
3343/// Response for the `GetMempoolFeeRateDiagram` RPC method
3344///
3345#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3346#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3347pub struct GetMempoolFeeRateDiagramResponse {
3348    pub field: serde_json::Value,
3349}
3350
3351/// Response for the `GetMempoolInfo` RPC method
3352///
3353#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3354#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3355pub struct GetMempoolInfoResponse {
3356    /// True if the initial load attempt of the persisted mempool finished
3357    pub loaded: bool,
3358    /// Current tx count
3359    pub size: u64,
3360    /// Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted
3361    pub bytes: u64,
3362    /// Total memory usage for the mempool
3363    pub usage: u64,
3364    /// Total fees for the mempool in BTC, ignoring modified fees through prioritisetransaction
3365    pub total_fee: f64,
3366    /// Maximum memory usage for the mempool
3367    pub maxmempool: u64,
3368    /// Minimum fee rate in BTC/kvB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee
3369    pub mempoolminfee: f64,
3370    /// Current minimum relay fee for transactions
3371    pub minrelaytxfee: f64,
3372    /// minimum fee rate increment for mempool limiting or replacement in BTC/kvB
3373    pub incrementalrelayfee: f64,
3374    /// Current number of transactions that haven't passed initial broadcast yet
3375    pub unbroadcastcount: u64,
3376    /// True if the mempool accepts RBF without replaceability signaling inspection (DEPRECATED)
3377    pub fullrbf: bool,
3378    /// True if the mempool accepts transactions with bare multisig outputs
3379    pub permitbaremultisig: Option<bool>,
3380    /// Maximum number of bytes that can be used by OP_RETURN outputs in the mempool
3381    pub maxdatacarriersize: Option<u64>,
3382    /// Maximum number of transactions that can be in a cluster (configured by -limitclustercount)
3383    pub limitclustercount: Option<u64>,
3384    /// Maximum size of a cluster in virtual bytes (configured by -limitclustersize)
3385    pub limitclustersize: Option<u64>,
3386}
3387
3388/// Response for the `GetMiningInfo` RPC method
3389///
3390#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3391#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3392pub struct GetMiningInfoResponse {
3393    /// The current block
3394    pub blocks: u64,
3395    /// The block weight (including reserved weight for block header, txs count and coinbase tx) of the last assembled block (only present if a block was ever assembled)
3396    pub currentblockweight: Option<u64>,
3397    /// The number of block transactions (excluding coinbase) of the last assembled block (only present if a block was ever assembled)
3398    pub currentblocktx: Option<u64>,
3399    /// The current nBits, compact representation of the block difficulty target
3400    pub bits: String,
3401    /// The current difficulty
3402    pub difficulty: f64,
3403    /// The current target
3404    pub target: String,
3405    /// The network hashes per second
3406    pub networkhashps: f64,
3407    /// The size of the mempool
3408    pub pooledtx: u64,
3409    /// Minimum feerate of packages selected for block inclusion in BTC/kvB
3410    pub blockmintxfee: Option<f64>,
3411    /// current network name (main, test, testnet4, signet, regtest)
3412    pub chain: String,
3413    /// The block challenge (aka. block script), in hexadecimal (only present if the current network is a signet)
3414    pub signet_challenge: Option<String>,
3415    /// The next block
3416    pub next: serde_json::Value,
3417    /// any network and blockchain warnings (run with `-deprecatedrpc=warnings` to return the latest warning as a single string)
3418    pub warnings: Vec<String>,
3419}
3420
3421/// Response for the `GetNetTotals` RPC method
3422///
3423#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3424#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3425pub struct GetNetTotalsResponse {
3426    /// Total bytes received
3427    pub totalbytesrecv: u64,
3428    /// Total bytes sent
3429    pub totalbytessent: u64,
3430    /// Current system UNIX epoch time in milliseconds
3431    pub timemillis: u64,
3432    pub uploadtarget: serde_json::Value,
3433}
3434
3435/// Response for the `GetNetworkHashPs` RPC method
3436///
3437/// This method returns a primitive value wrapped in a transparent struct.
3438#[derive(Debug, Clone, PartialEq, Serialize)]
3439pub struct GetNetworkHashPsResponse {
3440    /// Wrapped primitive value
3441    pub value: u64,
3442}
3443
3444impl<'de> serde::Deserialize<'de> for GetNetworkHashPsResponse {
3445    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3446    where
3447        D: serde::Deserializer<'de>,
3448    {
3449        use std::fmt;
3450
3451        use serde::de::{self, Visitor};
3452
3453        struct PrimitiveWrapperVisitor;
3454
3455        #[allow(unused_variables, clippy::needless_lifetimes)]
3456        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
3457            type Value = GetNetworkHashPsResponse;
3458
3459            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3460                formatter.write_str("a primitive value or an object with 'value' field")
3461            }
3462
3463            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
3464            where
3465                E: de::Error,
3466            {
3467                Ok(GetNetworkHashPsResponse { value: v })
3468            }
3469
3470            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
3471            where
3472                E: de::Error,
3473            {
3474                Ok(GetNetworkHashPsResponse { value: v as u64 })
3475            }
3476
3477            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
3478            where
3479                E: de::Error,
3480            {
3481                Ok(GetNetworkHashPsResponse { value: v as u64 })
3482            }
3483
3484            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
3485            where
3486                E: de::Error,
3487            {
3488                let value = v.parse::<u64>().map_err(de::Error::custom)?;
3489                Ok(GetNetworkHashPsResponse { value })
3490            }
3491
3492            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
3493            where
3494                E: de::Error,
3495            {
3496                Ok(GetNetworkHashPsResponse { value: v as u64 })
3497            }
3498
3499            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
3500            where
3501                M: de::MapAccess<'de>,
3502            {
3503                let mut value = None;
3504                while let Some(key) = map.next_key::<String>()? {
3505                    if key == "value" {
3506                        if value.is_some() {
3507                            return Err(de::Error::duplicate_field("value"));
3508                        }
3509                        value = Some(map.next_value()?);
3510                    } else {
3511                        let _ = map.next_value::<de::IgnoredAny>()?;
3512                    }
3513                }
3514                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
3515                Ok(GetNetworkHashPsResponse { value })
3516            }
3517        }
3518
3519        deserializer.deserialize_any(PrimitiveWrapperVisitor)
3520    }
3521}
3522
3523impl std::ops::Deref for GetNetworkHashPsResponse {
3524    type Target = u64;
3525    fn deref(&self) -> &Self::Target { &self.value }
3526}
3527
3528impl std::ops::DerefMut for GetNetworkHashPsResponse {
3529    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
3530}
3531
3532impl AsRef<u64> for GetNetworkHashPsResponse {
3533    fn as_ref(&self) -> &u64 { &self.value }
3534}
3535
3536impl From<u64> for GetNetworkHashPsResponse {
3537    fn from(value: u64) -> Self { Self { value } }
3538}
3539
3540impl From<GetNetworkHashPsResponse> for u64 {
3541    fn from(wrapper: GetNetworkHashPsResponse) -> Self { wrapper.value }
3542}
3543
3544/// Response for the `GetNetworkInfo` RPC method
3545///
3546#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3547#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3548pub struct GetNetworkInfoResponse {
3549    /// the server version
3550    pub version: u32,
3551    /// the server subversion string
3552    pub subversion: String,
3553    /// the protocol version
3554    pub protocolversion: u64,
3555    /// the services we offer to the network
3556    pub localservices: String,
3557    /// the services we offer to the network, in human-readable form
3558    pub localservicesnames: Vec<String>,
3559    /// true if transaction relay is requested from peers
3560    pub localrelay: bool,
3561    /// the time offset
3562    pub timeoffset: u64,
3563    /// the total number of connections
3564    pub connections: u64,
3565    /// the number of inbound connections
3566    pub connections_in: u64,
3567    /// the number of outbound connections
3568    pub connections_out: u64,
3569    /// whether p2p networking is enabled
3570    pub networkactive: bool,
3571    /// information per network
3572    pub networks: serde_json::Value,
3573    /// minimum relay fee rate for transactions in BTC/kvB
3574    pub relayfee: f64,
3575    /// minimum fee rate increment for mempool limiting or replacement in BTC/kvB
3576    pub incrementalfee: f64,
3577    /// list of local addresses
3578    pub localaddresses: serde_json::Value,
3579    /// any network and blockchain warnings (run with `-deprecatedrpc=warnings` to return the latest warning as a single string)
3580    pub warnings: Vec<String>,
3581}
3582
3583/// Response for the `GetNewAddress` RPC method
3584///
3585/// This method returns a primitive value wrapped in a transparent struct.
3586#[derive(Debug, Clone, PartialEq, Serialize)]
3587pub struct GetNewAddressResponse {
3588    /// Wrapped primitive value
3589    pub value: String,
3590}
3591
3592impl<'de> serde::Deserialize<'de> for GetNewAddressResponse {
3593    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3594    where
3595        D: serde::Deserializer<'de>,
3596    {
3597        use std::fmt;
3598
3599        use serde::de::{self, Visitor};
3600
3601        struct PrimitiveWrapperVisitor;
3602
3603        #[allow(unused_variables, clippy::needless_lifetimes)]
3604        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
3605            type Value = GetNewAddressResponse;
3606
3607            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3608                formatter.write_str("a primitive value or an object with 'value' field")
3609            }
3610
3611            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
3612            where
3613                E: de::Error,
3614            {
3615                Ok(GetNewAddressResponse { value: v.to_string() })
3616            }
3617
3618            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
3619            where
3620                E: de::Error,
3621            {
3622                Ok(GetNewAddressResponse { value: v.to_string() })
3623            }
3624
3625            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
3626            where
3627                E: de::Error,
3628            {
3629                Ok(GetNewAddressResponse { value: v.to_string() })
3630            }
3631
3632            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
3633            where
3634                E: de::Error,
3635            {
3636                Ok(GetNewAddressResponse { value: v.to_string() })
3637            }
3638
3639            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
3640            where
3641                E: de::Error,
3642            {
3643                Ok(GetNewAddressResponse { value: v.to_string() })
3644            }
3645
3646            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
3647            where
3648                M: de::MapAccess<'de>,
3649            {
3650                let mut value = None;
3651                while let Some(key) = map.next_key::<String>()? {
3652                    if key == "value" {
3653                        if value.is_some() {
3654                            return Err(de::Error::duplicate_field("value"));
3655                        }
3656                        value = Some(map.next_value()?);
3657                    } else {
3658                        let _ = map.next_value::<de::IgnoredAny>()?;
3659                    }
3660                }
3661                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
3662                Ok(GetNewAddressResponse { value })
3663            }
3664        }
3665
3666        deserializer.deserialize_any(PrimitiveWrapperVisitor)
3667    }
3668}
3669
3670impl std::ops::Deref for GetNewAddressResponse {
3671    type Target = String;
3672    fn deref(&self) -> &Self::Target { &self.value }
3673}
3674
3675impl std::ops::DerefMut for GetNewAddressResponse {
3676    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
3677}
3678
3679impl AsRef<String> for GetNewAddressResponse {
3680    fn as_ref(&self) -> &String { &self.value }
3681}
3682
3683impl From<String> for GetNewAddressResponse {
3684    fn from(value: String) -> Self { Self { value } }
3685}
3686
3687impl From<GetNewAddressResponse> for String {
3688    fn from(wrapper: GetNewAddressResponse) -> Self { wrapper.value }
3689}
3690
3691/// Response for the `GetNodeAddresses` RPC method
3692///
3693/// This method returns an array wrapped in a transparent struct.
3694#[derive(Debug, Clone, PartialEq, Serialize)]
3695pub struct GetNodeAddressesResponse {
3696    /// Wrapped array value
3697    pub value: Vec<serde_json::Value>,
3698}
3699
3700impl<'de> serde::Deserialize<'de> for GetNodeAddressesResponse {
3701    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3702    where
3703        D: serde::Deserializer<'de>,
3704    {
3705        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
3706        Ok(Self { value })
3707    }
3708}
3709
3710impl From<Vec<serde_json::Value>> for GetNodeAddressesResponse {
3711    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
3712}
3713
3714impl From<GetNodeAddressesResponse> for Vec<serde_json::Value> {
3715    fn from(wrapper: GetNodeAddressesResponse) -> Self { wrapper.value }
3716}
3717
3718/// Response for the `GetOrphanTxs` RPC method
3719///
3720/// This method returns an array wrapped in a transparent struct.
3721#[derive(Debug, Clone, PartialEq, Serialize)]
3722pub struct GetOrphanTxsResponse {
3723    /// Wrapped array value
3724    pub value: Vec<bitcoin::Txid>,
3725}
3726
3727impl<'de> serde::Deserialize<'de> for GetOrphanTxsResponse {
3728    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3729    where
3730        D: serde::Deserializer<'de>,
3731    {
3732        let value = Vec::<bitcoin::Txid>::deserialize(deserializer)?;
3733        Ok(Self { value })
3734    }
3735}
3736
3737impl From<Vec<bitcoin::Txid>> for GetOrphanTxsResponse {
3738    fn from(value: Vec<bitcoin::Txid>) -> Self { Self { value } }
3739}
3740
3741impl From<GetOrphanTxsResponse> for Vec<bitcoin::Txid> {
3742    fn from(wrapper: GetOrphanTxsResponse) -> Self { wrapper.value }
3743}
3744
3745/// Response for the `GetPeerInfo` RPC method
3746///
3747/// This method returns an array wrapped in a transparent struct.
3748#[derive(Debug, Clone, PartialEq, Serialize)]
3749pub struct GetPeerInfoResponse {
3750    /// Wrapped array value
3751    pub value: Vec<serde_json::Value>,
3752}
3753
3754impl<'de> serde::Deserialize<'de> for GetPeerInfoResponse {
3755    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3756    where
3757        D: serde::Deserializer<'de>,
3758    {
3759        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
3760        Ok(Self { value })
3761    }
3762}
3763
3764impl From<Vec<serde_json::Value>> for GetPeerInfoResponse {
3765    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
3766}
3767
3768impl From<GetPeerInfoResponse> for Vec<serde_json::Value> {
3769    fn from(wrapper: GetPeerInfoResponse) -> Self { wrapper.value }
3770}
3771
3772/// Response for the `GetPrioritisedTransactions` RPC method
3773///
3774/// prioritisation keyed by txid
3775#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3776#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3777pub struct GetPrioritisedTransactionsResponse {
3778    #[serde(rename = "<transactionid>")]
3779    pub transactionid: serde_json::Value,
3780}
3781
3782/// Response for the `GetRawAddrMan` RPC method
3783///
3784#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3785#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3786pub struct GetRawAddrManResponse {
3787    /// buckets with addresses in the address manager table ( new, tried )
3788    #[serde(default)]
3789    pub table: Option<serde_json::Value>,
3790}
3791
3792/// Response for the `GetRawChangeAddress` RPC method
3793///
3794/// This method returns a primitive value wrapped in a transparent struct.
3795#[derive(Debug, Clone, PartialEq, Serialize)]
3796pub struct GetRawChangeAddressResponse {
3797    /// Wrapped primitive value
3798    pub value: String,
3799}
3800
3801impl<'de> serde::Deserialize<'de> for GetRawChangeAddressResponse {
3802    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3803    where
3804        D: serde::Deserializer<'de>,
3805    {
3806        use std::fmt;
3807
3808        use serde::de::{self, Visitor};
3809
3810        struct PrimitiveWrapperVisitor;
3811
3812        #[allow(unused_variables, clippy::needless_lifetimes)]
3813        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
3814            type Value = GetRawChangeAddressResponse;
3815
3816            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3817                formatter.write_str("a primitive value or an object with 'value' field")
3818            }
3819
3820            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
3821            where
3822                E: de::Error,
3823            {
3824                Ok(GetRawChangeAddressResponse { value: v.to_string() })
3825            }
3826
3827            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
3828            where
3829                E: de::Error,
3830            {
3831                Ok(GetRawChangeAddressResponse { value: v.to_string() })
3832            }
3833
3834            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
3835            where
3836                E: de::Error,
3837            {
3838                Ok(GetRawChangeAddressResponse { value: v.to_string() })
3839            }
3840
3841            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
3842            where
3843                E: de::Error,
3844            {
3845                Ok(GetRawChangeAddressResponse { value: v.to_string() })
3846            }
3847
3848            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
3849            where
3850                E: de::Error,
3851            {
3852                Ok(GetRawChangeAddressResponse { value: v.to_string() })
3853            }
3854
3855            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
3856            where
3857                M: de::MapAccess<'de>,
3858            {
3859                let mut value = None;
3860                while let Some(key) = map.next_key::<String>()? {
3861                    if key == "value" {
3862                        if value.is_some() {
3863                            return Err(de::Error::duplicate_field("value"));
3864                        }
3865                        value = Some(map.next_value()?);
3866                    } else {
3867                        let _ = map.next_value::<de::IgnoredAny>()?;
3868                    }
3869                }
3870                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
3871                Ok(GetRawChangeAddressResponse { value })
3872            }
3873        }
3874
3875        deserializer.deserialize_any(PrimitiveWrapperVisitor)
3876    }
3877}
3878
3879impl std::ops::Deref for GetRawChangeAddressResponse {
3880    type Target = String;
3881    fn deref(&self) -> &Self::Target { &self.value }
3882}
3883
3884impl std::ops::DerefMut for GetRawChangeAddressResponse {
3885    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
3886}
3887
3888impl AsRef<String> for GetRawChangeAddressResponse {
3889    fn as_ref(&self) -> &String { &self.value }
3890}
3891
3892impl From<String> for GetRawChangeAddressResponse {
3893    fn from(value: String) -> Self { Self { value } }
3894}
3895
3896impl From<GetRawChangeAddressResponse> for String {
3897    fn from(wrapper: GetRawChangeAddressResponse) -> Self { wrapper.value }
3898}
3899
3900/// Response for the `GetRawMempool` RPC method
3901///
3902/// This method returns an array wrapped in a transparent struct.
3903#[derive(Debug, Clone, PartialEq, Serialize)]
3904pub struct GetRawMempoolResponse {
3905    /// Wrapped array value
3906    pub value: Vec<serde_json::Value>,
3907}
3908
3909impl<'de> serde::Deserialize<'de> for GetRawMempoolResponse {
3910    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3911    where
3912        D: serde::Deserializer<'de>,
3913    {
3914        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
3915        Ok(Self { value })
3916    }
3917}
3918
3919impl From<Vec<serde_json::Value>> for GetRawMempoolResponse {
3920    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
3921}
3922
3923impl From<GetRawMempoolResponse> for Vec<serde_json::Value> {
3924    fn from(wrapper: GetRawMempoolResponse) -> Self { wrapper.value }
3925}
3926
3927/// Response for the `GetRawTransaction` RPC method
3928///
3929#[derive(Debug, Clone, PartialEq, Serialize)]
3930pub struct GetRawTransactionResponse {
3931    /// The serialized transaction as a hex-encoded string for 'txid'
3932    pub data: Option<String>,
3933    /// Whether specified block is in the active chain or not (only present with explicit "blockhash" argument)
3934    pub in_active_chain: Option<bool>,
3935    /// the block hash
3936    #[serde(rename = "blockhash")]
3937    pub block_hash: Option<bitcoin::BlockHash>,
3938    /// The confirmations
3939    pub confirmations: Option<i64>,
3940    /// The block time expressed in UNIX epoch time
3941    #[serde(rename = "blocktime")]
3942    pub block_time: Option<u64>,
3943    /// Same as "blocktime"
3944    pub time: Option<u64>,
3945    /// The serialized, hex-encoded data for 'txid'
3946    pub hex: Option<String>,
3947    /// The transaction id (same as provided)
3948    pub txid: Option<bitcoin::Txid>,
3949    /// The transaction hash (differs from txid for witness transactions)
3950    pub hash: Option<String>,
3951    /// The serialized transaction size
3952    pub size: Option<u64>,
3953    /// The virtual transaction size (differs from size for witness transactions)
3954    pub vsize: Option<u64>,
3955    /// The transaction's weight (between vsize*4-3 and vsize*4)
3956    pub weight: Option<u64>,
3957    /// The version
3958    pub version: Option<u32>,
3959    /// The lock time
3960    #[serde(rename = "locktime")]
3961    pub lock_time: Option<u64>,
3962    pub vin: Option<Vec<DecodedVin>>,
3963    pub vout: Option<Vec<DecodedVout>>,
3964    /// transaction fee in BTC, omitted if block undo data is not available
3965    pub fee: Option<f64>,
3966    pub vin_1: Option<serde_json::Value>,
3967}
3968impl<'de> serde::Deserialize<'de> for GetRawTransactionResponse {
3969    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3970    where
3971        D: serde::Deserializer<'de>,
3972    {
3973        use std::fmt;
3974
3975        use serde::de::{self, Visitor};
3976
3977        struct ConditionalResponseVisitor;
3978
3979        #[allow(clippy::needless_lifetimes)]
3980        impl<'de> Visitor<'de> for ConditionalResponseVisitor {
3981            type Value = GetRawTransactionResponse;
3982
3983            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3984                formatter.write_str("string or object")
3985            }
3986
3987            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
3988            where
3989                E: de::Error,
3990            {
3991                let data = v.to_string();
3992                Ok(GetRawTransactionResponse {
3993                    data: Some(data),
3994                    in_active_chain: None,
3995                    block_hash: None,
3996                    confirmations: None,
3997                    block_time: None,
3998                    time: None,
3999                    hex: None,
4000                    txid: None,
4001                    hash: None,
4002                    size: None,
4003                    vsize: None,
4004                    weight: None,
4005                    version: None,
4006                    lock_time: None,
4007                    vin: None,
4008                    vout: None,
4009                    fee: None,
4010                    vin_1: None,
4011                })
4012            }
4013
4014            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
4015            where
4016                M: de::MapAccess<'de>,
4017            {
4018                let mut data = None;
4019                let mut in_active_chain = None;
4020                let mut block_hash = None;
4021                let mut confirmations = None;
4022                let mut block_time = None;
4023                let mut time = None;
4024                let mut hex = None;
4025                let mut txid = None;
4026                let mut hash = None;
4027                let mut size = None;
4028                let mut vsize = None;
4029                let mut weight = None;
4030                let mut version = None;
4031                let mut lock_time = None;
4032                let mut vin = None;
4033                let mut vout = None;
4034                let mut fee = None;
4035                let mut vin_1 = None;
4036                while let Some(key) = map.next_key::<String>()? {
4037                    if key == "data" {
4038                        if data.is_some() {
4039                            return Err(de::Error::duplicate_field("data"));
4040                        }
4041                        data = Some(map.next_value::<String>()?);
4042                    }
4043                    if key == "in_active_chain" {
4044                        if in_active_chain.is_some() {
4045                            return Err(de::Error::duplicate_field("in_active_chain"));
4046                        }
4047                        in_active_chain = Some(map.next_value::<bool>()?);
4048                    }
4049                    if key == "blockhash" {
4050                        if block_hash.is_some() {
4051                            return Err(de::Error::duplicate_field("blockhash"));
4052                        }
4053                        block_hash = Some(map.next_value::<bitcoin::BlockHash>()?);
4054                    }
4055                    if key == "confirmations" {
4056                        if confirmations.is_some() {
4057                            return Err(de::Error::duplicate_field("confirmations"));
4058                        }
4059                        confirmations = Some(map.next_value::<i64>()?);
4060                    }
4061                    if key == "blocktime" {
4062                        if block_time.is_some() {
4063                            return Err(de::Error::duplicate_field("blocktime"));
4064                        }
4065                        block_time = Some(map.next_value::<u64>()?);
4066                    }
4067                    if key == "time" {
4068                        if time.is_some() {
4069                            return Err(de::Error::duplicate_field("time"));
4070                        }
4071                        time = Some(map.next_value::<u64>()?);
4072                    }
4073                    if key == "hex" {
4074                        if hex.is_some() {
4075                            return Err(de::Error::duplicate_field("hex"));
4076                        }
4077                        hex = Some(map.next_value::<String>()?);
4078                    }
4079                    if key == "txid" {
4080                        if txid.is_some() {
4081                            return Err(de::Error::duplicate_field("txid"));
4082                        }
4083                        txid = Some(map.next_value::<bitcoin::Txid>()?);
4084                    }
4085                    if key == "hash" {
4086                        if hash.is_some() {
4087                            return Err(de::Error::duplicate_field("hash"));
4088                        }
4089                        hash = Some(map.next_value::<String>()?);
4090                    }
4091                    if key == "size" {
4092                        if size.is_some() {
4093                            return Err(de::Error::duplicate_field("size"));
4094                        }
4095                        size = Some(map.next_value::<u64>()?);
4096                    }
4097                    if key == "vsize" {
4098                        if vsize.is_some() {
4099                            return Err(de::Error::duplicate_field("vsize"));
4100                        }
4101                        vsize = Some(map.next_value::<u64>()?);
4102                    }
4103                    if key == "weight" {
4104                        if weight.is_some() {
4105                            return Err(de::Error::duplicate_field("weight"));
4106                        }
4107                        weight = Some(map.next_value::<u64>()?);
4108                    }
4109                    if key == "version" {
4110                        if version.is_some() {
4111                            return Err(de::Error::duplicate_field("version"));
4112                        }
4113                        version = Some(map.next_value::<u32>()?);
4114                    }
4115                    if key == "locktime" {
4116                        if lock_time.is_some() {
4117                            return Err(de::Error::duplicate_field("locktime"));
4118                        }
4119                        lock_time = Some(map.next_value::<u64>()?);
4120                    }
4121                    if key == "vin" {
4122                        if vin.is_some() {
4123                            return Err(de::Error::duplicate_field("vin"));
4124                        }
4125                        vin = Some(map.next_value::<Vec<DecodedVin>>()?);
4126                    }
4127                    if key == "vout" {
4128                        if vout.is_some() {
4129                            return Err(de::Error::duplicate_field("vout"));
4130                        }
4131                        vout = Some(map.next_value::<Vec<DecodedVout>>()?);
4132                    }
4133                    if key == "fee" {
4134                        if fee.is_some() {
4135                            return Err(de::Error::duplicate_field("fee"));
4136                        }
4137                        fee = Some(map.next_value::<f64>()?);
4138                    }
4139                    if key == "vin_1" {
4140                        if vin_1.is_some() {
4141                            return Err(de::Error::duplicate_field("vin_1"));
4142                        }
4143                        vin_1 = Some(map.next_value::<serde_json::Value>()?);
4144                    } else {
4145                        let _ = map.next_value::<de::IgnoredAny>()?;
4146                    }
4147                }
4148                Ok(GetRawTransactionResponse {
4149                    data,
4150                    in_active_chain,
4151                    block_hash,
4152                    confirmations,
4153                    block_time,
4154                    time,
4155                    hex,
4156                    txid,
4157                    hash,
4158                    size,
4159                    vsize,
4160                    weight,
4161                    version,
4162                    lock_time,
4163                    vin,
4164                    vout,
4165                    fee,
4166                    vin_1,
4167                })
4168            }
4169        }
4170
4171        deserializer.deserialize_any(ConditionalResponseVisitor)
4172    }
4173}
4174
4175/// Response for the `GetReceivedByAddress` RPC method
4176///
4177/// This method returns a primitive value wrapped in a transparent struct.
4178#[derive(Debug, Clone, PartialEq, Serialize)]
4179pub struct GetReceivedByAddressResponse {
4180    /// Wrapped primitive value
4181    pub value: bitcoin::Amount,
4182}
4183
4184impl<'de> serde::Deserialize<'de> for GetReceivedByAddressResponse {
4185    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4186    where
4187        D: serde::Deserializer<'de>,
4188    {
4189        use std::fmt;
4190
4191        use serde::de::{self, Visitor};
4192
4193        struct PrimitiveWrapperVisitor;
4194
4195        #[allow(unused_variables, clippy::needless_lifetimes)]
4196        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
4197            type Value = GetReceivedByAddressResponse;
4198
4199            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
4200                formatter.write_str("a primitive value or an object with 'value' field")
4201            }
4202
4203            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
4204            where
4205                E: de::Error,
4206            {
4207                Ok(GetReceivedByAddressResponse { value: bitcoin::Amount::from_sat(v) })
4208            }
4209
4210            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
4211            where
4212                E: de::Error,
4213            {
4214                if v < 0 {
4215                    return Err(de::Error::custom(format!("Amount cannot be negative: {}", v)));
4216                }
4217                Ok(GetReceivedByAddressResponse { value: bitcoin::Amount::from_sat(v as u64) })
4218            }
4219
4220            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
4221            where
4222                E: de::Error,
4223            {
4224                let amount = bitcoin::Amount::from_btc(v)
4225                    .map_err(|e| de::Error::custom(format!("Invalid BTC amount: {}", e)))?;
4226                Ok(GetReceivedByAddressResponse { value: amount })
4227            }
4228
4229            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
4230            where
4231                E: de::Error,
4232            {
4233                let value = v.parse::<bitcoin::Amount>().map_err(de::Error::custom)?;
4234                Ok(GetReceivedByAddressResponse { value })
4235            }
4236
4237            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
4238            where
4239                E: de::Error,
4240            {
4241                Err(de::Error::custom("cannot convert bool to bitcoin::Amount"))
4242            }
4243
4244            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
4245            where
4246                M: de::MapAccess<'de>,
4247            {
4248                let mut value = None;
4249                while let Some(key) = map.next_key::<String>()? {
4250                    if key == "value" {
4251                        if value.is_some() {
4252                            return Err(de::Error::duplicate_field("value"));
4253                        }
4254                        value = Some(map.next_value()?);
4255                    } else {
4256                        let _ = map.next_value::<de::IgnoredAny>()?;
4257                    }
4258                }
4259                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
4260                Ok(GetReceivedByAddressResponse { value })
4261            }
4262        }
4263
4264        deserializer.deserialize_any(PrimitiveWrapperVisitor)
4265    }
4266}
4267
4268impl std::ops::Deref for GetReceivedByAddressResponse {
4269    type Target = bitcoin::Amount;
4270    fn deref(&self) -> &Self::Target { &self.value }
4271}
4272
4273impl std::ops::DerefMut for GetReceivedByAddressResponse {
4274    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
4275}
4276
4277impl AsRef<bitcoin::Amount> for GetReceivedByAddressResponse {
4278    fn as_ref(&self) -> &bitcoin::Amount { &self.value }
4279}
4280
4281impl From<bitcoin::Amount> for GetReceivedByAddressResponse {
4282    fn from(value: bitcoin::Amount) -> Self { Self { value } }
4283}
4284
4285impl From<GetReceivedByAddressResponse> for bitcoin::Amount {
4286    fn from(wrapper: GetReceivedByAddressResponse) -> Self { wrapper.value }
4287}
4288
4289/// Response for the `GetReceivedByLabel` RPC method
4290///
4291/// This method returns a primitive value wrapped in a transparent struct.
4292#[derive(Debug, Clone, PartialEq, Serialize)]
4293pub struct GetReceivedByLabelResponse {
4294    /// Wrapped primitive value
4295    pub value: bitcoin::Amount,
4296}
4297
4298impl<'de> serde::Deserialize<'de> for GetReceivedByLabelResponse {
4299    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4300    where
4301        D: serde::Deserializer<'de>,
4302    {
4303        use std::fmt;
4304
4305        use serde::de::{self, Visitor};
4306
4307        struct PrimitiveWrapperVisitor;
4308
4309        #[allow(unused_variables, clippy::needless_lifetimes)]
4310        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
4311            type Value = GetReceivedByLabelResponse;
4312
4313            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
4314                formatter.write_str("a primitive value or an object with 'value' field")
4315            }
4316
4317            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
4318            where
4319                E: de::Error,
4320            {
4321                Ok(GetReceivedByLabelResponse { value: bitcoin::Amount::from_sat(v) })
4322            }
4323
4324            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
4325            where
4326                E: de::Error,
4327            {
4328                if v < 0 {
4329                    return Err(de::Error::custom(format!("Amount cannot be negative: {}", v)));
4330                }
4331                Ok(GetReceivedByLabelResponse { value: bitcoin::Amount::from_sat(v as u64) })
4332            }
4333
4334            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
4335            where
4336                E: de::Error,
4337            {
4338                let amount = bitcoin::Amount::from_btc(v)
4339                    .map_err(|e| de::Error::custom(format!("Invalid BTC amount: {}", e)))?;
4340                Ok(GetReceivedByLabelResponse { value: amount })
4341            }
4342
4343            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
4344            where
4345                E: de::Error,
4346            {
4347                let value = v.parse::<bitcoin::Amount>().map_err(de::Error::custom)?;
4348                Ok(GetReceivedByLabelResponse { value })
4349            }
4350
4351            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
4352            where
4353                E: de::Error,
4354            {
4355                Err(de::Error::custom("cannot convert bool to bitcoin::Amount"))
4356            }
4357
4358            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
4359            where
4360                M: de::MapAccess<'de>,
4361            {
4362                let mut value = None;
4363                while let Some(key) = map.next_key::<String>()? {
4364                    if key == "value" {
4365                        if value.is_some() {
4366                            return Err(de::Error::duplicate_field("value"));
4367                        }
4368                        value = Some(map.next_value()?);
4369                    } else {
4370                        let _ = map.next_value::<de::IgnoredAny>()?;
4371                    }
4372                }
4373                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
4374                Ok(GetReceivedByLabelResponse { value })
4375            }
4376        }
4377
4378        deserializer.deserialize_any(PrimitiveWrapperVisitor)
4379    }
4380}
4381
4382impl std::ops::Deref for GetReceivedByLabelResponse {
4383    type Target = bitcoin::Amount;
4384    fn deref(&self) -> &Self::Target { &self.value }
4385}
4386
4387impl std::ops::DerefMut for GetReceivedByLabelResponse {
4388    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
4389}
4390
4391impl AsRef<bitcoin::Amount> for GetReceivedByLabelResponse {
4392    fn as_ref(&self) -> &bitcoin::Amount { &self.value }
4393}
4394
4395impl From<bitcoin::Amount> for GetReceivedByLabelResponse {
4396    fn from(value: bitcoin::Amount) -> Self { Self { value } }
4397}
4398
4399impl From<GetReceivedByLabelResponse> for bitcoin::Amount {
4400    fn from(wrapper: GetReceivedByLabelResponse) -> Self { wrapper.value }
4401}
4402
4403/// Response for the `GetRpcInfo` RPC method
4404///
4405#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4406#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
4407pub struct GetRpcInfoResponse {
4408    /// All active commands
4409    pub active_commands: serde_json::Value,
4410    /// The complete file path to the debug log
4411    pub logpath: String,
4412}
4413
4414/// Response for the `GetTransaction` RPC method
4415///
4416#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4417#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
4418pub struct GetTransactionResponse {
4419    /// The amount in BTC
4420    #[serde(deserialize_with = "amount_from_btc_float")]
4421    pub amount: bitcoin::Amount,
4422    /// The amount of the fee in BTC. This is negative and only available for the
4423    /// 'send' category of transactions.
4424    #[serde(deserialize_with = "option_amount_from_btc_float")]
4425    pub fee: Option<bitcoin::Amount>,
4426    /// The number of confirmations for the transaction. Negative confirmations means the
4427    /// transaction conflicted that many blocks ago.
4428    pub confirmations: i64,
4429    /// Only present if the transaction's only input is a coinbase one.
4430    pub generated: Option<bool>,
4431    /// Whether we consider the transaction to be trusted and safe to spend from.
4432    /// Only present when the transaction has 0 confirmations (or negative confirmations, if conflicted).
4433    pub trusted: Option<bool>,
4434    /// The block hash containing the transaction.
4435    #[serde(rename = "blockhash")]
4436    pub block_hash: Option<bitcoin::BlockHash>,
4437    /// The block height containing the transaction.
4438    #[serde(rename = "blockheight")]
4439    pub block_height: Option<u64>,
4440    /// The index of the transaction in the block that includes it.
4441    pub blockindex: Option<u64>,
4442    /// The block time expressed in UNIX epoch time.
4443    #[serde(rename = "blocktime")]
4444    pub block_time: Option<u64>,
4445    /// The transaction id.
4446    pub txid: bitcoin::Txid,
4447    /// The hash of serialized transaction, including witness data.
4448    pub wtxid: String,
4449    /// Confirmed transactions that have been detected by the wallet to conflict with this transaction.
4450    pub walletconflicts: Vec<String>,
4451    /// Only if 'category' is 'send'. The txid if this tx was replaced.
4452    pub replaced_by_txid: Option<String>,
4453    /// Only if 'category' is 'send'. The txid if this tx replaces another.
4454    pub replaces_txid: Option<String>,
4455    /// Transactions in the mempool that directly conflict with either this transaction or an ancestor transaction
4456    pub mempoolconflicts: Vec<String>,
4457    /// If a comment to is associated with the transaction.
4458    pub to: Option<String>,
4459    /// The transaction time expressed in UNIX epoch time.
4460    pub time: u64,
4461    /// The time received expressed in UNIX epoch time.
4462    #[serde(rename = "timereceived")]
4463    pub time_received: u64,
4464    /// If a comment is associated with the transaction, only present if not empty.
4465    pub comment: Option<String>,
4466    /// ("yes|no|unknown") Whether this transaction signals BIP125 replaceability or has an unconfirmed ancestor signaling BIP125 replaceability.
4467    /// May be unknown for unconfirmed transactions not in the mempool because their unconfirmed ancestors are unknown.
4468    #[serde(rename = "bip125-replaceable")]
4469    pub bip125_replaceable: String,
4470    /// Only if 'category' is 'received'. List of parent descriptors for the output script of this coin.
4471    pub parent_descs: Option<Vec<String>>,
4472    pub details: serde_json::Value,
4473    /// Raw data for transaction
4474    pub hex: String,
4475    /// The decoded transaction (only present when `verbose` is passed)
4476    pub decoded: Option<serde_json::Value>,
4477    /// hash and height of the block this information was generated on
4478    pub lastprocessedblock: serde_json::Value,
4479}
4480
4481/// Response for the `GetTxOut` RPC method
4482///
4483#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4484#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
4485pub struct GetTxOutResponse {
4486    #[serde(default)]
4487    pub field_0: Option<()>,
4488    /// The hash of the block at the tip of the chain
4489    pub bestblock: String,
4490    /// The number of confirmations
4491    pub confirmations: i64,
4492    /// The transaction value in BTC
4493    #[serde(deserialize_with = "amount_from_btc_float")]
4494    pub value: bitcoin::Amount,
4495    pub scriptPubKey: serde_json::Value,
4496    /// Coinbase or not
4497    pub coinbase: bool,
4498}
4499
4500/// Response for the `GetTxOutProof` RPC method
4501///
4502/// This method returns a primitive value wrapped in a transparent struct.
4503#[derive(Debug, Clone, PartialEq, Serialize)]
4504pub struct GetTxOutProofResponse {
4505    /// Wrapped primitive value
4506    pub value: String,
4507}
4508
4509impl<'de> serde::Deserialize<'de> for GetTxOutProofResponse {
4510    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4511    where
4512        D: serde::Deserializer<'de>,
4513    {
4514        use std::fmt;
4515
4516        use serde::de::{self, Visitor};
4517
4518        struct PrimitiveWrapperVisitor;
4519
4520        #[allow(unused_variables, clippy::needless_lifetimes)]
4521        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
4522            type Value = GetTxOutProofResponse;
4523
4524            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
4525                formatter.write_str("a primitive value or an object with 'value' field")
4526            }
4527
4528            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
4529            where
4530                E: de::Error,
4531            {
4532                Ok(GetTxOutProofResponse { value: v.to_string() })
4533            }
4534
4535            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
4536            where
4537                E: de::Error,
4538            {
4539                Ok(GetTxOutProofResponse { value: v.to_string() })
4540            }
4541
4542            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
4543            where
4544                E: de::Error,
4545            {
4546                Ok(GetTxOutProofResponse { value: v.to_string() })
4547            }
4548
4549            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
4550            where
4551                E: de::Error,
4552            {
4553                Ok(GetTxOutProofResponse { value: v.to_string() })
4554            }
4555
4556            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
4557            where
4558                E: de::Error,
4559            {
4560                Ok(GetTxOutProofResponse { value: v.to_string() })
4561            }
4562
4563            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
4564            where
4565                M: de::MapAccess<'de>,
4566            {
4567                let mut value = None;
4568                while let Some(key) = map.next_key::<String>()? {
4569                    if key == "value" {
4570                        if value.is_some() {
4571                            return Err(de::Error::duplicate_field("value"));
4572                        }
4573                        value = Some(map.next_value()?);
4574                    } else {
4575                        let _ = map.next_value::<de::IgnoredAny>()?;
4576                    }
4577                }
4578                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
4579                Ok(GetTxOutProofResponse { value })
4580            }
4581        }
4582
4583        deserializer.deserialize_any(PrimitiveWrapperVisitor)
4584    }
4585}
4586
4587impl std::ops::Deref for GetTxOutProofResponse {
4588    type Target = String;
4589    fn deref(&self) -> &Self::Target { &self.value }
4590}
4591
4592impl std::ops::DerefMut for GetTxOutProofResponse {
4593    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
4594}
4595
4596impl AsRef<String> for GetTxOutProofResponse {
4597    fn as_ref(&self) -> &String { &self.value }
4598}
4599
4600impl From<String> for GetTxOutProofResponse {
4601    fn from(value: String) -> Self { Self { value } }
4602}
4603
4604impl From<GetTxOutProofResponse> for String {
4605    fn from(wrapper: GetTxOutProofResponse) -> Self { wrapper.value }
4606}
4607
4608/// Response for the `GetTxOutSetInfo` RPC method
4609///
4610#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4611#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
4612pub struct GetTxOutSetInfoResponse {
4613    /// The block height (index) of the returned statistics
4614    pub height: u64,
4615    /// The hash of the block at which these statistics are calculated
4616    pub bestblock: String,
4617    /// The number of unspent transaction outputs
4618    pub txouts: u64,
4619    /// Database-independent, meaningless metric indicating the UTXO set size
4620    pub bogosize: u64,
4621    /// The serialized hash (only present if 'hash_serialized_3' hash_type is chosen)
4622    pub hash_serialized_3: Option<String>,
4623    /// The serialized hash (only present if 'muhash' hash_type is chosen)
4624    pub muhash: Option<String>,
4625    /// The number of transactions with unspent outputs (not available when coinstatsindex is used)
4626    pub transactions: Option<u64>,
4627    /// The estimated size of the chainstate on disk (not available when coinstatsindex is used)
4628    pub disk_size: Option<u64>,
4629    /// The total amount of coins in the UTXO set
4630    #[serde(deserialize_with = "amount_from_btc_float")]
4631    pub total_amount: bitcoin::Amount,
4632    /// The total amount of coins permanently excluded from the UTXO set (only available if coinstatsindex is used)
4633    #[serde(default)]
4634    #[serde(deserialize_with = "option_amount_from_btc_float")]
4635    pub total_unspendable_amount: Option<bitcoin::Amount>,
4636    /// Info on amounts in the block at this block height (only available if coinstatsindex is used)
4637    pub block_info: Option<serde_json::Value>,
4638}
4639
4640/// Response for the `GetTxSpendingPrevOut` RPC method
4641///
4642#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4643#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
4644pub struct GetTxSpendingPrevOutResponse {
4645    pub field: serde_json::Value,
4646}
4647
4648/// Response for the `GetWalletInfo` RPC method
4649///
4650#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4651#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
4652pub struct GetWalletInfoResponse {
4653    /// the wallet name
4654    #[serde(rename = "walletname")]
4655    pub wallet_name: String,
4656    /// (DEPRECATED) only related to unsupported legacy wallet, returns the latest version 169900 for backwards compatibility
4657    pub walletversion: u64,
4658    /// the database format (only sqlite)
4659    pub format: String,
4660    /// the total number of transactions in the wallet
4661    pub txcount: u64,
4662    /// how many new keys are pre-generated (only counts external keys)
4663    #[serde(rename = "keypoolsize")]
4664    pub key_pool_size: u64,
4665    /// how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used)
4666    pub keypoolsize_hd_internal: Option<u64>,
4667    /// the UNIX epoch time until which the wallet is unlocked for transfers, or 0 if the wallet is locked (only present for passphrase-encrypted wallets)
4668    pub unlocked_until: Option<u64>,
4669    /// false if privatekeys are disabled for this wallet (enforced watch-only wallet)
4670    pub private_keys_enabled: bool,
4671    /// whether this wallet tracks clean/dirty coins in terms of reuse
4672    pub avoid_reuse: bool,
4673    /// current scanning details, or false if no scan is in progress
4674    pub scanning: serde_json::Value,
4675    /// whether this wallet uses descriptors for output script management
4676    pub descriptors: bool,
4677    /// whether this wallet is configured to use an external signer such as a hardware wallet
4678    pub external_signer: bool,
4679    /// Whether this wallet intentionally does not contain any keys, scripts, or descriptors
4680    pub blank: bool,
4681    /// The start time for blocks scanning. It could be modified by (re)importing any descriptor with an earlier timestamp.
4682    #[serde(rename = "birthtime")]
4683    pub birth_time: Option<u64>,
4684    /// The flags currently set on the wallet
4685    pub flags: Vec<String>,
4686    /// hash and height of the block this information was generated on
4687    pub lastprocessedblock: serde_json::Value,
4688}
4689
4690/// Response for the `Help` RPC method
4691///
4692/// This method returns a primitive value wrapped in a transparent struct.
4693#[derive(Debug, Clone, PartialEq, Serialize)]
4694pub struct HelpResponse {
4695    /// Wrapped primitive value
4696    pub value: String,
4697}
4698
4699impl<'de> serde::Deserialize<'de> for HelpResponse {
4700    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4701    where
4702        D: serde::Deserializer<'de>,
4703    {
4704        use std::fmt;
4705
4706        use serde::de::{self, Visitor};
4707
4708        struct PrimitiveWrapperVisitor;
4709
4710        #[allow(unused_variables, clippy::needless_lifetimes)]
4711        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
4712            type Value = HelpResponse;
4713
4714            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
4715                formatter.write_str("a primitive value or an object with 'value' field")
4716            }
4717
4718            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
4719            where
4720                E: de::Error,
4721            {
4722                Ok(HelpResponse { value: v.to_string() })
4723            }
4724
4725            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
4726            where
4727                E: de::Error,
4728            {
4729                Ok(HelpResponse { value: v.to_string() })
4730            }
4731
4732            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
4733            where
4734                E: de::Error,
4735            {
4736                Ok(HelpResponse { value: v.to_string() })
4737            }
4738
4739            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
4740            where
4741                E: de::Error,
4742            {
4743                Ok(HelpResponse { value: v.to_string() })
4744            }
4745
4746            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
4747            where
4748                E: de::Error,
4749            {
4750                Ok(HelpResponse { value: v.to_string() })
4751            }
4752
4753            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
4754            where
4755                M: de::MapAccess<'de>,
4756            {
4757                let mut value = None;
4758                while let Some(key) = map.next_key::<String>()? {
4759                    if key == "value" {
4760                        if value.is_some() {
4761                            return Err(de::Error::duplicate_field("value"));
4762                        }
4763                        value = Some(map.next_value()?);
4764                    } else {
4765                        let _ = map.next_value::<de::IgnoredAny>()?;
4766                    }
4767                }
4768                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
4769                Ok(HelpResponse { value })
4770            }
4771        }
4772
4773        deserializer.deserialize_any(PrimitiveWrapperVisitor)
4774    }
4775}
4776
4777impl std::ops::Deref for HelpResponse {
4778    type Target = String;
4779    fn deref(&self) -> &Self::Target { &self.value }
4780}
4781
4782impl std::ops::DerefMut for HelpResponse {
4783    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
4784}
4785
4786impl AsRef<String> for HelpResponse {
4787    fn as_ref(&self) -> &String { &self.value }
4788}
4789
4790impl From<String> for HelpResponse {
4791    fn from(value: String) -> Self { Self { value } }
4792}
4793
4794impl From<HelpResponse> for String {
4795    fn from(wrapper: HelpResponse) -> Self { wrapper.value }
4796}
4797
4798/// Response for the `ImportDescriptors` RPC method
4799///
4800/// Response is an array with the same size as the input that has the execution result
4801#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4802#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
4803pub struct ImportDescriptorsResponse {
4804    pub field: serde_json::Value,
4805}
4806
4807/// Response for the `ImportMempool` RPC method
4808///
4809/// This method returns no meaningful data.
4810#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4811pub struct ImportMempoolResponse;
4812
4813/// Response for the `ImportPrunedFunds` RPC method
4814///
4815/// This method returns a primitive value wrapped in a transparent struct.
4816#[derive(Debug, Clone, PartialEq, Serialize)]
4817pub struct ImportPrunedFundsResponse {
4818    /// Wrapped primitive value
4819    pub value: (),
4820}
4821
4822impl<'de> serde::Deserialize<'de> for ImportPrunedFundsResponse {
4823    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4824    where
4825        D: serde::Deserializer<'de>,
4826    {
4827        use std::fmt;
4828
4829        use serde::de::{self, Visitor};
4830
4831        struct PrimitiveWrapperVisitor;
4832
4833        #[allow(unused_variables, clippy::needless_lifetimes)]
4834        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
4835            type Value = ImportPrunedFundsResponse;
4836
4837            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
4838                formatter.write_str("a primitive value or an object with 'value' field")
4839            }
4840
4841            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
4842            where
4843                E: de::Error,
4844            {
4845                Ok(ImportPrunedFundsResponse { value: () })
4846            }
4847
4848            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
4849            where
4850                E: de::Error,
4851            {
4852                Ok(ImportPrunedFundsResponse { value: () })
4853            }
4854
4855            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
4856            where
4857                E: de::Error,
4858            {
4859                Ok(ImportPrunedFundsResponse { value: () })
4860            }
4861
4862            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
4863            where
4864                E: de::Error,
4865            {
4866                Ok(ImportPrunedFundsResponse { value: () })
4867            }
4868
4869            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
4870            where
4871                E: de::Error,
4872            {
4873                Ok(ImportPrunedFundsResponse { value: () })
4874            }
4875
4876            fn visit_none<E>(self) -> Result<Self::Value, E>
4877            where
4878                E: de::Error,
4879            {
4880                Ok(ImportPrunedFundsResponse { value: () })
4881            }
4882
4883            fn visit_unit<E>(self) -> Result<Self::Value, E>
4884            where
4885                E: de::Error,
4886            {
4887                Ok(ImportPrunedFundsResponse { value: () })
4888            }
4889
4890            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
4891            where
4892                M: de::MapAccess<'de>,
4893            {
4894                let mut value = None;
4895                while let Some(key) = map.next_key::<String>()? {
4896                    if key == "value" {
4897                        if value.is_some() {
4898                            return Err(de::Error::duplicate_field("value"));
4899                        }
4900                        value = Some(map.next_value::<()>()?);
4901                    } else {
4902                        let _ = map.next_value::<de::IgnoredAny>()?;
4903                    }
4904                }
4905                value.ok_or_else(|| de::Error::missing_field("value"))?;
4906                Ok(ImportPrunedFundsResponse { value: () })
4907            }
4908        }
4909
4910        deserializer.deserialize_any(PrimitiveWrapperVisitor)
4911    }
4912}
4913
4914impl std::ops::Deref for ImportPrunedFundsResponse {
4915    type Target = ();
4916    fn deref(&self) -> &Self::Target { &self.value }
4917}
4918
4919impl std::ops::DerefMut for ImportPrunedFundsResponse {
4920    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
4921}
4922
4923impl AsRef<()> for ImportPrunedFundsResponse {
4924    fn as_ref(&self) -> &() { &self.value }
4925}
4926
4927impl From<()> for ImportPrunedFundsResponse {
4928    fn from(value: ()) -> Self { Self { value } }
4929}
4930
4931impl From<ImportPrunedFundsResponse> for () {
4932    fn from(wrapper: ImportPrunedFundsResponse) -> Self { wrapper.value }
4933}
4934
4935/// Response for the `InvalidateBlock` RPC method
4936///
4937/// This method returns a primitive value wrapped in a transparent struct.
4938#[derive(Debug, Clone, PartialEq, Serialize)]
4939pub struct InvalidateBlockResponse {
4940    /// Wrapped primitive value
4941    pub value: (),
4942}
4943
4944impl<'de> serde::Deserialize<'de> for InvalidateBlockResponse {
4945    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4946    where
4947        D: serde::Deserializer<'de>,
4948    {
4949        use std::fmt;
4950
4951        use serde::de::{self, Visitor};
4952
4953        struct PrimitiveWrapperVisitor;
4954
4955        #[allow(unused_variables, clippy::needless_lifetimes)]
4956        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
4957            type Value = InvalidateBlockResponse;
4958
4959            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
4960                formatter.write_str("a primitive value or an object with 'value' field")
4961            }
4962
4963            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
4964            where
4965                E: de::Error,
4966            {
4967                Ok(InvalidateBlockResponse { value: () })
4968            }
4969
4970            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
4971            where
4972                E: de::Error,
4973            {
4974                Ok(InvalidateBlockResponse { value: () })
4975            }
4976
4977            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
4978            where
4979                E: de::Error,
4980            {
4981                Ok(InvalidateBlockResponse { value: () })
4982            }
4983
4984            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
4985            where
4986                E: de::Error,
4987            {
4988                Ok(InvalidateBlockResponse { value: () })
4989            }
4990
4991            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
4992            where
4993                E: de::Error,
4994            {
4995                Ok(InvalidateBlockResponse { value: () })
4996            }
4997
4998            fn visit_none<E>(self) -> Result<Self::Value, E>
4999            where
5000                E: de::Error,
5001            {
5002                Ok(InvalidateBlockResponse { value: () })
5003            }
5004
5005            fn visit_unit<E>(self) -> Result<Self::Value, E>
5006            where
5007                E: de::Error,
5008            {
5009                Ok(InvalidateBlockResponse { value: () })
5010            }
5011
5012            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
5013            where
5014                M: de::MapAccess<'de>,
5015            {
5016                let mut value = None;
5017                while let Some(key) = map.next_key::<String>()? {
5018                    if key == "value" {
5019                        if value.is_some() {
5020                            return Err(de::Error::duplicate_field("value"));
5021                        }
5022                        value = Some(map.next_value::<()>()?);
5023                    } else {
5024                        let _ = map.next_value::<de::IgnoredAny>()?;
5025                    }
5026                }
5027                value.ok_or_else(|| de::Error::missing_field("value"))?;
5028                Ok(InvalidateBlockResponse { value: () })
5029            }
5030        }
5031
5032        deserializer.deserialize_any(PrimitiveWrapperVisitor)
5033    }
5034}
5035
5036impl std::ops::Deref for InvalidateBlockResponse {
5037    type Target = ();
5038    fn deref(&self) -> &Self::Target { &self.value }
5039}
5040
5041impl std::ops::DerefMut for InvalidateBlockResponse {
5042    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
5043}
5044
5045impl AsRef<()> for InvalidateBlockResponse {
5046    fn as_ref(&self) -> &() { &self.value }
5047}
5048
5049impl From<()> for InvalidateBlockResponse {
5050    fn from(value: ()) -> Self { Self { value } }
5051}
5052
5053impl From<InvalidateBlockResponse> for () {
5054    fn from(wrapper: InvalidateBlockResponse) -> Self { wrapper.value }
5055}
5056
5057/// Response for the `JoinPsbts` RPC method
5058///
5059/// This method returns a primitive value wrapped in a transparent struct.
5060#[derive(Debug, Clone, PartialEq, Serialize)]
5061pub struct JoinPsbtsResponse {
5062    /// Wrapped primitive value
5063    pub value: String,
5064}
5065
5066impl<'de> serde::Deserialize<'de> for JoinPsbtsResponse {
5067    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5068    where
5069        D: serde::Deserializer<'de>,
5070    {
5071        use std::fmt;
5072
5073        use serde::de::{self, Visitor};
5074
5075        struct PrimitiveWrapperVisitor;
5076
5077        #[allow(unused_variables, clippy::needless_lifetimes)]
5078        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
5079            type Value = JoinPsbtsResponse;
5080
5081            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5082                formatter.write_str("a primitive value or an object with 'value' field")
5083            }
5084
5085            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
5086            where
5087                E: de::Error,
5088            {
5089                Ok(JoinPsbtsResponse { value: v.to_string() })
5090            }
5091
5092            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
5093            where
5094                E: de::Error,
5095            {
5096                Ok(JoinPsbtsResponse { value: v.to_string() })
5097            }
5098
5099            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
5100            where
5101                E: de::Error,
5102            {
5103                Ok(JoinPsbtsResponse { value: v.to_string() })
5104            }
5105
5106            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
5107            where
5108                E: de::Error,
5109            {
5110                Ok(JoinPsbtsResponse { value: v.to_string() })
5111            }
5112
5113            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
5114            where
5115                E: de::Error,
5116            {
5117                Ok(JoinPsbtsResponse { value: v.to_string() })
5118            }
5119
5120            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
5121            where
5122                M: de::MapAccess<'de>,
5123            {
5124                let mut value = None;
5125                while let Some(key) = map.next_key::<String>()? {
5126                    if key == "value" {
5127                        if value.is_some() {
5128                            return Err(de::Error::duplicate_field("value"));
5129                        }
5130                        value = Some(map.next_value()?);
5131                    } else {
5132                        let _ = map.next_value::<de::IgnoredAny>()?;
5133                    }
5134                }
5135                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
5136                Ok(JoinPsbtsResponse { value })
5137            }
5138        }
5139
5140        deserializer.deserialize_any(PrimitiveWrapperVisitor)
5141    }
5142}
5143
5144impl std::ops::Deref for JoinPsbtsResponse {
5145    type Target = String;
5146    fn deref(&self) -> &Self::Target { &self.value }
5147}
5148
5149impl std::ops::DerefMut for JoinPsbtsResponse {
5150    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
5151}
5152
5153impl AsRef<String> for JoinPsbtsResponse {
5154    fn as_ref(&self) -> &String { &self.value }
5155}
5156
5157impl From<String> for JoinPsbtsResponse {
5158    fn from(value: String) -> Self { Self { value } }
5159}
5160
5161impl From<JoinPsbtsResponse> for String {
5162    fn from(wrapper: JoinPsbtsResponse) -> Self { wrapper.value }
5163}
5164
5165/// Response for the `KeypoolRefill` RPC method
5166///
5167/// This method returns a primitive value wrapped in a transparent struct.
5168#[derive(Debug, Clone, PartialEq, Serialize)]
5169pub struct KeypoolRefillResponse {
5170    /// Wrapped primitive value
5171    pub value: (),
5172}
5173
5174impl<'de> serde::Deserialize<'de> for KeypoolRefillResponse {
5175    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5176    where
5177        D: serde::Deserializer<'de>,
5178    {
5179        use std::fmt;
5180
5181        use serde::de::{self, Visitor};
5182
5183        struct PrimitiveWrapperVisitor;
5184
5185        #[allow(unused_variables, clippy::needless_lifetimes)]
5186        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
5187            type Value = KeypoolRefillResponse;
5188
5189            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5190                formatter.write_str("a primitive value or an object with 'value' field")
5191            }
5192
5193            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
5194            where
5195                E: de::Error,
5196            {
5197                Ok(KeypoolRefillResponse { value: () })
5198            }
5199
5200            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
5201            where
5202                E: de::Error,
5203            {
5204                Ok(KeypoolRefillResponse { value: () })
5205            }
5206
5207            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
5208            where
5209                E: de::Error,
5210            {
5211                Ok(KeypoolRefillResponse { value: () })
5212            }
5213
5214            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
5215            where
5216                E: de::Error,
5217            {
5218                Ok(KeypoolRefillResponse { value: () })
5219            }
5220
5221            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
5222            where
5223                E: de::Error,
5224            {
5225                Ok(KeypoolRefillResponse { value: () })
5226            }
5227
5228            fn visit_none<E>(self) -> Result<Self::Value, E>
5229            where
5230                E: de::Error,
5231            {
5232                Ok(KeypoolRefillResponse { value: () })
5233            }
5234
5235            fn visit_unit<E>(self) -> Result<Self::Value, E>
5236            where
5237                E: de::Error,
5238            {
5239                Ok(KeypoolRefillResponse { value: () })
5240            }
5241
5242            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
5243            where
5244                M: de::MapAccess<'de>,
5245            {
5246                let mut value = None;
5247                while let Some(key) = map.next_key::<String>()? {
5248                    if key == "value" {
5249                        if value.is_some() {
5250                            return Err(de::Error::duplicate_field("value"));
5251                        }
5252                        value = Some(map.next_value::<()>()?);
5253                    } else {
5254                        let _ = map.next_value::<de::IgnoredAny>()?;
5255                    }
5256                }
5257                value.ok_or_else(|| de::Error::missing_field("value"))?;
5258                Ok(KeypoolRefillResponse { value: () })
5259            }
5260        }
5261
5262        deserializer.deserialize_any(PrimitiveWrapperVisitor)
5263    }
5264}
5265
5266impl std::ops::Deref for KeypoolRefillResponse {
5267    type Target = ();
5268    fn deref(&self) -> &Self::Target { &self.value }
5269}
5270
5271impl std::ops::DerefMut for KeypoolRefillResponse {
5272    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
5273}
5274
5275impl AsRef<()> for KeypoolRefillResponse {
5276    fn as_ref(&self) -> &() { &self.value }
5277}
5278
5279impl From<()> for KeypoolRefillResponse {
5280    fn from(value: ()) -> Self { Self { value } }
5281}
5282
5283impl From<KeypoolRefillResponse> for () {
5284    fn from(wrapper: KeypoolRefillResponse) -> Self { wrapper.value }
5285}
5286
5287/// Response for the `ListAddressGroupings` RPC method
5288///
5289/// This method returns an array wrapped in a transparent struct.
5290#[derive(Debug, Clone, PartialEq, Serialize)]
5291pub struct ListAddressGroupingsResponse {
5292    /// Wrapped array value
5293    pub value: Vec<serde_json::Value>,
5294}
5295
5296impl<'de> serde::Deserialize<'de> for ListAddressGroupingsResponse {
5297    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5298    where
5299        D: serde::Deserializer<'de>,
5300    {
5301        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5302        Ok(Self { value })
5303    }
5304}
5305
5306impl From<Vec<serde_json::Value>> for ListAddressGroupingsResponse {
5307    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5308}
5309
5310impl From<ListAddressGroupingsResponse> for Vec<serde_json::Value> {
5311    fn from(wrapper: ListAddressGroupingsResponse) -> Self { wrapper.value }
5312}
5313
5314/// Response for the `ListBanned` RPC method
5315///
5316/// This method returns an array wrapped in a transparent struct.
5317#[derive(Debug, Clone, PartialEq, Serialize)]
5318pub struct ListBannedResponse {
5319    /// Wrapped array value
5320    pub value: Vec<serde_json::Value>,
5321}
5322
5323impl<'de> serde::Deserialize<'de> for ListBannedResponse {
5324    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5325    where
5326        D: serde::Deserializer<'de>,
5327    {
5328        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5329        Ok(Self { value })
5330    }
5331}
5332
5333impl From<Vec<serde_json::Value>> for ListBannedResponse {
5334    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5335}
5336
5337impl From<ListBannedResponse> for Vec<serde_json::Value> {
5338    fn from(wrapper: ListBannedResponse) -> Self { wrapper.value }
5339}
5340
5341/// Response for the `ListDescriptors` RPC method
5342///
5343#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
5344#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
5345pub struct ListDescriptorsResponse {
5346    /// Name of wallet this operation was performed on
5347    pub wallet_name: String,
5348    /// Array of descriptor objects (sorted by descriptor string representation)
5349    pub descriptors: serde_json::Value,
5350}
5351
5352/// Response for the `ListLabels` RPC method
5353///
5354/// This method returns an array wrapped in a transparent struct.
5355#[derive(Debug, Clone, PartialEq, Serialize)]
5356pub struct ListLabelsResponse {
5357    /// Wrapped array value
5358    pub value: Vec<serde_json::Value>,
5359}
5360
5361impl<'de> serde::Deserialize<'de> for ListLabelsResponse {
5362    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5363    where
5364        D: serde::Deserializer<'de>,
5365    {
5366        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5367        Ok(Self { value })
5368    }
5369}
5370
5371impl From<Vec<serde_json::Value>> for ListLabelsResponse {
5372    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5373}
5374
5375impl From<ListLabelsResponse> for Vec<serde_json::Value> {
5376    fn from(wrapper: ListLabelsResponse) -> Self { wrapper.value }
5377}
5378
5379/// Response for the `ListLockUnspent` RPC method
5380///
5381/// This method returns an array wrapped in a transparent struct.
5382#[derive(Debug, Clone, PartialEq, Serialize)]
5383pub struct ListLockUnspentResponse {
5384    /// Wrapped array value
5385    pub value: Vec<serde_json::Value>,
5386}
5387
5388impl<'de> serde::Deserialize<'de> for ListLockUnspentResponse {
5389    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5390    where
5391        D: serde::Deserializer<'de>,
5392    {
5393        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5394        Ok(Self { value })
5395    }
5396}
5397
5398impl From<Vec<serde_json::Value>> for ListLockUnspentResponse {
5399    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5400}
5401
5402impl From<ListLockUnspentResponse> for Vec<serde_json::Value> {
5403    fn from(wrapper: ListLockUnspentResponse) -> Self { wrapper.value }
5404}
5405
5406/// Response for the `ListReceivedByAddress` RPC method
5407///
5408/// This method returns an array wrapped in a transparent struct.
5409#[derive(Debug, Clone, PartialEq, Serialize)]
5410pub struct ListReceivedByAddressResponse {
5411    /// Wrapped array value
5412    pub value: Vec<serde_json::Value>,
5413}
5414
5415impl<'de> serde::Deserialize<'de> for ListReceivedByAddressResponse {
5416    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5417    where
5418        D: serde::Deserializer<'de>,
5419    {
5420        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5421        Ok(Self { value })
5422    }
5423}
5424
5425impl From<Vec<serde_json::Value>> for ListReceivedByAddressResponse {
5426    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5427}
5428
5429impl From<ListReceivedByAddressResponse> for Vec<serde_json::Value> {
5430    fn from(wrapper: ListReceivedByAddressResponse) -> Self { wrapper.value }
5431}
5432
5433/// Response for the `ListReceivedByLabel` RPC method
5434///
5435/// This method returns an array wrapped in a transparent struct.
5436#[derive(Debug, Clone, PartialEq, Serialize)]
5437pub struct ListReceivedByLabelResponse {
5438    /// Wrapped array value
5439    pub value: Vec<serde_json::Value>,
5440}
5441
5442impl<'de> serde::Deserialize<'de> for ListReceivedByLabelResponse {
5443    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5444    where
5445        D: serde::Deserializer<'de>,
5446    {
5447        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5448        Ok(Self { value })
5449    }
5450}
5451
5452impl From<Vec<serde_json::Value>> for ListReceivedByLabelResponse {
5453    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5454}
5455
5456impl From<ListReceivedByLabelResponse> for Vec<serde_json::Value> {
5457    fn from(wrapper: ListReceivedByLabelResponse) -> Self { wrapper.value }
5458}
5459
5460/// Response for the `ListSinceBlock` RPC method
5461///
5462#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
5463#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
5464pub struct ListSinceBlockResponse {
5465    pub transactions: serde_json::Value,
5466    /// &lt;structure is the same as "transactions" above, only present if include_removed=true&gt;
5467    /// Note: transactions that were re-added in the active chain will appear as-is in this array, and may thus have a positive confirmation count.
5468    pub removed: Option<Vec<String>>,
5469    /// The hash of the block (target_confirmations-1) from the best block on the main chain, or the genesis hash if the referenced block does not exist yet. This is typically used to feed back into listsinceblock the next time you call it. So you would generally use a target_confirmations of say 6, so you will be continually re-notified of transactions until they've reached 6 confirmations plus any new ones
5470    #[serde(rename = "lastblock")]
5471    pub last_block: String,
5472}
5473
5474/// Response for the `ListTransactions` RPC method
5475///
5476/// This method returns an array wrapped in a transparent struct.
5477#[derive(Debug, Clone, PartialEq, Serialize)]
5478pub struct ListTransactionsResponse {
5479    /// Wrapped array value
5480    pub value: Vec<serde_json::Value>,
5481}
5482
5483impl<'de> serde::Deserialize<'de> for ListTransactionsResponse {
5484    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5485    where
5486        D: serde::Deserializer<'de>,
5487    {
5488        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5489        Ok(Self { value })
5490    }
5491}
5492
5493impl From<Vec<serde_json::Value>> for ListTransactionsResponse {
5494    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5495}
5496
5497impl From<ListTransactionsResponse> for Vec<serde_json::Value> {
5498    fn from(wrapper: ListTransactionsResponse) -> Self { wrapper.value }
5499}
5500
5501/// Response for the `ListUnspent` RPC method
5502///
5503/// This method returns an array wrapped in a transparent struct.
5504#[derive(Debug, Clone, PartialEq, Serialize)]
5505pub struct ListUnspentResponse {
5506    /// Wrapped array value
5507    pub value: Vec<serde_json::Value>,
5508}
5509
5510impl<'de> serde::Deserialize<'de> for ListUnspentResponse {
5511    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5512    where
5513        D: serde::Deserializer<'de>,
5514    {
5515        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5516        Ok(Self { value })
5517    }
5518}
5519
5520impl From<Vec<serde_json::Value>> for ListUnspentResponse {
5521    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5522}
5523
5524impl From<ListUnspentResponse> for Vec<serde_json::Value> {
5525    fn from(wrapper: ListUnspentResponse) -> Self { wrapper.value }
5526}
5527
5528/// Response for the `ListWalletDir` RPC method
5529///
5530#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
5531#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
5532pub struct ListWalletDirResponse {
5533    pub wallets: serde_json::Value,
5534}
5535
5536/// Response for the `ListWallets` RPC method
5537///
5538/// This method returns an array wrapped in a transparent struct.
5539#[derive(Debug, Clone, PartialEq, Serialize)]
5540pub struct ListWalletsResponse {
5541    /// Wrapped array value
5542    pub value: Vec<serde_json::Value>,
5543}
5544
5545impl<'de> serde::Deserialize<'de> for ListWalletsResponse {
5546    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5547    where
5548        D: serde::Deserializer<'de>,
5549    {
5550        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5551        Ok(Self { value })
5552    }
5553}
5554
5555impl From<Vec<serde_json::Value>> for ListWalletsResponse {
5556    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5557}
5558
5559impl From<ListWalletsResponse> for Vec<serde_json::Value> {
5560    fn from(wrapper: ListWalletsResponse) -> Self { wrapper.value }
5561}
5562
5563/// Response for the `LoadTxOutSet` RPC method
5564///
5565#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
5566#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
5567pub struct LoadTxOutSetResponse {
5568    /// the number of coins loaded from the snapshot
5569    pub coins_loaded: u64,
5570    /// the hash of the base of the snapshot
5571    pub tip_hash: String,
5572    /// the height of the base of the snapshot
5573    pub base_height: u64,
5574    /// the absolute path that the snapshot was loaded from
5575    pub path: String,
5576}
5577
5578/// Response for the `LoadWallet` RPC method
5579///
5580#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
5581#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
5582pub struct LoadWalletResponse {
5583    /// The wallet name if loaded successfully.
5584    pub name: String,
5585    /// Warning messages, if any, related to loading the wallet.
5586    pub warnings: Option<Vec<String>>,
5587}
5588
5589/// Response for the `LockUnspent` RPC method
5590///
5591/// This method returns a primitive value wrapped in a transparent struct.
5592#[derive(Debug, Clone, PartialEq, Serialize)]
5593pub struct LockUnspentResponse {
5594    /// Wrapped primitive value
5595    pub value: bool,
5596}
5597
5598impl<'de> serde::Deserialize<'de> for LockUnspentResponse {
5599    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5600    where
5601        D: serde::Deserializer<'de>,
5602    {
5603        use std::fmt;
5604
5605        use serde::de::{self, Visitor};
5606
5607        struct PrimitiveWrapperVisitor;
5608
5609        #[allow(unused_variables, clippy::needless_lifetimes)]
5610        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
5611            type Value = LockUnspentResponse;
5612
5613            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5614                formatter.write_str("a primitive value or an object with 'value' field")
5615            }
5616
5617            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
5618            where
5619                E: de::Error,
5620            {
5621                Ok(LockUnspentResponse { value: v != 0 })
5622            }
5623
5624            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
5625            where
5626                E: de::Error,
5627            {
5628                Ok(LockUnspentResponse { value: v != 0 })
5629            }
5630
5631            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
5632            where
5633                E: de::Error,
5634            {
5635                Ok(LockUnspentResponse { value: v != 0.0 })
5636            }
5637
5638            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
5639            where
5640                E: de::Error,
5641            {
5642                let value = v.parse::<bool>().map_err(de::Error::custom)?;
5643                Ok(LockUnspentResponse { value })
5644            }
5645
5646            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
5647            where
5648                E: de::Error,
5649            {
5650                Ok(LockUnspentResponse { value: v })
5651            }
5652
5653            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
5654            where
5655                M: de::MapAccess<'de>,
5656            {
5657                let mut value = None;
5658                while let Some(key) = map.next_key::<String>()? {
5659                    if key == "value" {
5660                        if value.is_some() {
5661                            return Err(de::Error::duplicate_field("value"));
5662                        }
5663                        value = Some(map.next_value()?);
5664                    } else {
5665                        let _ = map.next_value::<de::IgnoredAny>()?;
5666                    }
5667                }
5668                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
5669                Ok(LockUnspentResponse { value })
5670            }
5671        }
5672
5673        deserializer.deserialize_any(PrimitiveWrapperVisitor)
5674    }
5675}
5676
5677impl std::ops::Deref for LockUnspentResponse {
5678    type Target = bool;
5679    fn deref(&self) -> &Self::Target { &self.value }
5680}
5681
5682impl std::ops::DerefMut for LockUnspentResponse {
5683    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
5684}
5685
5686impl AsRef<bool> for LockUnspentResponse {
5687    fn as_ref(&self) -> &bool { &self.value }
5688}
5689
5690impl From<bool> for LockUnspentResponse {
5691    fn from(value: bool) -> Self { Self { value } }
5692}
5693
5694impl From<LockUnspentResponse> for bool {
5695    fn from(wrapper: LockUnspentResponse) -> Self { wrapper.value }
5696}
5697
5698/// Response for the `Logging` RPC method
5699///
5700/// keys are the logging categories, and values indicates its status
5701#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
5702#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
5703pub struct LoggingResponse {
5704    /// if being debug logged or not. false:inactive, true:active
5705    #[serde(default)]
5706    pub category: Option<bool>,
5707}
5708
5709/// Response for the `MigrateWallet` RPC method
5710///
5711#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
5712#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
5713pub struct MigrateWalletResponse {
5714    /// The name of the primary migrated wallet
5715    pub wallet_name: String,
5716    /// The name of the migrated wallet containing the watchonly scripts
5717    pub watchonly_name: Option<String>,
5718    /// The name of the migrated wallet containing solvable but not watched scripts
5719    pub solvables_name: Option<String>,
5720    /// The location of the backup of the original wallet
5721    pub backup_path: String,
5722}
5723
5724/// Response for the `MockScheduler` RPC method
5725///
5726/// This method returns a primitive value wrapped in a transparent struct.
5727#[derive(Debug, Clone, PartialEq, Serialize)]
5728pub struct MockSchedulerResponse {
5729    /// Wrapped primitive value
5730    pub value: (),
5731}
5732
5733impl<'de> serde::Deserialize<'de> for MockSchedulerResponse {
5734    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5735    where
5736        D: serde::Deserializer<'de>,
5737    {
5738        use std::fmt;
5739
5740        use serde::de::{self, Visitor};
5741
5742        struct PrimitiveWrapperVisitor;
5743
5744        #[allow(unused_variables, clippy::needless_lifetimes)]
5745        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
5746            type Value = MockSchedulerResponse;
5747
5748            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5749                formatter.write_str("a primitive value or an object with 'value' field")
5750            }
5751
5752            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
5753            where
5754                E: de::Error,
5755            {
5756                Ok(MockSchedulerResponse { value: () })
5757            }
5758
5759            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
5760            where
5761                E: de::Error,
5762            {
5763                Ok(MockSchedulerResponse { value: () })
5764            }
5765
5766            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
5767            where
5768                E: de::Error,
5769            {
5770                Ok(MockSchedulerResponse { value: () })
5771            }
5772
5773            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
5774            where
5775                E: de::Error,
5776            {
5777                Ok(MockSchedulerResponse { value: () })
5778            }
5779
5780            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
5781            where
5782                E: de::Error,
5783            {
5784                Ok(MockSchedulerResponse { value: () })
5785            }
5786
5787            fn visit_none<E>(self) -> Result<Self::Value, E>
5788            where
5789                E: de::Error,
5790            {
5791                Ok(MockSchedulerResponse { value: () })
5792            }
5793
5794            fn visit_unit<E>(self) -> Result<Self::Value, E>
5795            where
5796                E: de::Error,
5797            {
5798                Ok(MockSchedulerResponse { value: () })
5799            }
5800
5801            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
5802            where
5803                M: de::MapAccess<'de>,
5804            {
5805                let mut value = None;
5806                while let Some(key) = map.next_key::<String>()? {
5807                    if key == "value" {
5808                        if value.is_some() {
5809                            return Err(de::Error::duplicate_field("value"));
5810                        }
5811                        value = Some(map.next_value::<()>()?);
5812                    } else {
5813                        let _ = map.next_value::<de::IgnoredAny>()?;
5814                    }
5815                }
5816                value.ok_or_else(|| de::Error::missing_field("value"))?;
5817                Ok(MockSchedulerResponse { value: () })
5818            }
5819        }
5820
5821        deserializer.deserialize_any(PrimitiveWrapperVisitor)
5822    }
5823}
5824
5825impl std::ops::Deref for MockSchedulerResponse {
5826    type Target = ();
5827    fn deref(&self) -> &Self::Target { &self.value }
5828}
5829
5830impl std::ops::DerefMut for MockSchedulerResponse {
5831    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
5832}
5833
5834impl AsRef<()> for MockSchedulerResponse {
5835    fn as_ref(&self) -> &() { &self.value }
5836}
5837
5838impl From<()> for MockSchedulerResponse {
5839    fn from(value: ()) -> Self { Self { value } }
5840}
5841
5842impl From<MockSchedulerResponse> for () {
5843    fn from(wrapper: MockSchedulerResponse) -> Self { wrapper.value }
5844}
5845
5846/// Response for the `Ping` RPC method
5847///
5848/// This method returns a primitive value wrapped in a transparent struct.
5849#[derive(Debug, Clone, PartialEq, Serialize)]
5850pub struct PingResponse {
5851    /// Wrapped primitive value
5852    pub value: (),
5853}
5854
5855impl<'de> serde::Deserialize<'de> for PingResponse {
5856    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5857    where
5858        D: serde::Deserializer<'de>,
5859    {
5860        use std::fmt;
5861
5862        use serde::de::{self, Visitor};
5863
5864        struct PrimitiveWrapperVisitor;
5865
5866        #[allow(unused_variables, clippy::needless_lifetimes)]
5867        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
5868            type Value = PingResponse;
5869
5870            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5871                formatter.write_str("a primitive value or an object with 'value' field")
5872            }
5873
5874            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
5875            where
5876                E: de::Error,
5877            {
5878                Ok(PingResponse { value: () })
5879            }
5880
5881            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
5882            where
5883                E: de::Error,
5884            {
5885                Ok(PingResponse { value: () })
5886            }
5887
5888            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
5889            where
5890                E: de::Error,
5891            {
5892                Ok(PingResponse { value: () })
5893            }
5894
5895            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
5896            where
5897                E: de::Error,
5898            {
5899                Ok(PingResponse { value: () })
5900            }
5901
5902            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
5903            where
5904                E: de::Error,
5905            {
5906                Ok(PingResponse { value: () })
5907            }
5908
5909            fn visit_none<E>(self) -> Result<Self::Value, E>
5910            where
5911                E: de::Error,
5912            {
5913                Ok(PingResponse { value: () })
5914            }
5915
5916            fn visit_unit<E>(self) -> Result<Self::Value, E>
5917            where
5918                E: de::Error,
5919            {
5920                Ok(PingResponse { value: () })
5921            }
5922
5923            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
5924            where
5925                M: de::MapAccess<'de>,
5926            {
5927                let mut value = None;
5928                while let Some(key) = map.next_key::<String>()? {
5929                    if key == "value" {
5930                        if value.is_some() {
5931                            return Err(de::Error::duplicate_field("value"));
5932                        }
5933                        value = Some(map.next_value::<()>()?);
5934                    } else {
5935                        let _ = map.next_value::<de::IgnoredAny>()?;
5936                    }
5937                }
5938                value.ok_or_else(|| de::Error::missing_field("value"))?;
5939                Ok(PingResponse { value: () })
5940            }
5941        }
5942
5943        deserializer.deserialize_any(PrimitiveWrapperVisitor)
5944    }
5945}
5946
5947impl std::ops::Deref for PingResponse {
5948    type Target = ();
5949    fn deref(&self) -> &Self::Target { &self.value }
5950}
5951
5952impl std::ops::DerefMut for PingResponse {
5953    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
5954}
5955
5956impl AsRef<()> for PingResponse {
5957    fn as_ref(&self) -> &() { &self.value }
5958}
5959
5960impl From<()> for PingResponse {
5961    fn from(value: ()) -> Self { Self { value } }
5962}
5963
5964impl From<PingResponse> for () {
5965    fn from(wrapper: PingResponse) -> Self { wrapper.value }
5966}
5967
5968/// Response for the `PreciousBlock` RPC method
5969///
5970/// This method returns a primitive value wrapped in a transparent struct.
5971#[derive(Debug, Clone, PartialEq, Serialize)]
5972pub struct PreciousBlockResponse {
5973    /// Wrapped primitive value
5974    pub value: (),
5975}
5976
5977impl<'de> serde::Deserialize<'de> for PreciousBlockResponse {
5978    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5979    where
5980        D: serde::Deserializer<'de>,
5981    {
5982        use std::fmt;
5983
5984        use serde::de::{self, Visitor};
5985
5986        struct PrimitiveWrapperVisitor;
5987
5988        #[allow(unused_variables, clippy::needless_lifetimes)]
5989        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
5990            type Value = PreciousBlockResponse;
5991
5992            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5993                formatter.write_str("a primitive value or an object with 'value' field")
5994            }
5995
5996            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
5997            where
5998                E: de::Error,
5999            {
6000                Ok(PreciousBlockResponse { value: () })
6001            }
6002
6003            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
6004            where
6005                E: de::Error,
6006            {
6007                Ok(PreciousBlockResponse { value: () })
6008            }
6009
6010            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
6011            where
6012                E: de::Error,
6013            {
6014                Ok(PreciousBlockResponse { value: () })
6015            }
6016
6017            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6018            where
6019                E: de::Error,
6020            {
6021                Ok(PreciousBlockResponse { value: () })
6022            }
6023
6024            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
6025            where
6026                E: de::Error,
6027            {
6028                Ok(PreciousBlockResponse { value: () })
6029            }
6030
6031            fn visit_none<E>(self) -> Result<Self::Value, E>
6032            where
6033                E: de::Error,
6034            {
6035                Ok(PreciousBlockResponse { value: () })
6036            }
6037
6038            fn visit_unit<E>(self) -> Result<Self::Value, E>
6039            where
6040                E: de::Error,
6041            {
6042                Ok(PreciousBlockResponse { value: () })
6043            }
6044
6045            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6046            where
6047                M: de::MapAccess<'de>,
6048            {
6049                let mut value = None;
6050                while let Some(key) = map.next_key::<String>()? {
6051                    if key == "value" {
6052                        if value.is_some() {
6053                            return Err(de::Error::duplicate_field("value"));
6054                        }
6055                        value = Some(map.next_value::<()>()?);
6056                    } else {
6057                        let _ = map.next_value::<de::IgnoredAny>()?;
6058                    }
6059                }
6060                value.ok_or_else(|| de::Error::missing_field("value"))?;
6061                Ok(PreciousBlockResponse { value: () })
6062            }
6063        }
6064
6065        deserializer.deserialize_any(PrimitiveWrapperVisitor)
6066    }
6067}
6068
6069impl std::ops::Deref for PreciousBlockResponse {
6070    type Target = ();
6071    fn deref(&self) -> &Self::Target { &self.value }
6072}
6073
6074impl std::ops::DerefMut for PreciousBlockResponse {
6075    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
6076}
6077
6078impl AsRef<()> for PreciousBlockResponse {
6079    fn as_ref(&self) -> &() { &self.value }
6080}
6081
6082impl From<()> for PreciousBlockResponse {
6083    fn from(value: ()) -> Self { Self { value } }
6084}
6085
6086impl From<PreciousBlockResponse> for () {
6087    fn from(wrapper: PreciousBlockResponse) -> Self { wrapper.value }
6088}
6089
6090/// Response for the `PrioritiseTransaction` RPC method
6091///
6092/// This method returns a primitive value wrapped in a transparent struct.
6093#[derive(Debug, Clone, PartialEq, Serialize)]
6094pub struct PrioritiseTransactionResponse {
6095    /// Wrapped primitive value
6096    pub value: bool,
6097}
6098
6099impl<'de> serde::Deserialize<'de> for PrioritiseTransactionResponse {
6100    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6101    where
6102        D: serde::Deserializer<'de>,
6103    {
6104        use std::fmt;
6105
6106        use serde::de::{self, Visitor};
6107
6108        struct PrimitiveWrapperVisitor;
6109
6110        #[allow(unused_variables, clippy::needless_lifetimes)]
6111        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
6112            type Value = PrioritiseTransactionResponse;
6113
6114            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6115                formatter.write_str("a primitive value or an object with 'value' field")
6116            }
6117
6118            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
6119            where
6120                E: de::Error,
6121            {
6122                Ok(PrioritiseTransactionResponse { value: v != 0 })
6123            }
6124
6125            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
6126            where
6127                E: de::Error,
6128            {
6129                Ok(PrioritiseTransactionResponse { value: v != 0 })
6130            }
6131
6132            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
6133            where
6134                E: de::Error,
6135            {
6136                Ok(PrioritiseTransactionResponse { value: v != 0.0 })
6137            }
6138
6139            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6140            where
6141                E: de::Error,
6142            {
6143                let value = v.parse::<bool>().map_err(de::Error::custom)?;
6144                Ok(PrioritiseTransactionResponse { value })
6145            }
6146
6147            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
6148            where
6149                E: de::Error,
6150            {
6151                Ok(PrioritiseTransactionResponse { value: v })
6152            }
6153
6154            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6155            where
6156                M: de::MapAccess<'de>,
6157            {
6158                let mut value = None;
6159                while let Some(key) = map.next_key::<String>()? {
6160                    if key == "value" {
6161                        if value.is_some() {
6162                            return Err(de::Error::duplicate_field("value"));
6163                        }
6164                        value = Some(map.next_value()?);
6165                    } else {
6166                        let _ = map.next_value::<de::IgnoredAny>()?;
6167                    }
6168                }
6169                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
6170                Ok(PrioritiseTransactionResponse { value })
6171            }
6172        }
6173
6174        deserializer.deserialize_any(PrimitiveWrapperVisitor)
6175    }
6176}
6177
6178impl std::ops::Deref for PrioritiseTransactionResponse {
6179    type Target = bool;
6180    fn deref(&self) -> &Self::Target { &self.value }
6181}
6182
6183impl std::ops::DerefMut for PrioritiseTransactionResponse {
6184    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
6185}
6186
6187impl AsRef<bool> for PrioritiseTransactionResponse {
6188    fn as_ref(&self) -> &bool { &self.value }
6189}
6190
6191impl From<bool> for PrioritiseTransactionResponse {
6192    fn from(value: bool) -> Self { Self { value } }
6193}
6194
6195impl From<PrioritiseTransactionResponse> for bool {
6196    fn from(wrapper: PrioritiseTransactionResponse) -> Self { wrapper.value }
6197}
6198
6199/// Response for the `PruneBlockchain` RPC method
6200///
6201/// This method returns a primitive value wrapped in a transparent struct.
6202#[derive(Debug, Clone, PartialEq, Serialize)]
6203pub struct PruneBlockchainResponse {
6204    /// Wrapped primitive value
6205    pub value: u64,
6206}
6207
6208impl<'de> serde::Deserialize<'de> for PruneBlockchainResponse {
6209    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6210    where
6211        D: serde::Deserializer<'de>,
6212    {
6213        use std::fmt;
6214
6215        use serde::de::{self, Visitor};
6216
6217        struct PrimitiveWrapperVisitor;
6218
6219        #[allow(unused_variables, clippy::needless_lifetimes)]
6220        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
6221            type Value = PruneBlockchainResponse;
6222
6223            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6224                formatter.write_str("a primitive value or an object with 'value' field")
6225            }
6226
6227            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
6228            where
6229                E: de::Error,
6230            {
6231                Ok(PruneBlockchainResponse { value: v })
6232            }
6233
6234            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
6235            where
6236                E: de::Error,
6237            {
6238                Ok(PruneBlockchainResponse { value: v as u64 })
6239            }
6240
6241            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
6242            where
6243                E: de::Error,
6244            {
6245                Ok(PruneBlockchainResponse { value: v as u64 })
6246            }
6247
6248            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6249            where
6250                E: de::Error,
6251            {
6252                let value = v.parse::<u64>().map_err(de::Error::custom)?;
6253                Ok(PruneBlockchainResponse { value })
6254            }
6255
6256            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
6257            where
6258                E: de::Error,
6259            {
6260                Ok(PruneBlockchainResponse { value: v as u64 })
6261            }
6262
6263            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6264            where
6265                M: de::MapAccess<'de>,
6266            {
6267                let mut value = None;
6268                while let Some(key) = map.next_key::<String>()? {
6269                    if key == "value" {
6270                        if value.is_some() {
6271                            return Err(de::Error::duplicate_field("value"));
6272                        }
6273                        value = Some(map.next_value()?);
6274                    } else {
6275                        let _ = map.next_value::<de::IgnoredAny>()?;
6276                    }
6277                }
6278                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
6279                Ok(PruneBlockchainResponse { value })
6280            }
6281        }
6282
6283        deserializer.deserialize_any(PrimitiveWrapperVisitor)
6284    }
6285}
6286
6287impl std::ops::Deref for PruneBlockchainResponse {
6288    type Target = u64;
6289    fn deref(&self) -> &Self::Target { &self.value }
6290}
6291
6292impl std::ops::DerefMut for PruneBlockchainResponse {
6293    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
6294}
6295
6296impl AsRef<u64> for PruneBlockchainResponse {
6297    fn as_ref(&self) -> &u64 { &self.value }
6298}
6299
6300impl From<u64> for PruneBlockchainResponse {
6301    fn from(value: u64) -> Self { Self { value } }
6302}
6303
6304impl From<PruneBlockchainResponse> for u64 {
6305    fn from(wrapper: PruneBlockchainResponse) -> Self { wrapper.value }
6306}
6307
6308/// Response for the `PsbtBumpFee` RPC method
6309///
6310#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6311#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6312pub struct PsbtBumpFeeResponse {
6313    /// The base64-encoded unsigned PSBT of the new transaction.
6314    pub psbt: String,
6315    /// The fee of the replaced transaction.
6316    #[serde(rename = "origfee")]
6317    #[serde(deserialize_with = "amount_from_btc_float")]
6318    pub orig_fee: bitcoin::Amount,
6319    /// The fee of the new transaction.
6320    #[serde(deserialize_with = "amount_from_btc_float")]
6321    pub fee: bitcoin::Amount,
6322    /// Errors encountered during processing (may be empty).
6323    pub errors: Vec<String>,
6324}
6325
6326/// Response for the `ReconsiderBlock` RPC method
6327///
6328/// This method returns a primitive value wrapped in a transparent struct.
6329#[derive(Debug, Clone, PartialEq, Serialize)]
6330pub struct ReconsiderBlockResponse {
6331    /// Wrapped primitive value
6332    pub value: (),
6333}
6334
6335impl<'de> serde::Deserialize<'de> for ReconsiderBlockResponse {
6336    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6337    where
6338        D: serde::Deserializer<'de>,
6339    {
6340        use std::fmt;
6341
6342        use serde::de::{self, Visitor};
6343
6344        struct PrimitiveWrapperVisitor;
6345
6346        #[allow(unused_variables, clippy::needless_lifetimes)]
6347        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
6348            type Value = ReconsiderBlockResponse;
6349
6350            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6351                formatter.write_str("a primitive value or an object with 'value' field")
6352            }
6353
6354            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
6355            where
6356                E: de::Error,
6357            {
6358                Ok(ReconsiderBlockResponse { value: () })
6359            }
6360
6361            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
6362            where
6363                E: de::Error,
6364            {
6365                Ok(ReconsiderBlockResponse { value: () })
6366            }
6367
6368            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
6369            where
6370                E: de::Error,
6371            {
6372                Ok(ReconsiderBlockResponse { value: () })
6373            }
6374
6375            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6376            where
6377                E: de::Error,
6378            {
6379                Ok(ReconsiderBlockResponse { value: () })
6380            }
6381
6382            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
6383            where
6384                E: de::Error,
6385            {
6386                Ok(ReconsiderBlockResponse { value: () })
6387            }
6388
6389            fn visit_none<E>(self) -> Result<Self::Value, E>
6390            where
6391                E: de::Error,
6392            {
6393                Ok(ReconsiderBlockResponse { value: () })
6394            }
6395
6396            fn visit_unit<E>(self) -> Result<Self::Value, E>
6397            where
6398                E: de::Error,
6399            {
6400                Ok(ReconsiderBlockResponse { value: () })
6401            }
6402
6403            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6404            where
6405                M: de::MapAccess<'de>,
6406            {
6407                let mut value = None;
6408                while let Some(key) = map.next_key::<String>()? {
6409                    if key == "value" {
6410                        if value.is_some() {
6411                            return Err(de::Error::duplicate_field("value"));
6412                        }
6413                        value = Some(map.next_value::<()>()?);
6414                    } else {
6415                        let _ = map.next_value::<de::IgnoredAny>()?;
6416                    }
6417                }
6418                value.ok_or_else(|| de::Error::missing_field("value"))?;
6419                Ok(ReconsiderBlockResponse { value: () })
6420            }
6421        }
6422
6423        deserializer.deserialize_any(PrimitiveWrapperVisitor)
6424    }
6425}
6426
6427impl std::ops::Deref for ReconsiderBlockResponse {
6428    type Target = ();
6429    fn deref(&self) -> &Self::Target { &self.value }
6430}
6431
6432impl std::ops::DerefMut for ReconsiderBlockResponse {
6433    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
6434}
6435
6436impl AsRef<()> for ReconsiderBlockResponse {
6437    fn as_ref(&self) -> &() { &self.value }
6438}
6439
6440impl From<()> for ReconsiderBlockResponse {
6441    fn from(value: ()) -> Self { Self { value } }
6442}
6443
6444impl From<ReconsiderBlockResponse> for () {
6445    fn from(wrapper: ReconsiderBlockResponse) -> Self { wrapper.value }
6446}
6447
6448/// Response for the `RemovePrunedFunds` RPC method
6449///
6450/// This method returns a primitive value wrapped in a transparent struct.
6451#[derive(Debug, Clone, PartialEq, Serialize)]
6452pub struct RemovePrunedFundsResponse {
6453    /// Wrapped primitive value
6454    pub value: (),
6455}
6456
6457impl<'de> serde::Deserialize<'de> for RemovePrunedFundsResponse {
6458    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6459    where
6460        D: serde::Deserializer<'de>,
6461    {
6462        use std::fmt;
6463
6464        use serde::de::{self, Visitor};
6465
6466        struct PrimitiveWrapperVisitor;
6467
6468        #[allow(unused_variables, clippy::needless_lifetimes)]
6469        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
6470            type Value = RemovePrunedFundsResponse;
6471
6472            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6473                formatter.write_str("a primitive value or an object with 'value' field")
6474            }
6475
6476            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
6477            where
6478                E: de::Error,
6479            {
6480                Ok(RemovePrunedFundsResponse { value: () })
6481            }
6482
6483            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
6484            where
6485                E: de::Error,
6486            {
6487                Ok(RemovePrunedFundsResponse { value: () })
6488            }
6489
6490            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
6491            where
6492                E: de::Error,
6493            {
6494                Ok(RemovePrunedFundsResponse { value: () })
6495            }
6496
6497            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6498            where
6499                E: de::Error,
6500            {
6501                Ok(RemovePrunedFundsResponse { value: () })
6502            }
6503
6504            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
6505            where
6506                E: de::Error,
6507            {
6508                Ok(RemovePrunedFundsResponse { value: () })
6509            }
6510
6511            fn visit_none<E>(self) -> Result<Self::Value, E>
6512            where
6513                E: de::Error,
6514            {
6515                Ok(RemovePrunedFundsResponse { value: () })
6516            }
6517
6518            fn visit_unit<E>(self) -> Result<Self::Value, E>
6519            where
6520                E: de::Error,
6521            {
6522                Ok(RemovePrunedFundsResponse { value: () })
6523            }
6524
6525            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6526            where
6527                M: de::MapAccess<'de>,
6528            {
6529                let mut value = None;
6530                while let Some(key) = map.next_key::<String>()? {
6531                    if key == "value" {
6532                        if value.is_some() {
6533                            return Err(de::Error::duplicate_field("value"));
6534                        }
6535                        value = Some(map.next_value::<()>()?);
6536                    } else {
6537                        let _ = map.next_value::<de::IgnoredAny>()?;
6538                    }
6539                }
6540                value.ok_or_else(|| de::Error::missing_field("value"))?;
6541                Ok(RemovePrunedFundsResponse { value: () })
6542            }
6543        }
6544
6545        deserializer.deserialize_any(PrimitiveWrapperVisitor)
6546    }
6547}
6548
6549impl std::ops::Deref for RemovePrunedFundsResponse {
6550    type Target = ();
6551    fn deref(&self) -> &Self::Target { &self.value }
6552}
6553
6554impl std::ops::DerefMut for RemovePrunedFundsResponse {
6555    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
6556}
6557
6558impl AsRef<()> for RemovePrunedFundsResponse {
6559    fn as_ref(&self) -> &() { &self.value }
6560}
6561
6562impl From<()> for RemovePrunedFundsResponse {
6563    fn from(value: ()) -> Self { Self { value } }
6564}
6565
6566impl From<RemovePrunedFundsResponse> for () {
6567    fn from(wrapper: RemovePrunedFundsResponse) -> Self { wrapper.value }
6568}
6569
6570/// Response for the `RescanBlockchain` RPC method
6571///
6572#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6573#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6574pub struct RescanBlockchainResponse {
6575    /// The block height where the rescan started (the requested height or 0)
6576    pub start_height: u64,
6577    /// The height of the last rescanned block. May be null in rare cases if there was a reorg and the call didn't scan any blocks because they were already scanned in the background.
6578    pub stop_height: u64,
6579}
6580
6581/// Response for the `RestoreWallet` RPC method
6582///
6583#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6584#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6585pub struct RestoreWalletResponse {
6586    /// The wallet name if restored successfully.
6587    pub name: String,
6588    /// Warning messages, if any, related to restoring and loading the wallet.
6589    pub warnings: Option<Vec<String>>,
6590}
6591
6592/// Response for the `SaveMempool` RPC method
6593///
6594#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6595#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6596pub struct SaveMempoolResponse {
6597    /// the directory and file where the mempool was saved
6598    pub filename: String,
6599}
6600
6601/// Response for the `ScanBlocks` RPC method
6602///
6603#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6604#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6605pub struct ScanBlocksResponse {
6606    pub field_0: (),
6607    /// The height we started the scan from
6608    pub from_height: u64,
6609    /// The height we ended the scan at
6610    pub to_height: u64,
6611    /// Blocks that may have matched a scanobject.
6612    pub relevant_blocks: Vec<String>,
6613    /// true if the scan process was not aborted
6614    pub completed: bool,
6615    /// Approximate percent complete
6616    pub progress: u64,
6617    /// Height of the block currently being scanned
6618    pub current_height: u64,
6619    /// True if scan will be aborted (not necessarily before this RPC returns), or false if there is no scan to abort
6620    pub success: bool,
6621}
6622
6623/// Response for the `ScanTxOutSet` RPC method
6624///
6625#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6626#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6627pub struct ScanTxOutSetResponse {
6628    /// Whether the scan was completed
6629    pub success: bool,
6630    /// The number of unspent transaction outputs scanned
6631    pub txouts: u64,
6632    /// The block height at which the scan was done
6633    pub height: u64,
6634    /// The hash of the block at the tip of the chain
6635    pub bestblock: String,
6636    pub unspents: serde_json::Value,
6637    /// The total amount of all found unspent outputs in BTC
6638    #[serde(deserialize_with = "amount_from_btc_float")]
6639    pub total_amount: bitcoin::Amount,
6640    /// True if scan will be aborted (not necessarily before this RPC returns), or false if there is no scan to abort
6641    pub success_1: bool,
6642    /// Approximate percent complete
6643    pub progress: u64,
6644    pub field_3: (),
6645}
6646
6647/// Response for the `Schema` RPC method
6648///
6649/// This method returns no meaningful data.
6650#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6651pub struct SchemaResponse;
6652
6653/// Response for the `Send` RPC method
6654///
6655#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6656#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6657pub struct SendResponse {
6658    /// If the transaction has a complete set of signatures
6659    pub complete: bool,
6660    /// The transaction id for the send. Only 1 transaction is created regardless of the number of addresses.
6661    pub txid: Option<bitcoin::Txid>,
6662    /// If add_to_wallet is false, the hex-encoded raw transaction with signature(s)
6663    pub hex: Option<String>,
6664    /// If more signatures are needed, or if add_to_wallet is false, the base64-encoded (partially) signed transaction
6665    pub psbt: Option<String>,
6666}
6667
6668/// Response for the `SendAll` RPC method
6669///
6670#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6671#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6672pub struct SendAllResponse {
6673    /// If the transaction has a complete set of signatures
6674    pub complete: bool,
6675    /// The transaction id for the send. Only 1 transaction is created regardless of the number of addresses.
6676    pub txid: Option<bitcoin::Txid>,
6677    /// If add_to_wallet is false, the hex-encoded raw transaction with signature(s)
6678    pub hex: Option<String>,
6679    /// If more signatures are needed, or if add_to_wallet is false, the base64-encoded (partially) signed transaction
6680    pub psbt: Option<String>,
6681}
6682
6683/// Response for the `SendMany` RPC method
6684///
6685#[derive(Debug, Clone, PartialEq, Serialize)]
6686pub struct SendManyResponse {
6687    /// The transaction id for the send. Only 1 transaction is created regardless of
6688    /// the number of addresses.
6689    pub txid: Option<bitcoin::Txid>,
6690    /// The transaction fee reason.
6691    pub fee_reason: Option<String>,
6692}
6693impl<'de> serde::Deserialize<'de> for SendManyResponse {
6694    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6695    where
6696        D: serde::Deserializer<'de>,
6697    {
6698        use std::fmt;
6699
6700        use serde::de::{self, Visitor};
6701
6702        struct ConditionalResponseVisitor;
6703
6704        #[allow(clippy::needless_lifetimes)]
6705        impl<'de> Visitor<'de> for ConditionalResponseVisitor {
6706            type Value = SendManyResponse;
6707
6708            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6709                formatter.write_str("string or object")
6710            }
6711
6712            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6713            where
6714                E: de::Error,
6715            {
6716                let txid = bitcoin::Txid::from_str(v).map_err(de::Error::custom)?;
6717                Ok(SendManyResponse { txid: Some(txid), fee_reason: None })
6718            }
6719
6720            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6721            where
6722                M: de::MapAccess<'de>,
6723            {
6724                let mut txid = None;
6725                let mut fee_reason = None;
6726                while let Some(key) = map.next_key::<String>()? {
6727                    if key == "txid" {
6728                        if txid.is_some() {
6729                            return Err(de::Error::duplicate_field("txid"));
6730                        }
6731                        txid = Some(map.next_value::<bitcoin::Txid>()?);
6732                    }
6733                    if key == "fee_reason" {
6734                        if fee_reason.is_some() {
6735                            return Err(de::Error::duplicate_field("fee_reason"));
6736                        }
6737                        fee_reason = Some(map.next_value::<String>()?);
6738                    } else {
6739                        let _ = map.next_value::<de::IgnoredAny>()?;
6740                    }
6741                }
6742                Ok(SendManyResponse { txid, fee_reason })
6743            }
6744        }
6745
6746        deserializer.deserialize_any(ConditionalResponseVisitor)
6747    }
6748}
6749
6750/// Response for the `SendMsgToPeer` RPC method
6751///
6752/// This method returns no meaningful data.
6753#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6754pub struct SendMsgToPeerResponse;
6755
6756/// Response for the `SendRawTransaction` RPC method
6757///
6758/// This method returns a primitive value wrapped in a transparent struct.
6759#[derive(Debug, Clone, PartialEq, Serialize)]
6760pub struct SendRawTransactionResponse {
6761    /// Wrapped primitive value
6762    pub value: String,
6763}
6764
6765impl<'de> serde::Deserialize<'de> for SendRawTransactionResponse {
6766    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6767    where
6768        D: serde::Deserializer<'de>,
6769    {
6770        use std::fmt;
6771
6772        use serde::de::{self, Visitor};
6773
6774        struct PrimitiveWrapperVisitor;
6775
6776        #[allow(unused_variables, clippy::needless_lifetimes)]
6777        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
6778            type Value = SendRawTransactionResponse;
6779
6780            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6781                formatter.write_str("a primitive value or an object with 'value' field")
6782            }
6783
6784            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
6785            where
6786                E: de::Error,
6787            {
6788                Ok(SendRawTransactionResponse { value: v.to_string() })
6789            }
6790
6791            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
6792            where
6793                E: de::Error,
6794            {
6795                Ok(SendRawTransactionResponse { value: v.to_string() })
6796            }
6797
6798            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
6799            where
6800                E: de::Error,
6801            {
6802                Ok(SendRawTransactionResponse { value: v.to_string() })
6803            }
6804
6805            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6806            where
6807                E: de::Error,
6808            {
6809                Ok(SendRawTransactionResponse { value: v.to_string() })
6810            }
6811
6812            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
6813            where
6814                E: de::Error,
6815            {
6816                Ok(SendRawTransactionResponse { value: v.to_string() })
6817            }
6818
6819            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6820            where
6821                M: de::MapAccess<'de>,
6822            {
6823                let mut value = None;
6824                while let Some(key) = map.next_key::<String>()? {
6825                    if key == "value" {
6826                        if value.is_some() {
6827                            return Err(de::Error::duplicate_field("value"));
6828                        }
6829                        value = Some(map.next_value()?);
6830                    } else {
6831                        let _ = map.next_value::<de::IgnoredAny>()?;
6832                    }
6833                }
6834                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
6835                Ok(SendRawTransactionResponse { value })
6836            }
6837        }
6838
6839        deserializer.deserialize_any(PrimitiveWrapperVisitor)
6840    }
6841}
6842
6843impl std::ops::Deref for SendRawTransactionResponse {
6844    type Target = String;
6845    fn deref(&self) -> &Self::Target { &self.value }
6846}
6847
6848impl std::ops::DerefMut for SendRawTransactionResponse {
6849    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
6850}
6851
6852impl AsRef<String> for SendRawTransactionResponse {
6853    fn as_ref(&self) -> &String { &self.value }
6854}
6855
6856impl From<String> for SendRawTransactionResponse {
6857    fn from(value: String) -> Self { Self { value } }
6858}
6859
6860impl From<SendRawTransactionResponse> for String {
6861    fn from(wrapper: SendRawTransactionResponse) -> Self { wrapper.value }
6862}
6863
6864/// Response for the `SendToAddress` RPC method
6865///
6866#[derive(Debug, Clone, PartialEq, Serialize)]
6867pub struct SendToAddressResponse {
6868    /// The transaction id.
6869    pub txid: Option<bitcoin::Txid>,
6870    /// The transaction fee reason.
6871    pub fee_reason: Option<String>,
6872}
6873impl<'de> serde::Deserialize<'de> for SendToAddressResponse {
6874    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6875    where
6876        D: serde::Deserializer<'de>,
6877    {
6878        use std::fmt;
6879
6880        use serde::de::{self, Visitor};
6881
6882        struct ConditionalResponseVisitor;
6883
6884        #[allow(clippy::needless_lifetimes)]
6885        impl<'de> Visitor<'de> for ConditionalResponseVisitor {
6886            type Value = SendToAddressResponse;
6887
6888            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6889                formatter.write_str("string or object")
6890            }
6891
6892            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6893            where
6894                E: de::Error,
6895            {
6896                let txid = bitcoin::Txid::from_str(v).map_err(de::Error::custom)?;
6897                Ok(SendToAddressResponse { txid: Some(txid), fee_reason: None })
6898            }
6899
6900            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6901            where
6902                M: de::MapAccess<'de>,
6903            {
6904                let mut txid = None;
6905                let mut fee_reason = None;
6906                while let Some(key) = map.next_key::<String>()? {
6907                    if key == "txid" {
6908                        if txid.is_some() {
6909                            return Err(de::Error::duplicate_field("txid"));
6910                        }
6911                        txid = Some(map.next_value::<bitcoin::Txid>()?);
6912                    }
6913                    if key == "fee_reason" {
6914                        if fee_reason.is_some() {
6915                            return Err(de::Error::duplicate_field("fee_reason"));
6916                        }
6917                        fee_reason = Some(map.next_value::<String>()?);
6918                    } else {
6919                        let _ = map.next_value::<de::IgnoredAny>()?;
6920                    }
6921                }
6922                Ok(SendToAddressResponse { txid, fee_reason })
6923            }
6924        }
6925
6926        deserializer.deserialize_any(ConditionalResponseVisitor)
6927    }
6928}
6929
6930/// Response for the `SetBan` RPC method
6931///
6932/// This method returns a primitive value wrapped in a transparent struct.
6933#[derive(Debug, Clone, PartialEq, Serialize)]
6934pub struct SetBanResponse {
6935    /// Wrapped primitive value
6936    pub value: (),
6937}
6938
6939impl<'de> serde::Deserialize<'de> for SetBanResponse {
6940    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6941    where
6942        D: serde::Deserializer<'de>,
6943    {
6944        use std::fmt;
6945
6946        use serde::de::{self, Visitor};
6947
6948        struct PrimitiveWrapperVisitor;
6949
6950        #[allow(unused_variables, clippy::needless_lifetimes)]
6951        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
6952            type Value = SetBanResponse;
6953
6954            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6955                formatter.write_str("a primitive value or an object with 'value' field")
6956            }
6957
6958            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
6959            where
6960                E: de::Error,
6961            {
6962                Ok(SetBanResponse { value: () })
6963            }
6964
6965            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
6966            where
6967                E: de::Error,
6968            {
6969                Ok(SetBanResponse { value: () })
6970            }
6971
6972            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
6973            where
6974                E: de::Error,
6975            {
6976                Ok(SetBanResponse { value: () })
6977            }
6978
6979            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6980            where
6981                E: de::Error,
6982            {
6983                Ok(SetBanResponse { value: () })
6984            }
6985
6986            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
6987            where
6988                E: de::Error,
6989            {
6990                Ok(SetBanResponse { value: () })
6991            }
6992
6993            fn visit_none<E>(self) -> Result<Self::Value, E>
6994            where
6995                E: de::Error,
6996            {
6997                Ok(SetBanResponse { value: () })
6998            }
6999
7000            fn visit_unit<E>(self) -> Result<Self::Value, E>
7001            where
7002                E: de::Error,
7003            {
7004                Ok(SetBanResponse { value: () })
7005            }
7006
7007            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7008            where
7009                M: de::MapAccess<'de>,
7010            {
7011                let mut value = None;
7012                while let Some(key) = map.next_key::<String>()? {
7013                    if key == "value" {
7014                        if value.is_some() {
7015                            return Err(de::Error::duplicate_field("value"));
7016                        }
7017                        value = Some(map.next_value::<()>()?);
7018                    } else {
7019                        let _ = map.next_value::<de::IgnoredAny>()?;
7020                    }
7021                }
7022                value.ok_or_else(|| de::Error::missing_field("value"))?;
7023                Ok(SetBanResponse { value: () })
7024            }
7025        }
7026
7027        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7028    }
7029}
7030
7031impl std::ops::Deref for SetBanResponse {
7032    type Target = ();
7033    fn deref(&self) -> &Self::Target { &self.value }
7034}
7035
7036impl std::ops::DerefMut for SetBanResponse {
7037    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7038}
7039
7040impl AsRef<()> for SetBanResponse {
7041    fn as_ref(&self) -> &() { &self.value }
7042}
7043
7044impl From<()> for SetBanResponse {
7045    fn from(value: ()) -> Self { Self { value } }
7046}
7047
7048impl From<SetBanResponse> for () {
7049    fn from(wrapper: SetBanResponse) -> Self { wrapper.value }
7050}
7051
7052/// Response for the `SetLabel` RPC method
7053///
7054/// This method returns a primitive value wrapped in a transparent struct.
7055#[derive(Debug, Clone, PartialEq, Serialize)]
7056pub struct SetLabelResponse {
7057    /// Wrapped primitive value
7058    pub value: (),
7059}
7060
7061impl<'de> serde::Deserialize<'de> for SetLabelResponse {
7062    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7063    where
7064        D: serde::Deserializer<'de>,
7065    {
7066        use std::fmt;
7067
7068        use serde::de::{self, Visitor};
7069
7070        struct PrimitiveWrapperVisitor;
7071
7072        #[allow(unused_variables, clippy::needless_lifetimes)]
7073        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7074            type Value = SetLabelResponse;
7075
7076            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7077                formatter.write_str("a primitive value or an object with 'value' field")
7078            }
7079
7080            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7081            where
7082                E: de::Error,
7083            {
7084                Ok(SetLabelResponse { value: () })
7085            }
7086
7087            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7088            where
7089                E: de::Error,
7090            {
7091                Ok(SetLabelResponse { value: () })
7092            }
7093
7094            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7095            where
7096                E: de::Error,
7097            {
7098                Ok(SetLabelResponse { value: () })
7099            }
7100
7101            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7102            where
7103                E: de::Error,
7104            {
7105                Ok(SetLabelResponse { value: () })
7106            }
7107
7108            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7109            where
7110                E: de::Error,
7111            {
7112                Ok(SetLabelResponse { value: () })
7113            }
7114
7115            fn visit_none<E>(self) -> Result<Self::Value, E>
7116            where
7117                E: de::Error,
7118            {
7119                Ok(SetLabelResponse { value: () })
7120            }
7121
7122            fn visit_unit<E>(self) -> Result<Self::Value, E>
7123            where
7124                E: de::Error,
7125            {
7126                Ok(SetLabelResponse { value: () })
7127            }
7128
7129            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7130            where
7131                M: de::MapAccess<'de>,
7132            {
7133                let mut value = None;
7134                while let Some(key) = map.next_key::<String>()? {
7135                    if key == "value" {
7136                        if value.is_some() {
7137                            return Err(de::Error::duplicate_field("value"));
7138                        }
7139                        value = Some(map.next_value::<()>()?);
7140                    } else {
7141                        let _ = map.next_value::<de::IgnoredAny>()?;
7142                    }
7143                }
7144                value.ok_or_else(|| de::Error::missing_field("value"))?;
7145                Ok(SetLabelResponse { value: () })
7146            }
7147        }
7148
7149        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7150    }
7151}
7152
7153impl std::ops::Deref for SetLabelResponse {
7154    type Target = ();
7155    fn deref(&self) -> &Self::Target { &self.value }
7156}
7157
7158impl std::ops::DerefMut for SetLabelResponse {
7159    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7160}
7161
7162impl AsRef<()> for SetLabelResponse {
7163    fn as_ref(&self) -> &() { &self.value }
7164}
7165
7166impl From<()> for SetLabelResponse {
7167    fn from(value: ()) -> Self { Self { value } }
7168}
7169
7170impl From<SetLabelResponse> for () {
7171    fn from(wrapper: SetLabelResponse) -> Self { wrapper.value }
7172}
7173
7174/// Response for the `SetMockTime` RPC method
7175///
7176/// This method returns a primitive value wrapped in a transparent struct.
7177#[derive(Debug, Clone, PartialEq, Serialize)]
7178pub struct SetMockTimeResponse {
7179    /// Wrapped primitive value
7180    pub value: (),
7181}
7182
7183impl<'de> serde::Deserialize<'de> for SetMockTimeResponse {
7184    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7185    where
7186        D: serde::Deserializer<'de>,
7187    {
7188        use std::fmt;
7189
7190        use serde::de::{self, Visitor};
7191
7192        struct PrimitiveWrapperVisitor;
7193
7194        #[allow(unused_variables, clippy::needless_lifetimes)]
7195        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7196            type Value = SetMockTimeResponse;
7197
7198            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7199                formatter.write_str("a primitive value or an object with 'value' field")
7200            }
7201
7202            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7203            where
7204                E: de::Error,
7205            {
7206                Ok(SetMockTimeResponse { value: () })
7207            }
7208
7209            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7210            where
7211                E: de::Error,
7212            {
7213                Ok(SetMockTimeResponse { value: () })
7214            }
7215
7216            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7217            where
7218                E: de::Error,
7219            {
7220                Ok(SetMockTimeResponse { value: () })
7221            }
7222
7223            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7224            where
7225                E: de::Error,
7226            {
7227                Ok(SetMockTimeResponse { value: () })
7228            }
7229
7230            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7231            where
7232                E: de::Error,
7233            {
7234                Ok(SetMockTimeResponse { value: () })
7235            }
7236
7237            fn visit_none<E>(self) -> Result<Self::Value, E>
7238            where
7239                E: de::Error,
7240            {
7241                Ok(SetMockTimeResponse { value: () })
7242            }
7243
7244            fn visit_unit<E>(self) -> Result<Self::Value, E>
7245            where
7246                E: de::Error,
7247            {
7248                Ok(SetMockTimeResponse { value: () })
7249            }
7250
7251            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7252            where
7253                M: de::MapAccess<'de>,
7254            {
7255                let mut value = None;
7256                while let Some(key) = map.next_key::<String>()? {
7257                    if key == "value" {
7258                        if value.is_some() {
7259                            return Err(de::Error::duplicate_field("value"));
7260                        }
7261                        value = Some(map.next_value::<()>()?);
7262                    } else {
7263                        let _ = map.next_value::<de::IgnoredAny>()?;
7264                    }
7265                }
7266                value.ok_or_else(|| de::Error::missing_field("value"))?;
7267                Ok(SetMockTimeResponse { value: () })
7268            }
7269        }
7270
7271        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7272    }
7273}
7274
7275impl std::ops::Deref for SetMockTimeResponse {
7276    type Target = ();
7277    fn deref(&self) -> &Self::Target { &self.value }
7278}
7279
7280impl std::ops::DerefMut for SetMockTimeResponse {
7281    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7282}
7283
7284impl AsRef<()> for SetMockTimeResponse {
7285    fn as_ref(&self) -> &() { &self.value }
7286}
7287
7288impl From<()> for SetMockTimeResponse {
7289    fn from(value: ()) -> Self { Self { value } }
7290}
7291
7292impl From<SetMockTimeResponse> for () {
7293    fn from(wrapper: SetMockTimeResponse) -> Self { wrapper.value }
7294}
7295
7296/// Response for the `SetNetworkActive` RPC method
7297///
7298/// This method returns a primitive value wrapped in a transparent struct.
7299#[derive(Debug, Clone, PartialEq, Serialize)]
7300pub struct SetNetworkActiveResponse {
7301    /// Wrapped primitive value
7302    pub value: bool,
7303}
7304
7305impl<'de> serde::Deserialize<'de> for SetNetworkActiveResponse {
7306    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7307    where
7308        D: serde::Deserializer<'de>,
7309    {
7310        use std::fmt;
7311
7312        use serde::de::{self, Visitor};
7313
7314        struct PrimitiveWrapperVisitor;
7315
7316        #[allow(unused_variables, clippy::needless_lifetimes)]
7317        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7318            type Value = SetNetworkActiveResponse;
7319
7320            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7321                formatter.write_str("a primitive value or an object with 'value' field")
7322            }
7323
7324            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7325            where
7326                E: de::Error,
7327            {
7328                Ok(SetNetworkActiveResponse { value: v != 0 })
7329            }
7330
7331            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7332            where
7333                E: de::Error,
7334            {
7335                Ok(SetNetworkActiveResponse { value: v != 0 })
7336            }
7337
7338            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7339            where
7340                E: de::Error,
7341            {
7342                Ok(SetNetworkActiveResponse { value: v != 0.0 })
7343            }
7344
7345            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7346            where
7347                E: de::Error,
7348            {
7349                let value = v.parse::<bool>().map_err(de::Error::custom)?;
7350                Ok(SetNetworkActiveResponse { value })
7351            }
7352
7353            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7354            where
7355                E: de::Error,
7356            {
7357                Ok(SetNetworkActiveResponse { value: v })
7358            }
7359
7360            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7361            where
7362                M: de::MapAccess<'de>,
7363            {
7364                let mut value = None;
7365                while let Some(key) = map.next_key::<String>()? {
7366                    if key == "value" {
7367                        if value.is_some() {
7368                            return Err(de::Error::duplicate_field("value"));
7369                        }
7370                        value = Some(map.next_value()?);
7371                    } else {
7372                        let _ = map.next_value::<de::IgnoredAny>()?;
7373                    }
7374                }
7375                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
7376                Ok(SetNetworkActiveResponse { value })
7377            }
7378        }
7379
7380        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7381    }
7382}
7383
7384impl std::ops::Deref for SetNetworkActiveResponse {
7385    type Target = bool;
7386    fn deref(&self) -> &Self::Target { &self.value }
7387}
7388
7389impl std::ops::DerefMut for SetNetworkActiveResponse {
7390    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7391}
7392
7393impl AsRef<bool> for SetNetworkActiveResponse {
7394    fn as_ref(&self) -> &bool { &self.value }
7395}
7396
7397impl From<bool> for SetNetworkActiveResponse {
7398    fn from(value: bool) -> Self { Self { value } }
7399}
7400
7401impl From<SetNetworkActiveResponse> for bool {
7402    fn from(wrapper: SetNetworkActiveResponse) -> Self { wrapper.value }
7403}
7404
7405/// Response for the `SetWalletFlag` RPC method
7406///
7407#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
7408#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
7409pub struct SetWalletFlagResponse {
7410    /// The name of the flag that was modified
7411    pub flag_name: String,
7412    /// The new state of the flag
7413    pub flag_state: bool,
7414    /// Any warnings associated with the change
7415    pub warnings: Option<String>,
7416}
7417
7418/// Response for the `SignMessage` RPC method
7419///
7420/// This method returns a primitive value wrapped in a transparent struct.
7421#[derive(Debug, Clone, PartialEq, Serialize)]
7422pub struct SignMessageResponse {
7423    /// Wrapped primitive value
7424    pub value: String,
7425}
7426
7427impl<'de> serde::Deserialize<'de> for SignMessageResponse {
7428    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7429    where
7430        D: serde::Deserializer<'de>,
7431    {
7432        use std::fmt;
7433
7434        use serde::de::{self, Visitor};
7435
7436        struct PrimitiveWrapperVisitor;
7437
7438        #[allow(unused_variables, clippy::needless_lifetimes)]
7439        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7440            type Value = SignMessageResponse;
7441
7442            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7443                formatter.write_str("a primitive value or an object with 'value' field")
7444            }
7445
7446            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7447            where
7448                E: de::Error,
7449            {
7450                Ok(SignMessageResponse { value: v.to_string() })
7451            }
7452
7453            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7454            where
7455                E: de::Error,
7456            {
7457                Ok(SignMessageResponse { value: v.to_string() })
7458            }
7459
7460            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7461            where
7462                E: de::Error,
7463            {
7464                Ok(SignMessageResponse { value: v.to_string() })
7465            }
7466
7467            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7468            where
7469                E: de::Error,
7470            {
7471                Ok(SignMessageResponse { value: v.to_string() })
7472            }
7473
7474            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7475            where
7476                E: de::Error,
7477            {
7478                Ok(SignMessageResponse { value: v.to_string() })
7479            }
7480
7481            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7482            where
7483                M: de::MapAccess<'de>,
7484            {
7485                let mut value = None;
7486                while let Some(key) = map.next_key::<String>()? {
7487                    if key == "value" {
7488                        if value.is_some() {
7489                            return Err(de::Error::duplicate_field("value"));
7490                        }
7491                        value = Some(map.next_value()?);
7492                    } else {
7493                        let _ = map.next_value::<de::IgnoredAny>()?;
7494                    }
7495                }
7496                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
7497                Ok(SignMessageResponse { value })
7498            }
7499        }
7500
7501        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7502    }
7503}
7504
7505impl std::ops::Deref for SignMessageResponse {
7506    type Target = String;
7507    fn deref(&self) -> &Self::Target { &self.value }
7508}
7509
7510impl std::ops::DerefMut for SignMessageResponse {
7511    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7512}
7513
7514impl AsRef<String> for SignMessageResponse {
7515    fn as_ref(&self) -> &String { &self.value }
7516}
7517
7518impl From<String> for SignMessageResponse {
7519    fn from(value: String) -> Self { Self { value } }
7520}
7521
7522impl From<SignMessageResponse> for String {
7523    fn from(wrapper: SignMessageResponse) -> Self { wrapper.value }
7524}
7525
7526/// Response for the `SignMessageWithPrivKey` RPC method
7527///
7528/// This method returns a primitive value wrapped in a transparent struct.
7529#[derive(Debug, Clone, PartialEq, Serialize)]
7530pub struct SignMessageWithPrivKeyResponse {
7531    /// Wrapped primitive value
7532    pub value: String,
7533}
7534
7535impl<'de> serde::Deserialize<'de> for SignMessageWithPrivKeyResponse {
7536    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7537    where
7538        D: serde::Deserializer<'de>,
7539    {
7540        use std::fmt;
7541
7542        use serde::de::{self, Visitor};
7543
7544        struct PrimitiveWrapperVisitor;
7545
7546        #[allow(unused_variables, clippy::needless_lifetimes)]
7547        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7548            type Value = SignMessageWithPrivKeyResponse;
7549
7550            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7551                formatter.write_str("a primitive value or an object with 'value' field")
7552            }
7553
7554            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7555            where
7556                E: de::Error,
7557            {
7558                Ok(SignMessageWithPrivKeyResponse { value: v.to_string() })
7559            }
7560
7561            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7562            where
7563                E: de::Error,
7564            {
7565                Ok(SignMessageWithPrivKeyResponse { value: v.to_string() })
7566            }
7567
7568            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7569            where
7570                E: de::Error,
7571            {
7572                Ok(SignMessageWithPrivKeyResponse { value: v.to_string() })
7573            }
7574
7575            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7576            where
7577                E: de::Error,
7578            {
7579                Ok(SignMessageWithPrivKeyResponse { value: v.to_string() })
7580            }
7581
7582            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7583            where
7584                E: de::Error,
7585            {
7586                Ok(SignMessageWithPrivKeyResponse { value: v.to_string() })
7587            }
7588
7589            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7590            where
7591                M: de::MapAccess<'de>,
7592            {
7593                let mut value = None;
7594                while let Some(key) = map.next_key::<String>()? {
7595                    if key == "value" {
7596                        if value.is_some() {
7597                            return Err(de::Error::duplicate_field("value"));
7598                        }
7599                        value = Some(map.next_value()?);
7600                    } else {
7601                        let _ = map.next_value::<de::IgnoredAny>()?;
7602                    }
7603                }
7604                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
7605                Ok(SignMessageWithPrivKeyResponse { value })
7606            }
7607        }
7608
7609        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7610    }
7611}
7612
7613impl std::ops::Deref for SignMessageWithPrivKeyResponse {
7614    type Target = String;
7615    fn deref(&self) -> &Self::Target { &self.value }
7616}
7617
7618impl std::ops::DerefMut for SignMessageWithPrivKeyResponse {
7619    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7620}
7621
7622impl AsRef<String> for SignMessageWithPrivKeyResponse {
7623    fn as_ref(&self) -> &String { &self.value }
7624}
7625
7626impl From<String> for SignMessageWithPrivKeyResponse {
7627    fn from(value: String) -> Self { Self { value } }
7628}
7629
7630impl From<SignMessageWithPrivKeyResponse> for String {
7631    fn from(wrapper: SignMessageWithPrivKeyResponse) -> Self { wrapper.value }
7632}
7633
7634/// Response for the `SignRawTransactionWithKey` RPC method
7635///
7636#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
7637#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
7638pub struct SignRawTransactionWithKeyResponse {
7639    /// The hex-encoded raw transaction with signature(s)
7640    pub hex: String,
7641    /// If the transaction has a complete set of signatures
7642    pub complete: bool,
7643    /// Script verification errors (if there are any)
7644    pub errors: Option<serde_json::Value>,
7645}
7646
7647/// Response for the `SignRawTransactionWithWallet` RPC method
7648///
7649#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
7650#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
7651pub struct SignRawTransactionWithWalletResponse {
7652    /// The hex-encoded raw transaction with signature(s)
7653    pub hex: String,
7654    /// If the transaction has a complete set of signatures
7655    pub complete: bool,
7656    /// Script verification errors (if there are any)
7657    pub errors: Option<serde_json::Value>,
7658}
7659
7660/// Response for the `SimulateRawTransaction` RPC method
7661///
7662#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
7663#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
7664pub struct SimulateRawTransactionResponse {
7665    /// The wallet balance change (negative means decrease).
7666    #[serde(deserialize_with = "amount_from_btc_float")]
7667    pub balance_change: bitcoin::Amount,
7668}
7669
7670/// Response for the `Stop` RPC method
7671///
7672/// This method returns a primitive value wrapped in a transparent struct.
7673#[derive(Debug, Clone, PartialEq, Serialize)]
7674pub struct StopResponse {
7675    /// Wrapped primitive value
7676    pub value: String,
7677}
7678
7679impl<'de> serde::Deserialize<'de> for StopResponse {
7680    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7681    where
7682        D: serde::Deserializer<'de>,
7683    {
7684        use std::fmt;
7685
7686        use serde::de::{self, Visitor};
7687
7688        struct PrimitiveWrapperVisitor;
7689
7690        #[allow(unused_variables, clippy::needless_lifetimes)]
7691        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7692            type Value = StopResponse;
7693
7694            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7695                formatter.write_str("a primitive value or an object with 'value' field")
7696            }
7697
7698            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7699            where
7700                E: de::Error,
7701            {
7702                Ok(StopResponse { value: v.to_string() })
7703            }
7704
7705            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7706            where
7707                E: de::Error,
7708            {
7709                Ok(StopResponse { value: v.to_string() })
7710            }
7711
7712            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7713            where
7714                E: de::Error,
7715            {
7716                Ok(StopResponse { value: v.to_string() })
7717            }
7718
7719            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7720            where
7721                E: de::Error,
7722            {
7723                Ok(StopResponse { value: v.to_string() })
7724            }
7725
7726            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7727            where
7728                E: de::Error,
7729            {
7730                Ok(StopResponse { value: v.to_string() })
7731            }
7732
7733            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7734            where
7735                M: de::MapAccess<'de>,
7736            {
7737                let mut value = None;
7738                while let Some(key) = map.next_key::<String>()? {
7739                    if key == "value" {
7740                        if value.is_some() {
7741                            return Err(de::Error::duplicate_field("value"));
7742                        }
7743                        value = Some(map.next_value()?);
7744                    } else {
7745                        let _ = map.next_value::<de::IgnoredAny>()?;
7746                    }
7747                }
7748                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
7749                Ok(StopResponse { value })
7750            }
7751        }
7752
7753        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7754    }
7755}
7756
7757impl std::ops::Deref for StopResponse {
7758    type Target = String;
7759    fn deref(&self) -> &Self::Target { &self.value }
7760}
7761
7762impl std::ops::DerefMut for StopResponse {
7763    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7764}
7765
7766impl AsRef<String> for StopResponse {
7767    fn as_ref(&self) -> &String { &self.value }
7768}
7769
7770impl From<String> for StopResponse {
7771    fn from(value: String) -> Self { Self { value } }
7772}
7773
7774impl From<StopResponse> for String {
7775    fn from(wrapper: StopResponse) -> Self { wrapper.value }
7776}
7777
7778/// Response for the `SubmitBlock` RPC method
7779///
7780#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
7781#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
7782pub struct SubmitBlockResponse {
7783    pub field_0: (),
7784    /// According to BIP22
7785    pub field_1: String,
7786}
7787
7788/// Response for the `SubmitHeader` RPC method
7789///
7790/// This method returns a primitive value wrapped in a transparent struct.
7791#[derive(Debug, Clone, PartialEq, Serialize)]
7792pub struct SubmitHeaderResponse {
7793    /// Wrapped primitive value
7794    pub value: (),
7795}
7796
7797impl<'de> serde::Deserialize<'de> for SubmitHeaderResponse {
7798    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7799    where
7800        D: serde::Deserializer<'de>,
7801    {
7802        use std::fmt;
7803
7804        use serde::de::{self, Visitor};
7805
7806        struct PrimitiveWrapperVisitor;
7807
7808        #[allow(unused_variables, clippy::needless_lifetimes)]
7809        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7810            type Value = SubmitHeaderResponse;
7811
7812            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7813                formatter.write_str("a primitive value or an object with 'value' field")
7814            }
7815
7816            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7817            where
7818                E: de::Error,
7819            {
7820                Ok(SubmitHeaderResponse { value: () })
7821            }
7822
7823            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7824            where
7825                E: de::Error,
7826            {
7827                Ok(SubmitHeaderResponse { value: () })
7828            }
7829
7830            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7831            where
7832                E: de::Error,
7833            {
7834                Ok(SubmitHeaderResponse { value: () })
7835            }
7836
7837            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7838            where
7839                E: de::Error,
7840            {
7841                Ok(SubmitHeaderResponse { value: () })
7842            }
7843
7844            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7845            where
7846                E: de::Error,
7847            {
7848                Ok(SubmitHeaderResponse { value: () })
7849            }
7850
7851            fn visit_none<E>(self) -> Result<Self::Value, E>
7852            where
7853                E: de::Error,
7854            {
7855                Ok(SubmitHeaderResponse { value: () })
7856            }
7857
7858            fn visit_unit<E>(self) -> Result<Self::Value, E>
7859            where
7860                E: de::Error,
7861            {
7862                Ok(SubmitHeaderResponse { value: () })
7863            }
7864
7865            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7866            where
7867                M: de::MapAccess<'de>,
7868            {
7869                let mut value = None;
7870                while let Some(key) = map.next_key::<String>()? {
7871                    if key == "value" {
7872                        if value.is_some() {
7873                            return Err(de::Error::duplicate_field("value"));
7874                        }
7875                        value = Some(map.next_value::<()>()?);
7876                    } else {
7877                        let _ = map.next_value::<de::IgnoredAny>()?;
7878                    }
7879                }
7880                value.ok_or_else(|| de::Error::missing_field("value"))?;
7881                Ok(SubmitHeaderResponse { value: () })
7882            }
7883        }
7884
7885        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7886    }
7887}
7888
7889impl std::ops::Deref for SubmitHeaderResponse {
7890    type Target = ();
7891    fn deref(&self) -> &Self::Target { &self.value }
7892}
7893
7894impl std::ops::DerefMut for SubmitHeaderResponse {
7895    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7896}
7897
7898impl AsRef<()> for SubmitHeaderResponse {
7899    fn as_ref(&self) -> &() { &self.value }
7900}
7901
7902impl From<()> for SubmitHeaderResponse {
7903    fn from(value: ()) -> Self { Self { value } }
7904}
7905
7906impl From<SubmitHeaderResponse> for () {
7907    fn from(wrapper: SubmitHeaderResponse) -> Self { wrapper.value }
7908}
7909
7910/// Response for the `SubmitPackage` RPC method
7911///
7912#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
7913#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
7914pub struct SubmitPackageResponse {
7915    /// The transaction package result message. "success" indicates all transactions were accepted into or are already in the mempool.
7916    pub package_msg: String,
7917    /// The transaction results keyed by wtxid. An entry is returned for every submitted wtxid.
7918    #[serde(rename = "tx-results")]
7919    pub tx_results: serde_json::Value,
7920    /// List of txids of replaced transactions
7921    #[serde(rename = "replaced-transactions")]
7922    pub replaced_transactions: Option<Vec<String>>,
7923}
7924
7925/// Response for the `SyncWithValidationInterfaceQueue` RPC method
7926///
7927/// This method returns a primitive value wrapped in a transparent struct.
7928#[derive(Debug, Clone, PartialEq, Serialize)]
7929pub struct SyncWithValidationInterfaceQueueResponse {
7930    /// Wrapped primitive value
7931    pub value: (),
7932}
7933
7934impl<'de> serde::Deserialize<'de> for SyncWithValidationInterfaceQueueResponse {
7935    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7936    where
7937        D: serde::Deserializer<'de>,
7938    {
7939        use std::fmt;
7940
7941        use serde::de::{self, Visitor};
7942
7943        struct PrimitiveWrapperVisitor;
7944
7945        #[allow(unused_variables, clippy::needless_lifetimes)]
7946        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7947            type Value = SyncWithValidationInterfaceQueueResponse;
7948
7949            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7950                formatter.write_str("a primitive value or an object with 'value' field")
7951            }
7952
7953            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7954            where
7955                E: de::Error,
7956            {
7957                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
7958            }
7959
7960            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7961            where
7962                E: de::Error,
7963            {
7964                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
7965            }
7966
7967            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7968            where
7969                E: de::Error,
7970            {
7971                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
7972            }
7973
7974            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7975            where
7976                E: de::Error,
7977            {
7978                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
7979            }
7980
7981            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7982            where
7983                E: de::Error,
7984            {
7985                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
7986            }
7987
7988            fn visit_none<E>(self) -> Result<Self::Value, E>
7989            where
7990                E: de::Error,
7991            {
7992                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
7993            }
7994
7995            fn visit_unit<E>(self) -> Result<Self::Value, E>
7996            where
7997                E: de::Error,
7998            {
7999                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
8000            }
8001
8002            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8003            where
8004                M: de::MapAccess<'de>,
8005            {
8006                let mut value = None;
8007                while let Some(key) = map.next_key::<String>()? {
8008                    if key == "value" {
8009                        if value.is_some() {
8010                            return Err(de::Error::duplicate_field("value"));
8011                        }
8012                        value = Some(map.next_value::<()>()?);
8013                    } else {
8014                        let _ = map.next_value::<de::IgnoredAny>()?;
8015                    }
8016                }
8017                value.ok_or_else(|| de::Error::missing_field("value"))?;
8018                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
8019            }
8020        }
8021
8022        deserializer.deserialize_any(PrimitiveWrapperVisitor)
8023    }
8024}
8025
8026impl std::ops::Deref for SyncWithValidationInterfaceQueueResponse {
8027    type Target = ();
8028    fn deref(&self) -> &Self::Target { &self.value }
8029}
8030
8031impl std::ops::DerefMut for SyncWithValidationInterfaceQueueResponse {
8032    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
8033}
8034
8035impl AsRef<()> for SyncWithValidationInterfaceQueueResponse {
8036    fn as_ref(&self) -> &() { &self.value }
8037}
8038
8039impl From<()> for SyncWithValidationInterfaceQueueResponse {
8040    fn from(value: ()) -> Self { Self { value } }
8041}
8042
8043impl From<SyncWithValidationInterfaceQueueResponse> for () {
8044    fn from(wrapper: SyncWithValidationInterfaceQueueResponse) -> Self { wrapper.value }
8045}
8046
8047/// Response for the `TestMempoolAccept` RPC method
8048///
8049/// The result of the mempool acceptance test for each raw transaction in the input array.
8050/// Returns results for each transaction in the same order they were passed in.
8051/// Transactions that cannot be fully validated due to failures in other transactions will not contain an 'allowed' result.
8052#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
8053#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8054pub struct TestMempoolAcceptResponse {
8055    pub field: serde_json::Value,
8056}
8057
8058/// Response for the `UnloadWallet` RPC method
8059///
8060#[derive(Debug, Clone, PartialEq, Serialize)]
8061pub struct UnloadWalletResponse {
8062    /// Warning messages, if any, related to unloading the wallet.
8063    pub warnings: Option<Vec<String>>,
8064}
8065impl<'de> serde::Deserialize<'de> for UnloadWalletResponse {
8066    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8067    where
8068        D: serde::Deserializer<'de>,
8069    {
8070        use std::fmt;
8071
8072        use serde::de::{self, Visitor};
8073
8074        struct ConditionalResponseVisitor;
8075
8076        #[allow(clippy::needless_lifetimes)]
8077        impl<'de> Visitor<'de> for ConditionalResponseVisitor {
8078            type Value = UnloadWalletResponse;
8079
8080            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8081                formatter.write_str("string or object")
8082            }
8083
8084            fn visit_str<E>(self, _v: &str) -> Result<Self::Value, E>
8085            where
8086                E: de::Error,
8087            {
8088                Ok(UnloadWalletResponse { warnings: None })
8089            }
8090
8091            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8092            where
8093                M: de::MapAccess<'de>,
8094            {
8095                let mut warnings = None;
8096                while let Some(key) = map.next_key::<String>()? {
8097                    if key == "warnings" {
8098                        if warnings.is_some() {
8099                            return Err(de::Error::duplicate_field("warnings"));
8100                        }
8101                        warnings = Some(map.next_value::<Vec<String>>()?);
8102                    } else {
8103                        let _ = map.next_value::<de::IgnoredAny>()?;
8104                    }
8105                }
8106                Ok(UnloadWalletResponse { warnings })
8107            }
8108        }
8109
8110        deserializer.deserialize_any(ConditionalResponseVisitor)
8111    }
8112}
8113
8114/// Response for the `Uptime` RPC method
8115///
8116/// This method returns a primitive value wrapped in a transparent struct.
8117#[derive(Debug, Clone, PartialEq, Serialize)]
8118pub struct UptimeResponse {
8119    /// Wrapped primitive value
8120    pub value: u64,
8121}
8122
8123impl<'de> serde::Deserialize<'de> for UptimeResponse {
8124    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8125    where
8126        D: serde::Deserializer<'de>,
8127    {
8128        use std::fmt;
8129
8130        use serde::de::{self, Visitor};
8131
8132        struct PrimitiveWrapperVisitor;
8133
8134        #[allow(unused_variables, clippy::needless_lifetimes)]
8135        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
8136            type Value = UptimeResponse;
8137
8138            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8139                formatter.write_str("a primitive value or an object with 'value' field")
8140            }
8141
8142            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
8143            where
8144                E: de::Error,
8145            {
8146                Ok(UptimeResponse { value: v })
8147            }
8148
8149            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
8150            where
8151                E: de::Error,
8152            {
8153                Ok(UptimeResponse { value: v as u64 })
8154            }
8155
8156            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
8157            where
8158                E: de::Error,
8159            {
8160                Ok(UptimeResponse { value: v as u64 })
8161            }
8162
8163            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
8164            where
8165                E: de::Error,
8166            {
8167                let value = v.parse::<u64>().map_err(de::Error::custom)?;
8168                Ok(UptimeResponse { value })
8169            }
8170
8171            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
8172            where
8173                E: de::Error,
8174            {
8175                Ok(UptimeResponse { value: v as u64 })
8176            }
8177
8178            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8179            where
8180                M: de::MapAccess<'de>,
8181            {
8182                let mut value = None;
8183                while let Some(key) = map.next_key::<String>()? {
8184                    if key == "value" {
8185                        if value.is_some() {
8186                            return Err(de::Error::duplicate_field("value"));
8187                        }
8188                        value = Some(map.next_value()?);
8189                    } else {
8190                        let _ = map.next_value::<de::IgnoredAny>()?;
8191                    }
8192                }
8193                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
8194                Ok(UptimeResponse { value })
8195            }
8196        }
8197
8198        deserializer.deserialize_any(PrimitiveWrapperVisitor)
8199    }
8200}
8201
8202impl std::ops::Deref for UptimeResponse {
8203    type Target = u64;
8204    fn deref(&self) -> &Self::Target { &self.value }
8205}
8206
8207impl std::ops::DerefMut for UptimeResponse {
8208    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
8209}
8210
8211impl AsRef<u64> for UptimeResponse {
8212    fn as_ref(&self) -> &u64 { &self.value }
8213}
8214
8215impl From<u64> for UptimeResponse {
8216    fn from(value: u64) -> Self { Self { value } }
8217}
8218
8219impl From<UptimeResponse> for u64 {
8220    fn from(wrapper: UptimeResponse) -> Self { wrapper.value }
8221}
8222
8223/// Response for the `UtxoUpdatePsbt` RPC method
8224///
8225/// This method returns a primitive value wrapped in a transparent struct.
8226#[derive(Debug, Clone, PartialEq, Serialize)]
8227pub struct UtxoUpdatePsbtResponse {
8228    /// Wrapped primitive value
8229    pub value: String,
8230}
8231
8232impl<'de> serde::Deserialize<'de> for UtxoUpdatePsbtResponse {
8233    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8234    where
8235        D: serde::Deserializer<'de>,
8236    {
8237        use std::fmt;
8238
8239        use serde::de::{self, Visitor};
8240
8241        struct PrimitiveWrapperVisitor;
8242
8243        #[allow(unused_variables, clippy::needless_lifetimes)]
8244        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
8245            type Value = UtxoUpdatePsbtResponse;
8246
8247            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8248                formatter.write_str("a primitive value or an object with 'value' field")
8249            }
8250
8251            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
8252            where
8253                E: de::Error,
8254            {
8255                Ok(UtxoUpdatePsbtResponse { value: v.to_string() })
8256            }
8257
8258            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
8259            where
8260                E: de::Error,
8261            {
8262                Ok(UtxoUpdatePsbtResponse { value: v.to_string() })
8263            }
8264
8265            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
8266            where
8267                E: de::Error,
8268            {
8269                Ok(UtxoUpdatePsbtResponse { value: v.to_string() })
8270            }
8271
8272            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
8273            where
8274                E: de::Error,
8275            {
8276                Ok(UtxoUpdatePsbtResponse { value: v.to_string() })
8277            }
8278
8279            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
8280            where
8281                E: de::Error,
8282            {
8283                Ok(UtxoUpdatePsbtResponse { value: v.to_string() })
8284            }
8285
8286            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8287            where
8288                M: de::MapAccess<'de>,
8289            {
8290                let mut value = None;
8291                while let Some(key) = map.next_key::<String>()? {
8292                    if key == "value" {
8293                        if value.is_some() {
8294                            return Err(de::Error::duplicate_field("value"));
8295                        }
8296                        value = Some(map.next_value()?);
8297                    } else {
8298                        let _ = map.next_value::<de::IgnoredAny>()?;
8299                    }
8300                }
8301                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
8302                Ok(UtxoUpdatePsbtResponse { value })
8303            }
8304        }
8305
8306        deserializer.deserialize_any(PrimitiveWrapperVisitor)
8307    }
8308}
8309
8310impl std::ops::Deref for UtxoUpdatePsbtResponse {
8311    type Target = String;
8312    fn deref(&self) -> &Self::Target { &self.value }
8313}
8314
8315impl std::ops::DerefMut for UtxoUpdatePsbtResponse {
8316    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
8317}
8318
8319impl AsRef<String> for UtxoUpdatePsbtResponse {
8320    fn as_ref(&self) -> &String { &self.value }
8321}
8322
8323impl From<String> for UtxoUpdatePsbtResponse {
8324    fn from(value: String) -> Self { Self { value } }
8325}
8326
8327impl From<UtxoUpdatePsbtResponse> for String {
8328    fn from(wrapper: UtxoUpdatePsbtResponse) -> Self { wrapper.value }
8329}
8330
8331/// Response for the `ValidateAddress` RPC method
8332///
8333#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
8334#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8335pub struct ValidateAddressResponse {
8336    /// If the address is valid or not
8337    pub isvalid: bool,
8338    /// The bitcoin address validated
8339    pub address: Option<String>,
8340    /// The hex-encoded output script generated by the address
8341    pub scriptPubKey: Option<bitcoin::ScriptBuf>,
8342    /// If the key is a script
8343    pub isscript: Option<bool>,
8344    /// If the address is a witness address
8345    #[serde(rename = "iswitness")]
8346    pub is_witness: Option<bool>,
8347    /// The version number of the witness program
8348    pub witness_version: Option<u64>,
8349    /// The hex value of the witness program
8350    pub witness_program: Option<String>,
8351    /// Error message, if any
8352    pub error: Option<String>,
8353    /// Indices of likely error locations in address, if known (e.g. Bech32 errors)
8354    pub error_locations: Option<Vec<String>>,
8355}
8356
8357/// Response for the `VerifyChain` RPC method
8358///
8359/// This method returns a primitive value wrapped in a transparent struct.
8360#[derive(Debug, Clone, PartialEq, Serialize)]
8361pub struct VerifyChainResponse {
8362    /// Wrapped primitive value
8363    pub value: bool,
8364}
8365
8366impl<'de> serde::Deserialize<'de> for VerifyChainResponse {
8367    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8368    where
8369        D: serde::Deserializer<'de>,
8370    {
8371        use std::fmt;
8372
8373        use serde::de::{self, Visitor};
8374
8375        struct PrimitiveWrapperVisitor;
8376
8377        #[allow(unused_variables, clippy::needless_lifetimes)]
8378        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
8379            type Value = VerifyChainResponse;
8380
8381            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8382                formatter.write_str("a primitive value or an object with 'value' field")
8383            }
8384
8385            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
8386            where
8387                E: de::Error,
8388            {
8389                Ok(VerifyChainResponse { value: v != 0 })
8390            }
8391
8392            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
8393            where
8394                E: de::Error,
8395            {
8396                Ok(VerifyChainResponse { value: v != 0 })
8397            }
8398
8399            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
8400            where
8401                E: de::Error,
8402            {
8403                Ok(VerifyChainResponse { value: v != 0.0 })
8404            }
8405
8406            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
8407            where
8408                E: de::Error,
8409            {
8410                let value = v.parse::<bool>().map_err(de::Error::custom)?;
8411                Ok(VerifyChainResponse { value })
8412            }
8413
8414            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
8415            where
8416                E: de::Error,
8417            {
8418                Ok(VerifyChainResponse { value: v })
8419            }
8420
8421            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8422            where
8423                M: de::MapAccess<'de>,
8424            {
8425                let mut value = None;
8426                while let Some(key) = map.next_key::<String>()? {
8427                    if key == "value" {
8428                        if value.is_some() {
8429                            return Err(de::Error::duplicate_field("value"));
8430                        }
8431                        value = Some(map.next_value()?);
8432                    } else {
8433                        let _ = map.next_value::<de::IgnoredAny>()?;
8434                    }
8435                }
8436                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
8437                Ok(VerifyChainResponse { value })
8438            }
8439        }
8440
8441        deserializer.deserialize_any(PrimitiveWrapperVisitor)
8442    }
8443}
8444
8445impl std::ops::Deref for VerifyChainResponse {
8446    type Target = bool;
8447    fn deref(&self) -> &Self::Target { &self.value }
8448}
8449
8450impl std::ops::DerefMut for VerifyChainResponse {
8451    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
8452}
8453
8454impl AsRef<bool> for VerifyChainResponse {
8455    fn as_ref(&self) -> &bool { &self.value }
8456}
8457
8458impl From<bool> for VerifyChainResponse {
8459    fn from(value: bool) -> Self { Self { value } }
8460}
8461
8462impl From<VerifyChainResponse> for bool {
8463    fn from(wrapper: VerifyChainResponse) -> Self { wrapper.value }
8464}
8465
8466/// Response for the `VerifyMessage` RPC method
8467///
8468/// This method returns a primitive value wrapped in a transparent struct.
8469#[derive(Debug, Clone, PartialEq, Serialize)]
8470pub struct VerifyMessageResponse {
8471    /// Wrapped primitive value
8472    pub value: bool,
8473}
8474
8475impl<'de> serde::Deserialize<'de> for VerifyMessageResponse {
8476    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8477    where
8478        D: serde::Deserializer<'de>,
8479    {
8480        use std::fmt;
8481
8482        use serde::de::{self, Visitor};
8483
8484        struct PrimitiveWrapperVisitor;
8485
8486        #[allow(unused_variables, clippy::needless_lifetimes)]
8487        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
8488            type Value = VerifyMessageResponse;
8489
8490            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8491                formatter.write_str("a primitive value or an object with 'value' field")
8492            }
8493
8494            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
8495            where
8496                E: de::Error,
8497            {
8498                Ok(VerifyMessageResponse { value: v != 0 })
8499            }
8500
8501            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
8502            where
8503                E: de::Error,
8504            {
8505                Ok(VerifyMessageResponse { value: v != 0 })
8506            }
8507
8508            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
8509            where
8510                E: de::Error,
8511            {
8512                Ok(VerifyMessageResponse { value: v != 0.0 })
8513            }
8514
8515            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
8516            where
8517                E: de::Error,
8518            {
8519                let value = v.parse::<bool>().map_err(de::Error::custom)?;
8520                Ok(VerifyMessageResponse { value })
8521            }
8522
8523            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
8524            where
8525                E: de::Error,
8526            {
8527                Ok(VerifyMessageResponse { value: v })
8528            }
8529
8530            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8531            where
8532                M: de::MapAccess<'de>,
8533            {
8534                let mut value = None;
8535                while let Some(key) = map.next_key::<String>()? {
8536                    if key == "value" {
8537                        if value.is_some() {
8538                            return Err(de::Error::duplicate_field("value"));
8539                        }
8540                        value = Some(map.next_value()?);
8541                    } else {
8542                        let _ = map.next_value::<de::IgnoredAny>()?;
8543                    }
8544                }
8545                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
8546                Ok(VerifyMessageResponse { value })
8547            }
8548        }
8549
8550        deserializer.deserialize_any(PrimitiveWrapperVisitor)
8551    }
8552}
8553
8554impl std::ops::Deref for VerifyMessageResponse {
8555    type Target = bool;
8556    fn deref(&self) -> &Self::Target { &self.value }
8557}
8558
8559impl std::ops::DerefMut for VerifyMessageResponse {
8560    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
8561}
8562
8563impl AsRef<bool> for VerifyMessageResponse {
8564    fn as_ref(&self) -> &bool { &self.value }
8565}
8566
8567impl From<bool> for VerifyMessageResponse {
8568    fn from(value: bool) -> Self { Self { value } }
8569}
8570
8571impl From<VerifyMessageResponse> for bool {
8572    fn from(wrapper: VerifyMessageResponse) -> Self { wrapper.value }
8573}
8574
8575/// Response for the `VerifyTxOutProof` RPC method
8576///
8577/// This method returns an array wrapped in a transparent struct.
8578#[derive(Debug, Clone, PartialEq, Serialize)]
8579pub struct VerifyTxOutProofResponse {
8580    /// Wrapped array value
8581    pub value: Vec<serde_json::Value>,
8582}
8583
8584impl<'de> serde::Deserialize<'de> for VerifyTxOutProofResponse {
8585    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8586    where
8587        D: serde::Deserializer<'de>,
8588    {
8589        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
8590        Ok(Self { value })
8591    }
8592}
8593
8594impl From<Vec<serde_json::Value>> for VerifyTxOutProofResponse {
8595    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
8596}
8597
8598impl From<VerifyTxOutProofResponse> for Vec<serde_json::Value> {
8599    fn from(wrapper: VerifyTxOutProofResponse) -> Self { wrapper.value }
8600}
8601
8602/// Response for the `WaitForBlock` RPC method
8603///
8604#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
8605#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8606pub struct WaitForBlockResponse {
8607    /// The blockhash
8608    pub hash: String,
8609    /// Block height
8610    pub height: u64,
8611}
8612
8613/// Response for the `WaitForBlockHeight` RPC method
8614///
8615#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
8616#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8617pub struct WaitForBlockHeightResponse {
8618    /// The blockhash
8619    pub hash: String,
8620    /// Block height
8621    pub height: u64,
8622}
8623
8624/// Response for the `WaitForNewBlock` RPC method
8625///
8626#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
8627#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8628pub struct WaitForNewBlockResponse {
8629    /// The blockhash
8630    pub hash: String,
8631    /// Block height
8632    pub height: u64,
8633}
8634
8635/// Response for the `WalletCreateFundedPsbt` RPC method
8636///
8637#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
8638#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8639pub struct WalletCreateFundedPsbtResponse {
8640    /// The resulting raw transaction (base64-encoded string)
8641    pub psbt: String,
8642    /// Fee in BTC the resulting transaction pays
8643    #[serde(deserialize_with = "amount_from_btc_float")]
8644    pub fee: bitcoin::Amount,
8645    /// The position of the added change output, or -1
8646    pub changepos: i64,
8647}
8648
8649/// Response for the `WalletDisplayAddress` RPC method
8650///
8651#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
8652#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8653pub struct WalletDisplayAddressResponse {
8654    /// The address as confirmed by the signer
8655    pub address: String,
8656}
8657
8658/// Response for the `WalletLock` RPC method
8659///
8660/// This method returns a primitive value wrapped in a transparent struct.
8661#[derive(Debug, Clone, PartialEq, Serialize)]
8662pub struct WalletLockResponse {
8663    /// Wrapped primitive value
8664    pub value: (),
8665}
8666
8667impl<'de> serde::Deserialize<'de> for WalletLockResponse {
8668    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8669    where
8670        D: serde::Deserializer<'de>,
8671    {
8672        use std::fmt;
8673
8674        use serde::de::{self, Visitor};
8675
8676        struct PrimitiveWrapperVisitor;
8677
8678        #[allow(unused_variables, clippy::needless_lifetimes)]
8679        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
8680            type Value = WalletLockResponse;
8681
8682            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8683                formatter.write_str("a primitive value or an object with 'value' field")
8684            }
8685
8686            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
8687            where
8688                E: de::Error,
8689            {
8690                Ok(WalletLockResponse { value: () })
8691            }
8692
8693            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
8694            where
8695                E: de::Error,
8696            {
8697                Ok(WalletLockResponse { value: () })
8698            }
8699
8700            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
8701            where
8702                E: de::Error,
8703            {
8704                Ok(WalletLockResponse { value: () })
8705            }
8706
8707            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
8708            where
8709                E: de::Error,
8710            {
8711                Ok(WalletLockResponse { value: () })
8712            }
8713
8714            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
8715            where
8716                E: de::Error,
8717            {
8718                Ok(WalletLockResponse { value: () })
8719            }
8720
8721            fn visit_none<E>(self) -> Result<Self::Value, E>
8722            where
8723                E: de::Error,
8724            {
8725                Ok(WalletLockResponse { value: () })
8726            }
8727
8728            fn visit_unit<E>(self) -> Result<Self::Value, E>
8729            where
8730                E: de::Error,
8731            {
8732                Ok(WalletLockResponse { value: () })
8733            }
8734
8735            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8736            where
8737                M: de::MapAccess<'de>,
8738            {
8739                let mut value = None;
8740                while let Some(key) = map.next_key::<String>()? {
8741                    if key == "value" {
8742                        if value.is_some() {
8743                            return Err(de::Error::duplicate_field("value"));
8744                        }
8745                        value = Some(map.next_value::<()>()?);
8746                    } else {
8747                        let _ = map.next_value::<de::IgnoredAny>()?;
8748                    }
8749                }
8750                value.ok_or_else(|| de::Error::missing_field("value"))?;
8751                Ok(WalletLockResponse { value: () })
8752            }
8753        }
8754
8755        deserializer.deserialize_any(PrimitiveWrapperVisitor)
8756    }
8757}
8758
8759impl std::ops::Deref for WalletLockResponse {
8760    type Target = ();
8761    fn deref(&self) -> &Self::Target { &self.value }
8762}
8763
8764impl std::ops::DerefMut for WalletLockResponse {
8765    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
8766}
8767
8768impl AsRef<()> for WalletLockResponse {
8769    fn as_ref(&self) -> &() { &self.value }
8770}
8771
8772impl From<()> for WalletLockResponse {
8773    fn from(value: ()) -> Self { Self { value } }
8774}
8775
8776impl From<WalletLockResponse> for () {
8777    fn from(wrapper: WalletLockResponse) -> Self { wrapper.value }
8778}
8779
8780/// Response for the `WalletPassphrase` RPC method
8781///
8782/// This method returns a primitive value wrapped in a transparent struct.
8783#[derive(Debug, Clone, PartialEq, Serialize)]
8784pub struct WalletPassphraseResponse {
8785    /// Wrapped primitive value
8786    pub value: (),
8787}
8788
8789impl<'de> serde::Deserialize<'de> for WalletPassphraseResponse {
8790    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8791    where
8792        D: serde::Deserializer<'de>,
8793    {
8794        use std::fmt;
8795
8796        use serde::de::{self, Visitor};
8797
8798        struct PrimitiveWrapperVisitor;
8799
8800        #[allow(unused_variables, clippy::needless_lifetimes)]
8801        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
8802            type Value = WalletPassphraseResponse;
8803
8804            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8805                formatter.write_str("a primitive value or an object with 'value' field")
8806            }
8807
8808            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
8809            where
8810                E: de::Error,
8811            {
8812                Ok(WalletPassphraseResponse { value: () })
8813            }
8814
8815            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
8816            where
8817                E: de::Error,
8818            {
8819                Ok(WalletPassphraseResponse { value: () })
8820            }
8821
8822            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
8823            where
8824                E: de::Error,
8825            {
8826                Ok(WalletPassphraseResponse { value: () })
8827            }
8828
8829            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
8830            where
8831                E: de::Error,
8832            {
8833                Ok(WalletPassphraseResponse { value: () })
8834            }
8835
8836            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
8837            where
8838                E: de::Error,
8839            {
8840                Ok(WalletPassphraseResponse { value: () })
8841            }
8842
8843            fn visit_none<E>(self) -> Result<Self::Value, E>
8844            where
8845                E: de::Error,
8846            {
8847                Ok(WalletPassphraseResponse { value: () })
8848            }
8849
8850            fn visit_unit<E>(self) -> Result<Self::Value, E>
8851            where
8852                E: de::Error,
8853            {
8854                Ok(WalletPassphraseResponse { value: () })
8855            }
8856
8857            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8858            where
8859                M: de::MapAccess<'de>,
8860            {
8861                let mut value = None;
8862                while let Some(key) = map.next_key::<String>()? {
8863                    if key == "value" {
8864                        if value.is_some() {
8865                            return Err(de::Error::duplicate_field("value"));
8866                        }
8867                        value = Some(map.next_value::<()>()?);
8868                    } else {
8869                        let _ = map.next_value::<de::IgnoredAny>()?;
8870                    }
8871                }
8872                value.ok_or_else(|| de::Error::missing_field("value"))?;
8873                Ok(WalletPassphraseResponse { value: () })
8874            }
8875        }
8876
8877        deserializer.deserialize_any(PrimitiveWrapperVisitor)
8878    }
8879}
8880
8881impl std::ops::Deref for WalletPassphraseResponse {
8882    type Target = ();
8883    fn deref(&self) -> &Self::Target { &self.value }
8884}
8885
8886impl std::ops::DerefMut for WalletPassphraseResponse {
8887    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
8888}
8889
8890impl AsRef<()> for WalletPassphraseResponse {
8891    fn as_ref(&self) -> &() { &self.value }
8892}
8893
8894impl From<()> for WalletPassphraseResponse {
8895    fn from(value: ()) -> Self { Self { value } }
8896}
8897
8898impl From<WalletPassphraseResponse> for () {
8899    fn from(wrapper: WalletPassphraseResponse) -> Self { wrapper.value }
8900}
8901
8902/// Response for the `WalletPassphraseChange` RPC method
8903///
8904/// This method returns a primitive value wrapped in a transparent struct.
8905#[derive(Debug, Clone, PartialEq, Serialize)]
8906pub struct WalletPassphraseChangeResponse {
8907    /// Wrapped primitive value
8908    pub value: (),
8909}
8910
8911impl<'de> serde::Deserialize<'de> for WalletPassphraseChangeResponse {
8912    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8913    where
8914        D: serde::Deserializer<'de>,
8915    {
8916        use std::fmt;
8917
8918        use serde::de::{self, Visitor};
8919
8920        struct PrimitiveWrapperVisitor;
8921
8922        #[allow(unused_variables, clippy::needless_lifetimes)]
8923        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
8924            type Value = WalletPassphraseChangeResponse;
8925
8926            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8927                formatter.write_str("a primitive value or an object with 'value' field")
8928            }
8929
8930            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
8931            where
8932                E: de::Error,
8933            {
8934                Ok(WalletPassphraseChangeResponse { value: () })
8935            }
8936
8937            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
8938            where
8939                E: de::Error,
8940            {
8941                Ok(WalletPassphraseChangeResponse { value: () })
8942            }
8943
8944            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
8945            where
8946                E: de::Error,
8947            {
8948                Ok(WalletPassphraseChangeResponse { value: () })
8949            }
8950
8951            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
8952            where
8953                E: de::Error,
8954            {
8955                Ok(WalletPassphraseChangeResponse { value: () })
8956            }
8957
8958            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
8959            where
8960                E: de::Error,
8961            {
8962                Ok(WalletPassphraseChangeResponse { value: () })
8963            }
8964
8965            fn visit_none<E>(self) -> Result<Self::Value, E>
8966            where
8967                E: de::Error,
8968            {
8969                Ok(WalletPassphraseChangeResponse { value: () })
8970            }
8971
8972            fn visit_unit<E>(self) -> Result<Self::Value, E>
8973            where
8974                E: de::Error,
8975            {
8976                Ok(WalletPassphraseChangeResponse { value: () })
8977            }
8978
8979            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8980            where
8981                M: de::MapAccess<'de>,
8982            {
8983                let mut value = None;
8984                while let Some(key) = map.next_key::<String>()? {
8985                    if key == "value" {
8986                        if value.is_some() {
8987                            return Err(de::Error::duplicate_field("value"));
8988                        }
8989                        value = Some(map.next_value::<()>()?);
8990                    } else {
8991                        let _ = map.next_value::<de::IgnoredAny>()?;
8992                    }
8993                }
8994                value.ok_or_else(|| de::Error::missing_field("value"))?;
8995                Ok(WalletPassphraseChangeResponse { value: () })
8996            }
8997        }
8998
8999        deserializer.deserialize_any(PrimitiveWrapperVisitor)
9000    }
9001}
9002
9003impl std::ops::Deref for WalletPassphraseChangeResponse {
9004    type Target = ();
9005    fn deref(&self) -> &Self::Target { &self.value }
9006}
9007
9008impl std::ops::DerefMut for WalletPassphraseChangeResponse {
9009    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
9010}
9011
9012impl AsRef<()> for WalletPassphraseChangeResponse {
9013    fn as_ref(&self) -> &() { &self.value }
9014}
9015
9016impl From<()> for WalletPassphraseChangeResponse {
9017    fn from(value: ()) -> Self { Self { value } }
9018}
9019
9020impl From<WalletPassphraseChangeResponse> for () {
9021    fn from(wrapper: WalletPassphraseChangeResponse) -> Self { wrapper.value }
9022}
9023
9024/// Response for the `WalletProcessPsbt` RPC method
9025///
9026#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
9027#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
9028pub struct WalletProcessPsbtResponse {
9029    /// The base64-encoded partially signed transaction
9030    pub psbt: String,
9031    /// If the transaction has a complete set of signatures
9032    pub complete: bool,
9033    /// The hex-encoded network transaction if complete
9034    pub hex: Option<String>,
9035}
9036
9037/// Deserializer for bitcoin::Amount that handles both float (BTC) and integer (satoshis) formats
9038/// Bitcoin Core returns amounts as floats in BTC, but some fields may be integers in satoshis
9039fn amount_from_btc_float<'de, D>(deserializer: D) -> Result<bitcoin::Amount, D::Error>
9040where
9041    D: serde::Deserializer<'de>,
9042{
9043    use std::fmt;
9044
9045    use serde::de::{self, Visitor};
9046
9047    struct AmountVisitor;
9048
9049    impl Visitor<'_> for AmountVisitor {
9050        type Value = bitcoin::Amount;
9051
9052        fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
9053            formatter.write_str("a number (float BTC or integer satoshis)")
9054        }
9055
9056        fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
9057        where
9058            E: de::Error,
9059        {
9060            bitcoin::Amount::from_btc(v)
9061                .map_err(|e| E::custom(format!("Invalid BTC amount: {}", e)))
9062        }
9063
9064        fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
9065        where
9066            E: de::Error,
9067        {
9068            Ok(bitcoin::Amount::from_sat(v))
9069        }
9070
9071        fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
9072        where
9073            E: de::Error,
9074        {
9075            if v < 0 {
9076                return Err(E::custom(format!("Amount cannot be negative: {}", v)));
9077            }
9078            Ok(bitcoin::Amount::from_sat(v as u64))
9079        }
9080    }
9081
9082    deserializer.deserialize_any(AmountVisitor)
9083}
9084
9085/// Deserializer for Option<bitcoin::Amount> that handles both float (BTC) and integer (satoshis) formats
9086/// Bitcoin Core returns amounts as floats in BTC, but some fields may be integers in satoshis
9087/// This deserializer also handles null/None values
9088fn option_amount_from_btc_float<'de, D>(
9089    deserializer: D,
9090) -> Result<Option<bitcoin::Amount>, D::Error>
9091where
9092    D: serde::Deserializer<'de>,
9093{
9094    use std::fmt;
9095
9096    use serde::de::{self, Visitor};
9097
9098    struct OptionAmountVisitor;
9099
9100    #[allow(clippy::needless_lifetimes)]
9101    impl<'de> Visitor<'de> for OptionAmountVisitor {
9102        type Value = Option<bitcoin::Amount>;
9103
9104        fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
9105            formatter.write_str("an optional number (float BTC or integer satoshis)")
9106        }
9107
9108        fn visit_none<E>(self) -> Result<Self::Value, E>
9109        where
9110            E: de::Error,
9111        {
9112            Ok(None)
9113        }
9114
9115        fn visit_some<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
9116        where
9117            D: serde::Deserializer<'de>,
9118        {
9119            amount_from_btc_float(deserializer).map(Some)
9120        }
9121
9122        fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
9123        where
9124            E: de::Error,
9125        {
9126            bitcoin::Amount::from_btc(v)
9127                .map_err(|e| E::custom(format!("Invalid BTC amount: {}", e)))
9128                .map(Some)
9129        }
9130
9131        fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
9132        where
9133            E: de::Error,
9134        {
9135            Ok(Some(bitcoin::Amount::from_sat(v)))
9136        }
9137
9138        fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
9139        where
9140            E: de::Error,
9141        {
9142            if v < 0 {
9143                return Err(E::custom(format!("Amount cannot be negative: {}", v)));
9144            }
9145            Ok(Some(bitcoin::Amount::from_sat(v as u64)))
9146        }
9147    }
9148
9149    deserializer.deserialize_any(OptionAmountVisitor)
9150}