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