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