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: Vec<String>,
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<Vec<String>>,
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<Vec<String>>,
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: Vec<String>,
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<Vec<String>>,
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: Vec<String>,
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<Vec<String>>,
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/// Represents the getblock "tx" field: verbosity 1 returns txids, verbosity 2 or 3 return decoded transactions.
2287///
2288/// Txids is strongly typed; Transactions is opaque JSON for the caller to deserialize as needed.
2289/// Use `as_txids()` when you called getblock with verbosity 1; use `as_transactions()` for verbosity 2 or 3.
2290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2291#[serde(untagged)]
2292pub enum GetblockTx {
2293    /// Verbosity 1: array of txid strings.
2294    Txids(Vec<bitcoin::Txid>),
2295    /// Verbosity 2 or 3: array of decoded transaction objects (opaque JSON).
2296    Transactions(Vec<serde_json::Value>),
2297}
2298
2299impl GetblockTx {
2300    /// For verbosity 1: returns the txid slice if this is the Txids variant.
2301    pub fn as_txids(&self) -> Option<&[bitcoin::Txid]> {
2302        match self {
2303            GetblockTx::Txids(v) => Some(v),
2304            _ => None,
2305        }
2306    }
2307    /// For verbosity 2 or 3: returns the transactions array if this is the Transactions variant.
2308    pub fn as_transactions(&self) -> Option<&[serde_json::Value]> {
2309        match self {
2310            GetblockTx::Transactions(v) => Some(v),
2311            _ => None,
2312        }
2313    }
2314}
2315
2316/// Response for the `GetBlock` RPC method
2317///
2318#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2319#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2320pub struct GetBlockResponse {
2321    /// nBits: compact representation of the block difficulty target
2322    pub bits: String,
2323    /// Expected number of hashes required to produce the chain up to this block (in hex)
2324    pub chainwork: String,
2325    /// The number of confirmations, or -1 if the block is not on the main chain
2326    pub confirmations: i64,
2327    /// The difficulty
2328    pub difficulty: f64,
2329    /// Same output as verbosity = 1
2330    pub field_20: Option<serde_json::Value>,
2331    /// Same output as verbosity = 2
2332    pub field_22: Option<serde_json::Value>,
2333    /// the block hash (same as provided)
2334    pub hash: String,
2335    /// The block height or index
2336    pub height: u64,
2337    /// The median block time expressed in UNIX epoch time
2338    pub mediantime: u64,
2339    /// The merkle root
2340    pub merkleroot: String,
2341    /// The number of transactions in the block
2342    pub nTx: u64,
2343    /// The hash of the next block (if available)
2344    pub nextblockhash: Option<String>,
2345    /// The nonce
2346    pub nonce: u64,
2347    /// The hash of the previous block (if available)
2348    pub previousblockhash: Option<String>,
2349    /// The block size
2350    pub size: u64,
2351    /// The block size excluding witness data
2352    pub strippedsize: u64,
2353    /// The difficulty target
2354    pub target: String,
2355    /// The block time expressed in UNIX epoch time
2356    pub time: u64,
2357    /// The transaction ids
2358    pub tx: GetblockTx,
2359    pub tx_1: Option<serde_json::Value>,
2360    pub tx_2: Option<serde_json::Value>,
2361    /// The block version
2362    pub version: u32,
2363    /// The block version formatted in hexadecimal
2364    pub versionHex: String,
2365    /// The block weight as defined in BIP 141
2366    pub weight: u64,
2367}
2368
2369/// Response for the `GetBlockchainInfo` RPC method
2370///
2371#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2372#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2373pub struct GetBlockchainInfoResponse {
2374    /// whether automatic pruning is enabled (only present if pruning is enabled)
2375    pub automatic_pruning: Option<bool>,
2376    /// the hash of the currently best block
2377    pub bestblockhash: String,
2378    /// nBits: compact representation of the block difficulty target
2379    pub bits: String,
2380    /// the height of the most-work fully-validated chain. The genesis block has height 0
2381    pub blocks: u64,
2382    /// current network name (main, test, testnet4, signet, regtest)
2383    pub chain: String,
2384    /// total amount of work in active chain, in hexadecimal
2385    pub chainwork: String,
2386    /// the current difficulty
2387    pub difficulty: f64,
2388    /// the current number of headers we have validated
2389    pub headers: u64,
2390    /// (debug information) estimate of whether this node is in Initial Block Download mode
2391    pub initialblockdownload: bool,
2392    /// The median block time expressed in UNIX epoch time
2393    pub mediantime: u64,
2394    /// the target size used by pruning (only present if automatic pruning is enabled)
2395    pub prune_target_size: Option<u64>,
2396    /// if the blocks are subject to pruning
2397    pub pruned: bool,
2398    /// height of the last block pruned, plus one (only present if pruning is enabled)
2399    pub pruneheight: Option<u64>,
2400    /// the block challenge (aka. block script), in hexadecimal (only present if the current network is a signet)
2401    pub signet_challenge: Option<String>,
2402    /// the estimated size of the block and undo files on disk
2403    pub size_on_disk: u64,
2404    /// The difficulty target
2405    pub target: String,
2406    /// The block time expressed in UNIX epoch time
2407    pub time: u64,
2408    /// estimate of verification progress \[0..1\]
2409    pub verificationprogress: f64,
2410    /// any network and blockchain warnings (run with `-deprecatedrpc=warnings` to return the latest warning as a single string)
2411    pub warnings: Vec<String>,
2412}
2413
2414/// Response for the `GetBlockCount` RPC method
2415///
2416/// This method returns a primitive value wrapped in a transparent struct.
2417#[derive(Debug, Clone, PartialEq, Serialize)]
2418pub struct GetBlockCountResponse {
2419    /// Wrapped primitive value
2420    pub value: u64,
2421}
2422
2423impl<'de> serde::Deserialize<'de> for GetBlockCountResponse {
2424    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2425    where
2426        D: serde::Deserializer<'de>,
2427    {
2428        use std::fmt;
2429
2430        use serde::de::{self, Visitor};
2431
2432        struct PrimitiveWrapperVisitor;
2433
2434        #[allow(unused_variables, clippy::needless_lifetimes)]
2435        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
2436            type Value = GetBlockCountResponse;
2437
2438            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
2439                formatter.write_str("a primitive value or an object with 'value' field")
2440            }
2441
2442            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
2443            where
2444                E: de::Error,
2445            {
2446                Ok(GetBlockCountResponse { value: v })
2447            }
2448
2449            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
2450            where
2451                E: de::Error,
2452            {
2453                Ok(GetBlockCountResponse { value: v as u64 })
2454            }
2455
2456            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
2457            where
2458                E: de::Error,
2459            {
2460                Ok(GetBlockCountResponse { value: v as u64 })
2461            }
2462
2463            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
2464            where
2465                E: de::Error,
2466            {
2467                let value = v.parse::<u64>().map_err(de::Error::custom)?;
2468                Ok(GetBlockCountResponse { value })
2469            }
2470
2471            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
2472            where
2473                E: de::Error,
2474            {
2475                Ok(GetBlockCountResponse { value: v as u64 })
2476            }
2477
2478            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
2479            where
2480                M: de::MapAccess<'de>,
2481            {
2482                let mut value = None;
2483                while let Some(key) = map.next_key::<String>()? {
2484                    if key == "value" {
2485                        if value.is_some() {
2486                            return Err(de::Error::duplicate_field("value"));
2487                        }
2488                        value = Some(map.next_value()?);
2489                    } else {
2490                        let _ = map.next_value::<de::IgnoredAny>()?;
2491                    }
2492                }
2493                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
2494                Ok(GetBlockCountResponse { value })
2495            }
2496        }
2497
2498        deserializer.deserialize_any(PrimitiveWrapperVisitor)
2499    }
2500}
2501
2502impl std::ops::Deref for GetBlockCountResponse {
2503    type Target = u64;
2504    fn deref(&self) -> &Self::Target { &self.value }
2505}
2506
2507impl std::ops::DerefMut for GetBlockCountResponse {
2508    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
2509}
2510
2511impl AsRef<u64> for GetBlockCountResponse {
2512    fn as_ref(&self) -> &u64 { &self.value }
2513}
2514
2515impl From<u64> for GetBlockCountResponse {
2516    fn from(value: u64) -> Self { Self { value } }
2517}
2518
2519impl From<GetBlockCountResponse> for u64 {
2520    fn from(wrapper: GetBlockCountResponse) -> Self { wrapper.value }
2521}
2522
2523/// Response for the `GetBlockFilter` RPC method
2524///
2525#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2526#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2527pub struct GetBlockFilterResponse {
2528    /// the hex-encoded filter data
2529    pub filter: String,
2530    /// the hex-encoded filter header
2531    pub header: String,
2532}
2533
2534/// Response for the `GetBlockFromPeer` RPC method
2535///
2536/// This method returns no meaningful data.
2537#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2538pub struct GetBlockFromPeerResponse;
2539
2540/// Response for the `GetBlockHash` RPC method
2541///
2542/// This method returns a primitive value wrapped in a transparent struct.
2543#[derive(Debug, Clone, PartialEq, Serialize)]
2544pub struct GetBlockHashResponse {
2545    /// Wrapped primitive value
2546    pub value: String,
2547}
2548
2549impl<'de> serde::Deserialize<'de> for GetBlockHashResponse {
2550    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2551    where
2552        D: serde::Deserializer<'de>,
2553    {
2554        use std::fmt;
2555
2556        use serde::de::{self, Visitor};
2557
2558        struct PrimitiveWrapperVisitor;
2559
2560        #[allow(unused_variables, clippy::needless_lifetimes)]
2561        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
2562            type Value = GetBlockHashResponse;
2563
2564            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
2565                formatter.write_str("a primitive value or an object with 'value' field")
2566            }
2567
2568            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
2569            where
2570                E: de::Error,
2571            {
2572                Ok(GetBlockHashResponse { value: v.to_string() })
2573            }
2574
2575            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
2576            where
2577                E: de::Error,
2578            {
2579                Ok(GetBlockHashResponse { value: v.to_string() })
2580            }
2581
2582            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
2583            where
2584                E: de::Error,
2585            {
2586                Ok(GetBlockHashResponse { value: v.to_string() })
2587            }
2588
2589            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
2590            where
2591                E: de::Error,
2592            {
2593                Ok(GetBlockHashResponse { value: v.to_string() })
2594            }
2595
2596            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
2597            where
2598                E: de::Error,
2599            {
2600                Ok(GetBlockHashResponse { value: v.to_string() })
2601            }
2602
2603            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
2604            where
2605                M: de::MapAccess<'de>,
2606            {
2607                let mut value = None;
2608                while let Some(key) = map.next_key::<String>()? {
2609                    if key == "value" {
2610                        if value.is_some() {
2611                            return Err(de::Error::duplicate_field("value"));
2612                        }
2613                        value = Some(map.next_value()?);
2614                    } else {
2615                        let _ = map.next_value::<de::IgnoredAny>()?;
2616                    }
2617                }
2618                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
2619                Ok(GetBlockHashResponse { value })
2620            }
2621        }
2622
2623        deserializer.deserialize_any(PrimitiveWrapperVisitor)
2624    }
2625}
2626
2627impl std::ops::Deref for GetBlockHashResponse {
2628    type Target = String;
2629    fn deref(&self) -> &Self::Target { &self.value }
2630}
2631
2632impl std::ops::DerefMut for GetBlockHashResponse {
2633    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
2634}
2635
2636impl AsRef<String> for GetBlockHashResponse {
2637    fn as_ref(&self) -> &String { &self.value }
2638}
2639
2640impl From<String> for GetBlockHashResponse {
2641    fn from(value: String) -> Self { Self { value } }
2642}
2643
2644impl From<GetBlockHashResponse> for String {
2645    fn from(wrapper: GetBlockHashResponse) -> Self { wrapper.value }
2646}
2647
2648/// Response for the `GetBlockHeader` RPC method
2649///
2650#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2651#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2652pub struct GetBlockHeaderResponse {
2653    /// nBits: compact representation of the block difficulty target
2654    pub bits: String,
2655    /// Expected number of hashes required to produce the current chain
2656    pub chainwork: String,
2657    /// The number of confirmations, or -1 if the block is not on the main chain
2658    pub confirmations: i64,
2659    /// The difficulty
2660    pub difficulty: f64,
2661    /// the block hash (same as provided)
2662    pub hash: String,
2663    /// The block height or index
2664    pub height: u64,
2665    /// The median block time expressed in UNIX epoch time
2666    pub mediantime: u64,
2667    /// The merkle root
2668    pub merkleroot: String,
2669    /// The number of transactions in the block
2670    pub nTx: u64,
2671    /// The hash of the next block (if available)
2672    pub nextblockhash: Option<String>,
2673    /// The nonce
2674    pub nonce: u64,
2675    /// The hash of the previous block (if available)
2676    pub previousblockhash: Option<String>,
2677    /// The difficulty target
2678    pub target: String,
2679    /// The block time expressed in UNIX epoch time
2680    pub time: u64,
2681    /// The block version
2682    pub version: u32,
2683    /// The block version formatted in hexadecimal
2684    pub versionHex: String,
2685}
2686
2687/// Response for the `GetBlockStats` RPC method
2688///
2689#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2690#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2691pub struct GetBlockStatsResponse {
2692    /// Average fee in the block
2693    pub avgfee: Option<u64>,
2694    /// Average feerate (in satoshis per virtual byte)
2695    pub avgfeerate: Option<u64>,
2696    /// Average transaction size
2697    pub avgtxsize: Option<u64>,
2698    /// The block hash (to check for potential reorgs)
2699    pub blockhash: Option<bitcoin::BlockHash>,
2700    /// Feerates at the 10th, 25th, 50th, 75th, and 90th percentile weight unit (in satoshis per virtual byte)
2701    pub feerate_percentiles: Option<serde_json::Value>,
2702    /// The height of the block
2703    pub height: Option<u64>,
2704    /// The number of inputs (excluding coinbase)
2705    pub ins: Option<u64>,
2706    /// Maximum fee in the block
2707    pub maxfee: Option<u64>,
2708    /// Maximum feerate (in satoshis per virtual byte)
2709    pub maxfeerate: Option<f64>,
2710    /// Maximum transaction size
2711    pub maxtxsize: Option<u64>,
2712    /// Truncated median fee in the block
2713    pub medianfee: Option<u64>,
2714    /// The block median time past
2715    pub mediantime: Option<u64>,
2716    /// Truncated median transaction size
2717    pub mediantxsize: Option<u64>,
2718    /// Minimum fee in the block
2719    pub minfee: Option<u64>,
2720    /// Minimum feerate (in satoshis per virtual byte)
2721    pub minfeerate: Option<u64>,
2722    /// Minimum transaction size
2723    pub mintxsize: Option<u64>,
2724    /// The number of outputs
2725    pub outs: Option<u64>,
2726    /// The block subsidy
2727    pub subsidy: Option<u64>,
2728    /// Total size of all segwit transactions
2729    pub swtotal_size: Option<u64>,
2730    /// Total weight of all segwit transactions
2731    pub swtotal_weight: Option<u64>,
2732    /// The number of segwit transactions
2733    pub swtxs: Option<u64>,
2734    /// The block time
2735    pub time: Option<u64>,
2736    /// Total amount in all outputs (excluding coinbase and thus reward \[ie subsidy + totalfee\])
2737    pub total_out: Option<u64>,
2738    /// Total size of all non-coinbase transactions
2739    pub total_size: Option<u64>,
2740    /// Total weight of all non-coinbase transactions
2741    pub total_weight: Option<u64>,
2742    /// The fee total
2743    pub totalfee: Option<u64>,
2744    /// The number of transactions (including coinbase)
2745    pub txs: Option<u64>,
2746    /// The increase/decrease in the number of unspent outputs (not discounting op_return and similar)
2747    pub utxo_increase: Option<u64>,
2748    /// The increase/decrease in the number of unspent outputs, not counting unspendables
2749    pub utxo_increase_actual: Option<u64>,
2750    /// The increase/decrease in size for the utxo index (not discounting op_return and similar)
2751    pub utxo_size_inc: Option<u64>,
2752    /// The increase/decrease in size for the utxo index, not counting unspendables
2753    pub utxo_size_inc_actual: Option<u64>,
2754}
2755
2756/// Response for the `GetBlockTemplate` RPC method
2757///
2758#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2759#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2760pub struct GetBlockTemplateResponse {
2761    /// compressed target of next block
2762    pub bits: String,
2763    pub capabilities: Vec<String>,
2764    /// data that should be included in the coinbase's scriptSig content
2765    pub coinbaseaux: serde_json::Value,
2766    /// maximum allowable input to coinbase transaction, including the generation award and transaction fees (in satoshis)
2767    pub coinbasevalue: u64,
2768    /// current timestamp in UNIX epoch time. Adjusted for the proposed BIP94 timewarp rule.
2769    pub curtime: u64,
2770    /// a valid witness commitment for the unmodified block template
2771    pub default_witness_commitment: Option<String>,
2772    #[serde(default)]
2773    pub field_0: Option<()>,
2774    /// The height of the next block
2775    pub height: u64,
2776    /// an id to include with a request to longpoll on an update to this template
2777    pub longpollid: String,
2778    /// The minimum timestamp appropriate for the next block time, expressed in UNIX epoch time. Adjusted for the proposed BIP94 timewarp rule.
2779    pub mintime: u64,
2780    /// list of ways the block template may be changed
2781    pub mutable: Vec<String>,
2782    /// A range of valid nonces
2783    pub noncerange: String,
2784    /// The hash of current highest block
2785    pub previousblockhash: String,
2786    /// specific block rules that are to be enforced
2787    pub rules: Vec<String>,
2788    /// Only on signet
2789    pub signet_challenge: Option<String>,
2790    /// limit of sigops in blocks
2791    pub sigoplimit: u64,
2792    /// limit of block size
2793    pub sizelimit: u64,
2794    /// The hash target
2795    pub target: String,
2796    /// contents of non-coinbase transactions that should be included in the next block
2797    pub transactions: serde_json::Value,
2798    /// set of pending, supported versionbit (BIP 9) softfork deployments
2799    pub vbavailable: serde_json::Value,
2800    /// bit mask of versionbits the server requires set in submissions
2801    pub vbrequired: u64,
2802    /// The preferred block version
2803    pub version: u32,
2804    /// limit of block weight
2805    pub weightlimit: Option<u64>,
2806}
2807
2808/// Response for the `GetChainStates` RPC method
2809///
2810#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2811#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2812pub struct GetChainStatesResponse {
2813    /// list of the chainstates ordered by work, with the most-work (active) chainstate last
2814    pub chainstates: serde_json::Value,
2815    /// the number of headers seen so far
2816    pub headers: u64,
2817}
2818
2819/// Response for the `GetChainTips` RPC method
2820///
2821#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2822#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2823pub struct GetChainTipsResponse {
2824    pub field: serde_json::Value,
2825}
2826
2827/// Response for the `GetChainTxStats` RPC method
2828///
2829#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2830#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2831pub struct GetChainTxStatsResponse {
2832    /// The timestamp for the final block in the window, expressed in UNIX epoch time
2833    pub time: u64,
2834    /// The total number of transactions in the chain up to that point, if known. It may be unknown when using assumeutxo.
2835    pub txcount: Option<u64>,
2836    /// The average rate of transactions per second in the window. Only returned if "window_interval" is &gt; 0 and if window_tx_count exists.
2837    pub txrate: Option<u64>,
2838    /// Size of the window in number of blocks
2839    pub window_block_count: u64,
2840    /// The hash of the final block in the window
2841    pub window_final_block_hash: String,
2842    /// The height of the final block in the window.
2843    pub window_final_block_height: u64,
2844    /// The elapsed time in the window in seconds. Only returned if "window_block_count" is &gt; 0
2845    pub window_interval: Option<u64>,
2846    /// 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.
2847    pub window_tx_count: Option<u64>,
2848}
2849
2850/// Response for the `GetConnectionCount` RPC method
2851///
2852/// This method returns a primitive value wrapped in a transparent struct.
2853#[derive(Debug, Clone, PartialEq, Serialize)]
2854pub struct GetConnectionCountResponse {
2855    /// Wrapped primitive value
2856    pub value: u64,
2857}
2858
2859impl<'de> serde::Deserialize<'de> for GetConnectionCountResponse {
2860    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2861    where
2862        D: serde::Deserializer<'de>,
2863    {
2864        use std::fmt;
2865
2866        use serde::de::{self, Visitor};
2867
2868        struct PrimitiveWrapperVisitor;
2869
2870        #[allow(unused_variables, clippy::needless_lifetimes)]
2871        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
2872            type Value = GetConnectionCountResponse;
2873
2874            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
2875                formatter.write_str("a primitive value or an object with 'value' field")
2876            }
2877
2878            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
2879            where
2880                E: de::Error,
2881            {
2882                Ok(GetConnectionCountResponse { value: v })
2883            }
2884
2885            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
2886            where
2887                E: de::Error,
2888            {
2889                Ok(GetConnectionCountResponse { value: v as u64 })
2890            }
2891
2892            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
2893            where
2894                E: de::Error,
2895            {
2896                Ok(GetConnectionCountResponse { value: v as u64 })
2897            }
2898
2899            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
2900            where
2901                E: de::Error,
2902            {
2903                let value = v.parse::<u64>().map_err(de::Error::custom)?;
2904                Ok(GetConnectionCountResponse { value })
2905            }
2906
2907            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
2908            where
2909                E: de::Error,
2910            {
2911                Ok(GetConnectionCountResponse { value: v as u64 })
2912            }
2913
2914            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
2915            where
2916                M: de::MapAccess<'de>,
2917            {
2918                let mut value = None;
2919                while let Some(key) = map.next_key::<String>()? {
2920                    if key == "value" {
2921                        if value.is_some() {
2922                            return Err(de::Error::duplicate_field("value"));
2923                        }
2924                        value = Some(map.next_value()?);
2925                    } else {
2926                        let _ = map.next_value::<de::IgnoredAny>()?;
2927                    }
2928                }
2929                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
2930                Ok(GetConnectionCountResponse { value })
2931            }
2932        }
2933
2934        deserializer.deserialize_any(PrimitiveWrapperVisitor)
2935    }
2936}
2937
2938impl std::ops::Deref for GetConnectionCountResponse {
2939    type Target = u64;
2940    fn deref(&self) -> &Self::Target { &self.value }
2941}
2942
2943impl std::ops::DerefMut for GetConnectionCountResponse {
2944    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
2945}
2946
2947impl AsRef<u64> for GetConnectionCountResponse {
2948    fn as_ref(&self) -> &u64 { &self.value }
2949}
2950
2951impl From<u64> for GetConnectionCountResponse {
2952    fn from(value: u64) -> Self { Self { value } }
2953}
2954
2955impl From<GetConnectionCountResponse> for u64 {
2956    fn from(wrapper: GetConnectionCountResponse) -> Self { wrapper.value }
2957}
2958
2959/// Response for the `GetDeploymentInfo` RPC method
2960///
2961#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2962#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2963pub struct GetDeploymentInfoResponse {
2964    pub deployments: serde_json::Value,
2965    /// requested block hash (or tip)
2966    pub hash: String,
2967    /// requested block height (or tip)
2968    pub height: u64,
2969}
2970
2971/// Response for the `GetDescriptorActivity` RPC method
2972///
2973#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2974#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2975pub struct GetDescriptorActivityResponse {
2976    /// events
2977    pub activity: serde_json::Value,
2978}
2979
2980/// Response for the `GetDescriptorInfo` RPC method
2981///
2982#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
2983#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
2984pub struct GetDescriptorInfoResponse {
2985    /// The checksum for the input descriptor
2986    pub checksum: String,
2987    /// The descriptor in canonical form, without private keys. For a multipath descriptor, only the first will be returned.
2988    pub descriptor: String,
2989    /// Whether the input descriptor contained at least one private key
2990    pub hasprivatekeys: bool,
2991    /// Whether the descriptor is ranged
2992    pub isrange: bool,
2993    /// Whether the descriptor is solvable
2994    pub issolvable: bool,
2995    /// All descriptors produced by expanding multipath derivation elements. Only if the provided descriptor specifies multipath derivation elements.
2996    pub multipath_expansion: Option<Vec<String>>,
2997}
2998
2999/// Response for the `GetDifficulty` RPC method
3000///
3001/// This method returns a primitive value wrapped in a transparent struct.
3002#[derive(Debug, Clone, PartialEq, Serialize)]
3003pub struct GetDifficultyResponse {
3004    /// Wrapped primitive value
3005    pub value: u64,
3006}
3007
3008impl<'de> serde::Deserialize<'de> for GetDifficultyResponse {
3009    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3010    where
3011        D: serde::Deserializer<'de>,
3012    {
3013        use std::fmt;
3014
3015        use serde::de::{self, Visitor};
3016
3017        struct PrimitiveWrapperVisitor;
3018
3019        #[allow(unused_variables, clippy::needless_lifetimes)]
3020        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
3021            type Value = GetDifficultyResponse;
3022
3023            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3024                formatter.write_str("a primitive value or an object with 'value' field")
3025            }
3026
3027            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
3028            where
3029                E: de::Error,
3030            {
3031                Ok(GetDifficultyResponse { value: v })
3032            }
3033
3034            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
3035            where
3036                E: de::Error,
3037            {
3038                Ok(GetDifficultyResponse { value: v as u64 })
3039            }
3040
3041            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
3042            where
3043                E: de::Error,
3044            {
3045                Ok(GetDifficultyResponse { value: v as u64 })
3046            }
3047
3048            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
3049            where
3050                E: de::Error,
3051            {
3052                let value = v.parse::<u64>().map_err(de::Error::custom)?;
3053                Ok(GetDifficultyResponse { value })
3054            }
3055
3056            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
3057            where
3058                E: de::Error,
3059            {
3060                Ok(GetDifficultyResponse { value: v as u64 })
3061            }
3062
3063            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
3064            where
3065                M: de::MapAccess<'de>,
3066            {
3067                let mut value = None;
3068                while let Some(key) = map.next_key::<String>()? {
3069                    if key == "value" {
3070                        if value.is_some() {
3071                            return Err(de::Error::duplicate_field("value"));
3072                        }
3073                        value = Some(map.next_value()?);
3074                    } else {
3075                        let _ = map.next_value::<de::IgnoredAny>()?;
3076                    }
3077                }
3078                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
3079                Ok(GetDifficultyResponse { value })
3080            }
3081        }
3082
3083        deserializer.deserialize_any(PrimitiveWrapperVisitor)
3084    }
3085}
3086
3087impl std::ops::Deref for GetDifficultyResponse {
3088    type Target = u64;
3089    fn deref(&self) -> &Self::Target { &self.value }
3090}
3091
3092impl std::ops::DerefMut for GetDifficultyResponse {
3093    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
3094}
3095
3096impl AsRef<u64> for GetDifficultyResponse {
3097    fn as_ref(&self) -> &u64 { &self.value }
3098}
3099
3100impl From<u64> for GetDifficultyResponse {
3101    fn from(value: u64) -> Self { Self { value } }
3102}
3103
3104impl From<GetDifficultyResponse> for u64 {
3105    fn from(wrapper: GetDifficultyResponse) -> Self { wrapper.value }
3106}
3107
3108/// Response for the `GetHdKeys` RPC method
3109///
3110#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3111#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3112pub struct GetHdKeysResponse {
3113    pub field: serde_json::Value,
3114}
3115
3116/// Response for the `GetIndexInfo` RPC method
3117///
3118#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3119#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3120pub struct GetIndexInfoResponse {
3121    /// The name of the index
3122    #[serde(default)]
3123    pub name: Option<serde_json::Value>,
3124}
3125
3126/// Response for the `GetMemoryInfo` RPC method
3127///
3128#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3129#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3130pub struct GetMemoryInfoResponse {
3131    /// Information about locked memory manager
3132    pub locked: serde_json::Value,
3133}
3134
3135/// Response for the `GetMempoolAncestors` RPC method
3136///
3137#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3138#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3139pub struct GetMempoolAncestorsResponse {
3140    pub field_0: Vec<String>,
3141    pub transactionid: serde_json::Value,
3142}
3143
3144/// Response for the `GetMempoolDescendants` RPC method
3145///
3146#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3147#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3148pub struct GetMempoolDescendantsResponse {
3149    pub field_0: Vec<String>,
3150    pub transactionid: serde_json::Value,
3151}
3152
3153/// Response for the `GetMempoolEntry` RPC method
3154///
3155#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3156#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3157pub struct GetMempoolEntryResponse {
3158    /// number of in-mempool ancestor transactions (including this one)
3159    pub ancestorcount: u64,
3160    /// virtual transaction size of in-mempool ancestors (including this one)
3161    pub ancestorsize: u64,
3162    /// Whether this transaction signals BIP125 replaceability or has an unconfirmed ancestor signaling BIP125 replaceability. (DEPRECATED)
3163    #[serde(rename = "bip125-replaceable")]
3164    pub bip125_replaceable: bool,
3165    /// unconfirmed transactions used as inputs for this transaction
3166    pub depends: Vec<String>,
3167    /// number of in-mempool descendant transactions (including this one)
3168    pub descendantcount: u64,
3169    /// virtual transaction size of in-mempool descendants (including this one)
3170    pub descendantsize: u64,
3171    pub fees: serde_json::Value,
3172    /// block height when transaction entered pool
3173    pub height: u64,
3174    /// unconfirmed transactions spending outputs from this transaction
3175    pub spentby: Vec<String>,
3176    /// local time transaction entered pool in seconds since 1 Jan 1970 GMT
3177    pub time: u64,
3178    /// Whether this transaction is currently unbroadcast (initial broadcast not yet acknowledged by any peers)
3179    pub unbroadcast: bool,
3180    /// virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted.
3181    pub vsize: u64,
3182    /// transaction weight as defined in BIP 141.
3183    pub weight: u64,
3184    /// hash of serialized transaction, including witness data
3185    pub wtxid: String,
3186}
3187
3188/// Response for the `GetMempoolInfo` RPC method
3189///
3190#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3191#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3192pub struct GetMempoolInfoResponse {
3193    /// Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted
3194    pub bytes: u64,
3195    /// True if the mempool accepts RBF without replaceability signaling inspection (DEPRECATED)
3196    pub fullrbf: bool,
3197    /// minimum fee rate increment for mempool limiting or replacement in BTC/kvB
3198    pub incrementalrelayfee: f64,
3199    /// True if the initial load attempt of the persisted mempool finished
3200    pub loaded: bool,
3201    /// Maximum number of bytes that can be used by OP_RETURN outputs in the mempool
3202    pub maxdatacarriersize: Option<u64>,
3203    /// Maximum memory usage for the mempool
3204    pub maxmempool: u64,
3205    /// Minimum fee rate in BTC/kvB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee
3206    pub mempoolminfee: f64,
3207    /// Current minimum relay fee for transactions
3208    pub minrelaytxfee: f64,
3209    /// True if the mempool accepts transactions with bare multisig outputs
3210    pub permitbaremultisig: Option<bool>,
3211    /// Current tx count
3212    pub size: u64,
3213    /// Total fees for the mempool in BTC, ignoring modified fees through prioritisetransaction
3214    pub total_fee: f64,
3215    /// Current number of transactions that haven't passed initial broadcast yet
3216    pub unbroadcastcount: u64,
3217    /// Total memory usage for the mempool
3218    pub usage: u64,
3219}
3220
3221/// Response for the `GetMiningInfo` RPC method
3222///
3223#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3224#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3225pub struct GetMiningInfoResponse {
3226    /// The current nBits, compact representation of the block difficulty target
3227    pub bits: String,
3228    /// Minimum feerate of packages selected for block inclusion in BTC/kvB
3229    pub blockmintxfee: Option<f64>,
3230    /// The current block
3231    pub blocks: u64,
3232    /// current network name (main, test, testnet4, signet, regtest)
3233    pub chain: String,
3234    /// The number of block transactions (excluding coinbase) of the last assembled block (only present if a block was ever assembled)
3235    pub currentblocktx: Option<u64>,
3236    /// 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)
3237    pub currentblockweight: Option<u64>,
3238    /// The current difficulty
3239    pub difficulty: f64,
3240    /// The network hashes per second
3241    pub networkhashps: f64,
3242    /// The next block
3243    pub next: serde_json::Value,
3244    /// The size of the mempool
3245    pub pooledtx: u64,
3246    /// The block challenge (aka. block script), in hexadecimal (only present if the current network is a signet)
3247    pub signet_challenge: Option<String>,
3248    /// The current target
3249    pub target: String,
3250    /// any network and blockchain warnings (run with `-deprecatedrpc=warnings` to return the latest warning as a single string)
3251    pub warnings: Vec<String>,
3252}
3253
3254/// Response for the `GetNetTotals` RPC method
3255///
3256#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3257#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3258pub struct GetNetTotalsResponse {
3259    /// Current system UNIX epoch time in milliseconds
3260    pub timemillis: u64,
3261    /// Total bytes received
3262    pub totalbytesrecv: u64,
3263    /// Total bytes sent
3264    pub totalbytessent: u64,
3265    pub uploadtarget: serde_json::Value,
3266}
3267
3268/// Response for the `GetNetworkHashPs` RPC method
3269///
3270/// This method returns a primitive value wrapped in a transparent struct.
3271#[derive(Debug, Clone, PartialEq, Serialize)]
3272pub struct GetNetworkHashPsResponse {
3273    /// Wrapped primitive value
3274    pub value: u64,
3275}
3276
3277impl<'de> serde::Deserialize<'de> for GetNetworkHashPsResponse {
3278    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3279    where
3280        D: serde::Deserializer<'de>,
3281    {
3282        use std::fmt;
3283
3284        use serde::de::{self, Visitor};
3285
3286        struct PrimitiveWrapperVisitor;
3287
3288        #[allow(unused_variables, clippy::needless_lifetimes)]
3289        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
3290            type Value = GetNetworkHashPsResponse;
3291
3292            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3293                formatter.write_str("a primitive value or an object with 'value' field")
3294            }
3295
3296            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
3297            where
3298                E: de::Error,
3299            {
3300                Ok(GetNetworkHashPsResponse { value: v })
3301            }
3302
3303            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
3304            where
3305                E: de::Error,
3306            {
3307                Ok(GetNetworkHashPsResponse { value: v as u64 })
3308            }
3309
3310            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
3311            where
3312                E: de::Error,
3313            {
3314                Ok(GetNetworkHashPsResponse { value: v as u64 })
3315            }
3316
3317            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
3318            where
3319                E: de::Error,
3320            {
3321                let value = v.parse::<u64>().map_err(de::Error::custom)?;
3322                Ok(GetNetworkHashPsResponse { value })
3323            }
3324
3325            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
3326            where
3327                E: de::Error,
3328            {
3329                Ok(GetNetworkHashPsResponse { value: v as u64 })
3330            }
3331
3332            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
3333            where
3334                M: de::MapAccess<'de>,
3335            {
3336                let mut value = None;
3337                while let Some(key) = map.next_key::<String>()? {
3338                    if key == "value" {
3339                        if value.is_some() {
3340                            return Err(de::Error::duplicate_field("value"));
3341                        }
3342                        value = Some(map.next_value()?);
3343                    } else {
3344                        let _ = map.next_value::<de::IgnoredAny>()?;
3345                    }
3346                }
3347                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
3348                Ok(GetNetworkHashPsResponse { value })
3349            }
3350        }
3351
3352        deserializer.deserialize_any(PrimitiveWrapperVisitor)
3353    }
3354}
3355
3356impl std::ops::Deref for GetNetworkHashPsResponse {
3357    type Target = u64;
3358    fn deref(&self) -> &Self::Target { &self.value }
3359}
3360
3361impl std::ops::DerefMut for GetNetworkHashPsResponse {
3362    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
3363}
3364
3365impl AsRef<u64> for GetNetworkHashPsResponse {
3366    fn as_ref(&self) -> &u64 { &self.value }
3367}
3368
3369impl From<u64> for GetNetworkHashPsResponse {
3370    fn from(value: u64) -> Self { Self { value } }
3371}
3372
3373impl From<GetNetworkHashPsResponse> for u64 {
3374    fn from(wrapper: GetNetworkHashPsResponse) -> Self { wrapper.value }
3375}
3376
3377/// Response for the `GetNetworkInfo` RPC method
3378///
3379#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3380#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3381pub struct GetNetworkInfoResponse {
3382    /// the total number of connections
3383    pub connections: u64,
3384    /// the number of inbound connections
3385    pub connections_in: u64,
3386    /// the number of outbound connections
3387    pub connections_out: u64,
3388    /// minimum fee rate increment for mempool limiting or replacement in BTC/kvB
3389    pub incrementalfee: f64,
3390    /// list of local addresses
3391    pub localaddresses: serde_json::Value,
3392    /// true if transaction relay is requested from peers
3393    pub localrelay: bool,
3394    /// the services we offer to the network
3395    pub localservices: String,
3396    /// the services we offer to the network, in human-readable form
3397    pub localservicesnames: Vec<String>,
3398    /// whether p2p networking is enabled
3399    pub networkactive: bool,
3400    /// information per network
3401    pub networks: serde_json::Value,
3402    /// the protocol version
3403    pub protocolversion: u64,
3404    /// minimum relay fee rate for transactions in BTC/kvB
3405    pub relayfee: f64,
3406    /// the server subversion string
3407    pub subversion: String,
3408    /// the time offset
3409    pub timeoffset: u64,
3410    /// the server version
3411    pub version: u32,
3412    /// any network and blockchain warnings (run with `-deprecatedrpc=warnings` to return the latest warning as a single string)
3413    pub warnings: Vec<String>,
3414}
3415
3416/// Response for the `GetNewAddress` RPC method
3417///
3418/// This method returns a primitive value wrapped in a transparent struct.
3419#[derive(Debug, Clone, PartialEq, Serialize)]
3420pub struct GetNewAddressResponse {
3421    /// Wrapped primitive value
3422    pub value: String,
3423}
3424
3425impl<'de> serde::Deserialize<'de> for GetNewAddressResponse {
3426    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3427    where
3428        D: serde::Deserializer<'de>,
3429    {
3430        use std::fmt;
3431
3432        use serde::de::{self, Visitor};
3433
3434        struct PrimitiveWrapperVisitor;
3435
3436        #[allow(unused_variables, clippy::needless_lifetimes)]
3437        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
3438            type Value = GetNewAddressResponse;
3439
3440            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3441                formatter.write_str("a primitive value or an object with 'value' field")
3442            }
3443
3444            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
3445            where
3446                E: de::Error,
3447            {
3448                Ok(GetNewAddressResponse { value: v.to_string() })
3449            }
3450
3451            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
3452            where
3453                E: de::Error,
3454            {
3455                Ok(GetNewAddressResponse { value: v.to_string() })
3456            }
3457
3458            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
3459            where
3460                E: de::Error,
3461            {
3462                Ok(GetNewAddressResponse { value: v.to_string() })
3463            }
3464
3465            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
3466            where
3467                E: de::Error,
3468            {
3469                Ok(GetNewAddressResponse { value: v.to_string() })
3470            }
3471
3472            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
3473            where
3474                E: de::Error,
3475            {
3476                Ok(GetNewAddressResponse { value: v.to_string() })
3477            }
3478
3479            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
3480            where
3481                M: de::MapAccess<'de>,
3482            {
3483                let mut value = None;
3484                while let Some(key) = map.next_key::<String>()? {
3485                    if key == "value" {
3486                        if value.is_some() {
3487                            return Err(de::Error::duplicate_field("value"));
3488                        }
3489                        value = Some(map.next_value()?);
3490                    } else {
3491                        let _ = map.next_value::<de::IgnoredAny>()?;
3492                    }
3493                }
3494                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
3495                Ok(GetNewAddressResponse { value })
3496            }
3497        }
3498
3499        deserializer.deserialize_any(PrimitiveWrapperVisitor)
3500    }
3501}
3502
3503impl std::ops::Deref for GetNewAddressResponse {
3504    type Target = String;
3505    fn deref(&self) -> &Self::Target { &self.value }
3506}
3507
3508impl std::ops::DerefMut for GetNewAddressResponse {
3509    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
3510}
3511
3512impl AsRef<String> for GetNewAddressResponse {
3513    fn as_ref(&self) -> &String { &self.value }
3514}
3515
3516impl From<String> for GetNewAddressResponse {
3517    fn from(value: String) -> Self { Self { value } }
3518}
3519
3520impl From<GetNewAddressResponse> for String {
3521    fn from(wrapper: GetNewAddressResponse) -> Self { wrapper.value }
3522}
3523
3524/// Response for the `GetNodeAddresses` RPC method
3525///
3526/// This method returns an array wrapped in a transparent struct.
3527#[derive(Debug, Clone, PartialEq, Serialize)]
3528pub struct GetNodeAddressesResponse {
3529    /// Wrapped array value
3530    pub value: Vec<serde_json::Value>,
3531}
3532
3533impl<'de> serde::Deserialize<'de> for GetNodeAddressesResponse {
3534    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3535    where
3536        D: serde::Deserializer<'de>,
3537    {
3538        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
3539        Ok(Self { value })
3540    }
3541}
3542
3543impl From<Vec<serde_json::Value>> for GetNodeAddressesResponse {
3544    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
3545}
3546
3547impl From<GetNodeAddressesResponse> for Vec<serde_json::Value> {
3548    fn from(wrapper: GetNodeAddressesResponse) -> Self { wrapper.value }
3549}
3550
3551/// Response for the `GetOrphanTxs` RPC method
3552///
3553/// This method returns an array wrapped in a transparent struct.
3554#[derive(Debug, Clone, PartialEq, Serialize)]
3555pub struct GetOrphanTxsResponse {
3556    /// Wrapped array value
3557    pub value: Vec<serde_json::Value>,
3558}
3559
3560impl<'de> serde::Deserialize<'de> for GetOrphanTxsResponse {
3561    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3562    where
3563        D: serde::Deserializer<'de>,
3564    {
3565        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
3566        Ok(Self { value })
3567    }
3568}
3569
3570impl From<Vec<serde_json::Value>> for GetOrphanTxsResponse {
3571    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
3572}
3573
3574impl From<GetOrphanTxsResponse> for Vec<serde_json::Value> {
3575    fn from(wrapper: GetOrphanTxsResponse) -> Self { wrapper.value }
3576}
3577
3578/// Response for the `GetPeerInfo` RPC method
3579///
3580/// This method returns an array wrapped in a transparent struct.
3581#[derive(Debug, Clone, PartialEq, Serialize)]
3582pub struct GetPeerInfoResponse {
3583    /// Wrapped array value
3584    pub value: Vec<serde_json::Value>,
3585}
3586
3587impl<'de> serde::Deserialize<'de> for GetPeerInfoResponse {
3588    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3589    where
3590        D: serde::Deserializer<'de>,
3591    {
3592        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
3593        Ok(Self { value })
3594    }
3595}
3596
3597impl From<Vec<serde_json::Value>> for GetPeerInfoResponse {
3598    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
3599}
3600
3601impl From<GetPeerInfoResponse> for Vec<serde_json::Value> {
3602    fn from(wrapper: GetPeerInfoResponse) -> Self { wrapper.value }
3603}
3604
3605/// Response for the `GetPrioritisedTransactions` RPC method
3606///
3607/// prioritisation keyed by txid
3608#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3609#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3610pub struct GetPrioritisedTransactionsResponse {
3611    #[serde(rename = "<transactionid>")]
3612    pub transactionid: serde_json::Value,
3613}
3614
3615/// Response for the `GetRawAddrMan` RPC method
3616///
3617#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
3618#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
3619pub struct GetRawAddrManResponse {
3620    /// buckets with addresses in the address manager table ( new, tried )
3621    #[serde(default)]
3622    pub table: Option<serde_json::Value>,
3623}
3624
3625/// Response for the `GetRawChangeAddress` RPC method
3626///
3627/// This method returns a primitive value wrapped in a transparent struct.
3628#[derive(Debug, Clone, PartialEq, Serialize)]
3629pub struct GetRawChangeAddressResponse {
3630    /// Wrapped primitive value
3631    pub value: String,
3632}
3633
3634impl<'de> serde::Deserialize<'de> for GetRawChangeAddressResponse {
3635    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3636    where
3637        D: serde::Deserializer<'de>,
3638    {
3639        use std::fmt;
3640
3641        use serde::de::{self, Visitor};
3642
3643        struct PrimitiveWrapperVisitor;
3644
3645        #[allow(unused_variables, clippy::needless_lifetimes)]
3646        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
3647            type Value = GetRawChangeAddressResponse;
3648
3649            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3650                formatter.write_str("a primitive value or an object with 'value' field")
3651            }
3652
3653            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
3654            where
3655                E: de::Error,
3656            {
3657                Ok(GetRawChangeAddressResponse { value: v.to_string() })
3658            }
3659
3660            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
3661            where
3662                E: de::Error,
3663            {
3664                Ok(GetRawChangeAddressResponse { value: v.to_string() })
3665            }
3666
3667            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
3668            where
3669                E: de::Error,
3670            {
3671                Ok(GetRawChangeAddressResponse { value: v.to_string() })
3672            }
3673
3674            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
3675            where
3676                E: de::Error,
3677            {
3678                Ok(GetRawChangeAddressResponse { value: v.to_string() })
3679            }
3680
3681            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
3682            where
3683                E: de::Error,
3684            {
3685                Ok(GetRawChangeAddressResponse { value: v.to_string() })
3686            }
3687
3688            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
3689            where
3690                M: de::MapAccess<'de>,
3691            {
3692                let mut value = None;
3693                while let Some(key) = map.next_key::<String>()? {
3694                    if key == "value" {
3695                        if value.is_some() {
3696                            return Err(de::Error::duplicate_field("value"));
3697                        }
3698                        value = Some(map.next_value()?);
3699                    } else {
3700                        let _ = map.next_value::<de::IgnoredAny>()?;
3701                    }
3702                }
3703                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
3704                Ok(GetRawChangeAddressResponse { value })
3705            }
3706        }
3707
3708        deserializer.deserialize_any(PrimitiveWrapperVisitor)
3709    }
3710}
3711
3712impl std::ops::Deref for GetRawChangeAddressResponse {
3713    type Target = String;
3714    fn deref(&self) -> &Self::Target { &self.value }
3715}
3716
3717impl std::ops::DerefMut for GetRawChangeAddressResponse {
3718    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
3719}
3720
3721impl AsRef<String> for GetRawChangeAddressResponse {
3722    fn as_ref(&self) -> &String { &self.value }
3723}
3724
3725impl From<String> for GetRawChangeAddressResponse {
3726    fn from(value: String) -> Self { Self { value } }
3727}
3728
3729impl From<GetRawChangeAddressResponse> for String {
3730    fn from(wrapper: GetRawChangeAddressResponse) -> Self { wrapper.value }
3731}
3732
3733/// Response for the `GetRawMempool` RPC method
3734///
3735/// This method returns an array wrapped in a transparent struct.
3736#[derive(Debug, Clone, PartialEq, Serialize)]
3737pub struct GetRawMempoolResponse {
3738    /// Wrapped array value
3739    pub value: Vec<serde_json::Value>,
3740}
3741
3742impl<'de> serde::Deserialize<'de> for GetRawMempoolResponse {
3743    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3744    where
3745        D: serde::Deserializer<'de>,
3746    {
3747        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
3748        Ok(Self { value })
3749    }
3750}
3751
3752impl From<Vec<serde_json::Value>> for GetRawMempoolResponse {
3753    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
3754}
3755
3756impl From<GetRawMempoolResponse> for Vec<serde_json::Value> {
3757    fn from(wrapper: GetRawMempoolResponse) -> Self { wrapper.value }
3758}
3759
3760/// Response for the `GetRawTransaction` RPC method
3761///
3762#[derive(Debug, Clone, PartialEq, Serialize)]
3763pub struct GetRawTransactionResponse {
3764    /// the block hash
3765    pub blockhash: Option<bitcoin::BlockHash>,
3766    /// The block time expressed in UNIX epoch time
3767    pub blocktime: Option<u64>,
3768    /// The confirmations
3769    pub confirmations: Option<i64>,
3770    /// The serialized transaction as a hex-encoded string for 'txid'
3771    pub data: Option<String>,
3772    /// transaction fee in BTC, omitted if block undo data is not available
3773    pub fee: Option<f64>,
3774    /// Same output as verbosity = 1
3775    pub field_16: Option<serde_json::Value>,
3776    /// The transaction hash (differs from txid for witness transactions)
3777    pub hash: Option<String>,
3778    /// The serialized, hex-encoded data for 'txid'
3779    pub hex: Option<String>,
3780    /// Whether specified block is in the active chain or not (only present with explicit "blockhash" argument)
3781    pub in_active_chain: Option<bool>,
3782    /// The lock time
3783    pub locktime: Option<u64>,
3784    /// The serialized transaction size
3785    pub size: Option<u64>,
3786    /// Same as "blocktime"
3787    pub time: Option<u64>,
3788    /// The transaction id (same as provided)
3789    pub txid: Option<bitcoin::Txid>,
3790    /// The version
3791    pub version: Option<u32>,
3792    pub vin: Option<serde_json::Value>,
3793    pub vin_1: Option<serde_json::Value>,
3794    pub vout: Option<serde_json::Value>,
3795    /// The virtual transaction size (differs from size for witness transactions)
3796    pub vsize: Option<u64>,
3797    /// The transaction's weight (between vsize*4-3 and vsize*4)
3798    pub weight: Option<u64>,
3799}
3800impl<'de> serde::Deserialize<'de> for GetRawTransactionResponse {
3801    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3802    where
3803        D: serde::Deserializer<'de>,
3804    {
3805        use std::fmt;
3806
3807        use serde::de::{self, Visitor};
3808
3809        struct ConditionalResponseVisitor;
3810
3811        #[allow(clippy::needless_lifetimes)]
3812        impl<'de> Visitor<'de> for ConditionalResponseVisitor {
3813            type Value = GetRawTransactionResponse;
3814
3815            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3816                formatter.write_str("string or object")
3817            }
3818
3819            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
3820            where
3821                E: de::Error,
3822            {
3823                let data = v.to_string();
3824                Ok(GetRawTransactionResponse {
3825                    blockhash: None,
3826                    blocktime: None,
3827                    confirmations: None,
3828                    data: Some(data),
3829                    fee: None,
3830                    field_16: None,
3831                    hash: None,
3832                    hex: None,
3833                    in_active_chain: None,
3834                    locktime: None,
3835                    size: None,
3836                    time: None,
3837                    txid: None,
3838                    version: None,
3839                    vin: None,
3840                    vin_1: None,
3841                    vout: None,
3842                    vsize: None,
3843                    weight: None,
3844                })
3845            }
3846
3847            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
3848            where
3849                M: de::MapAccess<'de>,
3850            {
3851                let mut blockhash = None;
3852                let mut blocktime = None;
3853                let mut confirmations = None;
3854                let mut data = None;
3855                let mut fee = None;
3856                let mut field_16 = None;
3857                let mut hash = None;
3858                let mut hex = None;
3859                let mut in_active_chain = None;
3860                let mut locktime = None;
3861                let mut size = None;
3862                let mut time = None;
3863                let mut txid = None;
3864                let mut version = None;
3865                let mut vin = None;
3866                let mut vin_1 = None;
3867                let mut vout = None;
3868                let mut vsize = None;
3869                let mut weight = None;
3870                while let Some(key) = map.next_key::<String>()? {
3871                    if key == "blockhash" {
3872                        if blockhash.is_some() {
3873                            return Err(de::Error::duplicate_field("blockhash"));
3874                        }
3875                        blockhash = Some(map.next_value::<bitcoin::BlockHash>()?);
3876                    }
3877                    if key == "blocktime" {
3878                        if blocktime.is_some() {
3879                            return Err(de::Error::duplicate_field("blocktime"));
3880                        }
3881                        blocktime = Some(map.next_value::<u64>()?);
3882                    }
3883                    if key == "confirmations" {
3884                        if confirmations.is_some() {
3885                            return Err(de::Error::duplicate_field("confirmations"));
3886                        }
3887                        confirmations = Some(map.next_value::<i64>()?);
3888                    }
3889                    if key == "data" {
3890                        if data.is_some() {
3891                            return Err(de::Error::duplicate_field("data"));
3892                        }
3893                        data = Some(map.next_value::<String>()?);
3894                    }
3895                    if key == "fee" {
3896                        if fee.is_some() {
3897                            return Err(de::Error::duplicate_field("fee"));
3898                        }
3899                        fee = Some(map.next_value::<f64>()?);
3900                    }
3901                    if key == "field_16" {
3902                        if field_16.is_some() {
3903                            return Err(de::Error::duplicate_field("field_16"));
3904                        }
3905                        field_16 = Some(map.next_value::<serde_json::Value>()?);
3906                    }
3907                    if key == "hash" {
3908                        if hash.is_some() {
3909                            return Err(de::Error::duplicate_field("hash"));
3910                        }
3911                        hash = Some(map.next_value::<String>()?);
3912                    }
3913                    if key == "hex" {
3914                        if hex.is_some() {
3915                            return Err(de::Error::duplicate_field("hex"));
3916                        }
3917                        hex = Some(map.next_value::<String>()?);
3918                    }
3919                    if key == "in_active_chain" {
3920                        if in_active_chain.is_some() {
3921                            return Err(de::Error::duplicate_field("in_active_chain"));
3922                        }
3923                        in_active_chain = Some(map.next_value::<bool>()?);
3924                    }
3925                    if key == "locktime" {
3926                        if locktime.is_some() {
3927                            return Err(de::Error::duplicate_field("locktime"));
3928                        }
3929                        locktime = Some(map.next_value::<u64>()?);
3930                    }
3931                    if key == "size" {
3932                        if size.is_some() {
3933                            return Err(de::Error::duplicate_field("size"));
3934                        }
3935                        size = Some(map.next_value::<u64>()?);
3936                    }
3937                    if key == "time" {
3938                        if time.is_some() {
3939                            return Err(de::Error::duplicate_field("time"));
3940                        }
3941                        time = Some(map.next_value::<u64>()?);
3942                    }
3943                    if key == "txid" {
3944                        if txid.is_some() {
3945                            return Err(de::Error::duplicate_field("txid"));
3946                        }
3947                        txid = Some(map.next_value::<bitcoin::Txid>()?);
3948                    }
3949                    if key == "version" {
3950                        if version.is_some() {
3951                            return Err(de::Error::duplicate_field("version"));
3952                        }
3953                        version = Some(map.next_value::<u32>()?);
3954                    }
3955                    if key == "vin" {
3956                        if vin.is_some() {
3957                            return Err(de::Error::duplicate_field("vin"));
3958                        }
3959                        vin = Some(map.next_value::<serde_json::Value>()?);
3960                    }
3961                    if key == "vin_1" {
3962                        if vin_1.is_some() {
3963                            return Err(de::Error::duplicate_field("vin_1"));
3964                        }
3965                        vin_1 = Some(map.next_value::<serde_json::Value>()?);
3966                    }
3967                    if key == "vout" {
3968                        if vout.is_some() {
3969                            return Err(de::Error::duplicate_field("vout"));
3970                        }
3971                        vout = Some(map.next_value::<serde_json::Value>()?);
3972                    }
3973                    if key == "vsize" {
3974                        if vsize.is_some() {
3975                            return Err(de::Error::duplicate_field("vsize"));
3976                        }
3977                        vsize = Some(map.next_value::<u64>()?);
3978                    }
3979                    if key == "weight" {
3980                        if weight.is_some() {
3981                            return Err(de::Error::duplicate_field("weight"));
3982                        }
3983                        weight = Some(map.next_value::<u64>()?);
3984                    } else {
3985                        let _ = map.next_value::<de::IgnoredAny>()?;
3986                    }
3987                }
3988                Ok(GetRawTransactionResponse {
3989                    blockhash,
3990                    blocktime,
3991                    confirmations,
3992                    data,
3993                    fee,
3994                    field_16,
3995                    hash,
3996                    hex,
3997                    in_active_chain,
3998                    locktime,
3999                    size,
4000                    time,
4001                    txid,
4002                    version,
4003                    vin,
4004                    vin_1,
4005                    vout,
4006                    vsize,
4007                    weight,
4008                })
4009            }
4010        }
4011
4012        deserializer.deserialize_any(ConditionalResponseVisitor)
4013    }
4014}
4015
4016/// Response for the `GetReceivedByAddress` RPC method
4017///
4018/// This method returns a primitive value wrapped in a transparent struct.
4019#[derive(Debug, Clone, PartialEq, Serialize)]
4020pub struct GetReceivedByAddressResponse {
4021    /// Wrapped primitive value
4022    pub value: bitcoin::Amount,
4023}
4024
4025impl<'de> serde::Deserialize<'de> for GetReceivedByAddressResponse {
4026    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4027    where
4028        D: serde::Deserializer<'de>,
4029    {
4030        use std::fmt;
4031
4032        use serde::de::{self, Visitor};
4033
4034        struct PrimitiveWrapperVisitor;
4035
4036        #[allow(unused_variables, clippy::needless_lifetimes)]
4037        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
4038            type Value = GetReceivedByAddressResponse;
4039
4040            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
4041                formatter.write_str("a primitive value or an object with 'value' field")
4042            }
4043
4044            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
4045            where
4046                E: de::Error,
4047            {
4048                Ok(GetReceivedByAddressResponse { value: bitcoin::Amount::from_sat(v) })
4049            }
4050
4051            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
4052            where
4053                E: de::Error,
4054            {
4055                if v < 0 {
4056                    return Err(de::Error::custom(format!("Amount cannot be negative: {}", v)));
4057                }
4058                Ok(GetReceivedByAddressResponse { value: bitcoin::Amount::from_sat(v as u64) })
4059            }
4060
4061            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
4062            where
4063                E: de::Error,
4064            {
4065                let amount = bitcoin::Amount::from_btc(v)
4066                    .map_err(|e| de::Error::custom(format!("Invalid BTC amount: {}", e)))?;
4067                Ok(GetReceivedByAddressResponse { value: amount })
4068            }
4069
4070            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
4071            where
4072                E: de::Error,
4073            {
4074                let value = v.parse::<bitcoin::Amount>().map_err(de::Error::custom)?;
4075                Ok(GetReceivedByAddressResponse { value })
4076            }
4077
4078            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
4079            where
4080                E: de::Error,
4081            {
4082                Err(de::Error::custom("cannot convert bool to bitcoin::Amount"))
4083            }
4084
4085            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
4086            where
4087                M: de::MapAccess<'de>,
4088            {
4089                let mut value = None;
4090                while let Some(key) = map.next_key::<String>()? {
4091                    if key == "value" {
4092                        if value.is_some() {
4093                            return Err(de::Error::duplicate_field("value"));
4094                        }
4095                        value = Some(map.next_value()?);
4096                    } else {
4097                        let _ = map.next_value::<de::IgnoredAny>()?;
4098                    }
4099                }
4100                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
4101                Ok(GetReceivedByAddressResponse { value })
4102            }
4103        }
4104
4105        deserializer.deserialize_any(PrimitiveWrapperVisitor)
4106    }
4107}
4108
4109impl std::ops::Deref for GetReceivedByAddressResponse {
4110    type Target = bitcoin::Amount;
4111    fn deref(&self) -> &Self::Target { &self.value }
4112}
4113
4114impl std::ops::DerefMut for GetReceivedByAddressResponse {
4115    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
4116}
4117
4118impl AsRef<bitcoin::Amount> for GetReceivedByAddressResponse {
4119    fn as_ref(&self) -> &bitcoin::Amount { &self.value }
4120}
4121
4122impl From<bitcoin::Amount> for GetReceivedByAddressResponse {
4123    fn from(value: bitcoin::Amount) -> Self { Self { value } }
4124}
4125
4126impl From<GetReceivedByAddressResponse> for bitcoin::Amount {
4127    fn from(wrapper: GetReceivedByAddressResponse) -> Self { wrapper.value }
4128}
4129
4130/// Response for the `GetReceivedByLabel` RPC method
4131///
4132/// This method returns a primitive value wrapped in a transparent struct.
4133#[derive(Debug, Clone, PartialEq, Serialize)]
4134pub struct GetReceivedByLabelResponse {
4135    /// Wrapped primitive value
4136    pub value: bitcoin::Amount,
4137}
4138
4139impl<'de> serde::Deserialize<'de> for GetReceivedByLabelResponse {
4140    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4141    where
4142        D: serde::Deserializer<'de>,
4143    {
4144        use std::fmt;
4145
4146        use serde::de::{self, Visitor};
4147
4148        struct PrimitiveWrapperVisitor;
4149
4150        #[allow(unused_variables, clippy::needless_lifetimes)]
4151        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
4152            type Value = GetReceivedByLabelResponse;
4153
4154            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
4155                formatter.write_str("a primitive value or an object with 'value' field")
4156            }
4157
4158            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
4159            where
4160                E: de::Error,
4161            {
4162                Ok(GetReceivedByLabelResponse { value: bitcoin::Amount::from_sat(v) })
4163            }
4164
4165            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
4166            where
4167                E: de::Error,
4168            {
4169                if v < 0 {
4170                    return Err(de::Error::custom(format!("Amount cannot be negative: {}", v)));
4171                }
4172                Ok(GetReceivedByLabelResponse { value: bitcoin::Amount::from_sat(v as u64) })
4173            }
4174
4175            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
4176            where
4177                E: de::Error,
4178            {
4179                let amount = bitcoin::Amount::from_btc(v)
4180                    .map_err(|e| de::Error::custom(format!("Invalid BTC amount: {}", e)))?;
4181                Ok(GetReceivedByLabelResponse { value: amount })
4182            }
4183
4184            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
4185            where
4186                E: de::Error,
4187            {
4188                let value = v.parse::<bitcoin::Amount>().map_err(de::Error::custom)?;
4189                Ok(GetReceivedByLabelResponse { value })
4190            }
4191
4192            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
4193            where
4194                E: de::Error,
4195            {
4196                Err(de::Error::custom("cannot convert bool to bitcoin::Amount"))
4197            }
4198
4199            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
4200            where
4201                M: de::MapAccess<'de>,
4202            {
4203                let mut value = None;
4204                while let Some(key) = map.next_key::<String>()? {
4205                    if key == "value" {
4206                        if value.is_some() {
4207                            return Err(de::Error::duplicate_field("value"));
4208                        }
4209                        value = Some(map.next_value()?);
4210                    } else {
4211                        let _ = map.next_value::<de::IgnoredAny>()?;
4212                    }
4213                }
4214                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
4215                Ok(GetReceivedByLabelResponse { value })
4216            }
4217        }
4218
4219        deserializer.deserialize_any(PrimitiveWrapperVisitor)
4220    }
4221}
4222
4223impl std::ops::Deref for GetReceivedByLabelResponse {
4224    type Target = bitcoin::Amount;
4225    fn deref(&self) -> &Self::Target { &self.value }
4226}
4227
4228impl std::ops::DerefMut for GetReceivedByLabelResponse {
4229    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
4230}
4231
4232impl AsRef<bitcoin::Amount> for GetReceivedByLabelResponse {
4233    fn as_ref(&self) -> &bitcoin::Amount { &self.value }
4234}
4235
4236impl From<bitcoin::Amount> for GetReceivedByLabelResponse {
4237    fn from(value: bitcoin::Amount) -> Self { Self { value } }
4238}
4239
4240impl From<GetReceivedByLabelResponse> for bitcoin::Amount {
4241    fn from(wrapper: GetReceivedByLabelResponse) -> Self { wrapper.value }
4242}
4243
4244/// Response for the `GetRpcInfo` RPC method
4245///
4246#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4247#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
4248pub struct GetRpcInfoResponse {
4249    /// All active commands
4250    pub active_commands: serde_json::Value,
4251    /// The complete file path to the debug log
4252    pub logpath: String,
4253}
4254
4255/// Response for the `GetTransaction` RPC method
4256///
4257#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4258#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
4259pub struct GetTransactionResponse {
4260    /// The amount in BTC
4261    #[serde(deserialize_with = "amount_from_btc_float")]
4262    pub amount: bitcoin::Amount,
4263    /// ("yes|no|unknown") Whether this transaction signals BIP125 replaceability or has an unconfirmed ancestor signaling BIP125 replaceability.
4264    /// May be unknown for unconfirmed transactions not in the mempool because their unconfirmed ancestors are unknown.
4265    #[serde(rename = "bip125-replaceable")]
4266    pub bip125_replaceable: String,
4267    /// The block hash containing the transaction.
4268    pub blockhash: Option<bitcoin::BlockHash>,
4269    /// The block height containing the transaction.
4270    pub blockheight: Option<u64>,
4271    /// The index of the transaction in the block that includes it.
4272    pub blockindex: Option<u64>,
4273    /// The block time expressed in UNIX epoch time.
4274    pub blocktime: Option<u64>,
4275    /// If a comment is associated with the transaction, only present if not empty.
4276    pub comment: Option<String>,
4277    /// The number of confirmations for the transaction. Negative confirmations means the
4278    /// transaction conflicted that many blocks ago.
4279    pub confirmations: i64,
4280    /// The decoded transaction (only present when `verbose` is passed)
4281    pub decoded: Option<serde_json::Value>,
4282    pub details: serde_json::Value,
4283    /// The amount of the fee in BTC. This is negative and only available for the
4284    /// 'send' category of transactions.
4285    #[serde(deserialize_with = "option_amount_from_btc_float")]
4286    pub fee: Option<bitcoin::Amount>,
4287    /// Only present if the transaction's only input is a coinbase one.
4288    pub generated: Option<bool>,
4289    /// Raw data for transaction
4290    pub hex: String,
4291    /// hash and height of the block this information was generated on
4292    pub lastprocessedblock: serde_json::Value,
4293    /// Transactions in the mempool that directly conflict with either this transaction or an ancestor transaction
4294    pub mempoolconflicts: Vec<String>,
4295    /// Only if 'category' is 'received'. List of parent descriptors for the output script of this coin.
4296    pub parent_descs: Option<Vec<String>>,
4297    /// Only if 'category' is 'send'. The txid if this tx was replaced.
4298    pub replaced_by_txid: Option<String>,
4299    /// Only if 'category' is 'send'. The txid if this tx replaces another.
4300    pub replaces_txid: Option<String>,
4301    /// The transaction time expressed in UNIX epoch time.
4302    pub time: u64,
4303    /// The time received expressed in UNIX epoch time.
4304    pub timereceived: u64,
4305    /// If a comment to is associated with the transaction.
4306    pub to: Option<String>,
4307    /// Whether we consider the transaction to be trusted and safe to spend from.
4308    /// Only present when the transaction has 0 confirmations (or negative confirmations, if conflicted).
4309    pub trusted: Option<bool>,
4310    /// The transaction id.
4311    pub txid: bitcoin::Txid,
4312    /// Confirmed transactions that have been detected by the wallet to conflict with this transaction.
4313    pub walletconflicts: Vec<String>,
4314    /// The hash of serialized transaction, including witness data.
4315    pub wtxid: String,
4316}
4317
4318/// Response for the `GetTxOut` RPC method
4319///
4320#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4321#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
4322pub struct GetTxOutResponse {
4323    /// The hash of the block at the tip of the chain
4324    pub bestblock: String,
4325    /// Coinbase or not
4326    pub coinbase: bool,
4327    /// The number of confirmations
4328    pub confirmations: i64,
4329    #[serde(default)]
4330    pub field_0: Option<()>,
4331    pub scriptPubKey: serde_json::Value,
4332    /// The transaction value in BTC
4333    #[serde(deserialize_with = "amount_from_btc_float")]
4334    pub value: bitcoin::Amount,
4335}
4336
4337/// Response for the `GetTxOutProof` RPC method
4338///
4339/// This method returns a primitive value wrapped in a transparent struct.
4340#[derive(Debug, Clone, PartialEq, Serialize)]
4341pub struct GetTxOutProofResponse {
4342    /// Wrapped primitive value
4343    pub value: String,
4344}
4345
4346impl<'de> serde::Deserialize<'de> for GetTxOutProofResponse {
4347    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4348    where
4349        D: serde::Deserializer<'de>,
4350    {
4351        use std::fmt;
4352
4353        use serde::de::{self, Visitor};
4354
4355        struct PrimitiveWrapperVisitor;
4356
4357        #[allow(unused_variables, clippy::needless_lifetimes)]
4358        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
4359            type Value = GetTxOutProofResponse;
4360
4361            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
4362                formatter.write_str("a primitive value or an object with 'value' field")
4363            }
4364
4365            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
4366            where
4367                E: de::Error,
4368            {
4369                Ok(GetTxOutProofResponse { value: v.to_string() })
4370            }
4371
4372            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
4373            where
4374                E: de::Error,
4375            {
4376                Ok(GetTxOutProofResponse { value: v.to_string() })
4377            }
4378
4379            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
4380            where
4381                E: de::Error,
4382            {
4383                Ok(GetTxOutProofResponse { value: v.to_string() })
4384            }
4385
4386            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
4387            where
4388                E: de::Error,
4389            {
4390                Ok(GetTxOutProofResponse { value: v.to_string() })
4391            }
4392
4393            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
4394            where
4395                E: de::Error,
4396            {
4397                Ok(GetTxOutProofResponse { value: v.to_string() })
4398            }
4399
4400            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
4401            where
4402                M: de::MapAccess<'de>,
4403            {
4404                let mut value = None;
4405                while let Some(key) = map.next_key::<String>()? {
4406                    if key == "value" {
4407                        if value.is_some() {
4408                            return Err(de::Error::duplicate_field("value"));
4409                        }
4410                        value = Some(map.next_value()?);
4411                    } else {
4412                        let _ = map.next_value::<de::IgnoredAny>()?;
4413                    }
4414                }
4415                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
4416                Ok(GetTxOutProofResponse { value })
4417            }
4418        }
4419
4420        deserializer.deserialize_any(PrimitiveWrapperVisitor)
4421    }
4422}
4423
4424impl std::ops::Deref for GetTxOutProofResponse {
4425    type Target = String;
4426    fn deref(&self) -> &Self::Target { &self.value }
4427}
4428
4429impl std::ops::DerefMut for GetTxOutProofResponse {
4430    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
4431}
4432
4433impl AsRef<String> for GetTxOutProofResponse {
4434    fn as_ref(&self) -> &String { &self.value }
4435}
4436
4437impl From<String> for GetTxOutProofResponse {
4438    fn from(value: String) -> Self { Self { value } }
4439}
4440
4441impl From<GetTxOutProofResponse> for String {
4442    fn from(wrapper: GetTxOutProofResponse) -> Self { wrapper.value }
4443}
4444
4445/// Response for the `GetTxOutSetInfo` RPC method
4446///
4447#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4448#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
4449pub struct GetTxOutSetInfoResponse {
4450    /// The hash of the block at which these statistics are calculated
4451    pub bestblock: String,
4452    /// Info on amounts in the block at this block height (only available if coinstatsindex is used)
4453    pub block_info: Option<serde_json::Value>,
4454    /// Database-independent, meaningless metric indicating the UTXO set size
4455    pub bogosize: u64,
4456    /// The estimated size of the chainstate on disk (not available when coinstatsindex is used)
4457    pub disk_size: Option<u64>,
4458    /// The serialized hash (only present if 'hash_serialized_3' hash_type is chosen)
4459    pub hash_serialized_3: Option<String>,
4460    /// The block height (index) of the returned statistics
4461    pub height: u64,
4462    /// The serialized hash (only present if 'muhash' hash_type is chosen)
4463    pub muhash: Option<String>,
4464    /// The total amount of coins in the UTXO set
4465    #[serde(deserialize_with = "amount_from_btc_float")]
4466    pub total_amount: bitcoin::Amount,
4467    /// The total amount of coins permanently excluded from the UTXO set (only available if coinstatsindex is used)
4468    #[serde(default)]
4469    #[serde(deserialize_with = "option_amount_from_btc_float")]
4470    pub total_unspendable_amount: Option<bitcoin::Amount>,
4471    /// The number of transactions with unspent outputs (not available when coinstatsindex is used)
4472    pub transactions: Option<u64>,
4473    /// The number of unspent transaction outputs
4474    pub txouts: u64,
4475}
4476
4477/// Response for the `GetTxSpendingPrevOut` RPC method
4478///
4479#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4480#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
4481pub struct GetTxSpendingPrevOutResponse {
4482    pub field: serde_json::Value,
4483}
4484
4485/// Response for the `GetWalletInfo` RPC method
4486///
4487#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4488#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
4489pub struct GetWalletInfoResponse {
4490    /// whether this wallet tracks clean/dirty coins in terms of reuse
4491    pub avoid_reuse: bool,
4492    /// The start time for blocks scanning. It could be modified by (re)importing any descriptor with an earlier timestamp.
4493    pub birthtime: Option<u64>,
4494    /// Whether this wallet intentionally does not contain any keys, scripts, or descriptors
4495    pub blank: bool,
4496    /// whether this wallet uses descriptors for output script management
4497    pub descriptors: bool,
4498    /// whether this wallet is configured to use an external signer such as a hardware wallet
4499    pub external_signer: bool,
4500    /// The flags currently set on the wallet
4501    pub flags: Vec<String>,
4502    /// the database format (only sqlite)
4503    pub format: String,
4504    /// how many new keys are pre-generated (only counts external keys)
4505    pub keypoolsize: u64,
4506    /// 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)
4507    pub keypoolsize_hd_internal: Option<u64>,
4508    /// hash and height of the block this information was generated on
4509    pub lastprocessedblock: serde_json::Value,
4510    /// the transaction fee configuration, set in BTC/kvB
4511    #[serde(deserialize_with = "amount_from_btc_float")]
4512    pub paytxfee: bitcoin::Amount,
4513    /// false if privatekeys are disabled for this wallet (enforced watch-only wallet)
4514    pub private_keys_enabled: bool,
4515    /// current scanning details, or false if no scan is in progress
4516    pub scanning: serde_json::Value,
4517    /// the total number of transactions in the wallet
4518    pub txcount: u64,
4519    /// 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)
4520    pub unlocked_until: Option<u64>,
4521    /// the wallet name
4522    pub walletname: String,
4523    /// (DEPRECATED) only related to unsupported legacy wallet, returns the latest version 169900 for backwards compatibility
4524    pub walletversion: u64,
4525}
4526
4527/// Response for the `Help` RPC method
4528///
4529/// This method returns a primitive value wrapped in a transparent struct.
4530#[derive(Debug, Clone, PartialEq, Serialize)]
4531pub struct HelpResponse {
4532    /// Wrapped primitive value
4533    pub value: String,
4534}
4535
4536impl<'de> serde::Deserialize<'de> for HelpResponse {
4537    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4538    where
4539        D: serde::Deserializer<'de>,
4540    {
4541        use std::fmt;
4542
4543        use serde::de::{self, Visitor};
4544
4545        struct PrimitiveWrapperVisitor;
4546
4547        #[allow(unused_variables, clippy::needless_lifetimes)]
4548        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
4549            type Value = HelpResponse;
4550
4551            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
4552                formatter.write_str("a primitive value or an object with 'value' field")
4553            }
4554
4555            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
4556            where
4557                E: de::Error,
4558            {
4559                Ok(HelpResponse { value: v.to_string() })
4560            }
4561
4562            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
4563            where
4564                E: de::Error,
4565            {
4566                Ok(HelpResponse { value: v.to_string() })
4567            }
4568
4569            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
4570            where
4571                E: de::Error,
4572            {
4573                Ok(HelpResponse { value: v.to_string() })
4574            }
4575
4576            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
4577            where
4578                E: de::Error,
4579            {
4580                Ok(HelpResponse { value: v.to_string() })
4581            }
4582
4583            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
4584            where
4585                E: de::Error,
4586            {
4587                Ok(HelpResponse { value: v.to_string() })
4588            }
4589
4590            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
4591            where
4592                M: de::MapAccess<'de>,
4593            {
4594                let mut value = None;
4595                while let Some(key) = map.next_key::<String>()? {
4596                    if key == "value" {
4597                        if value.is_some() {
4598                            return Err(de::Error::duplicate_field("value"));
4599                        }
4600                        value = Some(map.next_value()?);
4601                    } else {
4602                        let _ = map.next_value::<de::IgnoredAny>()?;
4603                    }
4604                }
4605                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
4606                Ok(HelpResponse { value })
4607            }
4608        }
4609
4610        deserializer.deserialize_any(PrimitiveWrapperVisitor)
4611    }
4612}
4613
4614impl std::ops::Deref for HelpResponse {
4615    type Target = String;
4616    fn deref(&self) -> &Self::Target { &self.value }
4617}
4618
4619impl std::ops::DerefMut for HelpResponse {
4620    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
4621}
4622
4623impl AsRef<String> for HelpResponse {
4624    fn as_ref(&self) -> &String { &self.value }
4625}
4626
4627impl From<String> for HelpResponse {
4628    fn from(value: String) -> Self { Self { value } }
4629}
4630
4631impl From<HelpResponse> for String {
4632    fn from(wrapper: HelpResponse) -> Self { wrapper.value }
4633}
4634
4635/// Response for the `ImportDescriptors` RPC method
4636///
4637/// Response is an array with the same size as the input that has the execution result
4638#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4639#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
4640pub struct ImportDescriptorsResponse {
4641    pub field: serde_json::Value,
4642}
4643
4644/// Response for the `ImportMempool` RPC method
4645///
4646/// This method returns no meaningful data.
4647#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
4648pub struct ImportMempoolResponse;
4649
4650/// Response for the `ImportPrunedFunds` RPC method
4651///
4652/// This method returns a primitive value wrapped in a transparent struct.
4653#[derive(Debug, Clone, PartialEq, Serialize)]
4654pub struct ImportPrunedFundsResponse {
4655    /// Wrapped primitive value
4656    pub value: (),
4657}
4658
4659impl<'de> serde::Deserialize<'de> for ImportPrunedFundsResponse {
4660    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4661    where
4662        D: serde::Deserializer<'de>,
4663    {
4664        use std::fmt;
4665
4666        use serde::de::{self, Visitor};
4667
4668        struct PrimitiveWrapperVisitor;
4669
4670        #[allow(unused_variables, clippy::needless_lifetimes)]
4671        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
4672            type Value = ImportPrunedFundsResponse;
4673
4674            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
4675                formatter.write_str("a primitive value or an object with 'value' field")
4676            }
4677
4678            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
4679            where
4680                E: de::Error,
4681            {
4682                Ok(ImportPrunedFundsResponse { value: () })
4683            }
4684
4685            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
4686            where
4687                E: de::Error,
4688            {
4689                Ok(ImportPrunedFundsResponse { value: () })
4690            }
4691
4692            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
4693            where
4694                E: de::Error,
4695            {
4696                Ok(ImportPrunedFundsResponse { value: () })
4697            }
4698
4699            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
4700            where
4701                E: de::Error,
4702            {
4703                Ok(ImportPrunedFundsResponse { value: () })
4704            }
4705
4706            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
4707            where
4708                E: de::Error,
4709            {
4710                Ok(ImportPrunedFundsResponse { value: () })
4711            }
4712
4713            fn visit_none<E>(self) -> Result<Self::Value, E>
4714            where
4715                E: de::Error,
4716            {
4717                Ok(ImportPrunedFundsResponse { value: () })
4718            }
4719
4720            fn visit_unit<E>(self) -> Result<Self::Value, E>
4721            where
4722                E: de::Error,
4723            {
4724                Ok(ImportPrunedFundsResponse { value: () })
4725            }
4726
4727            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
4728            where
4729                M: de::MapAccess<'de>,
4730            {
4731                let mut value = None;
4732                while let Some(key) = map.next_key::<String>()? {
4733                    if key == "value" {
4734                        if value.is_some() {
4735                            return Err(de::Error::duplicate_field("value"));
4736                        }
4737                        value = Some(map.next_value::<()>()?);
4738                    } else {
4739                        let _ = map.next_value::<de::IgnoredAny>()?;
4740                    }
4741                }
4742                value.ok_or_else(|| de::Error::missing_field("value"))?;
4743                Ok(ImportPrunedFundsResponse { value: () })
4744            }
4745        }
4746
4747        deserializer.deserialize_any(PrimitiveWrapperVisitor)
4748    }
4749}
4750
4751impl std::ops::Deref for ImportPrunedFundsResponse {
4752    type Target = ();
4753    fn deref(&self) -> &Self::Target { &self.value }
4754}
4755
4756impl std::ops::DerefMut for ImportPrunedFundsResponse {
4757    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
4758}
4759
4760impl AsRef<()> for ImportPrunedFundsResponse {
4761    fn as_ref(&self) -> &() { &self.value }
4762}
4763
4764impl From<()> for ImportPrunedFundsResponse {
4765    fn from(value: ()) -> Self { Self { value } }
4766}
4767
4768impl From<ImportPrunedFundsResponse> for () {
4769    fn from(wrapper: ImportPrunedFundsResponse) -> Self { wrapper.value }
4770}
4771
4772/// Response for the `InvalidateBlock` RPC method
4773///
4774/// This method returns a primitive value wrapped in a transparent struct.
4775#[derive(Debug, Clone, PartialEq, Serialize)]
4776pub struct InvalidateBlockResponse {
4777    /// Wrapped primitive value
4778    pub value: (),
4779}
4780
4781impl<'de> serde::Deserialize<'de> for InvalidateBlockResponse {
4782    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4783    where
4784        D: serde::Deserializer<'de>,
4785    {
4786        use std::fmt;
4787
4788        use serde::de::{self, Visitor};
4789
4790        struct PrimitiveWrapperVisitor;
4791
4792        #[allow(unused_variables, clippy::needless_lifetimes)]
4793        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
4794            type Value = InvalidateBlockResponse;
4795
4796            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
4797                formatter.write_str("a primitive value or an object with 'value' field")
4798            }
4799
4800            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
4801            where
4802                E: de::Error,
4803            {
4804                Ok(InvalidateBlockResponse { value: () })
4805            }
4806
4807            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
4808            where
4809                E: de::Error,
4810            {
4811                Ok(InvalidateBlockResponse { value: () })
4812            }
4813
4814            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
4815            where
4816                E: de::Error,
4817            {
4818                Ok(InvalidateBlockResponse { value: () })
4819            }
4820
4821            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
4822            where
4823                E: de::Error,
4824            {
4825                Ok(InvalidateBlockResponse { value: () })
4826            }
4827
4828            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
4829            where
4830                E: de::Error,
4831            {
4832                Ok(InvalidateBlockResponse { value: () })
4833            }
4834
4835            fn visit_none<E>(self) -> Result<Self::Value, E>
4836            where
4837                E: de::Error,
4838            {
4839                Ok(InvalidateBlockResponse { value: () })
4840            }
4841
4842            fn visit_unit<E>(self) -> Result<Self::Value, E>
4843            where
4844                E: de::Error,
4845            {
4846                Ok(InvalidateBlockResponse { value: () })
4847            }
4848
4849            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
4850            where
4851                M: de::MapAccess<'de>,
4852            {
4853                let mut value = None;
4854                while let Some(key) = map.next_key::<String>()? {
4855                    if key == "value" {
4856                        if value.is_some() {
4857                            return Err(de::Error::duplicate_field("value"));
4858                        }
4859                        value = Some(map.next_value::<()>()?);
4860                    } else {
4861                        let _ = map.next_value::<de::IgnoredAny>()?;
4862                    }
4863                }
4864                value.ok_or_else(|| de::Error::missing_field("value"))?;
4865                Ok(InvalidateBlockResponse { value: () })
4866            }
4867        }
4868
4869        deserializer.deserialize_any(PrimitiveWrapperVisitor)
4870    }
4871}
4872
4873impl std::ops::Deref for InvalidateBlockResponse {
4874    type Target = ();
4875    fn deref(&self) -> &Self::Target { &self.value }
4876}
4877
4878impl std::ops::DerefMut for InvalidateBlockResponse {
4879    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
4880}
4881
4882impl AsRef<()> for InvalidateBlockResponse {
4883    fn as_ref(&self) -> &() { &self.value }
4884}
4885
4886impl From<()> for InvalidateBlockResponse {
4887    fn from(value: ()) -> Self { Self { value } }
4888}
4889
4890impl From<InvalidateBlockResponse> for () {
4891    fn from(wrapper: InvalidateBlockResponse) -> Self { wrapper.value }
4892}
4893
4894/// Response for the `JoinPsbts` RPC method
4895///
4896/// This method returns a primitive value wrapped in a transparent struct.
4897#[derive(Debug, Clone, PartialEq, Serialize)]
4898pub struct JoinPsbtsResponse {
4899    /// Wrapped primitive value
4900    pub value: String,
4901}
4902
4903impl<'de> serde::Deserialize<'de> for JoinPsbtsResponse {
4904    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4905    where
4906        D: serde::Deserializer<'de>,
4907    {
4908        use std::fmt;
4909
4910        use serde::de::{self, Visitor};
4911
4912        struct PrimitiveWrapperVisitor;
4913
4914        #[allow(unused_variables, clippy::needless_lifetimes)]
4915        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
4916            type Value = JoinPsbtsResponse;
4917
4918            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
4919                formatter.write_str("a primitive value or an object with 'value' field")
4920            }
4921
4922            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
4923            where
4924                E: de::Error,
4925            {
4926                Ok(JoinPsbtsResponse { value: v.to_string() })
4927            }
4928
4929            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
4930            where
4931                E: de::Error,
4932            {
4933                Ok(JoinPsbtsResponse { value: v.to_string() })
4934            }
4935
4936            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
4937            where
4938                E: de::Error,
4939            {
4940                Ok(JoinPsbtsResponse { value: v.to_string() })
4941            }
4942
4943            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
4944            where
4945                E: de::Error,
4946            {
4947                Ok(JoinPsbtsResponse { value: v.to_string() })
4948            }
4949
4950            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
4951            where
4952                E: de::Error,
4953            {
4954                Ok(JoinPsbtsResponse { value: v.to_string() })
4955            }
4956
4957            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
4958            where
4959                M: de::MapAccess<'de>,
4960            {
4961                let mut value = None;
4962                while let Some(key) = map.next_key::<String>()? {
4963                    if key == "value" {
4964                        if value.is_some() {
4965                            return Err(de::Error::duplicate_field("value"));
4966                        }
4967                        value = Some(map.next_value()?);
4968                    } else {
4969                        let _ = map.next_value::<de::IgnoredAny>()?;
4970                    }
4971                }
4972                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
4973                Ok(JoinPsbtsResponse { value })
4974            }
4975        }
4976
4977        deserializer.deserialize_any(PrimitiveWrapperVisitor)
4978    }
4979}
4980
4981impl std::ops::Deref for JoinPsbtsResponse {
4982    type Target = String;
4983    fn deref(&self) -> &Self::Target { &self.value }
4984}
4985
4986impl std::ops::DerefMut for JoinPsbtsResponse {
4987    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
4988}
4989
4990impl AsRef<String> for JoinPsbtsResponse {
4991    fn as_ref(&self) -> &String { &self.value }
4992}
4993
4994impl From<String> for JoinPsbtsResponse {
4995    fn from(value: String) -> Self { Self { value } }
4996}
4997
4998impl From<JoinPsbtsResponse> for String {
4999    fn from(wrapper: JoinPsbtsResponse) -> Self { wrapper.value }
5000}
5001
5002/// Response for the `KeypoolRefill` RPC method
5003///
5004/// This method returns a primitive value wrapped in a transparent struct.
5005#[derive(Debug, Clone, PartialEq, Serialize)]
5006pub struct KeypoolRefillResponse {
5007    /// Wrapped primitive value
5008    pub value: (),
5009}
5010
5011impl<'de> serde::Deserialize<'de> for KeypoolRefillResponse {
5012    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5013    where
5014        D: serde::Deserializer<'de>,
5015    {
5016        use std::fmt;
5017
5018        use serde::de::{self, Visitor};
5019
5020        struct PrimitiveWrapperVisitor;
5021
5022        #[allow(unused_variables, clippy::needless_lifetimes)]
5023        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
5024            type Value = KeypoolRefillResponse;
5025
5026            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5027                formatter.write_str("a primitive value or an object with 'value' field")
5028            }
5029
5030            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
5031            where
5032                E: de::Error,
5033            {
5034                Ok(KeypoolRefillResponse { value: () })
5035            }
5036
5037            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
5038            where
5039                E: de::Error,
5040            {
5041                Ok(KeypoolRefillResponse { value: () })
5042            }
5043
5044            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
5045            where
5046                E: de::Error,
5047            {
5048                Ok(KeypoolRefillResponse { value: () })
5049            }
5050
5051            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
5052            where
5053                E: de::Error,
5054            {
5055                Ok(KeypoolRefillResponse { value: () })
5056            }
5057
5058            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
5059            where
5060                E: de::Error,
5061            {
5062                Ok(KeypoolRefillResponse { value: () })
5063            }
5064
5065            fn visit_none<E>(self) -> Result<Self::Value, E>
5066            where
5067                E: de::Error,
5068            {
5069                Ok(KeypoolRefillResponse { value: () })
5070            }
5071
5072            fn visit_unit<E>(self) -> Result<Self::Value, E>
5073            where
5074                E: de::Error,
5075            {
5076                Ok(KeypoolRefillResponse { value: () })
5077            }
5078
5079            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
5080            where
5081                M: de::MapAccess<'de>,
5082            {
5083                let mut value = None;
5084                while let Some(key) = map.next_key::<String>()? {
5085                    if key == "value" {
5086                        if value.is_some() {
5087                            return Err(de::Error::duplicate_field("value"));
5088                        }
5089                        value = Some(map.next_value::<()>()?);
5090                    } else {
5091                        let _ = map.next_value::<de::IgnoredAny>()?;
5092                    }
5093                }
5094                value.ok_or_else(|| de::Error::missing_field("value"))?;
5095                Ok(KeypoolRefillResponse { value: () })
5096            }
5097        }
5098
5099        deserializer.deserialize_any(PrimitiveWrapperVisitor)
5100    }
5101}
5102
5103impl std::ops::Deref for KeypoolRefillResponse {
5104    type Target = ();
5105    fn deref(&self) -> &Self::Target { &self.value }
5106}
5107
5108impl std::ops::DerefMut for KeypoolRefillResponse {
5109    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
5110}
5111
5112impl AsRef<()> for KeypoolRefillResponse {
5113    fn as_ref(&self) -> &() { &self.value }
5114}
5115
5116impl From<()> for KeypoolRefillResponse {
5117    fn from(value: ()) -> Self { Self { value } }
5118}
5119
5120impl From<KeypoolRefillResponse> for () {
5121    fn from(wrapper: KeypoolRefillResponse) -> Self { wrapper.value }
5122}
5123
5124/// Response for the `ListAddressGroupings` RPC method
5125///
5126/// This method returns an array wrapped in a transparent struct.
5127#[derive(Debug, Clone, PartialEq, Serialize)]
5128pub struct ListAddressGroupingsResponse {
5129    /// Wrapped array value
5130    pub value: Vec<serde_json::Value>,
5131}
5132
5133impl<'de> serde::Deserialize<'de> for ListAddressGroupingsResponse {
5134    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5135    where
5136        D: serde::Deserializer<'de>,
5137    {
5138        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5139        Ok(Self { value })
5140    }
5141}
5142
5143impl From<Vec<serde_json::Value>> for ListAddressGroupingsResponse {
5144    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5145}
5146
5147impl From<ListAddressGroupingsResponse> for Vec<serde_json::Value> {
5148    fn from(wrapper: ListAddressGroupingsResponse) -> Self { wrapper.value }
5149}
5150
5151/// Response for the `ListBanned` RPC method
5152///
5153/// This method returns an array wrapped in a transparent struct.
5154#[derive(Debug, Clone, PartialEq, Serialize)]
5155pub struct ListBannedResponse {
5156    /// Wrapped array value
5157    pub value: Vec<serde_json::Value>,
5158}
5159
5160impl<'de> serde::Deserialize<'de> for ListBannedResponse {
5161    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5162    where
5163        D: serde::Deserializer<'de>,
5164    {
5165        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5166        Ok(Self { value })
5167    }
5168}
5169
5170impl From<Vec<serde_json::Value>> for ListBannedResponse {
5171    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5172}
5173
5174impl From<ListBannedResponse> for Vec<serde_json::Value> {
5175    fn from(wrapper: ListBannedResponse) -> Self { wrapper.value }
5176}
5177
5178/// Response for the `ListDescriptors` RPC method
5179///
5180#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
5181#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
5182pub struct ListDescriptorsResponse {
5183    /// Array of descriptor objects (sorted by descriptor string representation)
5184    pub descriptors: serde_json::Value,
5185    /// Name of wallet this operation was performed on
5186    pub wallet_name: String,
5187}
5188
5189/// Response for the `ListLabels` RPC method
5190///
5191/// This method returns an array wrapped in a transparent struct.
5192#[derive(Debug, Clone, PartialEq, Serialize)]
5193pub struct ListLabelsResponse {
5194    /// Wrapped array value
5195    pub value: Vec<serde_json::Value>,
5196}
5197
5198impl<'de> serde::Deserialize<'de> for ListLabelsResponse {
5199    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5200    where
5201        D: serde::Deserializer<'de>,
5202    {
5203        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5204        Ok(Self { value })
5205    }
5206}
5207
5208impl From<Vec<serde_json::Value>> for ListLabelsResponse {
5209    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5210}
5211
5212impl From<ListLabelsResponse> for Vec<serde_json::Value> {
5213    fn from(wrapper: ListLabelsResponse) -> Self { wrapper.value }
5214}
5215
5216/// Response for the `ListLockUnspent` RPC method
5217///
5218/// This method returns an array wrapped in a transparent struct.
5219#[derive(Debug, Clone, PartialEq, Serialize)]
5220pub struct ListLockUnspentResponse {
5221    /// Wrapped array value
5222    pub value: Vec<serde_json::Value>,
5223}
5224
5225impl<'de> serde::Deserialize<'de> for ListLockUnspentResponse {
5226    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5227    where
5228        D: serde::Deserializer<'de>,
5229    {
5230        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5231        Ok(Self { value })
5232    }
5233}
5234
5235impl From<Vec<serde_json::Value>> for ListLockUnspentResponse {
5236    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5237}
5238
5239impl From<ListLockUnspentResponse> for Vec<serde_json::Value> {
5240    fn from(wrapper: ListLockUnspentResponse) -> Self { wrapper.value }
5241}
5242
5243/// Response for the `ListReceivedByAddress` RPC method
5244///
5245/// This method returns an array wrapped in a transparent struct.
5246#[derive(Debug, Clone, PartialEq, Serialize)]
5247pub struct ListReceivedByAddressResponse {
5248    /// Wrapped array value
5249    pub value: Vec<serde_json::Value>,
5250}
5251
5252impl<'de> serde::Deserialize<'de> for ListReceivedByAddressResponse {
5253    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5254    where
5255        D: serde::Deserializer<'de>,
5256    {
5257        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5258        Ok(Self { value })
5259    }
5260}
5261
5262impl From<Vec<serde_json::Value>> for ListReceivedByAddressResponse {
5263    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5264}
5265
5266impl From<ListReceivedByAddressResponse> for Vec<serde_json::Value> {
5267    fn from(wrapper: ListReceivedByAddressResponse) -> Self { wrapper.value }
5268}
5269
5270/// Response for the `ListReceivedByLabel` RPC method
5271///
5272/// This method returns an array wrapped in a transparent struct.
5273#[derive(Debug, Clone, PartialEq, Serialize)]
5274pub struct ListReceivedByLabelResponse {
5275    /// Wrapped array value
5276    pub value: Vec<serde_json::Value>,
5277}
5278
5279impl<'de> serde::Deserialize<'de> for ListReceivedByLabelResponse {
5280    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5281    where
5282        D: serde::Deserializer<'de>,
5283    {
5284        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5285        Ok(Self { value })
5286    }
5287}
5288
5289impl From<Vec<serde_json::Value>> for ListReceivedByLabelResponse {
5290    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5291}
5292
5293impl From<ListReceivedByLabelResponse> for Vec<serde_json::Value> {
5294    fn from(wrapper: ListReceivedByLabelResponse) -> Self { wrapper.value }
5295}
5296
5297/// Response for the `ListSinceBlock` RPC method
5298///
5299#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
5300#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
5301pub struct ListSinceBlockResponse {
5302    /// 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
5303    pub lastblock: String,
5304    /// &lt;structure is the same as "transactions" above, only present if include_removed=true&gt;
5305    /// 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.
5306    pub removed: Option<Vec<String>>,
5307    pub transactions: serde_json::Value,
5308}
5309
5310/// Response for the `ListTransactions` RPC method
5311///
5312/// This method returns an array wrapped in a transparent struct.
5313#[derive(Debug, Clone, PartialEq, Serialize)]
5314pub struct ListTransactionsResponse {
5315    /// Wrapped array value
5316    pub value: Vec<serde_json::Value>,
5317}
5318
5319impl<'de> serde::Deserialize<'de> for ListTransactionsResponse {
5320    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5321    where
5322        D: serde::Deserializer<'de>,
5323    {
5324        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5325        Ok(Self { value })
5326    }
5327}
5328
5329impl From<Vec<serde_json::Value>> for ListTransactionsResponse {
5330    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5331}
5332
5333impl From<ListTransactionsResponse> for Vec<serde_json::Value> {
5334    fn from(wrapper: ListTransactionsResponse) -> Self { wrapper.value }
5335}
5336
5337/// Response for the `ListUnspent` RPC method
5338///
5339/// This method returns an array wrapped in a transparent struct.
5340#[derive(Debug, Clone, PartialEq, Serialize)]
5341pub struct ListUnspentResponse {
5342    /// Wrapped array value
5343    pub value: Vec<serde_json::Value>,
5344}
5345
5346impl<'de> serde::Deserialize<'de> for ListUnspentResponse {
5347    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5348    where
5349        D: serde::Deserializer<'de>,
5350    {
5351        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5352        Ok(Self { value })
5353    }
5354}
5355
5356impl From<Vec<serde_json::Value>> for ListUnspentResponse {
5357    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5358}
5359
5360impl From<ListUnspentResponse> for Vec<serde_json::Value> {
5361    fn from(wrapper: ListUnspentResponse) -> Self { wrapper.value }
5362}
5363
5364/// Response for the `ListWalletDir` RPC method
5365///
5366#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
5367#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
5368pub struct ListWalletDirResponse {
5369    pub wallets: serde_json::Value,
5370}
5371
5372/// Response for the `ListWallets` RPC method
5373///
5374/// This method returns an array wrapped in a transparent struct.
5375#[derive(Debug, Clone, PartialEq, Serialize)]
5376pub struct ListWalletsResponse {
5377    /// Wrapped array value
5378    pub value: Vec<serde_json::Value>,
5379}
5380
5381impl<'de> serde::Deserialize<'de> for ListWalletsResponse {
5382    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5383    where
5384        D: serde::Deserializer<'de>,
5385    {
5386        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
5387        Ok(Self { value })
5388    }
5389}
5390
5391impl From<Vec<serde_json::Value>> for ListWalletsResponse {
5392    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
5393}
5394
5395impl From<ListWalletsResponse> for Vec<serde_json::Value> {
5396    fn from(wrapper: ListWalletsResponse) -> Self { wrapper.value }
5397}
5398
5399/// Response for the `LoadTxOutSet` RPC method
5400///
5401#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
5402#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
5403pub struct LoadTxOutSetResponse {
5404    /// the height of the base of the snapshot
5405    pub base_height: u64,
5406    /// the number of coins loaded from the snapshot
5407    pub coins_loaded: u64,
5408    /// the absolute path that the snapshot was loaded from
5409    pub path: String,
5410    /// the hash of the base of the snapshot
5411    pub tip_hash: String,
5412}
5413
5414/// Response for the `LoadWallet` RPC method
5415///
5416#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
5417#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
5418pub struct LoadWalletResponse {
5419    /// The wallet name if loaded successfully.
5420    pub name: String,
5421    /// Warning messages, if any, related to loading the wallet.
5422    pub warnings: Option<Vec<String>>,
5423}
5424
5425/// Response for the `LockUnspent` RPC method
5426///
5427/// This method returns a primitive value wrapped in a transparent struct.
5428#[derive(Debug, Clone, PartialEq, Serialize)]
5429pub struct LockUnspentResponse {
5430    /// Wrapped primitive value
5431    pub value: bool,
5432}
5433
5434impl<'de> serde::Deserialize<'de> for LockUnspentResponse {
5435    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5436    where
5437        D: serde::Deserializer<'de>,
5438    {
5439        use std::fmt;
5440
5441        use serde::de::{self, Visitor};
5442
5443        struct PrimitiveWrapperVisitor;
5444
5445        #[allow(unused_variables, clippy::needless_lifetimes)]
5446        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
5447            type Value = LockUnspentResponse;
5448
5449            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5450                formatter.write_str("a primitive value or an object with 'value' field")
5451            }
5452
5453            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
5454            where
5455                E: de::Error,
5456            {
5457                Ok(LockUnspentResponse { value: v != 0 })
5458            }
5459
5460            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
5461            where
5462                E: de::Error,
5463            {
5464                Ok(LockUnspentResponse { value: v != 0 })
5465            }
5466
5467            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
5468            where
5469                E: de::Error,
5470            {
5471                Ok(LockUnspentResponse { value: v != 0.0 })
5472            }
5473
5474            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
5475            where
5476                E: de::Error,
5477            {
5478                let value = v.parse::<bool>().map_err(de::Error::custom)?;
5479                Ok(LockUnspentResponse { value })
5480            }
5481
5482            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
5483            where
5484                E: de::Error,
5485            {
5486                Ok(LockUnspentResponse { value: v })
5487            }
5488
5489            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
5490            where
5491                M: de::MapAccess<'de>,
5492            {
5493                let mut value = None;
5494                while let Some(key) = map.next_key::<String>()? {
5495                    if key == "value" {
5496                        if value.is_some() {
5497                            return Err(de::Error::duplicate_field("value"));
5498                        }
5499                        value = Some(map.next_value()?);
5500                    } else {
5501                        let _ = map.next_value::<de::IgnoredAny>()?;
5502                    }
5503                }
5504                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
5505                Ok(LockUnspentResponse { value })
5506            }
5507        }
5508
5509        deserializer.deserialize_any(PrimitiveWrapperVisitor)
5510    }
5511}
5512
5513impl std::ops::Deref for LockUnspentResponse {
5514    type Target = bool;
5515    fn deref(&self) -> &Self::Target { &self.value }
5516}
5517
5518impl std::ops::DerefMut for LockUnspentResponse {
5519    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
5520}
5521
5522impl AsRef<bool> for LockUnspentResponse {
5523    fn as_ref(&self) -> &bool { &self.value }
5524}
5525
5526impl From<bool> for LockUnspentResponse {
5527    fn from(value: bool) -> Self { Self { value } }
5528}
5529
5530impl From<LockUnspentResponse> for bool {
5531    fn from(wrapper: LockUnspentResponse) -> Self { wrapper.value }
5532}
5533
5534/// Response for the `Logging` RPC method
5535///
5536/// keys are the logging categories, and values indicates its status
5537#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
5538#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
5539pub struct LoggingResponse {
5540    /// if being debug logged or not. false:inactive, true:active
5541    #[serde(default)]
5542    pub category: Option<bool>,
5543}
5544
5545/// Response for the `MigrateWallet` RPC method
5546///
5547#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
5548#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
5549pub struct MigrateWalletResponse {
5550    /// The location of the backup of the original wallet
5551    pub backup_path: String,
5552    /// The name of the migrated wallet containing solvable but not watched scripts
5553    pub solvables_name: Option<String>,
5554    /// The name of the primary migrated wallet
5555    pub wallet_name: String,
5556    /// The name of the migrated wallet containing the watchonly scripts
5557    pub watchonly_name: Option<String>,
5558}
5559
5560/// Response for the `MockScheduler` RPC method
5561///
5562/// This method returns a primitive value wrapped in a transparent struct.
5563#[derive(Debug, Clone, PartialEq, Serialize)]
5564pub struct MockSchedulerResponse {
5565    /// Wrapped primitive value
5566    pub value: (),
5567}
5568
5569impl<'de> serde::Deserialize<'de> for MockSchedulerResponse {
5570    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5571    where
5572        D: serde::Deserializer<'de>,
5573    {
5574        use std::fmt;
5575
5576        use serde::de::{self, Visitor};
5577
5578        struct PrimitiveWrapperVisitor;
5579
5580        #[allow(unused_variables, clippy::needless_lifetimes)]
5581        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
5582            type Value = MockSchedulerResponse;
5583
5584            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5585                formatter.write_str("a primitive value or an object with 'value' field")
5586            }
5587
5588            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
5589            where
5590                E: de::Error,
5591            {
5592                Ok(MockSchedulerResponse { value: () })
5593            }
5594
5595            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
5596            where
5597                E: de::Error,
5598            {
5599                Ok(MockSchedulerResponse { value: () })
5600            }
5601
5602            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
5603            where
5604                E: de::Error,
5605            {
5606                Ok(MockSchedulerResponse { value: () })
5607            }
5608
5609            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
5610            where
5611                E: de::Error,
5612            {
5613                Ok(MockSchedulerResponse { value: () })
5614            }
5615
5616            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
5617            where
5618                E: de::Error,
5619            {
5620                Ok(MockSchedulerResponse { value: () })
5621            }
5622
5623            fn visit_none<E>(self) -> Result<Self::Value, E>
5624            where
5625                E: de::Error,
5626            {
5627                Ok(MockSchedulerResponse { value: () })
5628            }
5629
5630            fn visit_unit<E>(self) -> Result<Self::Value, E>
5631            where
5632                E: de::Error,
5633            {
5634                Ok(MockSchedulerResponse { value: () })
5635            }
5636
5637            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
5638            where
5639                M: de::MapAccess<'de>,
5640            {
5641                let mut value = None;
5642                while let Some(key) = map.next_key::<String>()? {
5643                    if key == "value" {
5644                        if value.is_some() {
5645                            return Err(de::Error::duplicate_field("value"));
5646                        }
5647                        value = Some(map.next_value::<()>()?);
5648                    } else {
5649                        let _ = map.next_value::<de::IgnoredAny>()?;
5650                    }
5651                }
5652                value.ok_or_else(|| de::Error::missing_field("value"))?;
5653                Ok(MockSchedulerResponse { value: () })
5654            }
5655        }
5656
5657        deserializer.deserialize_any(PrimitiveWrapperVisitor)
5658    }
5659}
5660
5661impl std::ops::Deref for MockSchedulerResponse {
5662    type Target = ();
5663    fn deref(&self) -> &Self::Target { &self.value }
5664}
5665
5666impl std::ops::DerefMut for MockSchedulerResponse {
5667    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
5668}
5669
5670impl AsRef<()> for MockSchedulerResponse {
5671    fn as_ref(&self) -> &() { &self.value }
5672}
5673
5674impl From<()> for MockSchedulerResponse {
5675    fn from(value: ()) -> Self { Self { value } }
5676}
5677
5678impl From<MockSchedulerResponse> for () {
5679    fn from(wrapper: MockSchedulerResponse) -> Self { wrapper.value }
5680}
5681
5682/// Response for the `Ping` RPC method
5683///
5684/// This method returns a primitive value wrapped in a transparent struct.
5685#[derive(Debug, Clone, PartialEq, Serialize)]
5686pub struct PingResponse {
5687    /// Wrapped primitive value
5688    pub value: (),
5689}
5690
5691impl<'de> serde::Deserialize<'de> for PingResponse {
5692    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5693    where
5694        D: serde::Deserializer<'de>,
5695    {
5696        use std::fmt;
5697
5698        use serde::de::{self, Visitor};
5699
5700        struct PrimitiveWrapperVisitor;
5701
5702        #[allow(unused_variables, clippy::needless_lifetimes)]
5703        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
5704            type Value = PingResponse;
5705
5706            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5707                formatter.write_str("a primitive value or an object with 'value' field")
5708            }
5709
5710            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
5711            where
5712                E: de::Error,
5713            {
5714                Ok(PingResponse { value: () })
5715            }
5716
5717            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
5718            where
5719                E: de::Error,
5720            {
5721                Ok(PingResponse { value: () })
5722            }
5723
5724            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
5725            where
5726                E: de::Error,
5727            {
5728                Ok(PingResponse { value: () })
5729            }
5730
5731            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
5732            where
5733                E: de::Error,
5734            {
5735                Ok(PingResponse { value: () })
5736            }
5737
5738            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
5739            where
5740                E: de::Error,
5741            {
5742                Ok(PingResponse { value: () })
5743            }
5744
5745            fn visit_none<E>(self) -> Result<Self::Value, E>
5746            where
5747                E: de::Error,
5748            {
5749                Ok(PingResponse { value: () })
5750            }
5751
5752            fn visit_unit<E>(self) -> Result<Self::Value, E>
5753            where
5754                E: de::Error,
5755            {
5756                Ok(PingResponse { value: () })
5757            }
5758
5759            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
5760            where
5761                M: de::MapAccess<'de>,
5762            {
5763                let mut value = None;
5764                while let Some(key) = map.next_key::<String>()? {
5765                    if key == "value" {
5766                        if value.is_some() {
5767                            return Err(de::Error::duplicate_field("value"));
5768                        }
5769                        value = Some(map.next_value::<()>()?);
5770                    } else {
5771                        let _ = map.next_value::<de::IgnoredAny>()?;
5772                    }
5773                }
5774                value.ok_or_else(|| de::Error::missing_field("value"))?;
5775                Ok(PingResponse { value: () })
5776            }
5777        }
5778
5779        deserializer.deserialize_any(PrimitiveWrapperVisitor)
5780    }
5781}
5782
5783impl std::ops::Deref for PingResponse {
5784    type Target = ();
5785    fn deref(&self) -> &Self::Target { &self.value }
5786}
5787
5788impl std::ops::DerefMut for PingResponse {
5789    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
5790}
5791
5792impl AsRef<()> for PingResponse {
5793    fn as_ref(&self) -> &() { &self.value }
5794}
5795
5796impl From<()> for PingResponse {
5797    fn from(value: ()) -> Self { Self { value } }
5798}
5799
5800impl From<PingResponse> for () {
5801    fn from(wrapper: PingResponse) -> Self { wrapper.value }
5802}
5803
5804/// Response for the `PreciousBlock` RPC method
5805///
5806/// This method returns a primitive value wrapped in a transparent struct.
5807#[derive(Debug, Clone, PartialEq, Serialize)]
5808pub struct PreciousBlockResponse {
5809    /// Wrapped primitive value
5810    pub value: (),
5811}
5812
5813impl<'de> serde::Deserialize<'de> for PreciousBlockResponse {
5814    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5815    where
5816        D: serde::Deserializer<'de>,
5817    {
5818        use std::fmt;
5819
5820        use serde::de::{self, Visitor};
5821
5822        struct PrimitiveWrapperVisitor;
5823
5824        #[allow(unused_variables, clippy::needless_lifetimes)]
5825        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
5826            type Value = PreciousBlockResponse;
5827
5828            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5829                formatter.write_str("a primitive value or an object with 'value' field")
5830            }
5831
5832            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
5833            where
5834                E: de::Error,
5835            {
5836                Ok(PreciousBlockResponse { value: () })
5837            }
5838
5839            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
5840            where
5841                E: de::Error,
5842            {
5843                Ok(PreciousBlockResponse { value: () })
5844            }
5845
5846            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
5847            where
5848                E: de::Error,
5849            {
5850                Ok(PreciousBlockResponse { value: () })
5851            }
5852
5853            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
5854            where
5855                E: de::Error,
5856            {
5857                Ok(PreciousBlockResponse { value: () })
5858            }
5859
5860            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
5861            where
5862                E: de::Error,
5863            {
5864                Ok(PreciousBlockResponse { value: () })
5865            }
5866
5867            fn visit_none<E>(self) -> Result<Self::Value, E>
5868            where
5869                E: de::Error,
5870            {
5871                Ok(PreciousBlockResponse { value: () })
5872            }
5873
5874            fn visit_unit<E>(self) -> Result<Self::Value, E>
5875            where
5876                E: de::Error,
5877            {
5878                Ok(PreciousBlockResponse { value: () })
5879            }
5880
5881            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
5882            where
5883                M: de::MapAccess<'de>,
5884            {
5885                let mut value = None;
5886                while let Some(key) = map.next_key::<String>()? {
5887                    if key == "value" {
5888                        if value.is_some() {
5889                            return Err(de::Error::duplicate_field("value"));
5890                        }
5891                        value = Some(map.next_value::<()>()?);
5892                    } else {
5893                        let _ = map.next_value::<de::IgnoredAny>()?;
5894                    }
5895                }
5896                value.ok_or_else(|| de::Error::missing_field("value"))?;
5897                Ok(PreciousBlockResponse { value: () })
5898            }
5899        }
5900
5901        deserializer.deserialize_any(PrimitiveWrapperVisitor)
5902    }
5903}
5904
5905impl std::ops::Deref for PreciousBlockResponse {
5906    type Target = ();
5907    fn deref(&self) -> &Self::Target { &self.value }
5908}
5909
5910impl std::ops::DerefMut for PreciousBlockResponse {
5911    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
5912}
5913
5914impl AsRef<()> for PreciousBlockResponse {
5915    fn as_ref(&self) -> &() { &self.value }
5916}
5917
5918impl From<()> for PreciousBlockResponse {
5919    fn from(value: ()) -> Self { Self { value } }
5920}
5921
5922impl From<PreciousBlockResponse> for () {
5923    fn from(wrapper: PreciousBlockResponse) -> Self { wrapper.value }
5924}
5925
5926/// Response for the `PrioritiseTransaction` RPC method
5927///
5928/// This method returns a primitive value wrapped in a transparent struct.
5929#[derive(Debug, Clone, PartialEq, Serialize)]
5930pub struct PrioritiseTransactionResponse {
5931    /// Wrapped primitive value
5932    pub value: bool,
5933}
5934
5935impl<'de> serde::Deserialize<'de> for PrioritiseTransactionResponse {
5936    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5937    where
5938        D: serde::Deserializer<'de>,
5939    {
5940        use std::fmt;
5941
5942        use serde::de::{self, Visitor};
5943
5944        struct PrimitiveWrapperVisitor;
5945
5946        #[allow(unused_variables, clippy::needless_lifetimes)]
5947        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
5948            type Value = PrioritiseTransactionResponse;
5949
5950            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5951                formatter.write_str("a primitive value or an object with 'value' field")
5952            }
5953
5954            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
5955            where
5956                E: de::Error,
5957            {
5958                Ok(PrioritiseTransactionResponse { value: v != 0 })
5959            }
5960
5961            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
5962            where
5963                E: de::Error,
5964            {
5965                Ok(PrioritiseTransactionResponse { value: v != 0 })
5966            }
5967
5968            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
5969            where
5970                E: de::Error,
5971            {
5972                Ok(PrioritiseTransactionResponse { value: v != 0.0 })
5973            }
5974
5975            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
5976            where
5977                E: de::Error,
5978            {
5979                let value = v.parse::<bool>().map_err(de::Error::custom)?;
5980                Ok(PrioritiseTransactionResponse { value })
5981            }
5982
5983            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
5984            where
5985                E: de::Error,
5986            {
5987                Ok(PrioritiseTransactionResponse { value: v })
5988            }
5989
5990            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
5991            where
5992                M: de::MapAccess<'de>,
5993            {
5994                let mut value = None;
5995                while let Some(key) = map.next_key::<String>()? {
5996                    if key == "value" {
5997                        if value.is_some() {
5998                            return Err(de::Error::duplicate_field("value"));
5999                        }
6000                        value = Some(map.next_value()?);
6001                    } else {
6002                        let _ = map.next_value::<de::IgnoredAny>()?;
6003                    }
6004                }
6005                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
6006                Ok(PrioritiseTransactionResponse { value })
6007            }
6008        }
6009
6010        deserializer.deserialize_any(PrimitiveWrapperVisitor)
6011    }
6012}
6013
6014impl std::ops::Deref for PrioritiseTransactionResponse {
6015    type Target = bool;
6016    fn deref(&self) -> &Self::Target { &self.value }
6017}
6018
6019impl std::ops::DerefMut for PrioritiseTransactionResponse {
6020    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
6021}
6022
6023impl AsRef<bool> for PrioritiseTransactionResponse {
6024    fn as_ref(&self) -> &bool { &self.value }
6025}
6026
6027impl From<bool> for PrioritiseTransactionResponse {
6028    fn from(value: bool) -> Self { Self { value } }
6029}
6030
6031impl From<PrioritiseTransactionResponse> for bool {
6032    fn from(wrapper: PrioritiseTransactionResponse) -> Self { wrapper.value }
6033}
6034
6035/// Response for the `PruneBlockchain` RPC method
6036///
6037/// This method returns a primitive value wrapped in a transparent struct.
6038#[derive(Debug, Clone, PartialEq, Serialize)]
6039pub struct PruneBlockchainResponse {
6040    /// Wrapped primitive value
6041    pub value: u64,
6042}
6043
6044impl<'de> serde::Deserialize<'de> for PruneBlockchainResponse {
6045    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6046    where
6047        D: serde::Deserializer<'de>,
6048    {
6049        use std::fmt;
6050
6051        use serde::de::{self, Visitor};
6052
6053        struct PrimitiveWrapperVisitor;
6054
6055        #[allow(unused_variables, clippy::needless_lifetimes)]
6056        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
6057            type Value = PruneBlockchainResponse;
6058
6059            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6060                formatter.write_str("a primitive value or an object with 'value' field")
6061            }
6062
6063            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
6064            where
6065                E: de::Error,
6066            {
6067                Ok(PruneBlockchainResponse { value: v })
6068            }
6069
6070            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
6071            where
6072                E: de::Error,
6073            {
6074                Ok(PruneBlockchainResponse { value: v as u64 })
6075            }
6076
6077            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
6078            where
6079                E: de::Error,
6080            {
6081                Ok(PruneBlockchainResponse { value: v as u64 })
6082            }
6083
6084            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6085            where
6086                E: de::Error,
6087            {
6088                let value = v.parse::<u64>().map_err(de::Error::custom)?;
6089                Ok(PruneBlockchainResponse { value })
6090            }
6091
6092            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
6093            where
6094                E: de::Error,
6095            {
6096                Ok(PruneBlockchainResponse { value: v as u64 })
6097            }
6098
6099            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6100            where
6101                M: de::MapAccess<'de>,
6102            {
6103                let mut value = None;
6104                while let Some(key) = map.next_key::<String>()? {
6105                    if key == "value" {
6106                        if value.is_some() {
6107                            return Err(de::Error::duplicate_field("value"));
6108                        }
6109                        value = Some(map.next_value()?);
6110                    } else {
6111                        let _ = map.next_value::<de::IgnoredAny>()?;
6112                    }
6113                }
6114                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
6115                Ok(PruneBlockchainResponse { value })
6116            }
6117        }
6118
6119        deserializer.deserialize_any(PrimitiveWrapperVisitor)
6120    }
6121}
6122
6123impl std::ops::Deref for PruneBlockchainResponse {
6124    type Target = u64;
6125    fn deref(&self) -> &Self::Target { &self.value }
6126}
6127
6128impl std::ops::DerefMut for PruneBlockchainResponse {
6129    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
6130}
6131
6132impl AsRef<u64> for PruneBlockchainResponse {
6133    fn as_ref(&self) -> &u64 { &self.value }
6134}
6135
6136impl From<u64> for PruneBlockchainResponse {
6137    fn from(value: u64) -> Self { Self { value } }
6138}
6139
6140impl From<PruneBlockchainResponse> for u64 {
6141    fn from(wrapper: PruneBlockchainResponse) -> Self { wrapper.value }
6142}
6143
6144/// Response for the `PsbtBumpFee` RPC method
6145///
6146#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6147#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6148pub struct PsbtBumpFeeResponse {
6149    /// Errors encountered during processing (may be empty).
6150    pub errors: Vec<String>,
6151    /// The fee of the new transaction.
6152    #[serde(deserialize_with = "amount_from_btc_float")]
6153    pub fee: bitcoin::Amount,
6154    /// The fee of the replaced transaction.
6155    #[serde(deserialize_with = "amount_from_btc_float")]
6156    pub origfee: bitcoin::Amount,
6157    /// The base64-encoded unsigned PSBT of the new transaction.
6158    pub psbt: String,
6159}
6160
6161/// Response for the `ReconsiderBlock` RPC method
6162///
6163/// This method returns a primitive value wrapped in a transparent struct.
6164#[derive(Debug, Clone, PartialEq, Serialize)]
6165pub struct ReconsiderBlockResponse {
6166    /// Wrapped primitive value
6167    pub value: (),
6168}
6169
6170impl<'de> serde::Deserialize<'de> for ReconsiderBlockResponse {
6171    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6172    where
6173        D: serde::Deserializer<'de>,
6174    {
6175        use std::fmt;
6176
6177        use serde::de::{self, Visitor};
6178
6179        struct PrimitiveWrapperVisitor;
6180
6181        #[allow(unused_variables, clippy::needless_lifetimes)]
6182        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
6183            type Value = ReconsiderBlockResponse;
6184
6185            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6186                formatter.write_str("a primitive value or an object with 'value' field")
6187            }
6188
6189            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
6190            where
6191                E: de::Error,
6192            {
6193                Ok(ReconsiderBlockResponse { value: () })
6194            }
6195
6196            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
6197            where
6198                E: de::Error,
6199            {
6200                Ok(ReconsiderBlockResponse { value: () })
6201            }
6202
6203            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
6204            where
6205                E: de::Error,
6206            {
6207                Ok(ReconsiderBlockResponse { value: () })
6208            }
6209
6210            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6211            where
6212                E: de::Error,
6213            {
6214                Ok(ReconsiderBlockResponse { value: () })
6215            }
6216
6217            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
6218            where
6219                E: de::Error,
6220            {
6221                Ok(ReconsiderBlockResponse { value: () })
6222            }
6223
6224            fn visit_none<E>(self) -> Result<Self::Value, E>
6225            where
6226                E: de::Error,
6227            {
6228                Ok(ReconsiderBlockResponse { value: () })
6229            }
6230
6231            fn visit_unit<E>(self) -> Result<Self::Value, E>
6232            where
6233                E: de::Error,
6234            {
6235                Ok(ReconsiderBlockResponse { value: () })
6236            }
6237
6238            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6239            where
6240                M: de::MapAccess<'de>,
6241            {
6242                let mut value = None;
6243                while let Some(key) = map.next_key::<String>()? {
6244                    if key == "value" {
6245                        if value.is_some() {
6246                            return Err(de::Error::duplicate_field("value"));
6247                        }
6248                        value = Some(map.next_value::<()>()?);
6249                    } else {
6250                        let _ = map.next_value::<de::IgnoredAny>()?;
6251                    }
6252                }
6253                value.ok_or_else(|| de::Error::missing_field("value"))?;
6254                Ok(ReconsiderBlockResponse { value: () })
6255            }
6256        }
6257
6258        deserializer.deserialize_any(PrimitiveWrapperVisitor)
6259    }
6260}
6261
6262impl std::ops::Deref for ReconsiderBlockResponse {
6263    type Target = ();
6264    fn deref(&self) -> &Self::Target { &self.value }
6265}
6266
6267impl std::ops::DerefMut for ReconsiderBlockResponse {
6268    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
6269}
6270
6271impl AsRef<()> for ReconsiderBlockResponse {
6272    fn as_ref(&self) -> &() { &self.value }
6273}
6274
6275impl From<()> for ReconsiderBlockResponse {
6276    fn from(value: ()) -> Self { Self { value } }
6277}
6278
6279impl From<ReconsiderBlockResponse> for () {
6280    fn from(wrapper: ReconsiderBlockResponse) -> Self { wrapper.value }
6281}
6282
6283/// Response for the `RemovePrunedFunds` RPC method
6284///
6285/// This method returns a primitive value wrapped in a transparent struct.
6286#[derive(Debug, Clone, PartialEq, Serialize)]
6287pub struct RemovePrunedFundsResponse {
6288    /// Wrapped primitive value
6289    pub value: (),
6290}
6291
6292impl<'de> serde::Deserialize<'de> for RemovePrunedFundsResponse {
6293    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6294    where
6295        D: serde::Deserializer<'de>,
6296    {
6297        use std::fmt;
6298
6299        use serde::de::{self, Visitor};
6300
6301        struct PrimitiveWrapperVisitor;
6302
6303        #[allow(unused_variables, clippy::needless_lifetimes)]
6304        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
6305            type Value = RemovePrunedFundsResponse;
6306
6307            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6308                formatter.write_str("a primitive value or an object with 'value' field")
6309            }
6310
6311            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
6312            where
6313                E: de::Error,
6314            {
6315                Ok(RemovePrunedFundsResponse { value: () })
6316            }
6317
6318            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
6319            where
6320                E: de::Error,
6321            {
6322                Ok(RemovePrunedFundsResponse { value: () })
6323            }
6324
6325            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
6326            where
6327                E: de::Error,
6328            {
6329                Ok(RemovePrunedFundsResponse { value: () })
6330            }
6331
6332            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6333            where
6334                E: de::Error,
6335            {
6336                Ok(RemovePrunedFundsResponse { value: () })
6337            }
6338
6339            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
6340            where
6341                E: de::Error,
6342            {
6343                Ok(RemovePrunedFundsResponse { value: () })
6344            }
6345
6346            fn visit_none<E>(self) -> Result<Self::Value, E>
6347            where
6348                E: de::Error,
6349            {
6350                Ok(RemovePrunedFundsResponse { value: () })
6351            }
6352
6353            fn visit_unit<E>(self) -> Result<Self::Value, E>
6354            where
6355                E: de::Error,
6356            {
6357                Ok(RemovePrunedFundsResponse { value: () })
6358            }
6359
6360            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6361            where
6362                M: de::MapAccess<'de>,
6363            {
6364                let mut value = None;
6365                while let Some(key) = map.next_key::<String>()? {
6366                    if key == "value" {
6367                        if value.is_some() {
6368                            return Err(de::Error::duplicate_field("value"));
6369                        }
6370                        value = Some(map.next_value::<()>()?);
6371                    } else {
6372                        let _ = map.next_value::<de::IgnoredAny>()?;
6373                    }
6374                }
6375                value.ok_or_else(|| de::Error::missing_field("value"))?;
6376                Ok(RemovePrunedFundsResponse { value: () })
6377            }
6378        }
6379
6380        deserializer.deserialize_any(PrimitiveWrapperVisitor)
6381    }
6382}
6383
6384impl std::ops::Deref for RemovePrunedFundsResponse {
6385    type Target = ();
6386    fn deref(&self) -> &Self::Target { &self.value }
6387}
6388
6389impl std::ops::DerefMut for RemovePrunedFundsResponse {
6390    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
6391}
6392
6393impl AsRef<()> for RemovePrunedFundsResponse {
6394    fn as_ref(&self) -> &() { &self.value }
6395}
6396
6397impl From<()> for RemovePrunedFundsResponse {
6398    fn from(value: ()) -> Self { Self { value } }
6399}
6400
6401impl From<RemovePrunedFundsResponse> for () {
6402    fn from(wrapper: RemovePrunedFundsResponse) -> Self { wrapper.value }
6403}
6404
6405/// Response for the `RescanBlockchain` RPC method
6406///
6407#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6408#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6409pub struct RescanBlockchainResponse {
6410    /// The block height where the rescan started (the requested height or 0)
6411    pub start_height: u64,
6412    /// 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.
6413    pub stop_height: u64,
6414}
6415
6416/// Response for the `RestoreWallet` RPC method
6417///
6418#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6419#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6420pub struct RestoreWalletResponse {
6421    /// The wallet name if restored successfully.
6422    pub name: String,
6423    /// Warning messages, if any, related to restoring and loading the wallet.
6424    pub warnings: Option<Vec<String>>,
6425}
6426
6427/// Response for the `SaveMempool` RPC method
6428///
6429#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6430#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6431pub struct SaveMempoolResponse {
6432    /// the directory and file where the mempool was saved
6433    pub filename: String,
6434}
6435
6436/// Response for the `ScanBlocks` RPC method
6437///
6438#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6439#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6440pub struct ScanBlocksResponse {
6441    /// true if the scan process was not aborted
6442    pub completed: bool,
6443    /// Height of the block currently being scanned
6444    pub current_height: u64,
6445    pub field_0: (),
6446    /// The height we started the scan from
6447    pub from_height: u64,
6448    /// Approximate percent complete
6449    pub progress: u64,
6450    /// Blocks that may have matched a scanobject.
6451    pub relevant_blocks: Vec<String>,
6452    /// True if scan will be aborted (not necessarily before this RPC returns), or false if there is no scan to abort
6453    pub success: bool,
6454    /// The height we ended the scan at
6455    pub to_height: u64,
6456}
6457
6458/// Response for the `ScanTxOutSet` RPC method
6459///
6460#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6461#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6462pub struct ScanTxOutSetResponse {
6463    /// The hash of the block at the tip of the chain
6464    pub bestblock: String,
6465    pub field_3: (),
6466    /// The block height at which the scan was done
6467    pub height: u64,
6468    /// Approximate percent complete
6469    pub progress: u64,
6470    /// Whether the scan was completed
6471    pub success: bool,
6472    /// True if scan will be aborted (not necessarily before this RPC returns), or false if there is no scan to abort
6473    pub success_1: bool,
6474    /// The total amount of all found unspent outputs in BTC
6475    #[serde(deserialize_with = "amount_from_btc_float")]
6476    pub total_amount: bitcoin::Amount,
6477    /// The number of unspent transaction outputs scanned
6478    pub txouts: u64,
6479    pub unspents: serde_json::Value,
6480}
6481
6482/// Response for the `Schema` RPC method
6483///
6484/// This method returns no meaningful data.
6485#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6486pub struct SchemaResponse;
6487
6488/// Response for the `Send` RPC method
6489///
6490#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6491#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6492pub struct SendResponse {
6493    /// If the transaction has a complete set of signatures
6494    pub complete: bool,
6495    /// If add_to_wallet is false, the hex-encoded raw transaction with signature(s)
6496    pub hex: Option<String>,
6497    /// If more signatures are needed, or if add_to_wallet is false, the base64-encoded (partially) signed transaction
6498    pub psbt: Option<String>,
6499    /// The transaction id for the send. Only 1 transaction is created regardless of the number of addresses.
6500    pub txid: Option<bitcoin::Txid>,
6501}
6502
6503/// Response for the `SendAll` RPC method
6504///
6505#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6506#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
6507pub struct SendAllResponse {
6508    /// If the transaction has a complete set of signatures
6509    pub complete: bool,
6510    /// If add_to_wallet is false, the hex-encoded raw transaction with signature(s)
6511    pub hex: Option<String>,
6512    /// If more signatures are needed, or if add_to_wallet is false, the base64-encoded (partially) signed transaction
6513    pub psbt: Option<String>,
6514    /// The transaction id for the send. Only 1 transaction is created regardless of the number of addresses.
6515    pub txid: Option<bitcoin::Txid>,
6516}
6517
6518/// Response for the `SendMany` RPC method
6519///
6520#[derive(Debug, Clone, PartialEq, Serialize)]
6521pub struct SendManyResponse {
6522    /// The transaction fee reason.
6523    pub fee_reason: Option<String>,
6524    /// The transaction id for the send. Only 1 transaction is created regardless of
6525    /// the number of addresses.
6526    pub txid: Option<bitcoin::Txid>,
6527}
6528impl<'de> serde::Deserialize<'de> for SendManyResponse {
6529    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6530    where
6531        D: serde::Deserializer<'de>,
6532    {
6533        use std::fmt;
6534
6535        use serde::de::{self, Visitor};
6536
6537        struct ConditionalResponseVisitor;
6538
6539        #[allow(clippy::needless_lifetimes)]
6540        impl<'de> Visitor<'de> for ConditionalResponseVisitor {
6541            type Value = SendManyResponse;
6542
6543            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6544                formatter.write_str("string or object")
6545            }
6546
6547            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6548            where
6549                E: de::Error,
6550            {
6551                let txid = bitcoin::Txid::from_str(v).map_err(de::Error::custom)?;
6552                Ok(SendManyResponse { fee_reason: None, txid: Some(txid) })
6553            }
6554
6555            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6556            where
6557                M: de::MapAccess<'de>,
6558            {
6559                let mut fee_reason = None;
6560                let mut txid = None;
6561                while let Some(key) = map.next_key::<String>()? {
6562                    if key == "fee_reason" {
6563                        if fee_reason.is_some() {
6564                            return Err(de::Error::duplicate_field("fee_reason"));
6565                        }
6566                        fee_reason = Some(map.next_value::<String>()?);
6567                    }
6568                    if key == "txid" {
6569                        if txid.is_some() {
6570                            return Err(de::Error::duplicate_field("txid"));
6571                        }
6572                        txid = Some(map.next_value::<bitcoin::Txid>()?);
6573                    } else {
6574                        let _ = map.next_value::<de::IgnoredAny>()?;
6575                    }
6576                }
6577                Ok(SendManyResponse { fee_reason, txid })
6578            }
6579        }
6580
6581        deserializer.deserialize_any(ConditionalResponseVisitor)
6582    }
6583}
6584
6585/// Response for the `SendMsgToPeer` RPC method
6586///
6587/// This method returns no meaningful data.
6588#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
6589pub struct SendMsgToPeerResponse;
6590
6591/// Response for the `SendRawTransaction` RPC method
6592///
6593/// This method returns a primitive value wrapped in a transparent struct.
6594#[derive(Debug, Clone, PartialEq, Serialize)]
6595pub struct SendRawTransactionResponse {
6596    /// Wrapped primitive value
6597    pub value: String,
6598}
6599
6600impl<'de> serde::Deserialize<'de> for SendRawTransactionResponse {
6601    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6602    where
6603        D: serde::Deserializer<'de>,
6604    {
6605        use std::fmt;
6606
6607        use serde::de::{self, Visitor};
6608
6609        struct PrimitiveWrapperVisitor;
6610
6611        #[allow(unused_variables, clippy::needless_lifetimes)]
6612        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
6613            type Value = SendRawTransactionResponse;
6614
6615            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6616                formatter.write_str("a primitive value or an object with 'value' field")
6617            }
6618
6619            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
6620            where
6621                E: de::Error,
6622            {
6623                Ok(SendRawTransactionResponse { value: v.to_string() })
6624            }
6625
6626            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
6627            where
6628                E: de::Error,
6629            {
6630                Ok(SendRawTransactionResponse { value: v.to_string() })
6631            }
6632
6633            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
6634            where
6635                E: de::Error,
6636            {
6637                Ok(SendRawTransactionResponse { value: v.to_string() })
6638            }
6639
6640            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6641            where
6642                E: de::Error,
6643            {
6644                Ok(SendRawTransactionResponse { value: v.to_string() })
6645            }
6646
6647            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
6648            where
6649                E: de::Error,
6650            {
6651                Ok(SendRawTransactionResponse { value: v.to_string() })
6652            }
6653
6654            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6655            where
6656                M: de::MapAccess<'de>,
6657            {
6658                let mut value = None;
6659                while let Some(key) = map.next_key::<String>()? {
6660                    if key == "value" {
6661                        if value.is_some() {
6662                            return Err(de::Error::duplicate_field("value"));
6663                        }
6664                        value = Some(map.next_value()?);
6665                    } else {
6666                        let _ = map.next_value::<de::IgnoredAny>()?;
6667                    }
6668                }
6669                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
6670                Ok(SendRawTransactionResponse { value })
6671            }
6672        }
6673
6674        deserializer.deserialize_any(PrimitiveWrapperVisitor)
6675    }
6676}
6677
6678impl std::ops::Deref for SendRawTransactionResponse {
6679    type Target = String;
6680    fn deref(&self) -> &Self::Target { &self.value }
6681}
6682
6683impl std::ops::DerefMut for SendRawTransactionResponse {
6684    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
6685}
6686
6687impl AsRef<String> for SendRawTransactionResponse {
6688    fn as_ref(&self) -> &String { &self.value }
6689}
6690
6691impl From<String> for SendRawTransactionResponse {
6692    fn from(value: String) -> Self { Self { value } }
6693}
6694
6695impl From<SendRawTransactionResponse> for String {
6696    fn from(wrapper: SendRawTransactionResponse) -> Self { wrapper.value }
6697}
6698
6699/// Response for the `SendToAddress` RPC method
6700///
6701#[derive(Debug, Clone, PartialEq, Serialize)]
6702pub struct SendToAddressResponse {
6703    /// The transaction fee reason.
6704    pub fee_reason: Option<String>,
6705    /// The transaction id.
6706    pub txid: Option<bitcoin::Txid>,
6707}
6708impl<'de> serde::Deserialize<'de> for SendToAddressResponse {
6709    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6710    where
6711        D: serde::Deserializer<'de>,
6712    {
6713        use std::fmt;
6714
6715        use serde::de::{self, Visitor};
6716
6717        struct ConditionalResponseVisitor;
6718
6719        #[allow(clippy::needless_lifetimes)]
6720        impl<'de> Visitor<'de> for ConditionalResponseVisitor {
6721            type Value = SendToAddressResponse;
6722
6723            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6724                formatter.write_str("string or object")
6725            }
6726
6727            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6728            where
6729                E: de::Error,
6730            {
6731                let txid = bitcoin::Txid::from_str(v).map_err(de::Error::custom)?;
6732                Ok(SendToAddressResponse { fee_reason: None, txid: Some(txid) })
6733            }
6734
6735            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6736            where
6737                M: de::MapAccess<'de>,
6738            {
6739                let mut fee_reason = None;
6740                let mut txid = None;
6741                while let Some(key) = map.next_key::<String>()? {
6742                    if key == "fee_reason" {
6743                        if fee_reason.is_some() {
6744                            return Err(de::Error::duplicate_field("fee_reason"));
6745                        }
6746                        fee_reason = Some(map.next_value::<String>()?);
6747                    }
6748                    if key == "txid" {
6749                        if txid.is_some() {
6750                            return Err(de::Error::duplicate_field("txid"));
6751                        }
6752                        txid = Some(map.next_value::<bitcoin::Txid>()?);
6753                    } else {
6754                        let _ = map.next_value::<de::IgnoredAny>()?;
6755                    }
6756                }
6757                Ok(SendToAddressResponse { fee_reason, txid })
6758            }
6759        }
6760
6761        deserializer.deserialize_any(ConditionalResponseVisitor)
6762    }
6763}
6764
6765/// Response for the `SetBan` RPC method
6766///
6767/// This method returns a primitive value wrapped in a transparent struct.
6768#[derive(Debug, Clone, PartialEq, Serialize)]
6769pub struct SetBanResponse {
6770    /// Wrapped primitive value
6771    pub value: (),
6772}
6773
6774impl<'de> serde::Deserialize<'de> for SetBanResponse {
6775    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6776    where
6777        D: serde::Deserializer<'de>,
6778    {
6779        use std::fmt;
6780
6781        use serde::de::{self, Visitor};
6782
6783        struct PrimitiveWrapperVisitor;
6784
6785        #[allow(unused_variables, clippy::needless_lifetimes)]
6786        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
6787            type Value = SetBanResponse;
6788
6789            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6790                formatter.write_str("a primitive value or an object with 'value' field")
6791            }
6792
6793            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
6794            where
6795                E: de::Error,
6796            {
6797                Ok(SetBanResponse { value: () })
6798            }
6799
6800            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
6801            where
6802                E: de::Error,
6803            {
6804                Ok(SetBanResponse { value: () })
6805            }
6806
6807            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
6808            where
6809                E: de::Error,
6810            {
6811                Ok(SetBanResponse { value: () })
6812            }
6813
6814            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6815            where
6816                E: de::Error,
6817            {
6818                Ok(SetBanResponse { value: () })
6819            }
6820
6821            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
6822            where
6823                E: de::Error,
6824            {
6825                Ok(SetBanResponse { value: () })
6826            }
6827
6828            fn visit_none<E>(self) -> Result<Self::Value, E>
6829            where
6830                E: de::Error,
6831            {
6832                Ok(SetBanResponse { value: () })
6833            }
6834
6835            fn visit_unit<E>(self) -> Result<Self::Value, E>
6836            where
6837                E: de::Error,
6838            {
6839                Ok(SetBanResponse { value: () })
6840            }
6841
6842            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6843            where
6844                M: de::MapAccess<'de>,
6845            {
6846                let mut value = None;
6847                while let Some(key) = map.next_key::<String>()? {
6848                    if key == "value" {
6849                        if value.is_some() {
6850                            return Err(de::Error::duplicate_field("value"));
6851                        }
6852                        value = Some(map.next_value::<()>()?);
6853                    } else {
6854                        let _ = map.next_value::<de::IgnoredAny>()?;
6855                    }
6856                }
6857                value.ok_or_else(|| de::Error::missing_field("value"))?;
6858                Ok(SetBanResponse { value: () })
6859            }
6860        }
6861
6862        deserializer.deserialize_any(PrimitiveWrapperVisitor)
6863    }
6864}
6865
6866impl std::ops::Deref for SetBanResponse {
6867    type Target = ();
6868    fn deref(&self) -> &Self::Target { &self.value }
6869}
6870
6871impl std::ops::DerefMut for SetBanResponse {
6872    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
6873}
6874
6875impl AsRef<()> for SetBanResponse {
6876    fn as_ref(&self) -> &() { &self.value }
6877}
6878
6879impl From<()> for SetBanResponse {
6880    fn from(value: ()) -> Self { Self { value } }
6881}
6882
6883impl From<SetBanResponse> for () {
6884    fn from(wrapper: SetBanResponse) -> Self { wrapper.value }
6885}
6886
6887/// Response for the `SetLabel` RPC method
6888///
6889/// This method returns a primitive value wrapped in a transparent struct.
6890#[derive(Debug, Clone, PartialEq, Serialize)]
6891pub struct SetLabelResponse {
6892    /// Wrapped primitive value
6893    pub value: (),
6894}
6895
6896impl<'de> serde::Deserialize<'de> for SetLabelResponse {
6897    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6898    where
6899        D: serde::Deserializer<'de>,
6900    {
6901        use std::fmt;
6902
6903        use serde::de::{self, Visitor};
6904
6905        struct PrimitiveWrapperVisitor;
6906
6907        #[allow(unused_variables, clippy::needless_lifetimes)]
6908        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
6909            type Value = SetLabelResponse;
6910
6911            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6912                formatter.write_str("a primitive value or an object with 'value' field")
6913            }
6914
6915            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
6916            where
6917                E: de::Error,
6918            {
6919                Ok(SetLabelResponse { value: () })
6920            }
6921
6922            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
6923            where
6924                E: de::Error,
6925            {
6926                Ok(SetLabelResponse { value: () })
6927            }
6928
6929            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
6930            where
6931                E: de::Error,
6932            {
6933                Ok(SetLabelResponse { value: () })
6934            }
6935
6936            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
6937            where
6938                E: de::Error,
6939            {
6940                Ok(SetLabelResponse { value: () })
6941            }
6942
6943            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
6944            where
6945                E: de::Error,
6946            {
6947                Ok(SetLabelResponse { value: () })
6948            }
6949
6950            fn visit_none<E>(self) -> Result<Self::Value, E>
6951            where
6952                E: de::Error,
6953            {
6954                Ok(SetLabelResponse { value: () })
6955            }
6956
6957            fn visit_unit<E>(self) -> Result<Self::Value, E>
6958            where
6959                E: de::Error,
6960            {
6961                Ok(SetLabelResponse { value: () })
6962            }
6963
6964            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
6965            where
6966                M: de::MapAccess<'de>,
6967            {
6968                let mut value = None;
6969                while let Some(key) = map.next_key::<String>()? {
6970                    if key == "value" {
6971                        if value.is_some() {
6972                            return Err(de::Error::duplicate_field("value"));
6973                        }
6974                        value = Some(map.next_value::<()>()?);
6975                    } else {
6976                        let _ = map.next_value::<de::IgnoredAny>()?;
6977                    }
6978                }
6979                value.ok_or_else(|| de::Error::missing_field("value"))?;
6980                Ok(SetLabelResponse { value: () })
6981            }
6982        }
6983
6984        deserializer.deserialize_any(PrimitiveWrapperVisitor)
6985    }
6986}
6987
6988impl std::ops::Deref for SetLabelResponse {
6989    type Target = ();
6990    fn deref(&self) -> &Self::Target { &self.value }
6991}
6992
6993impl std::ops::DerefMut for SetLabelResponse {
6994    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
6995}
6996
6997impl AsRef<()> for SetLabelResponse {
6998    fn as_ref(&self) -> &() { &self.value }
6999}
7000
7001impl From<()> for SetLabelResponse {
7002    fn from(value: ()) -> Self { Self { value } }
7003}
7004
7005impl From<SetLabelResponse> for () {
7006    fn from(wrapper: SetLabelResponse) -> Self { wrapper.value }
7007}
7008
7009/// Response for the `SetMockTime` RPC method
7010///
7011/// This method returns a primitive value wrapped in a transparent struct.
7012#[derive(Debug, Clone, PartialEq, Serialize)]
7013pub struct SetMockTimeResponse {
7014    /// Wrapped primitive value
7015    pub value: (),
7016}
7017
7018impl<'de> serde::Deserialize<'de> for SetMockTimeResponse {
7019    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7020    where
7021        D: serde::Deserializer<'de>,
7022    {
7023        use std::fmt;
7024
7025        use serde::de::{self, Visitor};
7026
7027        struct PrimitiveWrapperVisitor;
7028
7029        #[allow(unused_variables, clippy::needless_lifetimes)]
7030        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7031            type Value = SetMockTimeResponse;
7032
7033            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7034                formatter.write_str("a primitive value or an object with 'value' field")
7035            }
7036
7037            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7038            where
7039                E: de::Error,
7040            {
7041                Ok(SetMockTimeResponse { value: () })
7042            }
7043
7044            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7045            where
7046                E: de::Error,
7047            {
7048                Ok(SetMockTimeResponse { value: () })
7049            }
7050
7051            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7052            where
7053                E: de::Error,
7054            {
7055                Ok(SetMockTimeResponse { value: () })
7056            }
7057
7058            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7059            where
7060                E: de::Error,
7061            {
7062                Ok(SetMockTimeResponse { value: () })
7063            }
7064
7065            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7066            where
7067                E: de::Error,
7068            {
7069                Ok(SetMockTimeResponse { value: () })
7070            }
7071
7072            fn visit_none<E>(self) -> Result<Self::Value, E>
7073            where
7074                E: de::Error,
7075            {
7076                Ok(SetMockTimeResponse { value: () })
7077            }
7078
7079            fn visit_unit<E>(self) -> Result<Self::Value, E>
7080            where
7081                E: de::Error,
7082            {
7083                Ok(SetMockTimeResponse { value: () })
7084            }
7085
7086            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7087            where
7088                M: de::MapAccess<'de>,
7089            {
7090                let mut value = None;
7091                while let Some(key) = map.next_key::<String>()? {
7092                    if key == "value" {
7093                        if value.is_some() {
7094                            return Err(de::Error::duplicate_field("value"));
7095                        }
7096                        value = Some(map.next_value::<()>()?);
7097                    } else {
7098                        let _ = map.next_value::<de::IgnoredAny>()?;
7099                    }
7100                }
7101                value.ok_or_else(|| de::Error::missing_field("value"))?;
7102                Ok(SetMockTimeResponse { value: () })
7103            }
7104        }
7105
7106        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7107    }
7108}
7109
7110impl std::ops::Deref for SetMockTimeResponse {
7111    type Target = ();
7112    fn deref(&self) -> &Self::Target { &self.value }
7113}
7114
7115impl std::ops::DerefMut for SetMockTimeResponse {
7116    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7117}
7118
7119impl AsRef<()> for SetMockTimeResponse {
7120    fn as_ref(&self) -> &() { &self.value }
7121}
7122
7123impl From<()> for SetMockTimeResponse {
7124    fn from(value: ()) -> Self { Self { value } }
7125}
7126
7127impl From<SetMockTimeResponse> for () {
7128    fn from(wrapper: SetMockTimeResponse) -> Self { wrapper.value }
7129}
7130
7131/// Response for the `SetNetworkActive` RPC method
7132///
7133/// This method returns a primitive value wrapped in a transparent struct.
7134#[derive(Debug, Clone, PartialEq, Serialize)]
7135pub struct SetNetworkActiveResponse {
7136    /// Wrapped primitive value
7137    pub value: bool,
7138}
7139
7140impl<'de> serde::Deserialize<'de> for SetNetworkActiveResponse {
7141    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7142    where
7143        D: serde::Deserializer<'de>,
7144    {
7145        use std::fmt;
7146
7147        use serde::de::{self, Visitor};
7148
7149        struct PrimitiveWrapperVisitor;
7150
7151        #[allow(unused_variables, clippy::needless_lifetimes)]
7152        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7153            type Value = SetNetworkActiveResponse;
7154
7155            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7156                formatter.write_str("a primitive value or an object with 'value' field")
7157            }
7158
7159            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7160            where
7161                E: de::Error,
7162            {
7163                Ok(SetNetworkActiveResponse { value: v != 0 })
7164            }
7165
7166            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7167            where
7168                E: de::Error,
7169            {
7170                Ok(SetNetworkActiveResponse { value: v != 0 })
7171            }
7172
7173            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7174            where
7175                E: de::Error,
7176            {
7177                Ok(SetNetworkActiveResponse { value: v != 0.0 })
7178            }
7179
7180            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7181            where
7182                E: de::Error,
7183            {
7184                let value = v.parse::<bool>().map_err(de::Error::custom)?;
7185                Ok(SetNetworkActiveResponse { value })
7186            }
7187
7188            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7189            where
7190                E: de::Error,
7191            {
7192                Ok(SetNetworkActiveResponse { value: v })
7193            }
7194
7195            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7196            where
7197                M: de::MapAccess<'de>,
7198            {
7199                let mut value = None;
7200                while let Some(key) = map.next_key::<String>()? {
7201                    if key == "value" {
7202                        if value.is_some() {
7203                            return Err(de::Error::duplicate_field("value"));
7204                        }
7205                        value = Some(map.next_value()?);
7206                    } else {
7207                        let _ = map.next_value::<de::IgnoredAny>()?;
7208                    }
7209                }
7210                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
7211                Ok(SetNetworkActiveResponse { value })
7212            }
7213        }
7214
7215        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7216    }
7217}
7218
7219impl std::ops::Deref for SetNetworkActiveResponse {
7220    type Target = bool;
7221    fn deref(&self) -> &Self::Target { &self.value }
7222}
7223
7224impl std::ops::DerefMut for SetNetworkActiveResponse {
7225    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7226}
7227
7228impl AsRef<bool> for SetNetworkActiveResponse {
7229    fn as_ref(&self) -> &bool { &self.value }
7230}
7231
7232impl From<bool> for SetNetworkActiveResponse {
7233    fn from(value: bool) -> Self { Self { value } }
7234}
7235
7236impl From<SetNetworkActiveResponse> for bool {
7237    fn from(wrapper: SetNetworkActiveResponse) -> Self { wrapper.value }
7238}
7239
7240/// Response for the `SetTxFee` RPC method
7241///
7242/// This method returns a primitive value wrapped in a transparent struct.
7243#[derive(Debug, Clone, PartialEq, Serialize)]
7244pub struct SetTxFeeResponse {
7245    /// Wrapped primitive value
7246    pub value: bool,
7247}
7248
7249impl<'de> serde::Deserialize<'de> for SetTxFeeResponse {
7250    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7251    where
7252        D: serde::Deserializer<'de>,
7253    {
7254        use std::fmt;
7255
7256        use serde::de::{self, Visitor};
7257
7258        struct PrimitiveWrapperVisitor;
7259
7260        #[allow(unused_variables, clippy::needless_lifetimes)]
7261        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7262            type Value = SetTxFeeResponse;
7263
7264            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7265                formatter.write_str("a primitive value or an object with 'value' field")
7266            }
7267
7268            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7269            where
7270                E: de::Error,
7271            {
7272                Ok(SetTxFeeResponse { value: v != 0 })
7273            }
7274
7275            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7276            where
7277                E: de::Error,
7278            {
7279                Ok(SetTxFeeResponse { value: v != 0 })
7280            }
7281
7282            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7283            where
7284                E: de::Error,
7285            {
7286                Ok(SetTxFeeResponse { value: v != 0.0 })
7287            }
7288
7289            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7290            where
7291                E: de::Error,
7292            {
7293                let value = v.parse::<bool>().map_err(de::Error::custom)?;
7294                Ok(SetTxFeeResponse { value })
7295            }
7296
7297            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7298            where
7299                E: de::Error,
7300            {
7301                Ok(SetTxFeeResponse { value: v })
7302            }
7303
7304            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7305            where
7306                M: de::MapAccess<'de>,
7307            {
7308                let mut value = None;
7309                while let Some(key) = map.next_key::<String>()? {
7310                    if key == "value" {
7311                        if value.is_some() {
7312                            return Err(de::Error::duplicate_field("value"));
7313                        }
7314                        value = Some(map.next_value()?);
7315                    } else {
7316                        let _ = map.next_value::<de::IgnoredAny>()?;
7317                    }
7318                }
7319                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
7320                Ok(SetTxFeeResponse { value })
7321            }
7322        }
7323
7324        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7325    }
7326}
7327
7328impl std::ops::Deref for SetTxFeeResponse {
7329    type Target = bool;
7330    fn deref(&self) -> &Self::Target { &self.value }
7331}
7332
7333impl std::ops::DerefMut for SetTxFeeResponse {
7334    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7335}
7336
7337impl AsRef<bool> for SetTxFeeResponse {
7338    fn as_ref(&self) -> &bool { &self.value }
7339}
7340
7341impl From<bool> for SetTxFeeResponse {
7342    fn from(value: bool) -> Self { Self { value } }
7343}
7344
7345impl From<SetTxFeeResponse> for bool {
7346    fn from(wrapper: SetTxFeeResponse) -> Self { wrapper.value }
7347}
7348
7349/// Response for the `SetWalletFlag` RPC method
7350///
7351#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
7352#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
7353pub struct SetWalletFlagResponse {
7354    /// The name of the flag that was modified
7355    pub flag_name: String,
7356    /// The new state of the flag
7357    pub flag_state: bool,
7358    /// Any warnings associated with the change
7359    pub warnings: Option<String>,
7360}
7361
7362/// Response for the `SignMessage` RPC method
7363///
7364/// This method returns a primitive value wrapped in a transparent struct.
7365#[derive(Debug, Clone, PartialEq, Serialize)]
7366pub struct SignMessageResponse {
7367    /// Wrapped primitive value
7368    pub value: String,
7369}
7370
7371impl<'de> serde::Deserialize<'de> for SignMessageResponse {
7372    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7373    where
7374        D: serde::Deserializer<'de>,
7375    {
7376        use std::fmt;
7377
7378        use serde::de::{self, Visitor};
7379
7380        struct PrimitiveWrapperVisitor;
7381
7382        #[allow(unused_variables, clippy::needless_lifetimes)]
7383        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7384            type Value = SignMessageResponse;
7385
7386            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7387                formatter.write_str("a primitive value or an object with 'value' field")
7388            }
7389
7390            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7391            where
7392                E: de::Error,
7393            {
7394                Ok(SignMessageResponse { value: v.to_string() })
7395            }
7396
7397            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7398            where
7399                E: de::Error,
7400            {
7401                Ok(SignMessageResponse { value: v.to_string() })
7402            }
7403
7404            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7405            where
7406                E: de::Error,
7407            {
7408                Ok(SignMessageResponse { value: v.to_string() })
7409            }
7410
7411            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7412            where
7413                E: de::Error,
7414            {
7415                Ok(SignMessageResponse { value: v.to_string() })
7416            }
7417
7418            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7419            where
7420                E: de::Error,
7421            {
7422                Ok(SignMessageResponse { value: v.to_string() })
7423            }
7424
7425            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7426            where
7427                M: de::MapAccess<'de>,
7428            {
7429                let mut value = None;
7430                while let Some(key) = map.next_key::<String>()? {
7431                    if key == "value" {
7432                        if value.is_some() {
7433                            return Err(de::Error::duplicate_field("value"));
7434                        }
7435                        value = Some(map.next_value()?);
7436                    } else {
7437                        let _ = map.next_value::<de::IgnoredAny>()?;
7438                    }
7439                }
7440                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
7441                Ok(SignMessageResponse { value })
7442            }
7443        }
7444
7445        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7446    }
7447}
7448
7449impl std::ops::Deref for SignMessageResponse {
7450    type Target = String;
7451    fn deref(&self) -> &Self::Target { &self.value }
7452}
7453
7454impl std::ops::DerefMut for SignMessageResponse {
7455    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7456}
7457
7458impl AsRef<String> for SignMessageResponse {
7459    fn as_ref(&self) -> &String { &self.value }
7460}
7461
7462impl From<String> for SignMessageResponse {
7463    fn from(value: String) -> Self { Self { value } }
7464}
7465
7466impl From<SignMessageResponse> for String {
7467    fn from(wrapper: SignMessageResponse) -> Self { wrapper.value }
7468}
7469
7470/// Response for the `SignMessageWithPrivKey` RPC method
7471///
7472/// This method returns a primitive value wrapped in a transparent struct.
7473#[derive(Debug, Clone, PartialEq, Serialize)]
7474pub struct SignMessageWithPrivKeyResponse {
7475    /// Wrapped primitive value
7476    pub value: String,
7477}
7478
7479impl<'de> serde::Deserialize<'de> for SignMessageWithPrivKeyResponse {
7480    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7481    where
7482        D: serde::Deserializer<'de>,
7483    {
7484        use std::fmt;
7485
7486        use serde::de::{self, Visitor};
7487
7488        struct PrimitiveWrapperVisitor;
7489
7490        #[allow(unused_variables, clippy::needless_lifetimes)]
7491        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7492            type Value = SignMessageWithPrivKeyResponse;
7493
7494            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7495                formatter.write_str("a primitive value or an object with 'value' field")
7496            }
7497
7498            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7499            where
7500                E: de::Error,
7501            {
7502                Ok(SignMessageWithPrivKeyResponse { value: v.to_string() })
7503            }
7504
7505            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7506            where
7507                E: de::Error,
7508            {
7509                Ok(SignMessageWithPrivKeyResponse { value: v.to_string() })
7510            }
7511
7512            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7513            where
7514                E: de::Error,
7515            {
7516                Ok(SignMessageWithPrivKeyResponse { value: v.to_string() })
7517            }
7518
7519            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7520            where
7521                E: de::Error,
7522            {
7523                Ok(SignMessageWithPrivKeyResponse { value: v.to_string() })
7524            }
7525
7526            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7527            where
7528                E: de::Error,
7529            {
7530                Ok(SignMessageWithPrivKeyResponse { value: v.to_string() })
7531            }
7532
7533            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7534            where
7535                M: de::MapAccess<'de>,
7536            {
7537                let mut value = None;
7538                while let Some(key) = map.next_key::<String>()? {
7539                    if key == "value" {
7540                        if value.is_some() {
7541                            return Err(de::Error::duplicate_field("value"));
7542                        }
7543                        value = Some(map.next_value()?);
7544                    } else {
7545                        let _ = map.next_value::<de::IgnoredAny>()?;
7546                    }
7547                }
7548                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
7549                Ok(SignMessageWithPrivKeyResponse { value })
7550            }
7551        }
7552
7553        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7554    }
7555}
7556
7557impl std::ops::Deref for SignMessageWithPrivKeyResponse {
7558    type Target = String;
7559    fn deref(&self) -> &Self::Target { &self.value }
7560}
7561
7562impl std::ops::DerefMut for SignMessageWithPrivKeyResponse {
7563    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7564}
7565
7566impl AsRef<String> for SignMessageWithPrivKeyResponse {
7567    fn as_ref(&self) -> &String { &self.value }
7568}
7569
7570impl From<String> for SignMessageWithPrivKeyResponse {
7571    fn from(value: String) -> Self { Self { value } }
7572}
7573
7574impl From<SignMessageWithPrivKeyResponse> for String {
7575    fn from(wrapper: SignMessageWithPrivKeyResponse) -> Self { wrapper.value }
7576}
7577
7578/// Response for the `SignRawTransactionWithKey` RPC method
7579///
7580#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
7581#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
7582pub struct SignRawTransactionWithKeyResponse {
7583    /// If the transaction has a complete set of signatures
7584    pub complete: bool,
7585    /// Script verification errors (if there are any)
7586    pub errors: Option<serde_json::Value>,
7587    /// The hex-encoded raw transaction with signature(s)
7588    pub hex: String,
7589}
7590
7591/// Response for the `SignRawTransactionWithWallet` RPC method
7592///
7593#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
7594#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
7595pub struct SignRawTransactionWithWalletResponse {
7596    /// If the transaction has a complete set of signatures
7597    pub complete: bool,
7598    /// Script verification errors (if there are any)
7599    pub errors: Option<serde_json::Value>,
7600    /// The hex-encoded raw transaction with signature(s)
7601    pub hex: String,
7602}
7603
7604/// Response for the `SimulateRawTransaction` RPC method
7605///
7606#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
7607#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
7608pub struct SimulateRawTransactionResponse {
7609    /// The wallet balance change (negative means decrease).
7610    #[serde(deserialize_with = "amount_from_btc_float")]
7611    pub balance_change: bitcoin::Amount,
7612}
7613
7614/// Response for the `Stop` RPC method
7615///
7616/// This method returns a primitive value wrapped in a transparent struct.
7617#[derive(Debug, Clone, PartialEq, Serialize)]
7618pub struct StopResponse {
7619    /// Wrapped primitive value
7620    pub value: String,
7621}
7622
7623impl<'de> serde::Deserialize<'de> for StopResponse {
7624    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7625    where
7626        D: serde::Deserializer<'de>,
7627    {
7628        use std::fmt;
7629
7630        use serde::de::{self, Visitor};
7631
7632        struct PrimitiveWrapperVisitor;
7633
7634        #[allow(unused_variables, clippy::needless_lifetimes)]
7635        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7636            type Value = StopResponse;
7637
7638            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7639                formatter.write_str("a primitive value or an object with 'value' field")
7640            }
7641
7642            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7643            where
7644                E: de::Error,
7645            {
7646                Ok(StopResponse { value: v.to_string() })
7647            }
7648
7649            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7650            where
7651                E: de::Error,
7652            {
7653                Ok(StopResponse { value: v.to_string() })
7654            }
7655
7656            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7657            where
7658                E: de::Error,
7659            {
7660                Ok(StopResponse { value: v.to_string() })
7661            }
7662
7663            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7664            where
7665                E: de::Error,
7666            {
7667                Ok(StopResponse { value: v.to_string() })
7668            }
7669
7670            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7671            where
7672                E: de::Error,
7673            {
7674                Ok(StopResponse { value: v.to_string() })
7675            }
7676
7677            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7678            where
7679                M: de::MapAccess<'de>,
7680            {
7681                let mut value = None;
7682                while let Some(key) = map.next_key::<String>()? {
7683                    if key == "value" {
7684                        if value.is_some() {
7685                            return Err(de::Error::duplicate_field("value"));
7686                        }
7687                        value = Some(map.next_value()?);
7688                    } else {
7689                        let _ = map.next_value::<de::IgnoredAny>()?;
7690                    }
7691                }
7692                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
7693                Ok(StopResponse { value })
7694            }
7695        }
7696
7697        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7698    }
7699}
7700
7701impl std::ops::Deref for StopResponse {
7702    type Target = String;
7703    fn deref(&self) -> &Self::Target { &self.value }
7704}
7705
7706impl std::ops::DerefMut for StopResponse {
7707    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7708}
7709
7710impl AsRef<String> for StopResponse {
7711    fn as_ref(&self) -> &String { &self.value }
7712}
7713
7714impl From<String> for StopResponse {
7715    fn from(value: String) -> Self { Self { value } }
7716}
7717
7718impl From<StopResponse> for String {
7719    fn from(wrapper: StopResponse) -> Self { wrapper.value }
7720}
7721
7722/// Response for the `SubmitBlock` RPC method
7723///
7724#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
7725#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
7726pub struct SubmitBlockResponse {
7727    pub field_0: (),
7728    /// According to BIP22
7729    pub field_1: String,
7730}
7731
7732/// Response for the `SubmitHeader` RPC method
7733///
7734/// This method returns a primitive value wrapped in a transparent struct.
7735#[derive(Debug, Clone, PartialEq, Serialize)]
7736pub struct SubmitHeaderResponse {
7737    /// Wrapped primitive value
7738    pub value: (),
7739}
7740
7741impl<'de> serde::Deserialize<'de> for SubmitHeaderResponse {
7742    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7743    where
7744        D: serde::Deserializer<'de>,
7745    {
7746        use std::fmt;
7747
7748        use serde::de::{self, Visitor};
7749
7750        struct PrimitiveWrapperVisitor;
7751
7752        #[allow(unused_variables, clippy::needless_lifetimes)]
7753        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7754            type Value = SubmitHeaderResponse;
7755
7756            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7757                formatter.write_str("a primitive value or an object with 'value' field")
7758            }
7759
7760            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7761            where
7762                E: de::Error,
7763            {
7764                Ok(SubmitHeaderResponse { value: () })
7765            }
7766
7767            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7768            where
7769                E: de::Error,
7770            {
7771                Ok(SubmitHeaderResponse { value: () })
7772            }
7773
7774            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7775            where
7776                E: de::Error,
7777            {
7778                Ok(SubmitHeaderResponse { value: () })
7779            }
7780
7781            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7782            where
7783                E: de::Error,
7784            {
7785                Ok(SubmitHeaderResponse { value: () })
7786            }
7787
7788            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7789            where
7790                E: de::Error,
7791            {
7792                Ok(SubmitHeaderResponse { value: () })
7793            }
7794
7795            fn visit_none<E>(self) -> Result<Self::Value, E>
7796            where
7797                E: de::Error,
7798            {
7799                Ok(SubmitHeaderResponse { value: () })
7800            }
7801
7802            fn visit_unit<E>(self) -> Result<Self::Value, E>
7803            where
7804                E: de::Error,
7805            {
7806                Ok(SubmitHeaderResponse { value: () })
7807            }
7808
7809            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7810            where
7811                M: de::MapAccess<'de>,
7812            {
7813                let mut value = None;
7814                while let Some(key) = map.next_key::<String>()? {
7815                    if key == "value" {
7816                        if value.is_some() {
7817                            return Err(de::Error::duplicate_field("value"));
7818                        }
7819                        value = Some(map.next_value::<()>()?);
7820                    } else {
7821                        let _ = map.next_value::<de::IgnoredAny>()?;
7822                    }
7823                }
7824                value.ok_or_else(|| de::Error::missing_field("value"))?;
7825                Ok(SubmitHeaderResponse { value: () })
7826            }
7827        }
7828
7829        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7830    }
7831}
7832
7833impl std::ops::Deref for SubmitHeaderResponse {
7834    type Target = ();
7835    fn deref(&self) -> &Self::Target { &self.value }
7836}
7837
7838impl std::ops::DerefMut for SubmitHeaderResponse {
7839    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7840}
7841
7842impl AsRef<()> for SubmitHeaderResponse {
7843    fn as_ref(&self) -> &() { &self.value }
7844}
7845
7846impl From<()> for SubmitHeaderResponse {
7847    fn from(value: ()) -> Self { Self { value } }
7848}
7849
7850impl From<SubmitHeaderResponse> for () {
7851    fn from(wrapper: SubmitHeaderResponse) -> Self { wrapper.value }
7852}
7853
7854/// Response for the `SubmitPackage` RPC method
7855///
7856#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
7857#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
7858pub struct SubmitPackageResponse {
7859    /// The transaction package result message. "success" indicates all transactions were accepted into or are already in the mempool.
7860    pub package_msg: String,
7861    /// List of txids of replaced transactions
7862    #[serde(rename = "replaced-transactions")]
7863    pub replaced_transactions: Option<Vec<String>>,
7864    /// The transaction results keyed by wtxid. An entry is returned for every submitted wtxid.
7865    #[serde(rename = "tx-results")]
7866    pub tx_results: serde_json::Value,
7867}
7868
7869/// Response for the `SyncWithValidationInterfaceQueue` RPC method
7870///
7871/// This method returns a primitive value wrapped in a transparent struct.
7872#[derive(Debug, Clone, PartialEq, Serialize)]
7873pub struct SyncWithValidationInterfaceQueueResponse {
7874    /// Wrapped primitive value
7875    pub value: (),
7876}
7877
7878impl<'de> serde::Deserialize<'de> for SyncWithValidationInterfaceQueueResponse {
7879    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7880    where
7881        D: serde::Deserializer<'de>,
7882    {
7883        use std::fmt;
7884
7885        use serde::de::{self, Visitor};
7886
7887        struct PrimitiveWrapperVisitor;
7888
7889        #[allow(unused_variables, clippy::needless_lifetimes)]
7890        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
7891            type Value = SyncWithValidationInterfaceQueueResponse;
7892
7893            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7894                formatter.write_str("a primitive value or an object with 'value' field")
7895            }
7896
7897            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
7898            where
7899                E: de::Error,
7900            {
7901                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
7902            }
7903
7904            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
7905            where
7906                E: de::Error,
7907            {
7908                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
7909            }
7910
7911            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
7912            where
7913                E: de::Error,
7914            {
7915                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
7916            }
7917
7918            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
7919            where
7920                E: de::Error,
7921            {
7922                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
7923            }
7924
7925            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
7926            where
7927                E: de::Error,
7928            {
7929                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
7930            }
7931
7932            fn visit_none<E>(self) -> Result<Self::Value, E>
7933            where
7934                E: de::Error,
7935            {
7936                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
7937            }
7938
7939            fn visit_unit<E>(self) -> Result<Self::Value, E>
7940            where
7941                E: de::Error,
7942            {
7943                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
7944            }
7945
7946            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
7947            where
7948                M: de::MapAccess<'de>,
7949            {
7950                let mut value = None;
7951                while let Some(key) = map.next_key::<String>()? {
7952                    if key == "value" {
7953                        if value.is_some() {
7954                            return Err(de::Error::duplicate_field("value"));
7955                        }
7956                        value = Some(map.next_value::<()>()?);
7957                    } else {
7958                        let _ = map.next_value::<de::IgnoredAny>()?;
7959                    }
7960                }
7961                value.ok_or_else(|| de::Error::missing_field("value"))?;
7962                Ok(SyncWithValidationInterfaceQueueResponse { value: () })
7963            }
7964        }
7965
7966        deserializer.deserialize_any(PrimitiveWrapperVisitor)
7967    }
7968}
7969
7970impl std::ops::Deref for SyncWithValidationInterfaceQueueResponse {
7971    type Target = ();
7972    fn deref(&self) -> &Self::Target { &self.value }
7973}
7974
7975impl std::ops::DerefMut for SyncWithValidationInterfaceQueueResponse {
7976    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
7977}
7978
7979impl AsRef<()> for SyncWithValidationInterfaceQueueResponse {
7980    fn as_ref(&self) -> &() { &self.value }
7981}
7982
7983impl From<()> for SyncWithValidationInterfaceQueueResponse {
7984    fn from(value: ()) -> Self { Self { value } }
7985}
7986
7987impl From<SyncWithValidationInterfaceQueueResponse> for () {
7988    fn from(wrapper: SyncWithValidationInterfaceQueueResponse) -> Self { wrapper.value }
7989}
7990
7991/// Response for the `TestMempoolAccept` RPC method
7992///
7993/// The result of the mempool acceptance test for each raw transaction in the input array.
7994/// Returns results for each transaction in the same order they were passed in.
7995/// Transactions that cannot be fully validated due to failures in other transactions will not contain an 'allowed' result.
7996#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
7997#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
7998pub struct TestMempoolAcceptResponse {
7999    pub field: serde_json::Value,
8000}
8001
8002/// Response for the `UnloadWallet` RPC method
8003///
8004#[derive(Debug, Clone, PartialEq, Serialize)]
8005pub struct UnloadWalletResponse {
8006    /// Warning messages, if any, related to unloading the wallet.
8007    pub warnings: Option<Vec<String>>,
8008}
8009impl<'de> serde::Deserialize<'de> for UnloadWalletResponse {
8010    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8011    where
8012        D: serde::Deserializer<'de>,
8013    {
8014        use std::fmt;
8015
8016        use serde::de::{self, Visitor};
8017
8018        struct ConditionalResponseVisitor;
8019
8020        #[allow(clippy::needless_lifetimes)]
8021        impl<'de> Visitor<'de> for ConditionalResponseVisitor {
8022            type Value = UnloadWalletResponse;
8023
8024            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8025                formatter.write_str("string or object")
8026            }
8027
8028            fn visit_str<E>(self, _v: &str) -> Result<Self::Value, E>
8029            where
8030                E: de::Error,
8031            {
8032                Ok(UnloadWalletResponse { warnings: None })
8033            }
8034
8035            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8036            where
8037                M: de::MapAccess<'de>,
8038            {
8039                let mut warnings = None;
8040                while let Some(key) = map.next_key::<String>()? {
8041                    if key == "warnings" {
8042                        if warnings.is_some() {
8043                            return Err(de::Error::duplicate_field("warnings"));
8044                        }
8045                        warnings = Some(map.next_value::<Vec<String>>()?);
8046                    } else {
8047                        let _ = map.next_value::<de::IgnoredAny>()?;
8048                    }
8049                }
8050                Ok(UnloadWalletResponse { warnings })
8051            }
8052        }
8053
8054        deserializer.deserialize_any(ConditionalResponseVisitor)
8055    }
8056}
8057
8058/// Response for the `Uptime` RPC method
8059///
8060/// This method returns a primitive value wrapped in a transparent struct.
8061#[derive(Debug, Clone, PartialEq, Serialize)]
8062pub struct UptimeResponse {
8063    /// Wrapped primitive value
8064    pub value: u64,
8065}
8066
8067impl<'de> serde::Deserialize<'de> for UptimeResponse {
8068    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8069    where
8070        D: serde::Deserializer<'de>,
8071    {
8072        use std::fmt;
8073
8074        use serde::de::{self, Visitor};
8075
8076        struct PrimitiveWrapperVisitor;
8077
8078        #[allow(unused_variables, clippy::needless_lifetimes)]
8079        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
8080            type Value = UptimeResponse;
8081
8082            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8083                formatter.write_str("a primitive value or an object with 'value' field")
8084            }
8085
8086            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
8087            where
8088                E: de::Error,
8089            {
8090                Ok(UptimeResponse { value: v })
8091            }
8092
8093            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
8094            where
8095                E: de::Error,
8096            {
8097                Ok(UptimeResponse { value: v as u64 })
8098            }
8099
8100            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
8101            where
8102                E: de::Error,
8103            {
8104                Ok(UptimeResponse { value: v as u64 })
8105            }
8106
8107            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
8108            where
8109                E: de::Error,
8110            {
8111                let value = v.parse::<u64>().map_err(de::Error::custom)?;
8112                Ok(UptimeResponse { value })
8113            }
8114
8115            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
8116            where
8117                E: de::Error,
8118            {
8119                Ok(UptimeResponse { value: v as u64 })
8120            }
8121
8122            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8123            where
8124                M: de::MapAccess<'de>,
8125            {
8126                let mut value = None;
8127                while let Some(key) = map.next_key::<String>()? {
8128                    if key == "value" {
8129                        if value.is_some() {
8130                            return Err(de::Error::duplicate_field("value"));
8131                        }
8132                        value = Some(map.next_value()?);
8133                    } else {
8134                        let _ = map.next_value::<de::IgnoredAny>()?;
8135                    }
8136                }
8137                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
8138                Ok(UptimeResponse { value })
8139            }
8140        }
8141
8142        deserializer.deserialize_any(PrimitiveWrapperVisitor)
8143    }
8144}
8145
8146impl std::ops::Deref for UptimeResponse {
8147    type Target = u64;
8148    fn deref(&self) -> &Self::Target { &self.value }
8149}
8150
8151impl std::ops::DerefMut for UptimeResponse {
8152    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
8153}
8154
8155impl AsRef<u64> for UptimeResponse {
8156    fn as_ref(&self) -> &u64 { &self.value }
8157}
8158
8159impl From<u64> for UptimeResponse {
8160    fn from(value: u64) -> Self { Self { value } }
8161}
8162
8163impl From<UptimeResponse> for u64 {
8164    fn from(wrapper: UptimeResponse) -> Self { wrapper.value }
8165}
8166
8167/// Response for the `UtxoUpdatePsbt` RPC method
8168///
8169/// This method returns a primitive value wrapped in a transparent struct.
8170#[derive(Debug, Clone, PartialEq, Serialize)]
8171pub struct UtxoUpdatePsbtResponse {
8172    /// Wrapped primitive value
8173    pub value: String,
8174}
8175
8176impl<'de> serde::Deserialize<'de> for UtxoUpdatePsbtResponse {
8177    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8178    where
8179        D: serde::Deserializer<'de>,
8180    {
8181        use std::fmt;
8182
8183        use serde::de::{self, Visitor};
8184
8185        struct PrimitiveWrapperVisitor;
8186
8187        #[allow(unused_variables, clippy::needless_lifetimes)]
8188        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
8189            type Value = UtxoUpdatePsbtResponse;
8190
8191            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8192                formatter.write_str("a primitive value or an object with 'value' field")
8193            }
8194
8195            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
8196            where
8197                E: de::Error,
8198            {
8199                Ok(UtxoUpdatePsbtResponse { value: v.to_string() })
8200            }
8201
8202            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
8203            where
8204                E: de::Error,
8205            {
8206                Ok(UtxoUpdatePsbtResponse { value: v.to_string() })
8207            }
8208
8209            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
8210            where
8211                E: de::Error,
8212            {
8213                Ok(UtxoUpdatePsbtResponse { value: v.to_string() })
8214            }
8215
8216            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
8217            where
8218                E: de::Error,
8219            {
8220                Ok(UtxoUpdatePsbtResponse { value: v.to_string() })
8221            }
8222
8223            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
8224            where
8225                E: de::Error,
8226            {
8227                Ok(UtxoUpdatePsbtResponse { value: v.to_string() })
8228            }
8229
8230            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8231            where
8232                M: de::MapAccess<'de>,
8233            {
8234                let mut value = None;
8235                while let Some(key) = map.next_key::<String>()? {
8236                    if key == "value" {
8237                        if value.is_some() {
8238                            return Err(de::Error::duplicate_field("value"));
8239                        }
8240                        value = Some(map.next_value()?);
8241                    } else {
8242                        let _ = map.next_value::<de::IgnoredAny>()?;
8243                    }
8244                }
8245                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
8246                Ok(UtxoUpdatePsbtResponse { value })
8247            }
8248        }
8249
8250        deserializer.deserialize_any(PrimitiveWrapperVisitor)
8251    }
8252}
8253
8254impl std::ops::Deref for UtxoUpdatePsbtResponse {
8255    type Target = String;
8256    fn deref(&self) -> &Self::Target { &self.value }
8257}
8258
8259impl std::ops::DerefMut for UtxoUpdatePsbtResponse {
8260    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
8261}
8262
8263impl AsRef<String> for UtxoUpdatePsbtResponse {
8264    fn as_ref(&self) -> &String { &self.value }
8265}
8266
8267impl From<String> for UtxoUpdatePsbtResponse {
8268    fn from(value: String) -> Self { Self { value } }
8269}
8270
8271impl From<UtxoUpdatePsbtResponse> for String {
8272    fn from(wrapper: UtxoUpdatePsbtResponse) -> Self { wrapper.value }
8273}
8274
8275/// Response for the `ValidateAddress` RPC method
8276///
8277#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
8278#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8279pub struct ValidateAddressResponse {
8280    /// The bitcoin address validated
8281    pub address: Option<String>,
8282    /// Error message, if any
8283    pub error: Option<String>,
8284    /// Indices of likely error locations in address, if known (e.g. Bech32 errors)
8285    pub error_locations: Option<Vec<String>>,
8286    /// If the key is a script
8287    pub isscript: Option<bool>,
8288    /// If the address is valid or not
8289    pub isvalid: bool,
8290    /// If the address is a witness address
8291    pub iswitness: Option<bool>,
8292    /// The hex-encoded output script generated by the address
8293    pub scriptPubKey: Option<bitcoin::ScriptBuf>,
8294    /// The hex value of the witness program
8295    pub witness_program: Option<String>,
8296    /// The version number of the witness program
8297    pub witness_version: Option<u64>,
8298}
8299
8300/// Response for the `VerifyChain` RPC method
8301///
8302/// This method returns a primitive value wrapped in a transparent struct.
8303#[derive(Debug, Clone, PartialEq, Serialize)]
8304pub struct VerifyChainResponse {
8305    /// Wrapped primitive value
8306    pub value: bool,
8307}
8308
8309impl<'de> serde::Deserialize<'de> for VerifyChainResponse {
8310    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8311    where
8312        D: serde::Deserializer<'de>,
8313    {
8314        use std::fmt;
8315
8316        use serde::de::{self, Visitor};
8317
8318        struct PrimitiveWrapperVisitor;
8319
8320        #[allow(unused_variables, clippy::needless_lifetimes)]
8321        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
8322            type Value = VerifyChainResponse;
8323
8324            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8325                formatter.write_str("a primitive value or an object with 'value' field")
8326            }
8327
8328            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
8329            where
8330                E: de::Error,
8331            {
8332                Ok(VerifyChainResponse { value: v != 0 })
8333            }
8334
8335            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
8336            where
8337                E: de::Error,
8338            {
8339                Ok(VerifyChainResponse { value: v != 0 })
8340            }
8341
8342            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
8343            where
8344                E: de::Error,
8345            {
8346                Ok(VerifyChainResponse { value: v != 0.0 })
8347            }
8348
8349            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
8350            where
8351                E: de::Error,
8352            {
8353                let value = v.parse::<bool>().map_err(de::Error::custom)?;
8354                Ok(VerifyChainResponse { value })
8355            }
8356
8357            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
8358            where
8359                E: de::Error,
8360            {
8361                Ok(VerifyChainResponse { value: v })
8362            }
8363
8364            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8365            where
8366                M: de::MapAccess<'de>,
8367            {
8368                let mut value = None;
8369                while let Some(key) = map.next_key::<String>()? {
8370                    if key == "value" {
8371                        if value.is_some() {
8372                            return Err(de::Error::duplicate_field("value"));
8373                        }
8374                        value = Some(map.next_value()?);
8375                    } else {
8376                        let _ = map.next_value::<de::IgnoredAny>()?;
8377                    }
8378                }
8379                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
8380                Ok(VerifyChainResponse { value })
8381            }
8382        }
8383
8384        deserializer.deserialize_any(PrimitiveWrapperVisitor)
8385    }
8386}
8387
8388impl std::ops::Deref for VerifyChainResponse {
8389    type Target = bool;
8390    fn deref(&self) -> &Self::Target { &self.value }
8391}
8392
8393impl std::ops::DerefMut for VerifyChainResponse {
8394    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
8395}
8396
8397impl AsRef<bool> for VerifyChainResponse {
8398    fn as_ref(&self) -> &bool { &self.value }
8399}
8400
8401impl From<bool> for VerifyChainResponse {
8402    fn from(value: bool) -> Self { Self { value } }
8403}
8404
8405impl From<VerifyChainResponse> for bool {
8406    fn from(wrapper: VerifyChainResponse) -> Self { wrapper.value }
8407}
8408
8409/// Response for the `VerifyMessage` RPC method
8410///
8411/// This method returns a primitive value wrapped in a transparent struct.
8412#[derive(Debug, Clone, PartialEq, Serialize)]
8413pub struct VerifyMessageResponse {
8414    /// Wrapped primitive value
8415    pub value: bool,
8416}
8417
8418impl<'de> serde::Deserialize<'de> for VerifyMessageResponse {
8419    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8420    where
8421        D: serde::Deserializer<'de>,
8422    {
8423        use std::fmt;
8424
8425        use serde::de::{self, Visitor};
8426
8427        struct PrimitiveWrapperVisitor;
8428
8429        #[allow(unused_variables, clippy::needless_lifetimes)]
8430        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
8431            type Value = VerifyMessageResponse;
8432
8433            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8434                formatter.write_str("a primitive value or an object with 'value' field")
8435            }
8436
8437            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
8438            where
8439                E: de::Error,
8440            {
8441                Ok(VerifyMessageResponse { value: v != 0 })
8442            }
8443
8444            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
8445            where
8446                E: de::Error,
8447            {
8448                Ok(VerifyMessageResponse { value: v != 0 })
8449            }
8450
8451            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
8452            where
8453                E: de::Error,
8454            {
8455                Ok(VerifyMessageResponse { value: v != 0.0 })
8456            }
8457
8458            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
8459            where
8460                E: de::Error,
8461            {
8462                let value = v.parse::<bool>().map_err(de::Error::custom)?;
8463                Ok(VerifyMessageResponse { value })
8464            }
8465
8466            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
8467            where
8468                E: de::Error,
8469            {
8470                Ok(VerifyMessageResponse { value: v })
8471            }
8472
8473            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8474            where
8475                M: de::MapAccess<'de>,
8476            {
8477                let mut value = None;
8478                while let Some(key) = map.next_key::<String>()? {
8479                    if key == "value" {
8480                        if value.is_some() {
8481                            return Err(de::Error::duplicate_field("value"));
8482                        }
8483                        value = Some(map.next_value()?);
8484                    } else {
8485                        let _ = map.next_value::<de::IgnoredAny>()?;
8486                    }
8487                }
8488                let value = value.ok_or_else(|| de::Error::missing_field("value"))?;
8489                Ok(VerifyMessageResponse { value })
8490            }
8491        }
8492
8493        deserializer.deserialize_any(PrimitiveWrapperVisitor)
8494    }
8495}
8496
8497impl std::ops::Deref for VerifyMessageResponse {
8498    type Target = bool;
8499    fn deref(&self) -> &Self::Target { &self.value }
8500}
8501
8502impl std::ops::DerefMut for VerifyMessageResponse {
8503    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
8504}
8505
8506impl AsRef<bool> for VerifyMessageResponse {
8507    fn as_ref(&self) -> &bool { &self.value }
8508}
8509
8510impl From<bool> for VerifyMessageResponse {
8511    fn from(value: bool) -> Self { Self { value } }
8512}
8513
8514impl From<VerifyMessageResponse> for bool {
8515    fn from(wrapper: VerifyMessageResponse) -> Self { wrapper.value }
8516}
8517
8518/// Response for the `VerifyTxOutProof` RPC method
8519///
8520/// This method returns an array wrapped in a transparent struct.
8521#[derive(Debug, Clone, PartialEq, Serialize)]
8522pub struct VerifyTxOutProofResponse {
8523    /// Wrapped array value
8524    pub value: Vec<serde_json::Value>,
8525}
8526
8527impl<'de> serde::Deserialize<'de> for VerifyTxOutProofResponse {
8528    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8529    where
8530        D: serde::Deserializer<'de>,
8531    {
8532        let value = Vec::<serde_json::Value>::deserialize(deserializer)?;
8533        Ok(Self { value })
8534    }
8535}
8536
8537impl From<Vec<serde_json::Value>> for VerifyTxOutProofResponse {
8538    fn from(value: Vec<serde_json::Value>) -> Self { Self { value } }
8539}
8540
8541impl From<VerifyTxOutProofResponse> for Vec<serde_json::Value> {
8542    fn from(wrapper: VerifyTxOutProofResponse) -> Self { wrapper.value }
8543}
8544
8545/// Response for the `WaitForBlock` RPC method
8546///
8547#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
8548#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8549pub struct WaitForBlockResponse {
8550    /// The blockhash
8551    pub hash: String,
8552    /// Block height
8553    pub height: u64,
8554}
8555
8556/// Response for the `WaitForBlockHeight` RPC method
8557///
8558#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
8559#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8560pub struct WaitForBlockHeightResponse {
8561    /// The blockhash
8562    pub hash: String,
8563    /// Block height
8564    pub height: u64,
8565}
8566
8567/// Response for the `WaitForNewBlock` RPC method
8568///
8569#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
8570#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8571pub struct WaitForNewBlockResponse {
8572    /// The blockhash
8573    pub hash: String,
8574    /// Block height
8575    pub height: u64,
8576}
8577
8578/// Response for the `WalletCreateFundedPsbt` RPC method
8579///
8580#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
8581#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8582pub struct WalletCreateFundedPsbtResponse {
8583    /// The position of the added change output, or -1
8584    pub changepos: i64,
8585    /// Fee in BTC the resulting transaction pays
8586    #[serde(deserialize_with = "amount_from_btc_float")]
8587    pub fee: bitcoin::Amount,
8588    /// The resulting raw transaction (base64-encoded string)
8589    pub psbt: String,
8590}
8591
8592/// Response for the `WalletDisplayAddress` RPC method
8593///
8594#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
8595#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8596pub struct WalletDisplayAddressResponse {
8597    /// The address as confirmed by the signer
8598    pub address: String,
8599}
8600
8601/// Response for the `WalletLock` RPC method
8602///
8603/// This method returns a primitive value wrapped in a transparent struct.
8604#[derive(Debug, Clone, PartialEq, Serialize)]
8605pub struct WalletLockResponse {
8606    /// Wrapped primitive value
8607    pub value: (),
8608}
8609
8610impl<'de> serde::Deserialize<'de> for WalletLockResponse {
8611    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8612    where
8613        D: serde::Deserializer<'de>,
8614    {
8615        use std::fmt;
8616
8617        use serde::de::{self, Visitor};
8618
8619        struct PrimitiveWrapperVisitor;
8620
8621        #[allow(unused_variables, clippy::needless_lifetimes)]
8622        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
8623            type Value = WalletLockResponse;
8624
8625            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8626                formatter.write_str("a primitive value or an object with 'value' field")
8627            }
8628
8629            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
8630            where
8631                E: de::Error,
8632            {
8633                Ok(WalletLockResponse { value: () })
8634            }
8635
8636            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
8637            where
8638                E: de::Error,
8639            {
8640                Ok(WalletLockResponse { value: () })
8641            }
8642
8643            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
8644            where
8645                E: de::Error,
8646            {
8647                Ok(WalletLockResponse { value: () })
8648            }
8649
8650            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
8651            where
8652                E: de::Error,
8653            {
8654                Ok(WalletLockResponse { value: () })
8655            }
8656
8657            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
8658            where
8659                E: de::Error,
8660            {
8661                Ok(WalletLockResponse { value: () })
8662            }
8663
8664            fn visit_none<E>(self) -> Result<Self::Value, E>
8665            where
8666                E: de::Error,
8667            {
8668                Ok(WalletLockResponse { value: () })
8669            }
8670
8671            fn visit_unit<E>(self) -> Result<Self::Value, E>
8672            where
8673                E: de::Error,
8674            {
8675                Ok(WalletLockResponse { value: () })
8676            }
8677
8678            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8679            where
8680                M: de::MapAccess<'de>,
8681            {
8682                let mut value = None;
8683                while let Some(key) = map.next_key::<String>()? {
8684                    if key == "value" {
8685                        if value.is_some() {
8686                            return Err(de::Error::duplicate_field("value"));
8687                        }
8688                        value = Some(map.next_value::<()>()?);
8689                    } else {
8690                        let _ = map.next_value::<de::IgnoredAny>()?;
8691                    }
8692                }
8693                value.ok_or_else(|| de::Error::missing_field("value"))?;
8694                Ok(WalletLockResponse { value: () })
8695            }
8696        }
8697
8698        deserializer.deserialize_any(PrimitiveWrapperVisitor)
8699    }
8700}
8701
8702impl std::ops::Deref for WalletLockResponse {
8703    type Target = ();
8704    fn deref(&self) -> &Self::Target { &self.value }
8705}
8706
8707impl std::ops::DerefMut for WalletLockResponse {
8708    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
8709}
8710
8711impl AsRef<()> for WalletLockResponse {
8712    fn as_ref(&self) -> &() { &self.value }
8713}
8714
8715impl From<()> for WalletLockResponse {
8716    fn from(value: ()) -> Self { Self { value } }
8717}
8718
8719impl From<WalletLockResponse> for () {
8720    fn from(wrapper: WalletLockResponse) -> Self { wrapper.value }
8721}
8722
8723/// Response for the `WalletPassphrase` RPC method
8724///
8725/// This method returns a primitive value wrapped in a transparent struct.
8726#[derive(Debug, Clone, PartialEq, Serialize)]
8727pub struct WalletPassphraseResponse {
8728    /// Wrapped primitive value
8729    pub value: (),
8730}
8731
8732impl<'de> serde::Deserialize<'de> for WalletPassphraseResponse {
8733    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8734    where
8735        D: serde::Deserializer<'de>,
8736    {
8737        use std::fmt;
8738
8739        use serde::de::{self, Visitor};
8740
8741        struct PrimitiveWrapperVisitor;
8742
8743        #[allow(unused_variables, clippy::needless_lifetimes)]
8744        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
8745            type Value = WalletPassphraseResponse;
8746
8747            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8748                formatter.write_str("a primitive value or an object with 'value' field")
8749            }
8750
8751            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
8752            where
8753                E: de::Error,
8754            {
8755                Ok(WalletPassphraseResponse { value: () })
8756            }
8757
8758            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
8759            where
8760                E: de::Error,
8761            {
8762                Ok(WalletPassphraseResponse { value: () })
8763            }
8764
8765            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
8766            where
8767                E: de::Error,
8768            {
8769                Ok(WalletPassphraseResponse { value: () })
8770            }
8771
8772            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
8773            where
8774                E: de::Error,
8775            {
8776                Ok(WalletPassphraseResponse { value: () })
8777            }
8778
8779            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
8780            where
8781                E: de::Error,
8782            {
8783                Ok(WalletPassphraseResponse { value: () })
8784            }
8785
8786            fn visit_none<E>(self) -> Result<Self::Value, E>
8787            where
8788                E: de::Error,
8789            {
8790                Ok(WalletPassphraseResponse { value: () })
8791            }
8792
8793            fn visit_unit<E>(self) -> Result<Self::Value, E>
8794            where
8795                E: de::Error,
8796            {
8797                Ok(WalletPassphraseResponse { value: () })
8798            }
8799
8800            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8801            where
8802                M: de::MapAccess<'de>,
8803            {
8804                let mut value = None;
8805                while let Some(key) = map.next_key::<String>()? {
8806                    if key == "value" {
8807                        if value.is_some() {
8808                            return Err(de::Error::duplicate_field("value"));
8809                        }
8810                        value = Some(map.next_value::<()>()?);
8811                    } else {
8812                        let _ = map.next_value::<de::IgnoredAny>()?;
8813                    }
8814                }
8815                value.ok_or_else(|| de::Error::missing_field("value"))?;
8816                Ok(WalletPassphraseResponse { value: () })
8817            }
8818        }
8819
8820        deserializer.deserialize_any(PrimitiveWrapperVisitor)
8821    }
8822}
8823
8824impl std::ops::Deref for WalletPassphraseResponse {
8825    type Target = ();
8826    fn deref(&self) -> &Self::Target { &self.value }
8827}
8828
8829impl std::ops::DerefMut for WalletPassphraseResponse {
8830    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
8831}
8832
8833impl AsRef<()> for WalletPassphraseResponse {
8834    fn as_ref(&self) -> &() { &self.value }
8835}
8836
8837impl From<()> for WalletPassphraseResponse {
8838    fn from(value: ()) -> Self { Self { value } }
8839}
8840
8841impl From<WalletPassphraseResponse> for () {
8842    fn from(wrapper: WalletPassphraseResponse) -> Self { wrapper.value }
8843}
8844
8845/// Response for the `WalletPassphraseChange` RPC method
8846///
8847/// This method returns a primitive value wrapped in a transparent struct.
8848#[derive(Debug, Clone, PartialEq, Serialize)]
8849pub struct WalletPassphraseChangeResponse {
8850    /// Wrapped primitive value
8851    pub value: (),
8852}
8853
8854impl<'de> serde::Deserialize<'de> for WalletPassphraseChangeResponse {
8855    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8856    where
8857        D: serde::Deserializer<'de>,
8858    {
8859        use std::fmt;
8860
8861        use serde::de::{self, Visitor};
8862
8863        struct PrimitiveWrapperVisitor;
8864
8865        #[allow(unused_variables, clippy::needless_lifetimes)]
8866        impl<'de> Visitor<'de> for PrimitiveWrapperVisitor {
8867            type Value = WalletPassphraseChangeResponse;
8868
8869            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8870                formatter.write_str("a primitive value or an object with 'value' field")
8871            }
8872
8873            fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
8874            where
8875                E: de::Error,
8876            {
8877                Ok(WalletPassphraseChangeResponse { value: () })
8878            }
8879
8880            fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
8881            where
8882                E: de::Error,
8883            {
8884                Ok(WalletPassphraseChangeResponse { value: () })
8885            }
8886
8887            fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
8888            where
8889                E: de::Error,
8890            {
8891                Ok(WalletPassphraseChangeResponse { value: () })
8892            }
8893
8894            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
8895            where
8896                E: de::Error,
8897            {
8898                Ok(WalletPassphraseChangeResponse { value: () })
8899            }
8900
8901            fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
8902            where
8903                E: de::Error,
8904            {
8905                Ok(WalletPassphraseChangeResponse { value: () })
8906            }
8907
8908            fn visit_none<E>(self) -> Result<Self::Value, E>
8909            where
8910                E: de::Error,
8911            {
8912                Ok(WalletPassphraseChangeResponse { value: () })
8913            }
8914
8915            fn visit_unit<E>(self) -> Result<Self::Value, E>
8916            where
8917                E: de::Error,
8918            {
8919                Ok(WalletPassphraseChangeResponse { value: () })
8920            }
8921
8922            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
8923            where
8924                M: de::MapAccess<'de>,
8925            {
8926                let mut value = None;
8927                while let Some(key) = map.next_key::<String>()? {
8928                    if key == "value" {
8929                        if value.is_some() {
8930                            return Err(de::Error::duplicate_field("value"));
8931                        }
8932                        value = Some(map.next_value::<()>()?);
8933                    } else {
8934                        let _ = map.next_value::<de::IgnoredAny>()?;
8935                    }
8936                }
8937                value.ok_or_else(|| de::Error::missing_field("value"))?;
8938                Ok(WalletPassphraseChangeResponse { value: () })
8939            }
8940        }
8941
8942        deserializer.deserialize_any(PrimitiveWrapperVisitor)
8943    }
8944}
8945
8946impl std::ops::Deref for WalletPassphraseChangeResponse {
8947    type Target = ();
8948    fn deref(&self) -> &Self::Target { &self.value }
8949}
8950
8951impl std::ops::DerefMut for WalletPassphraseChangeResponse {
8952    fn deref_mut(&mut self) -> &mut Self::Target { &mut self.value }
8953}
8954
8955impl AsRef<()> for WalletPassphraseChangeResponse {
8956    fn as_ref(&self) -> &() { &self.value }
8957}
8958
8959impl From<()> for WalletPassphraseChangeResponse {
8960    fn from(value: ()) -> Self { Self { value } }
8961}
8962
8963impl From<WalletPassphraseChangeResponse> for () {
8964    fn from(wrapper: WalletPassphraseChangeResponse) -> Self { wrapper.value }
8965}
8966
8967/// Response for the `WalletProcessPsbt` RPC method
8968///
8969#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
8970#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8971pub struct WalletProcessPsbtResponse {
8972    /// If the transaction has a complete set of signatures
8973    pub complete: bool,
8974    /// The hex-encoded network transaction if complete
8975    pub hex: Option<String>,
8976    /// The base64-encoded partially signed transaction
8977    pub psbt: String,
8978}
8979
8980/// Deserializer for bitcoin::Amount that handles both float (BTC) and integer (satoshis) formats
8981/// Bitcoin Core returns amounts as floats in BTC, but some fields may be integers in satoshis
8982fn amount_from_btc_float<'de, D>(deserializer: D) -> Result<bitcoin::Amount, D::Error>
8983where
8984    D: serde::Deserializer<'de>,
8985{
8986    use std::fmt;
8987
8988    use serde::de::{self, Visitor};
8989
8990    struct AmountVisitor;
8991
8992    impl Visitor<'_> for AmountVisitor {
8993        type Value = bitcoin::Amount;
8994
8995        fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
8996            formatter.write_str("a number (float BTC or integer satoshis)")
8997        }
8998
8999        fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
9000        where
9001            E: de::Error,
9002        {
9003            bitcoin::Amount::from_btc(v)
9004                .map_err(|e| E::custom(format!("Invalid BTC amount: {}", e)))
9005        }
9006
9007        fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
9008        where
9009            E: de::Error,
9010        {
9011            Ok(bitcoin::Amount::from_sat(v))
9012        }
9013
9014        fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
9015        where
9016            E: de::Error,
9017        {
9018            if v < 0 {
9019                return Err(E::custom(format!("Amount cannot be negative: {}", v)));
9020            }
9021            Ok(bitcoin::Amount::from_sat(v as u64))
9022        }
9023    }
9024
9025    deserializer.deserialize_any(AmountVisitor)
9026}
9027
9028/// Deserializer for Option<bitcoin::Amount> that handles both float (BTC) and integer (satoshis) formats
9029/// Bitcoin Core returns amounts as floats in BTC, but some fields may be integers in satoshis
9030/// This deserializer also handles null/None values
9031fn option_amount_from_btc_float<'de, D>(
9032    deserializer: D,
9033) -> Result<Option<bitcoin::Amount>, D::Error>
9034where
9035    D: serde::Deserializer<'de>,
9036{
9037    use std::fmt;
9038
9039    use serde::de::{self, Visitor};
9040
9041    struct OptionAmountVisitor;
9042
9043    #[allow(clippy::needless_lifetimes)]
9044    impl<'de> Visitor<'de> for OptionAmountVisitor {
9045        type Value = Option<bitcoin::Amount>;
9046
9047        fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
9048            formatter.write_str("an optional number (float BTC or integer satoshis)")
9049        }
9050
9051        fn visit_none<E>(self) -> Result<Self::Value, E>
9052        where
9053            E: de::Error,
9054        {
9055            Ok(None)
9056        }
9057
9058        fn visit_some<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
9059        where
9060            D: serde::Deserializer<'de>,
9061        {
9062            amount_from_btc_float(deserializer).map(Some)
9063        }
9064
9065        fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
9066        where
9067            E: de::Error,
9068        {
9069            bitcoin::Amount::from_btc(v)
9070                .map_err(|e| E::custom(format!("Invalid BTC amount: {}", e)))
9071                .map(Some)
9072        }
9073
9074        fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
9075        where
9076            E: de::Error,
9077        {
9078            Ok(Some(bitcoin::Amount::from_sat(v)))
9079        }
9080
9081        fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
9082        where
9083            E: de::Error,
9084        {
9085            if v < 0 {
9086                return Err(E::custom(format!("Amount cannot be negative: {}", v)));
9087            }
9088            Ok(Some(bitcoin::Amount::from_sat(v as u64)))
9089        }
9090    }
9091
9092    deserializer.deserialize_any(OptionAmountVisitor)
9093}