Skip to main content

ethos_bitcoind/types/
responses.rs

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