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