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