Skip to main content

ethos_bitcoind/types/
responses.rs

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