bitcoin_rpc_midas/client_trait/
client.rs

1// Generated client trait for Bitcoin Core v30
2
3use std::future::Future;
4
5use async_trait::async_trait;
6use bitcoin_rpc_types::HashOrHeight;
7use serde::de::DeserializeOwned;
8use serde::ser::SerializeSeq;
9use serde::Deserialize;
10
11use crate::responses::*;
12use crate::transport::{TransportError, TransportExt, TransportTrait};
13
14#[derive(Debug, Clone, Deserialize)]
15pub struct PrioritisetransactionParams {
16    pub _txid: bitcoin::Txid,
17    pub _fee_delta: f64,
18    pub _dummy: Option<String>,
19}
20
21impl serde::Serialize for PrioritisetransactionParams {
22    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
23    where
24        S: serde::Serializer,
25    {
26        let mut seq = serializer.serialize_seq(Some(3))?;
27        seq.serialize_element(&self._txid)?;
28        seq.serialize_element(&self._dummy)?;
29        seq.serialize_element(&self._fee_delta)?;
30        seq.end()
31    }
32}
33
34#[derive(Debug, Clone, Deserialize)]
35pub struct SendmanyParams {
36    pub _amounts: serde_json::Value,
37    pub _dummy: Option<String>,
38    pub _minconf: Option<u32>,
39    pub _comment: Option<String>,
40    pub _subtractfeefrom: Option<Vec<serde_json::Value>>,
41    pub _replaceable: Option<bool>,
42    pub _conf_target: Option<u64>,
43    pub _estimate_mode: Option<String>,
44    pub _fee_rate: Option<f64>,
45    pub _verbose: Option<bool>,
46}
47
48impl serde::Serialize for SendmanyParams {
49    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
50    where
51        S: serde::Serializer,
52    {
53        let mut seq = serializer.serialize_seq(Some(10))?;
54        seq.serialize_element(&self._dummy)?;
55        seq.serialize_element(&self._amounts)?;
56        seq.serialize_element(&self._minconf)?;
57        seq.serialize_element(&self._comment)?;
58        seq.serialize_element(&self._subtractfeefrom)?;
59        seq.serialize_element(&self._replaceable)?;
60        seq.serialize_element(&self._conf_target)?;
61        seq.serialize_element(&self._estimate_mode)?;
62        seq.serialize_element(&self._fee_rate)?;
63        seq.serialize_element(&self._verbose)?;
64        seq.end()
65    }
66}
67
68#[derive(Debug, Clone, Deserialize)]
69pub struct WalletcreatefundedpsbtParams {
70    pub _outputs: Vec<serde_json::Value>,
71    pub _inputs: Option<Vec<serde_json::Value>>,
72    pub _locktime: Option<u32>,
73    pub _options: Option<serde_json::Value>,
74    pub _bip32derivs: Option<bool>,
75    pub _version: Option<u32>,
76}
77
78impl serde::Serialize for WalletcreatefundedpsbtParams {
79    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
80    where
81        S: serde::Serializer,
82    {
83        let mut seq = serializer.serialize_seq(Some(6))?;
84        seq.serialize_element(&self._inputs)?;
85        seq.serialize_element(&self._outputs)?;
86        seq.serialize_element(&self._locktime)?;
87        seq.serialize_element(&self._options)?;
88        seq.serialize_element(&self._bip32derivs)?;
89        seq.serialize_element(&self._version)?;
90        seq.end()
91    }
92}
93
94#[doc = r#"A versioned client trait for Bitcoin Core v30"#]
95#[async_trait]
96pub trait BitcoinClientV30: Send + Sync + TransportTrait + TransportExt + RpcDispatchExt {
97    /// Mark in-wallet transaction <txid> as abandoned
98    /// This will mark this transaction and all its in-wallet descendants as abandoned which will allow
99    /// for their inputs to be respent.  It can be used to replace "stuck" or evicted transactions.
100    /// It only works on transactions which are not included in a block and are not currently in the mempool.
101    /// It has no effect on transactions which are already abandoned.
102    async fn abandontransaction(&self, _txid: bitcoin::Txid) -> Result<(), TransportError> {
103        let params = vec![serde_json::json!(_txid)];
104        self.dispatch_json::<()>("abandontransaction", &params).await
105    }
106
107    /// Stops current wallet rescan triggered by an RPC call, e.g. by a rescanblockchain call.
108    /// Note: Use "getwalletinfo" to query the scanning progress.
109    async fn abortrescan(&self) -> Result<AbortrescanResponse, TransportError> {
110        let params = vec![];
111        self.dispatch_json::<AbortrescanResponse>("abortrescan", &params).await
112    }
113
114    /// Open an outbound connection to a specified node. This RPC is for testing only.
115    async fn addconnection(
116        &self,
117        _address: String,
118        _connection_type: String,
119        _v2transport: bool,
120    ) -> Result<AddconnectionResponse, TransportError> {
121        let params = vec![
122            serde_json::json!(_address),
123            serde_json::json!(_connection_type),
124            serde_json::json!(_v2transport),
125        ];
126        self.dispatch_json::<AddconnectionResponse>("addconnection", &params).await
127    }
128
129    /// Attempts to add or remove a node from the addnode list.
130    /// Or try a connection to a node once.
131    /// Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be
132    /// full nodes/support SegWit as other outbound peers are (though such peers will not be synced from).
133    /// Addnode connections are limited to 8 at a time and are counted separately from the -maxconnections limit.
134    async fn addnode(
135        &self,
136        _node: String,
137        _command: String,
138        _v2transport: Option<bool>,
139    ) -> Result<(), TransportError> {
140        let params = vec![
141            serde_json::json!(_node),
142            serde_json::json!(_command),
143            serde_json::json!(_v2transport),
144        ];
145        self.dispatch_json::<()>("addnode", &params).await
146    }
147
148    /// Add the address of a potential peer to an address manager table. This RPC is for testing only.
149    async fn addpeeraddress(
150        &self,
151        _address: String,
152        _port: u16,
153        _tried: Option<bool>,
154    ) -> Result<AddpeeraddressResponse, TransportError> {
155        let params =
156            vec![serde_json::json!(_address), serde_json::json!(_port), serde_json::json!(_tried)];
157        self.dispatch_json::<AddpeeraddressResponse>("addpeeraddress", &params).await
158    }
159
160    /// Analyzes and provides information about the current status of a PSBT and its inputs
161    async fn analyzepsbt(&self, _psbt: String) -> Result<AnalyzepsbtResponse, TransportError> {
162        let params = vec![serde_json::json!(_psbt)];
163        self.dispatch_json::<AnalyzepsbtResponse>("analyzepsbt", &params).await
164    }
165
166    /// Safely copies the current wallet file to the specified destination, which can either be a directory or a path with a filename.
167    async fn backupwallet(&self, _destination: String) -> Result<(), TransportError> {
168        let params = vec![serde_json::json!(_destination)];
169        self.dispatch_json::<()>("backupwallet", &params).await
170    }
171
172    /// Bumps the fee of a transaction T, replacing it with a new transaction B.
173    /// A transaction with the given txid must be in the wallet.
174    /// The command will pay the additional fee by reducing change outputs or adding inputs when necessary.
175    /// It may add a new change output if one does not already exist.
176    /// All inputs in the original transaction will be included in the replacement transaction.
177    /// The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs.
178    /// By default, the new fee will be calculated automatically using the estimatesmartfee RPC.
179    /// The user can specify a confirmation target for estimatesmartfee.
180    /// Alternatively, the user can specify a fee rate in sat/vB for the new transaction.
181    /// At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee
182    /// returned by getnetworkinfo) to enter the node's mempool.
183    /// * WARNING: before version 0.21, fee_rate was in BTC/kvB. As of 0.21, fee_rate is in sat/vB. *
184    async fn bumpfee(
185        &self,
186        _txid: bitcoin::Txid,
187        _options: Option<serde_json::Value>,
188    ) -> Result<BumpfeeResponse, TransportError> {
189        let params = vec![serde_json::json!(_txid), serde_json::json!(_options)];
190        self.dispatch_json::<BumpfeeResponse>("bumpfee", &params).await
191    }
192
193    /// Clear all banned IPs.
194    async fn clearbanned(&self) -> Result<(), TransportError> {
195        let params = vec![];
196        self.dispatch_json::<()>("clearbanned", &params).await
197    }
198
199    /// Combine multiple partially signed Bitcoin transactions into one transaction.
200    /// Implements the Combiner role.
201    async fn combinepsbt(
202        &self,
203        _txs: Vec<serde_json::Value>,
204    ) -> Result<CombinepsbtResponse, TransportError> {
205        let params = vec![serde_json::json!(_txs)];
206        self.dispatch_json::<CombinepsbtResponse>("combinepsbt", &params).await
207    }
208
209    /// Combine multiple partially signed transactions into one transaction.
210    /// The combined transaction may be another partially signed transaction or a
211    /// fully signed transaction.
212    async fn combinerawtransaction(
213        &self,
214        _txs: Vec<serde_json::Value>,
215    ) -> Result<CombinerawtransactionResponse, TransportError> {
216        let params = vec![serde_json::json!(_txs)];
217        self.dispatch_json::<CombinerawtransactionResponse>("combinerawtransaction", &params).await
218    }
219
220    /// Converts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction
221    /// createpsbt and walletcreatefundedpsbt should be used for new applications.
222    async fn converttopsbt(
223        &self,
224        _hexstring: String,
225        _permitsigdata: Option<bool>,
226        _iswitness: Option<bool>,
227    ) -> Result<ConverttopsbtResponse, TransportError> {
228        let params = vec![
229            serde_json::json!(_hexstring),
230            serde_json::json!(_permitsigdata),
231            serde_json::json!(_iswitness),
232        ];
233        self.dispatch_json::<ConverttopsbtResponse>("converttopsbt", &params).await
234    }
235
236    /// Creates a multi-signature address with n signatures of m keys required.
237    /// It returns a json object with the address and redeemScript.
238    async fn createmultisig(
239        &self,
240        _nrequired: u32,
241        _keys: Vec<String>,
242        _address_type: Option<String>,
243    ) -> Result<CreatemultisigResponse, TransportError> {
244        let params = vec![
245            serde_json::json!(_nrequired),
246            serde_json::json!(_keys),
247            serde_json::json!(_address_type),
248        ];
249        self.dispatch_json::<CreatemultisigResponse>("createmultisig", &params).await
250    }
251
252    /// Creates a transaction in the Partially Signed Transaction format.
253    /// Implements the Creator role.
254    /// Note that the transaction's inputs are not signed, and
255    /// it is not stored in the wallet or transmitted to the network.
256    async fn createpsbt(
257        &self,
258        _inputs: Vec<serde_json::Value>,
259        _outputs: Vec<serde_json::Value>,
260        _locktime: Option<u32>,
261        _replaceable: Option<bool>,
262        _version: Option<u32>,
263    ) -> Result<CreatepsbtResponse, TransportError> {
264        let params = vec![
265            serde_json::json!(_inputs),
266            serde_json::json!(_outputs),
267            serde_json::json!(_locktime),
268            serde_json::json!(_replaceable),
269            serde_json::json!(_version),
270        ];
271        self.dispatch_json::<CreatepsbtResponse>("createpsbt", &params).await
272    }
273
274    /// Create a transaction spending the given inputs and creating new outputs.
275    /// Outputs can be addresses or data.
276    /// Returns hex-encoded raw transaction.
277    /// Note that the transaction's inputs are not signed, and
278    /// it is not stored in the wallet or transmitted to the network.
279    async fn createrawtransaction(
280        &self,
281        _inputs: Vec<serde_json::Value>,
282        _outputs: Vec<serde_json::Value>,
283        _locktime: Option<u32>,
284        _replaceable: Option<bool>,
285        _version: Option<u32>,
286    ) -> Result<CreaterawtransactionResponse, TransportError> {
287        let params = vec![
288            serde_json::json!(_inputs),
289            serde_json::json!(_outputs),
290            serde_json::json!(_locktime),
291            serde_json::json!(_replaceable),
292            serde_json::json!(_version),
293        ];
294        self.dispatch_json::<CreaterawtransactionResponse>("createrawtransaction", &params).await
295    }
296
297    /// Creates and loads a new wallet.
298    #[allow(clippy::too_many_arguments)]
299    async fn createwallet(
300        &self,
301        _wallet_name: String,
302        _disable_private_keys: Option<bool>,
303        _blank: Option<bool>,
304        _passphrase: Option<String>,
305        _avoid_reuse: Option<bool>,
306        _descriptors: Option<bool>,
307        _load_on_startup: Option<bool>,
308        _external_signer: Option<bool>,
309    ) -> Result<CreatewalletResponse, TransportError> {
310        let params = vec![
311            serde_json::json!(_wallet_name),
312            serde_json::json!(_disable_private_keys),
313            serde_json::json!(_blank),
314            serde_json::json!(_passphrase),
315            serde_json::json!(_avoid_reuse),
316            serde_json::json!(_descriptors),
317            serde_json::json!(_load_on_startup),
318            serde_json::json!(_external_signer),
319        ];
320        self.dispatch_json::<CreatewalletResponse>("createwallet", &params).await
321    }
322
323    /// Creates the wallet's descriptor for the given address type. The address type must be one that the wallet does not already have a descriptor for.
324    /// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
325    async fn createwalletdescriptor(
326        &self,
327        r#_type: String,
328        _options: Option<serde_json::Value>,
329    ) -> Result<CreatewalletdescriptorResponse, TransportError> {
330        let params = vec![serde_json::json!(r#_type), serde_json::json!(_options)];
331        self.dispatch_json::<CreatewalletdescriptorResponse>("createwalletdescriptor", &params)
332            .await
333    }
334
335    /// Return a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.
336    async fn decodepsbt(&self, _psbt: String) -> Result<DecodepsbtResponse, TransportError> {
337        let params = vec![serde_json::json!(_psbt)];
338        self.dispatch_json::<DecodepsbtResponse>("decodepsbt", &params).await
339    }
340
341    /// Return a JSON object representing the serialized, hex-encoded transaction.
342    async fn decoderawtransaction(
343        &self,
344        _hexstring: String,
345        _iswitness: Option<bool>,
346    ) -> Result<DecoderawtransactionResponse, TransportError> {
347        let params = vec![serde_json::json!(_hexstring), serde_json::json!(_iswitness)];
348        self.dispatch_json::<DecoderawtransactionResponse>("decoderawtransaction", &params).await
349    }
350
351    /// Decode a hex-encoded script.
352    async fn decodescript(
353        &self,
354        _hexstring: String,
355    ) -> Result<DecodescriptResponse, TransportError> {
356        let params = vec![serde_json::json!(_hexstring)];
357        self.dispatch_json::<DecodescriptResponse>("decodescript", &params).await
358    }
359
360    /// Derives one or more addresses corresponding to an output descriptor.
361    /// Examples of output descriptors are:
362    /// pkh(<pubkey>)                                     P2PKH outputs for the given pubkey
363    /// wpkh(<pubkey>)                                    Native segwit P2PKH outputs for the given pubkey
364    /// sh(multi(<n>,<pubkey>,<pubkey>,...))              P2SH-multisig outputs for the given threshold and pubkeys
365    /// raw(<hex script>)                                 Outputs whose output script equals the specified hex-encoded bytes
366    /// tr(<pubkey>,multi_a(<n>,<pubkey>,<pubkey>,...))   P2TR-multisig outputs for the given threshold and pubkeys
367    ///
368    /// In the above, <pubkey> either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one
369    /// or more path elements separated by "/", where "h" represents a hardened child key.
370    /// For more information on output descriptors, see the documentation in the doc/descriptors.md file.
371    async fn deriveaddresses(
372        &self,
373        _descriptor: String,
374        _range: Option<serde_json::Value>,
375    ) -> Result<DeriveaddressesResponse, TransportError> {
376        let params = vec![serde_json::json!(_descriptor), serde_json::json!(_range)];
377        self.dispatch_json::<DeriveaddressesResponse>("deriveaddresses", &params).await
378    }
379
380    /// Update all segwit inputs in a PSBT with information from output descriptors, the UTXO set or the mempool.
381    /// Then, sign the inputs we are able to with information from the output descriptors.
382    async fn descriptorprocesspsbt(
383        &self,
384        _psbt: String,
385        _descriptors: Vec<serde_json::Value>,
386        _sighashtype: Option<String>,
387        _bip32derivs: Option<bool>,
388        _finalize: Option<bool>,
389    ) -> Result<DescriptorprocesspsbtResponse, TransportError> {
390        let params = vec![
391            serde_json::json!(_psbt),
392            serde_json::json!(_descriptors),
393            serde_json::json!(_sighashtype),
394            serde_json::json!(_bip32derivs),
395            serde_json::json!(_finalize),
396        ];
397        self.dispatch_json::<DescriptorprocesspsbtResponse>("descriptorprocesspsbt", &params).await
398    }
399
400    /// Immediately disconnects from the specified peer node.
401    ///
402    /// Strictly one out of 'address' and 'nodeid' can be provided to identify the node.
403    ///
404    /// To disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.
405    async fn disconnectnode(
406        &self,
407        _address: Option<String>,
408        _nodeid: Option<u64>,
409    ) -> Result<(), TransportError> {
410        let params = vec![serde_json::json!(_address), serde_json::json!(_nodeid)];
411        self.dispatch_json::<()>("disconnectnode", &params).await
412    }
413
414    /// Write the serialized UTXO set to a file. This can be used in loadtxoutset afterwards if this snapshot height is supported in the chainparams as well.
415    ///
416    /// Unless the "latest" type is requested, the node will roll back to the requested height and network activity will be suspended during this process. Because of this it is discouraged to interact with the node in any other way during the execution of this call to avoid inconsistent results and race conditions, particularly RPCs that interact with blockstorage.
417    ///
418    /// This call may take several minutes. Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
419    async fn dumptxoutset(
420        &self,
421        _path: String,
422        r#_type: Option<String>,
423        _options: Option<serde_json::Value>,
424    ) -> Result<DumptxoutsetResponse, TransportError> {
425        let params =
426            vec![serde_json::json!(_path), serde_json::json!(r#_type), serde_json::json!(_options)];
427        self.dispatch_json::<DumptxoutsetResponse>("dumptxoutset", &params).await
428    }
429
430    /// Simply echo back the input arguments. This command is for testing.
431    ///
432    /// It will return an internal bug report when arg9='trigger_internal_bug' is passed.
433    ///
434    /// The difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in bitcoin-cli and the GUI. There is no server-side difference.
435    #[allow(clippy::too_many_arguments)]
436    async fn echo(
437        &self,
438        _arg0: Option<String>,
439        _arg1: Option<String>,
440        _arg2: Option<String>,
441        _arg3: Option<String>,
442        _arg4: Option<String>,
443        _arg5: Option<String>,
444        _arg6: Option<String>,
445        _arg7: Option<String>,
446        _arg8: Option<String>,
447        _arg9: Option<String>,
448    ) -> Result<EchoResponse, TransportError> {
449        let params = vec![
450            serde_json::json!(_arg0),
451            serde_json::json!(_arg1),
452            serde_json::json!(_arg2),
453            serde_json::json!(_arg3),
454            serde_json::json!(_arg4),
455            serde_json::json!(_arg5),
456            serde_json::json!(_arg6),
457            serde_json::json!(_arg7),
458            serde_json::json!(_arg8),
459            serde_json::json!(_arg9),
460        ];
461        self.dispatch_json::<EchoResponse>("echo", &params).await
462    }
463
464    /// Echo back the input argument, passing it through a spawned process in a multiprocess build.
465    /// This command is for testing.
466    async fn echoipc(&self, _arg: String) -> Result<EchoipcResponse, TransportError> {
467        let params = vec![serde_json::json!(_arg)];
468        self.dispatch_json::<EchoipcResponse>("echoipc", &params).await
469    }
470
471    /// Simply echo back the input arguments. This command is for testing.
472    ///
473    /// It will return an internal bug report when arg9='trigger_internal_bug' is passed.
474    ///
475    /// The difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in bitcoin-cli and the GUI. There is no server-side difference.
476    #[allow(clippy::too_many_arguments)]
477    async fn echojson(
478        &self,
479        _arg0: Option<String>,
480        _arg1: Option<String>,
481        _arg2: Option<String>,
482        _arg3: Option<String>,
483        _arg4: Option<String>,
484        _arg5: Option<String>,
485        _arg6: Option<String>,
486        _arg7: Option<String>,
487        _arg8: Option<String>,
488        _arg9: Option<String>,
489    ) -> Result<EchojsonResponse, TransportError> {
490        let params = vec![
491            serde_json::json!(_arg0),
492            serde_json::json!(_arg1),
493            serde_json::json!(_arg2),
494            serde_json::json!(_arg3),
495            serde_json::json!(_arg4),
496            serde_json::json!(_arg5),
497            serde_json::json!(_arg6),
498            serde_json::json!(_arg7),
499            serde_json::json!(_arg8),
500            serde_json::json!(_arg9),
501        ];
502        self.dispatch_json::<EchojsonResponse>("echojson", &params).await
503    }
504
505    /// Encrypts the wallet with 'passphrase'. This is for first time encryption.
506    /// After this, any calls that interact with private keys such as sending or signing
507    /// will require the passphrase to be set prior to making these calls.
508    /// Use the walletpassphrase call for this, and then walletlock call.
509    /// If the wallet is already encrypted, use the walletpassphrasechange call.
510    /// ** IMPORTANT **
511    /// For security reasons, the encryption process will generate a new HD seed, resulting
512    /// in the creation of a fresh set of active descriptors. Therefore, it is crucial to
513    /// securely back up the newly generated wallet file using the backupwallet RPC.
514    async fn encryptwallet(
515        &self,
516        _passphrase: String,
517    ) -> Result<EncryptwalletResponse, TransportError> {
518        let params = vec![serde_json::json!(_passphrase)];
519        self.dispatch_json::<EncryptwalletResponse>("encryptwallet", &params).await
520    }
521
522    /// Returns a list of external signers from -signer.
523    async fn enumeratesigners(&self) -> Result<EnumeratesignersResponse, TransportError> {
524        let params = vec![];
525        self.dispatch_json::<EnumeratesignersResponse>("enumeratesigners", &params).await
526    }
527
528    /// WARNING: This interface is unstable and may disappear or change!
529    ///
530    /// WARNING: This is an advanced API call that is tightly coupled to the specific
531    /// implementation of fee estimation. The parameters it can be called with
532    /// and the results it returns will change if the internal implementation changes.
533    ///
534    /// Estimates the approximate fee per kilobyte needed for a transaction to begin
535    /// confirmation within conf_target blocks if possible. Uses virtual transaction size as
536    /// defined in BIP 141 (witness data is discounted).
537    async fn estimaterawfee(
538        &self,
539        _conf_target: u64,
540        _threshold: Option<u64>,
541    ) -> Result<EstimaterawfeeResponse, TransportError> {
542        let params = vec![serde_json::json!(_conf_target), serde_json::json!(_threshold)];
543        self.dispatch_json::<EstimaterawfeeResponse>("estimaterawfee", &params).await
544    }
545
546    /// Estimates the approximate fee per kilobyte needed for a transaction to begin
547    /// confirmation within conf_target blocks if possible and return the number of blocks
548    /// for which the estimate is valid. Uses virtual transaction size as defined
549    /// in BIP 141 (witness data is discounted).
550    async fn estimatesmartfee(
551        &self,
552        _conf_target: u64,
553        _estimate_mode: Option<String>,
554    ) -> Result<EstimatesmartfeeResponse, TransportError> {
555        let params = vec![serde_json::json!(_conf_target), serde_json::json!(_estimate_mode)];
556        self.dispatch_json::<EstimatesmartfeeResponse>("estimatesmartfee", &params).await
557    }
558
559    /// Finalize the inputs of a PSBT. If the transaction is fully signed, it will produce a
560    /// network serialized transaction which can be broadcast with sendrawtransaction. Otherwise a PSBT will be
561    /// created which has the final_scriptSig and final_scriptwitness fields filled for inputs that are complete.
562    /// Implements the Finalizer and Extractor roles.
563    async fn finalizepsbt(
564        &self,
565        _psbt: String,
566        _extract: Option<bool>,
567    ) -> Result<FinalizepsbtResponse, TransportError> {
568        let params = vec![serde_json::json!(_psbt), serde_json::json!(_extract)];
569        self.dispatch_json::<FinalizepsbtResponse>("finalizepsbt", &params).await
570    }
571
572    /// If the transaction has no inputs, they will be automatically selected to meet its out value.
573    /// It will add at most one change output to the outputs.
574    /// No existing outputs will be modified unless "subtractFeeFromOutputs" is specified.
575    /// Note that inputs which were signed may need to be resigned after completion since in/outputs have been added.
576    /// The inputs added will not be signed, use signrawtransactionwithkey
577    /// or signrawtransactionwithwallet for that.
578    /// All existing inputs must either have their previous output transaction be in the wallet
579    /// or be in the UTXO set. Solving data must be provided for non-wallet inputs.
580    /// Note that all inputs selected must be of standard form and P2SH scripts must be
581    /// in the wallet using importdescriptors (to calculate fees).
582    /// You can see whether this is the case by checking the "solvable" field in the listunspent output.
583    /// Note that if specifying an exact fee rate, the resulting transaction may have a higher fee rate
584    /// if the transaction has unconfirmed inputs. This is because the wallet will attempt to make the
585    /// entire package have the given fee rate, not the resulting transaction.
586    async fn fundrawtransaction(
587        &self,
588        _hexstring: String,
589        _options: Option<serde_json::Value>,
590        _iswitness: Option<bool>,
591    ) -> Result<FundrawtransactionResponse, TransportError> {
592        let params = vec![
593            serde_json::json!(_hexstring),
594            serde_json::json!(_options),
595            serde_json::json!(_iswitness),
596        ];
597        self.dispatch_json::<FundrawtransactionResponse>("fundrawtransaction", &params).await
598    }
599
600    /// has been replaced by the -generate cli option. Refer to -help for more information.
601    async fn generate(&self) -> Result<(), TransportError> {
602        let params = vec![];
603        self.dispatch_json::<()>("generate", &params).await
604    }
605
606    /// Mine a set of ordered transactions to a specified address or descriptor and return the block hash.
607    async fn generateblock(
608        &self,
609        _output: String,
610        _transactions: Vec<serde_json::Value>,
611        _submit: Option<bool>,
612    ) -> Result<GenerateblockResponse, TransportError> {
613        let params = vec![
614            serde_json::json!(_output),
615            serde_json::json!(_transactions),
616            serde_json::json!(_submit),
617        ];
618        self.dispatch_json::<GenerateblockResponse>("generateblock", &params).await
619    }
620
621    /// Mine to a specified address and return the block hashes.
622    async fn generatetoaddress(
623        &self,
624        _nblocks: u64,
625        _address: String,
626        _maxtries: Option<u64>,
627    ) -> Result<GeneratetoaddressResponse, TransportError> {
628        let params = vec![
629            serde_json::json!(_nblocks),
630            serde_json::json!(_address),
631            serde_json::json!(_maxtries),
632        ];
633        self.dispatch_json::<GeneratetoaddressResponse>("generatetoaddress", &params).await
634    }
635
636    /// Mine to a specified descriptor and return the block hashes.
637    async fn generatetodescriptor(
638        &self,
639        _num_blocks: u64,
640        _descriptor: String,
641        _maxtries: Option<u64>,
642    ) -> Result<GeneratetodescriptorResponse, TransportError> {
643        let params = vec![
644            serde_json::json!(_num_blocks),
645            serde_json::json!(_descriptor),
646            serde_json::json!(_maxtries),
647        ];
648        self.dispatch_json::<GeneratetodescriptorResponse>("generatetodescriptor", &params).await
649    }
650
651    /// Returns information about the given added node, or all added nodes
652    /// (note that onetry addnodes are not listed here)
653    async fn getaddednodeinfo(
654        &self,
655        _node: Option<String>,
656    ) -> Result<GetaddednodeinfoResponse, TransportError> {
657        let params = vec![serde_json::json!(_node)];
658        self.dispatch_json::<GetaddednodeinfoResponse>("getaddednodeinfo", &params).await
659    }
660
661    /// Returns the list of addresses assigned the specified label.
662    async fn getaddressesbylabel(
663        &self,
664        _label: String,
665    ) -> Result<GetaddressesbylabelResponse, TransportError> {
666        let params = vec![serde_json::json!(_label)];
667        self.dispatch_json::<GetaddressesbylabelResponse>("getaddressesbylabel", &params).await
668    }
669
670    /// Return information about the given bitcoin address.
671    /// Some of the information will only be present if the address is in the active wallet.
672    async fn getaddressinfo(
673        &self,
674        _address: String,
675    ) -> Result<GetaddressinfoResponse, TransportError> {
676        let params = vec![serde_json::json!(_address)];
677        self.dispatch_json::<GetaddressinfoResponse>("getaddressinfo", &params).await
678    }
679
680    /// Provides information about the node's address manager by returning the number of addresses in the `new` and `tried` tables and their sum for all networks.
681    async fn getaddrmaninfo(&self) -> Result<GetaddrmaninfoResponse, TransportError> {
682        let params = vec![];
683        self.dispatch_json::<GetaddrmaninfoResponse>("getaddrmaninfo", &params).await
684    }
685
686    /// Returns the total available balance.
687    /// The available balance is what the wallet considers currently spendable, and is
688    /// thus affected by options which limit spendability such as -spendzeroconfchange.
689    async fn getbalance(
690        &self,
691        _dummy: Option<String>,
692        _minconf: Option<u32>,
693        _include_watchonly: Option<bool>,
694        _avoid_reuse: Option<bool>,
695    ) -> Result<GetbalanceResponse, TransportError> {
696        let params = vec![
697            serde_json::json!(_dummy),
698            serde_json::json!(_minconf),
699            serde_json::json!(_include_watchonly),
700            serde_json::json!(_avoid_reuse),
701        ];
702        self.dispatch_json::<GetbalanceResponse>("getbalance", &params).await
703    }
704
705    /// Returns an object with all balances in BTC.
706    async fn getbalances(&self) -> Result<GetbalancesResponse, TransportError> {
707        let params = vec![];
708        self.dispatch_json::<GetbalancesResponse>("getbalances", &params).await
709    }
710
711    /// Returns the hash of the best (tip) block in the most-work fully-validated chain.
712    async fn getbestblockhash(&self) -> Result<GetbestblockhashResponse, TransportError> {
713        let params = vec![];
714        self.dispatch_json::<GetbestblockhashResponse>("getbestblockhash", &params).await
715    }
716
717    /// If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.
718    /// If verbosity is 1, returns an Object with information about block <hash>.
719    /// If verbosity is 2, returns an Object with information about block <hash> and information about each transaction.
720    /// If verbosity is 3, returns an Object with information about block <hash> and information about each transaction, including prevout information for inputs (only for unpruned blocks in the current best chain).
721    async fn getblock(
722        &self,
723        _blockhash: bitcoin::BlockHash,
724        _verbosity: Option<u32>,
725    ) -> Result<GetblockResponse, TransportError> {
726        let params = vec![serde_json::json!(_blockhash), serde_json::json!(_verbosity)];
727        self.dispatch_json::<GetblockResponse>("getblock", &params).await
728    }
729
730    /// Returns an object containing various state info regarding blockchain processing.
731    async fn getblockchaininfo(&self) -> Result<GetblockchaininfoResponse, TransportError> {
732        let params = vec![];
733        self.dispatch_json::<GetblockchaininfoResponse>("getblockchaininfo", &params).await
734    }
735
736    /// Returns the height of the most-work fully-validated chain.
737    /// The genesis block has height 0.
738    async fn getblockcount(&self) -> Result<GetblockcountResponse, TransportError> {
739        let params = vec![];
740        self.dispatch_json::<GetblockcountResponse>("getblockcount", &params).await
741    }
742
743    /// Retrieve a BIP 157 content filter for a particular block.
744    async fn getblockfilter(
745        &self,
746        _blockhash: bitcoin::BlockHash,
747        _filtertype: Option<String>,
748    ) -> Result<GetblockfilterResponse, TransportError> {
749        let params = vec![serde_json::json!(_blockhash), serde_json::json!(_filtertype)];
750        self.dispatch_json::<GetblockfilterResponse>("getblockfilter", &params).await
751    }
752
753    /// Attempt to fetch block from a given peer.
754    ///
755    /// We must have the header for this block, e.g. using submitheader.
756    /// The block will not have any undo data which can limit the usage of the block data in a context where the undo data is needed.
757    /// Subsequent calls for the same block may cause the response from the previous peer to be ignored.
758    /// Peers generally ignore requests for a stale block that they never fully verified, or one that is more than a month old.
759    /// When a peer does not respond with a block, we will disconnect.
760    /// Note: The block could be re-pruned as soon as it is received.
761    ///
762    /// Returns an empty JSON object if the request was successfully scheduled.
763    async fn getblockfrompeer(
764        &self,
765        _blockhash: bitcoin::BlockHash,
766        _peer_id: u64,
767    ) -> Result<GetblockfrompeerResponse, TransportError> {
768        let params = vec![serde_json::json!(_blockhash), serde_json::json!(_peer_id)];
769        self.dispatch_json::<GetblockfrompeerResponse>("getblockfrompeer", &params).await
770    }
771
772    /// Returns hash of block in best-block-chain at height provided.
773    async fn getblockhash(&self, _height: u64) -> Result<GetblockhashResponse, TransportError> {
774        let params = vec![serde_json::json!(_height)];
775        self.dispatch_json::<GetblockhashResponse>("getblockhash", &params).await
776    }
777
778    /// If verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.
779    /// If verbose is true, returns an Object with information about blockheader <hash>.
780    async fn getblockheader(
781        &self,
782        _blockhash: bitcoin::BlockHash,
783        _verbose: Option<bool>,
784    ) -> Result<GetblockheaderResponse, TransportError> {
785        let params = vec![serde_json::json!(_blockhash), serde_json::json!(_verbose)];
786        self.dispatch_json::<GetblockheaderResponse>("getblockheader", &params).await
787    }
788
789    /// Compute per block statistics for a given window. All amounts are in satoshis.
790    /// It won't work for some heights with pruning.
791    async fn getblockstats(
792        &self,
793        _hash_or_height: HashOrHeight,
794        _stats: Option<Vec<String>>,
795    ) -> Result<GetblockstatsResponse, TransportError> {
796        let params = vec![serde_json::json!(_hash_or_height), serde_json::json!(_stats)];
797        self.dispatch_json::<GetblockstatsResponse>("getblockstats", &params).await
798    }
799
800    /// If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.
801    /// It returns data needed to construct a block to work on.
802    /// For full specification, see BIPs 22, 23, 9, and 145:
803    /// https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki
804    /// https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki
805    /// https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes
806    /// https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki
807    async fn getblocktemplate(
808        &self,
809        _template_request: serde_json::Value,
810    ) -> Result<(), TransportError> {
811        let params = vec![serde_json::json!(_template_request)];
812        self.dispatch_json::<()>("getblocktemplate", &params).await
813    }
814
815    /// Return information about chainstates.
816    async fn getchainstates(&self) -> Result<GetchainstatesResponse, TransportError> {
817        let params = vec![];
818        self.dispatch_json::<GetchainstatesResponse>("getchainstates", &params).await
819    }
820
821    /// Return information about all known tips in the block tree, including the main chain as well as orphaned branches.
822    async fn getchaintips(&self) -> Result<GetchaintipsResponse, TransportError> {
823        let params = vec![];
824        self.dispatch_json::<GetchaintipsResponse>("getchaintips", &params).await
825    }
826
827    /// Compute statistics about the total number and rate of transactions in the chain.
828    async fn getchaintxstats(
829        &self,
830        _nblocks: Option<u64>,
831        _blockhash: Option<bitcoin::BlockHash>,
832    ) -> Result<GetchaintxstatsResponse, TransportError> {
833        let params = vec![serde_json::json!(_nblocks), serde_json::json!(_blockhash)];
834        self.dispatch_json::<GetchaintxstatsResponse>("getchaintxstats", &params).await
835    }
836
837    /// Returns the number of connections to other nodes.
838    async fn getconnectioncount(&self) -> Result<GetconnectioncountResponse, TransportError> {
839        let params = vec![];
840        self.dispatch_json::<GetconnectioncountResponse>("getconnectioncount", &params).await
841    }
842
843    /// Returns an object containing various state info regarding deployments of consensus changes.
844    async fn getdeploymentinfo(
845        &self,
846        _blockhash: Option<bitcoin::BlockHash>,
847    ) -> Result<GetdeploymentinfoResponse, TransportError> {
848        let params = vec![serde_json::json!(_blockhash)];
849        self.dispatch_json::<GetdeploymentinfoResponse>("getdeploymentinfo", &params).await
850    }
851
852    /// Get spend and receive activity associated with a set of descriptors for a set of blocks. This command pairs well with the `relevant_blocks` output of `scanblocks()`.
853    /// This call may take several minutes. If you encounter timeouts, try specifying no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
854    async fn getdescriptoractivity(
855        &self,
856        _blockhashes: Vec<serde_json::Value>,
857        _scanobjects: Vec<serde_json::Value>,
858        _include_mempool: Option<bool>,
859    ) -> Result<GetdescriptoractivityResponse, TransportError> {
860        let params = vec![
861            serde_json::json!(_blockhashes),
862            serde_json::json!(_scanobjects),
863            serde_json::json!(_include_mempool),
864        ];
865        self.dispatch_json::<GetdescriptoractivityResponse>("getdescriptoractivity", &params).await
866    }
867
868    /// Analyses a descriptor.
869    async fn getdescriptorinfo(
870        &self,
871        _descriptor: String,
872    ) -> Result<GetdescriptorinfoResponse, TransportError> {
873        let params = vec![serde_json::json!(_descriptor)];
874        self.dispatch_json::<GetdescriptorinfoResponse>("getdescriptorinfo", &params).await
875    }
876
877    /// Returns the proof-of-work difficulty as a multiple of the minimum difficulty.
878    async fn getdifficulty(&self) -> Result<GetdifficultyResponse, TransportError> {
879        let params = vec![];
880        self.dispatch_json::<GetdifficultyResponse>("getdifficulty", &params).await
881    }
882
883    /// List all BIP 32 HD keys in the wallet and which descriptors use them.
884    async fn gethdkeys(
885        &self,
886        _options: Option<serde_json::Value>,
887    ) -> Result<GethdkeysResponse, TransportError> {
888        let params = vec![serde_json::json!(_options)];
889        self.dispatch_json::<GethdkeysResponse>("gethdkeys", &params).await
890    }
891
892    /// Returns the status of one or all available indices currently running in the node.
893    async fn getindexinfo(
894        &self,
895        _index_name: Option<String>,
896    ) -> Result<GetindexinfoResponse, TransportError> {
897        let params = vec![serde_json::json!(_index_name)];
898        self.dispatch_json::<GetindexinfoResponse>("getindexinfo", &params).await
899    }
900
901    /// Returns an object containing information about memory usage.
902    async fn getmemoryinfo(
903        &self,
904        _mode: Option<String>,
905    ) -> Result<GetmemoryinfoResponse, TransportError> {
906        let params = vec![serde_json::json!(_mode)];
907        self.dispatch_json::<GetmemoryinfoResponse>("getmemoryinfo", &params).await
908    }
909
910    /// If txid is in the mempool, returns all in-mempool ancestors.
911    async fn getmempoolancestors(
912        &self,
913        _txid: bitcoin::Txid,
914        _verbose: Option<bool>,
915    ) -> Result<GetmempoolancestorsResponse, TransportError> {
916        let params = vec![serde_json::json!(_txid), serde_json::json!(_verbose)];
917        self.dispatch_json::<GetmempoolancestorsResponse>("getmempoolancestors", &params).await
918    }
919
920    /// If txid is in the mempool, returns all in-mempool descendants.
921    async fn getmempooldescendants(
922        &self,
923        _txid: bitcoin::Txid,
924        _verbose: Option<bool>,
925    ) -> Result<GetmempooldescendantsResponse, TransportError> {
926        let params = vec![serde_json::json!(_txid), serde_json::json!(_verbose)];
927        self.dispatch_json::<GetmempooldescendantsResponse>("getmempooldescendants", &params).await
928    }
929
930    /// Returns mempool data for given transaction
931    async fn getmempoolentry(
932        &self,
933        _txid: bitcoin::Txid,
934    ) -> Result<GetmempoolentryResponse, TransportError> {
935        let params = vec![serde_json::json!(_txid)];
936        self.dispatch_json::<GetmempoolentryResponse>("getmempoolentry", &params).await
937    }
938
939    /// Returns details on the active state of the TX memory pool.
940    async fn getmempoolinfo(&self) -> Result<GetmempoolinfoResponse, TransportError> {
941        let params = vec![];
942        self.dispatch_json::<GetmempoolinfoResponse>("getmempoolinfo", &params).await
943    }
944
945    /// Returns a json object containing mining-related information.
946    async fn getmininginfo(&self) -> Result<GetmininginfoResponse, TransportError> {
947        let params = vec![];
948        self.dispatch_json::<GetmininginfoResponse>("getmininginfo", &params).await
949    }
950
951    /// Returns information about network traffic, including bytes in, bytes out,
952    /// and current system time.
953    async fn getnettotals(&self) -> Result<GetnettotalsResponse, TransportError> {
954        let params = vec![];
955        self.dispatch_json::<GetnettotalsResponse>("getnettotals", &params).await
956    }
957
958    /// Returns the estimated network hashes per second based on the last n blocks.
959    /// Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.
960    /// Pass in [height] to estimate the network speed at the time when a certain block was found.
961    async fn getnetworkhashps(
962        &self,
963        _nblocks: Option<u64>,
964        _height: Option<u64>,
965    ) -> Result<GetnetworkhashpsResponse, TransportError> {
966        let params = vec![serde_json::json!(_nblocks), serde_json::json!(_height)];
967        self.dispatch_json::<GetnetworkhashpsResponse>("getnetworkhashps", &params).await
968    }
969
970    /// Returns an object containing various state info regarding P2P networking.
971    async fn getnetworkinfo(&self) -> Result<GetnetworkinfoResponse, TransportError> {
972        let params = vec![];
973        self.dispatch_json::<GetnetworkinfoResponse>("getnetworkinfo", &params).await
974    }
975
976    /// Returns a new Bitcoin address for receiving payments.
977    /// If 'label' is specified, it is added to the address book
978    /// so payments received with the address will be associated with 'label'.
979    async fn getnewaddress(
980        &self,
981        _label: Option<String>,
982        _address_type: Option<String>,
983    ) -> Result<GetnewaddressResponse, TransportError> {
984        let params = vec![serde_json::json!(_label), serde_json::json!(_address_type)];
985        self.dispatch_json::<GetnewaddressResponse>("getnewaddress", &params).await
986    }
987
988    /// Return known addresses, after filtering for quality and recency.
989    /// These can potentially be used to find new peers in the network.
990    /// The total number of addresses known to the node may be higher.
991    async fn getnodeaddresses(
992        &self,
993        _count: Option<u64>,
994        _network: Option<String>,
995    ) -> Result<GetnodeaddressesResponse, TransportError> {
996        let params = vec![serde_json::json!(_count), serde_json::json!(_network)];
997        self.dispatch_json::<GetnodeaddressesResponse>("getnodeaddresses", &params).await
998    }
999
1000    /// Shows transactions in the tx orphanage.
1001    ///
1002    /// EXPERIMENTAL warning: this call may be changed in future releases.
1003    async fn getorphantxs(
1004        &self,
1005        _verbosity: Option<u32>,
1006    ) -> Result<GetorphantxsResponse, TransportError> {
1007        let params = vec![serde_json::json!(_verbosity)];
1008        self.dispatch_json::<GetorphantxsResponse>("getorphantxs", &params).await
1009    }
1010
1011    /// Returns data about each connected network peer as a json array of objects.
1012    async fn getpeerinfo(&self) -> Result<GetpeerinfoResponse, TransportError> {
1013        let params = vec![];
1014        self.dispatch_json::<GetpeerinfoResponse>("getpeerinfo", &params).await
1015    }
1016
1017    /// Returns a map of all user-created (see prioritisetransaction) fee deltas by txid, and whether the tx is present in mempool.
1018    async fn getprioritisedtransactions(
1019        &self,
1020    ) -> Result<GetprioritisedtransactionsResponse, TransportError> {
1021        let params = vec![];
1022        self.dispatch_json::<GetprioritisedtransactionsResponse>(
1023            "getprioritisedtransactions",
1024            &params,
1025        )
1026        .await
1027    }
1028
1029    /// EXPERIMENTAL warning: this call may be changed in future releases.
1030    ///
1031    /// Returns information on all address manager entries for the new and tried tables.
1032    async fn getrawaddrman(&self) -> Result<GetrawaddrmanResponse, TransportError> {
1033        let params = vec![];
1034        self.dispatch_json::<GetrawaddrmanResponse>("getrawaddrman", &params).await
1035    }
1036
1037    /// Returns a new Bitcoin address, for receiving change.
1038    /// This is for use with raw transactions, NOT normal use.
1039    async fn getrawchangeaddress(
1040        &self,
1041        _address_type: Option<String>,
1042    ) -> Result<GetrawchangeaddressResponse, TransportError> {
1043        let params = vec![serde_json::json!(_address_type)];
1044        self.dispatch_json::<GetrawchangeaddressResponse>("getrawchangeaddress", &params).await
1045    }
1046
1047    /// Returns all transaction ids in memory pool as a json array of string transaction ids.
1048    ///
1049    /// Hint: use getmempoolentry to fetch a specific transaction from the mempool.
1050    async fn getrawmempool(
1051        &self,
1052        _verbose: Option<bool>,
1053        _mempool_sequence: Option<bool>,
1054    ) -> Result<GetrawmempoolResponse, TransportError> {
1055        let params = vec![serde_json::json!(_verbose), serde_json::json!(_mempool_sequence)];
1056        self.dispatch_json::<GetrawmempoolResponse>("getrawmempool", &params).await
1057    }
1058
1059    /// By default, this call only returns a transaction if it is in the mempool. If -txindex is enabled
1060    /// and no blockhash argument is passed, it will return the transaction if it is in the mempool or any block.
1061    /// If a blockhash argument is passed, it will return the transaction if
1062    /// the specified block is available and the transaction is in that block.
1063    ///
1064    /// Hint: Use gettransaction for wallet transactions.
1065    ///
1066    /// If verbosity is 0 or omitted, returns the serialized transaction as a hex-encoded string.
1067    /// If verbosity is 1, returns a JSON Object with information about the transaction.
1068    /// If verbosity is 2, returns a JSON Object with information about the transaction, including fee and prevout information.
1069    async fn getrawtransaction(
1070        &self,
1071        _txid: bitcoin::Txid,
1072        _verbosity: Option<u32>,
1073        _blockhash: Option<bitcoin::BlockHash>,
1074    ) -> Result<GetrawtransactionResponse, TransportError> {
1075        let params = vec![
1076            serde_json::json!(_txid),
1077            serde_json::json!(_verbosity),
1078            serde_json::json!(_blockhash),
1079        ];
1080        self.dispatch_json::<GetrawtransactionResponse>("getrawtransaction", &params).await
1081    }
1082
1083    /// Returns the total amount received by the given address in transactions with at least minconf confirmations.
1084    async fn getreceivedbyaddress(
1085        &self,
1086        _address: String,
1087        _minconf: Option<u32>,
1088        _include_immature_coinbase: Option<bool>,
1089    ) -> Result<GetreceivedbyaddressResponse, TransportError> {
1090        let params = vec![
1091            serde_json::json!(_address),
1092            serde_json::json!(_minconf),
1093            serde_json::json!(_include_immature_coinbase),
1094        ];
1095        self.dispatch_json::<GetreceivedbyaddressResponse>("getreceivedbyaddress", &params).await
1096    }
1097
1098    /// Returns the total amount received by addresses with <label> in transactions with at least [minconf] confirmations.
1099    async fn getreceivedbylabel(
1100        &self,
1101        _label: String,
1102        _minconf: Option<u32>,
1103        _include_immature_coinbase: Option<bool>,
1104    ) -> Result<GetreceivedbylabelResponse, TransportError> {
1105        let params = vec![
1106            serde_json::json!(_label),
1107            serde_json::json!(_minconf),
1108            serde_json::json!(_include_immature_coinbase),
1109        ];
1110        self.dispatch_json::<GetreceivedbylabelResponse>("getreceivedbylabel", &params).await
1111    }
1112
1113    /// Returns details of the RPC server.
1114    async fn getrpcinfo(&self) -> Result<GetrpcinfoResponse, TransportError> {
1115        let params = vec![];
1116        self.dispatch_json::<GetrpcinfoResponse>("getrpcinfo", &params).await
1117    }
1118
1119    /// Get detailed information about in-wallet transaction <txid>
1120    async fn gettransaction(
1121        &self,
1122        _txid: bitcoin::Txid,
1123        _include_watchonly: Option<bool>,
1124        _verbose: Option<bool>,
1125    ) -> Result<GettransactionResponse, TransportError> {
1126        let params = vec![
1127            serde_json::json!(_txid),
1128            serde_json::json!(_include_watchonly),
1129            serde_json::json!(_verbose),
1130        ];
1131        self.dispatch_json::<GettransactionResponse>("gettransaction", &params).await
1132    }
1133
1134    /// Returns details about an unspent transaction output.
1135    async fn gettxout(
1136        &self,
1137        _txid: bitcoin::Txid,
1138        _n: u32,
1139        _include_mempool: Option<bool>,
1140    ) -> Result<(), TransportError> {
1141        let params = vec![
1142            serde_json::json!(_txid),
1143            serde_json::json!(_n),
1144            serde_json::json!(_include_mempool),
1145        ];
1146        self.dispatch_json::<()>("gettxout", &params).await
1147    }
1148
1149    /// Returns a hex-encoded proof that "txid" was included in a block.
1150    ///
1151    /// NOTE: By default this function only works sometimes. This is when there is an
1152    /// unspent output in the utxo for this transaction. To make it always work,
1153    /// you need to maintain a transaction index, using the -txindex command line option or
1154    /// specify the block in which the transaction is included manually (by blockhash).
1155    async fn gettxoutproof(
1156        &self,
1157        _txids: Vec<bitcoin::Txid>,
1158        _blockhash: Option<bitcoin::BlockHash>,
1159    ) -> Result<GettxoutproofResponse, TransportError> {
1160        let params = vec![serde_json::json!(_txids), serde_json::json!(_blockhash)];
1161        self.dispatch_json::<GettxoutproofResponse>("gettxoutproof", &params).await
1162    }
1163
1164    /// Returns statistics about the unspent transaction output set.
1165    /// Note this call may take some time if you are not using coinstatsindex.
1166    async fn gettxoutsetinfo(
1167        &self,
1168        _hash_type: Option<String>,
1169        _hash_or_height: Option<HashOrHeight>,
1170        _use_index: Option<bool>,
1171    ) -> Result<GettxoutsetinfoResponse, TransportError> {
1172        let params = vec![
1173            serde_json::json!(_hash_type),
1174            serde_json::json!(_hash_or_height),
1175            serde_json::json!(_use_index),
1176        ];
1177        self.dispatch_json::<GettxoutsetinfoResponse>("gettxoutsetinfo", &params).await
1178    }
1179
1180    /// Scans the mempool to find transactions spending any of the given outputs
1181    async fn gettxspendingprevout(
1182        &self,
1183        _outputs: Vec<serde_json::Value>,
1184    ) -> Result<GettxspendingprevoutResponse, TransportError> {
1185        let params = vec![serde_json::json!(_outputs)];
1186        self.dispatch_json::<GettxspendingprevoutResponse>("gettxspendingprevout", &params).await
1187    }
1188
1189    /// Returns an object containing various wallet state info.
1190    async fn getwalletinfo(&self) -> Result<GetwalletinfoResponse, TransportError> {
1191        let params = vec![];
1192        self.dispatch_json::<GetwalletinfoResponse>("getwalletinfo", &params).await
1193    }
1194
1195    /// Returns information about the active ZeroMQ notifications.
1196    async fn getzmqnotifications(&self) -> Result<GetzmqnotificationsResponse, TransportError> {
1197        let params = vec![];
1198        self.dispatch_json::<GetzmqnotificationsResponse>("getzmqnotifications", &params).await
1199    }
1200
1201    /// List all commands, or get help for a specified command.
1202    async fn help(&self, _command: Option<String>) -> Result<HelpResponse, TransportError> {
1203        let params = vec![serde_json::json!(_command)];
1204        self.dispatch_json::<HelpResponse>("help", &params).await
1205    }
1206
1207    /// Import descriptors. This will trigger a rescan of the blockchain based on the earliest timestamp of all descriptors being imported. Requires a new wallet backup.
1208    /// When importing descriptors with multipath key expressions, if the multipath specifier contains exactly two elements, the descriptor produced from the second element will be imported as an internal descriptor.
1209    ///
1210    /// Note: This call can take over an hour to complete if using an early timestamp; during that time, other rpc calls
1211    /// may report that the imported keys, addresses or scripts exist but related transactions are still missing.
1212    /// The rescan is significantly faster if block filters are available (using startup option "-blockfilterindex=1").
1213    async fn importdescriptors(
1214        &self,
1215        _requests: Vec<serde_json::Value>,
1216    ) -> Result<ImportdescriptorsResponse, TransportError> {
1217        let params = vec![serde_json::json!(_requests)];
1218        self.dispatch_json::<ImportdescriptorsResponse>("importdescriptors", &params).await
1219    }
1220
1221    /// Import a mempool.dat file and attempt to add its contents to the mempool.
1222    /// Warning: Importing untrusted files is dangerous, especially if metadata from the file is taken over.
1223    async fn importmempool(
1224        &self,
1225        _filepath: String,
1226        _options: Option<serde_json::Value>,
1227    ) -> Result<ImportmempoolResponse, TransportError> {
1228        let params = vec![serde_json::json!(_filepath), serde_json::json!(_options)];
1229        self.dispatch_json::<ImportmempoolResponse>("importmempool", &params).await
1230    }
1231
1232    /// Imports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.
1233    async fn importprunedfunds(
1234        &self,
1235        _rawtransaction: String,
1236        _txoutproof: String,
1237    ) -> Result<(), TransportError> {
1238        let params = vec![serde_json::json!(_rawtransaction), serde_json::json!(_txoutproof)];
1239        self.dispatch_json::<()>("importprunedfunds", &params).await
1240    }
1241
1242    /// Permanently marks a block as invalid, as if it violated a consensus rule.
1243    async fn invalidateblock(&self, _blockhash: bitcoin::BlockHash) -> Result<(), TransportError> {
1244        let params = vec![serde_json::json!(_blockhash)];
1245        self.dispatch_json::<()>("invalidateblock", &params).await
1246    }
1247
1248    /// Joins multiple distinct PSBTs with different inputs and outputs into one PSBT with inputs and outputs from all of the PSBTs
1249    /// No input in any of the PSBTs can be in more than one of the PSBTs.
1250    async fn joinpsbts(
1251        &self,
1252        _txs: Vec<serde_json::Value>,
1253    ) -> Result<JoinpsbtsResponse, TransportError> {
1254        let params = vec![serde_json::json!(_txs)];
1255        self.dispatch_json::<JoinpsbtsResponse>("joinpsbts", &params).await
1256    }
1257
1258    /// Refills each descriptor keypool in the wallet up to the specified number of new keys.
1259    /// By default, descriptor wallets have 4 active ranged descriptors ("legacy", "p2sh-segwit", "bech32", "bech32m"), each with 1000 entries.
1260    ///
1261    /// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
1262    async fn keypoolrefill(&self, _newsize: Option<u64>) -> Result<(), TransportError> {
1263        let params = vec![serde_json::json!(_newsize)];
1264        self.dispatch_json::<()>("keypoolrefill", &params).await
1265    }
1266
1267    /// Lists groups of addresses which have had their common ownership
1268    /// made public by common use as inputs or as the resulting change
1269    /// in past transactions
1270    async fn listaddressgroupings(&self) -> Result<ListaddressgroupingsResponse, TransportError> {
1271        let params = vec![];
1272        self.dispatch_json::<ListaddressgroupingsResponse>("listaddressgroupings", &params).await
1273    }
1274
1275    /// List all manually banned IPs/Subnets.
1276    async fn listbanned(&self) -> Result<ListbannedResponse, TransportError> {
1277        let params = vec![];
1278        self.dispatch_json::<ListbannedResponse>("listbanned", &params).await
1279    }
1280
1281    /// List all descriptors present in a wallet.
1282    async fn listdescriptors(
1283        &self,
1284        _private: Option<bool>,
1285    ) -> Result<ListdescriptorsResponse, TransportError> {
1286        let params = vec![serde_json::json!(_private)];
1287        self.dispatch_json::<ListdescriptorsResponse>("listdescriptors", &params).await
1288    }
1289
1290    /// Returns the list of all labels, or labels that are assigned to addresses with a specific purpose.
1291    async fn listlabels(
1292        &self,
1293        _purpose: Option<String>,
1294    ) -> Result<ListlabelsResponse, TransportError> {
1295        let params = vec![serde_json::json!(_purpose)];
1296        self.dispatch_json::<ListlabelsResponse>("listlabels", &params).await
1297    }
1298
1299    /// Returns list of temporarily unspendable outputs.
1300    /// See the lockunspent call to lock and unlock transactions for spending.
1301    async fn listlockunspent(&self) -> Result<ListlockunspentResponse, TransportError> {
1302        let params = vec![];
1303        self.dispatch_json::<ListlockunspentResponse>("listlockunspent", &params).await
1304    }
1305
1306    /// List balances by receiving address.
1307    async fn listreceivedbyaddress(
1308        &self,
1309        _minconf: Option<u32>,
1310        _include_empty: Option<bool>,
1311        _include_watchonly: Option<bool>,
1312        _address_filter: Option<String>,
1313        _include_immature_coinbase: Option<bool>,
1314    ) -> Result<ListreceivedbyaddressResponse, TransportError> {
1315        let params = vec![
1316            serde_json::json!(_minconf),
1317            serde_json::json!(_include_empty),
1318            serde_json::json!(_include_watchonly),
1319            serde_json::json!(_address_filter),
1320            serde_json::json!(_include_immature_coinbase),
1321        ];
1322        self.dispatch_json::<ListreceivedbyaddressResponse>("listreceivedbyaddress", &params).await
1323    }
1324
1325    /// List received transactions by label.
1326    async fn listreceivedbylabel(
1327        &self,
1328        _minconf: Option<u32>,
1329        _include_empty: Option<bool>,
1330        _include_watchonly: Option<bool>,
1331        _include_immature_coinbase: Option<bool>,
1332    ) -> Result<ListreceivedbylabelResponse, TransportError> {
1333        let params = vec![
1334            serde_json::json!(_minconf),
1335            serde_json::json!(_include_empty),
1336            serde_json::json!(_include_watchonly),
1337            serde_json::json!(_include_immature_coinbase),
1338        ];
1339        self.dispatch_json::<ListreceivedbylabelResponse>("listreceivedbylabel", &params).await
1340    }
1341
1342    /// Get all transactions in blocks since block [blockhash], or all transactions if omitted.
1343    /// If "blockhash" is no longer a part of the main chain, transactions from the fork point onward are included.
1344    /// Additionally, if include_removed is set, transactions affecting the wallet which were removed are returned in the "removed" array.
1345    async fn listsinceblock(
1346        &self,
1347        _blockhash: Option<bitcoin::BlockHash>,
1348        _target_confirmations: Option<u64>,
1349        _include_watchonly: Option<bool>,
1350        _include_removed: Option<bool>,
1351        _include_change: Option<bool>,
1352        _label: Option<String>,
1353    ) -> Result<ListsinceblockResponse, TransportError> {
1354        let params = vec![
1355            serde_json::json!(_blockhash),
1356            serde_json::json!(_target_confirmations),
1357            serde_json::json!(_include_watchonly),
1358            serde_json::json!(_include_removed),
1359            serde_json::json!(_include_change),
1360            serde_json::json!(_label),
1361        ];
1362        self.dispatch_json::<ListsinceblockResponse>("listsinceblock", &params).await
1363    }
1364
1365    /// If a label name is provided, this will return only incoming transactions paying to addresses with the specified label.
1366    ///
1367    /// Returns up to 'count' most recent transactions skipping the first 'from' transactions.
1368    async fn listtransactions(
1369        &self,
1370        _label: Option<String>,
1371        _count: Option<u64>,
1372        _skip: Option<u64>,
1373        _include_watchonly: Option<bool>,
1374    ) -> Result<ListtransactionsResponse, TransportError> {
1375        let params = vec![
1376            serde_json::json!(_label),
1377            serde_json::json!(_count),
1378            serde_json::json!(_skip),
1379            serde_json::json!(_include_watchonly),
1380        ];
1381        self.dispatch_json::<ListtransactionsResponse>("listtransactions", &params).await
1382    }
1383
1384    /// Returns array of unspent transaction outputs
1385    /// with between minconf and maxconf (inclusive) confirmations.
1386    /// Optionally filter to only include txouts paid to specified addresses.
1387    async fn listunspent(
1388        &self,
1389        _minconf: Option<u32>,
1390        _maxconf: Option<u32>,
1391        _addresses: Option<Vec<String>>,
1392        _include_unsafe: Option<bool>,
1393        _query_options: Option<serde_json::Value>,
1394    ) -> Result<ListunspentResponse, TransportError> {
1395        let params = vec![
1396            serde_json::json!(_minconf),
1397            serde_json::json!(_maxconf),
1398            serde_json::json!(_addresses),
1399            serde_json::json!(_include_unsafe),
1400            serde_json::json!(_query_options),
1401        ];
1402        self.dispatch_json::<ListunspentResponse>("listunspent", &params).await
1403    }
1404
1405    /// Returns a list of wallets in the wallet directory.
1406    async fn listwalletdir(&self) -> Result<ListwalletdirResponse, TransportError> {
1407        let params = vec![];
1408        self.dispatch_json::<ListwalletdirResponse>("listwalletdir", &params).await
1409    }
1410
1411    /// Returns a list of currently loaded wallets.
1412    /// For full information on the wallet, use "getwalletinfo"
1413    async fn listwallets(&self) -> Result<ListwalletsResponse, TransportError> {
1414        let params = vec![];
1415        self.dispatch_json::<ListwalletsResponse>("listwallets", &params).await
1416    }
1417
1418    /// Load the serialized UTXO set from a file.
1419    /// Once this snapshot is loaded, its contents will be deserialized into a second chainstate data structure, which is then used to sync to the network's tip. Meanwhile, the original chainstate will complete the initial block download process in the background, eventually validating up to the block that the snapshot is based upon.
1420    ///
1421    /// The result is a usable bitcoind instance that is current with the network tip in a matter of minutes rather than hours. UTXO snapshot are typically obtained from third-party sources (HTTP, torrent, etc.) which is reasonable since their contents are always checked by hash.
1422    ///
1423    /// You can find more information on this process in the `assumeutxo` design document (<https://github.com/bitcoin/bitcoin/blob/master/doc/design/assumeutxo.md>).
1424    async fn loadtxoutset(&self, _path: String) -> Result<LoadtxoutsetResponse, TransportError> {
1425        let params = vec![serde_json::json!(_path)];
1426        self.dispatch_json::<LoadtxoutsetResponse>("loadtxoutset", &params).await
1427    }
1428
1429    /// Loads a wallet from a wallet file or directory.
1430    /// Note that all wallet command-line options used when starting bitcoind will be
1431    /// applied to the new wallet.
1432    async fn loadwallet(
1433        &self,
1434        _filename: String,
1435        _load_on_startup: Option<bool>,
1436    ) -> Result<LoadwalletResponse, TransportError> {
1437        let params = vec![serde_json::json!(_filename), serde_json::json!(_load_on_startup)];
1438        self.dispatch_json::<LoadwalletResponse>("loadwallet", &params).await
1439    }
1440
1441    /// Updates list of temporarily unspendable outputs.
1442    /// Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs.
1443    /// If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked.
1444    /// A locked transaction output will not be chosen by automatic coin selection, when spending bitcoins.
1445    /// Manually selected coins are automatically unlocked.
1446    /// Locks are stored in memory only, unless persistent=true, in which case they will be written to the
1447    /// wallet database and loaded on node start. Unwritten (persistent=false) locks are always cleared
1448    /// (by virtue of process exit) when a node stops or fails. Unlocking will clear both persistent and not.
1449    /// Also see the listunspent call
1450    async fn lockunspent(
1451        &self,
1452        _unlock: bool,
1453        _transactions: Option<Vec<serde_json::Value>>,
1454        _persistent: Option<bool>,
1455    ) -> Result<LockunspentResponse, TransportError> {
1456        let params = vec![
1457            serde_json::json!(_unlock),
1458            serde_json::json!(_transactions),
1459            serde_json::json!(_persistent),
1460        ];
1461        self.dispatch_json::<LockunspentResponse>("lockunspent", &params).await
1462    }
1463
1464    /// Gets and sets the logging configuration.
1465    /// When called without an argument, returns the list of categories with status that are currently being debug logged or not.
1466    /// When called with arguments, adds or removes categories from debug logging and return the lists above.
1467    /// The arguments are evaluated in order "include", "exclude".
1468    /// If an item is both included and excluded, it will thus end up being excluded.
1469    /// The valid logging categories are: addrman, bench, blockstorage, cmpctblock, coindb, estimatefee, http, i2p, ipc, leveldb, libevent, mempool, mempoolrej, net, proxy, prune, qt, rand, reindex, rpc, scan, selectcoins, tor, txpackages, txreconciliation, validation, walletdb, zmq
1470    /// In addition, the following are available as category names with special meanings:
1471    /// - "all",  "1" : represent all logging categories.
1472    async fn logging(
1473        &self,
1474        _include: Option<Vec<serde_json::Value>>,
1475        _exclude: Option<Vec<serde_json::Value>>,
1476    ) -> Result<LoggingResponse, TransportError> {
1477        let params = vec![serde_json::json!(_include), serde_json::json!(_exclude)];
1478        self.dispatch_json::<LoggingResponse>("logging", &params).await
1479    }
1480
1481    /// Migrate the wallet to a descriptor wallet.
1482    /// A new wallet backup will need to be made.
1483    ///
1484    /// The migration process will create a backup of the wallet before migrating. This backup
1485    /// file will be named <wallet name>-<timestamp>.legacy.bak and can be found in the directory
1486    /// for this wallet. In the event of an incorrect migration, the backup can be restored using restorewallet.
1487    /// Encrypted wallets must have the passphrase provided as an argument to this call.
1488    ///
1489    /// This RPC may take a long time to complete. Increasing the RPC client timeout is recommended.
1490    async fn migratewallet(
1491        &self,
1492        _wallet_name: Option<String>,
1493        _passphrase: Option<String>,
1494    ) -> Result<MigratewalletResponse, TransportError> {
1495        let params = vec![serde_json::json!(_wallet_name), serde_json::json!(_passphrase)];
1496        self.dispatch_json::<MigratewalletResponse>("migratewallet", &params).await
1497    }
1498
1499    /// Bump the scheduler into the future (-regtest only)
1500    async fn mockscheduler(&self, _delta_time: u64) -> Result<(), TransportError> {
1501        let params = vec![serde_json::json!(_delta_time)];
1502        self.dispatch_json::<()>("mockscheduler", &params).await
1503    }
1504
1505    /// Requests that a ping be sent to all other nodes, to measure ping time.
1506    /// Results are provided in getpeerinfo.
1507    /// Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.
1508    async fn ping(&self) -> Result<(), TransportError> {
1509        let params = vec![];
1510        self.dispatch_json::<()>("ping", &params).await
1511    }
1512
1513    /// Treats a block as if it were received before others with the same work.
1514    ///
1515    /// A later preciousblock call can override the effect of an earlier one.
1516    ///
1517    /// The effects of preciousblock are not retained across restarts.
1518    async fn preciousblock(&self, _blockhash: bitcoin::BlockHash) -> Result<(), TransportError> {
1519        let params = vec![serde_json::json!(_blockhash)];
1520        self.dispatch_json::<()>("preciousblock", &params).await
1521    }
1522
1523    /// Accepts the transaction into mined blocks at a higher (or lower) priority
1524    async fn prioritisetransaction(
1525        &self,
1526        params: PrioritisetransactionParams,
1527    ) -> Result<PrioritisetransactionResponse, TransportError> {
1528        let params = vec![serde_json::json!(params)];
1529        self.dispatch_json::<PrioritisetransactionResponse>("prioritisetransaction", &params).await
1530    }
1531
1532    /// Attempts to delete block and undo data up to a specified height or timestamp, if eligible for pruning.
1533    /// Requires `-prune` to be enabled at startup. While pruned data may be re-fetched in some cases (e.g., via `getblockfrompeer`), local deletion is irreversible.
1534    async fn pruneblockchain(
1535        &self,
1536        _height: u64,
1537    ) -> Result<PruneblockchainResponse, TransportError> {
1538        let params = vec![serde_json::json!(_height)];
1539        self.dispatch_json::<PruneblockchainResponse>("pruneblockchain", &params).await
1540    }
1541
1542    /// Bumps the fee of a transaction T, replacing it with a new transaction B.
1543    /// Returns a PSBT instead of creating and signing a new transaction.
1544    /// A transaction with the given txid must be in the wallet.
1545    /// The command will pay the additional fee by reducing change outputs or adding inputs when necessary.
1546    /// It may add a new change output if one does not already exist.
1547    /// All inputs in the original transaction will be included in the replacement transaction.
1548    /// The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs.
1549    /// By default, the new fee will be calculated automatically using the estimatesmartfee RPC.
1550    /// The user can specify a confirmation target for estimatesmartfee.
1551    /// Alternatively, the user can specify a fee rate in sat/vB for the new transaction.
1552    /// At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee
1553    /// returned by getnetworkinfo) to enter the node's mempool.
1554    /// * WARNING: before version 0.21, fee_rate was in BTC/kvB. As of 0.21, fee_rate is in sat/vB. *
1555    async fn psbtbumpfee(
1556        &self,
1557        _txid: bitcoin::Txid,
1558        _options: Option<serde_json::Value>,
1559    ) -> Result<PsbtbumpfeeResponse, TransportError> {
1560        let params = vec![serde_json::json!(_txid), serde_json::json!(_options)];
1561        self.dispatch_json::<PsbtbumpfeeResponse>("psbtbumpfee", &params).await
1562    }
1563
1564    /// Removes invalidity status of a block, its ancestors and its descendants, reconsider them for activation.
1565    /// This can be used to undo the effects of invalidateblock.
1566    async fn reconsiderblock(&self, _blockhash: bitcoin::BlockHash) -> Result<(), TransportError> {
1567        let params = vec![serde_json::json!(_blockhash)];
1568        self.dispatch_json::<()>("reconsiderblock", &params).await
1569    }
1570
1571    /// Deletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.
1572    async fn removeprunedfunds(&self, _txid: bitcoin::Txid) -> Result<(), TransportError> {
1573        let params = vec![serde_json::json!(_txid)];
1574        self.dispatch_json::<()>("removeprunedfunds", &params).await
1575    }
1576
1577    /// Rescan the local blockchain for wallet related transactions.
1578    /// Note: Use "getwalletinfo" to query the scanning progress.
1579    /// The rescan is significantly faster if block filters are available
1580    /// (using startup option "-blockfilterindex=1").
1581    async fn rescanblockchain(
1582        &self,
1583        _start_height: Option<u64>,
1584        _stop_height: Option<u64>,
1585    ) -> Result<RescanblockchainResponse, TransportError> {
1586        let params = vec![serde_json::json!(_start_height), serde_json::json!(_stop_height)];
1587        self.dispatch_json::<RescanblockchainResponse>("rescanblockchain", &params).await
1588    }
1589
1590    /// Restores and loads a wallet from backup.
1591    ///
1592    /// The rescan is significantly faster if block filters are available
1593    /// (using startup option "-blockfilterindex=1").
1594    async fn restorewallet(
1595        &self,
1596        _wallet_name: String,
1597        _backup_file: String,
1598        _load_on_startup: Option<bool>,
1599    ) -> Result<RestorewalletResponse, TransportError> {
1600        let params = vec![
1601            serde_json::json!(_wallet_name),
1602            serde_json::json!(_backup_file),
1603            serde_json::json!(_load_on_startup),
1604        ];
1605        self.dispatch_json::<RestorewalletResponse>("restorewallet", &params).await
1606    }
1607
1608    /// Dumps the mempool to disk. It will fail until the previous dump is fully loaded.
1609    async fn savemempool(&self) -> Result<SavemempoolResponse, TransportError> {
1610        let params = vec![];
1611        self.dispatch_json::<SavemempoolResponse>("savemempool", &params).await
1612    }
1613
1614    /// Return relevant blockhashes for given descriptors (requires blockfilterindex).
1615    /// This call may take several minutes. Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
1616    async fn scanblocks(
1617        &self,
1618        _action: String,
1619        _scanobjects: Option<Vec<serde_json::Value>>,
1620        _start_height: Option<u64>,
1621        _stop_height: Option<u64>,
1622        _filtertype: Option<String>,
1623        _options: Option<serde_json::Value>,
1624    ) -> Result<(), TransportError> {
1625        let params = vec![
1626            serde_json::json!(_action),
1627            serde_json::json!(_scanobjects),
1628            serde_json::json!(_start_height),
1629            serde_json::json!(_stop_height),
1630            serde_json::json!(_filtertype),
1631            serde_json::json!(_options),
1632        ];
1633        self.dispatch_json::<()>("scanblocks", &params).await
1634    }
1635
1636    /// Scans the unspent transaction output set for entries that match certain output descriptors.
1637    /// Examples of output descriptors are:
1638    /// addr(<address>)                      Outputs whose output script corresponds to the specified address (does not include P2PK)
1639    /// raw(<hex script>)                    Outputs whose output script equals the specified hex-encoded bytes
1640    /// combo(<pubkey>)                      P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH outputs for the given pubkey
1641    /// pkh(<pubkey>)                        P2PKH outputs for the given pubkey
1642    /// sh(multi(<n>,<pubkey>,<pubkey>,...)) P2SH-multisig outputs for the given threshold and pubkeys
1643    /// tr(<pubkey>)                         P2TR
1644    /// tr(<pubkey>,{pk(<pubkey>)})          P2TR with single fallback pubkey in tapscript
1645    /// rawtr(<pubkey>)                      P2TR with the specified key as output key rather than inner
1646    /// wsh(and_v(v:pk(<pubkey>),after(2)))  P2WSH miniscript with mandatory pubkey and a timelock
1647    ///
1648    /// In the above, <pubkey> either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one
1649    /// or more path elements separated by "/", and optionally ending in "/*" (unhardened), or "/*'" or "/*h" (hardened) to specify all
1650    /// unhardened or hardened child keys.
1651    /// In the latter case, a range needs to be specified by below if different from 1000.
1652    /// For more information on output descriptors, see the documentation in the doc/descriptors.md file.
1653    async fn scantxoutset(
1654        &self,
1655        _action: String,
1656        _scanobjects: Option<Vec<serde_json::Value>>,
1657    ) -> Result<ScantxoutsetResponse, TransportError> {
1658        let params = vec![serde_json::json!(_action), serde_json::json!(_scanobjects)];
1659        self.dispatch_json::<ScantxoutsetResponse>("scantxoutset", &params).await
1660    }
1661
1662    /// Return RPC command JSON Schema descriptions.
1663    async fn schema(&self) -> Result<SchemaResponse, TransportError> {
1664        let params = vec![];
1665        self.dispatch_json::<SchemaResponse>("schema", &params).await
1666    }
1667
1668    /// EXPERIMENTAL warning: this call may be changed in future releases.
1669    ///
1670    /// Send a transaction.
1671    async fn send(
1672        &self,
1673        _outputs: Vec<serde_json::Value>,
1674        _conf_target: Option<u64>,
1675        _estimate_mode: Option<String>,
1676        _fee_rate: Option<f64>,
1677        _options: Option<serde_json::Value>,
1678        _version: Option<u32>,
1679    ) -> Result<SendResponse, TransportError> {
1680        let params = vec![
1681            serde_json::json!(_outputs),
1682            serde_json::json!(_conf_target),
1683            serde_json::json!(_estimate_mode),
1684            serde_json::json!(_fee_rate),
1685            serde_json::json!(_options),
1686            serde_json::json!(_version),
1687        ];
1688        self.dispatch_json::<SendResponse>("send", &params).await
1689    }
1690
1691    /// EXPERIMENTAL warning: this call may be changed in future releases.
1692    ///
1693    /// Spend the value of all (or specific) confirmed UTXOs and unconfirmed change in the wallet to one or more recipients.
1694    /// Unconfirmed inbound UTXOs and locked UTXOs will not be spent. Sendall will respect the avoid_reuse wallet flag.
1695    /// If your wallet contains many small inputs, either because it received tiny payments or as a result of accumulating change, consider using `send_max` to exclude inputs that are worth less than the fees needed to spend them.
1696    async fn sendall(
1697        &self,
1698        _recipients: Vec<serde_json::Value>,
1699        _conf_target: Option<u64>,
1700        _estimate_mode: Option<String>,
1701        _fee_rate: Option<f64>,
1702        _options: Option<serde_json::Value>,
1703    ) -> Result<SendallResponse, TransportError> {
1704        let params = vec![
1705            serde_json::json!(_recipients),
1706            serde_json::json!(_conf_target),
1707            serde_json::json!(_estimate_mode),
1708            serde_json::json!(_fee_rate),
1709            serde_json::json!(_options),
1710        ];
1711        self.dispatch_json::<SendallResponse>("sendall", &params).await
1712    }
1713
1714    /// Send multiple times. Amounts are double-precision floating point numbers.
1715    /// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
1716    #[allow(clippy::too_many_arguments)]
1717    async fn sendmany(&self, params: SendmanyParams) -> Result<SendmanyResponse, TransportError> {
1718        let params = vec![serde_json::json!(params)];
1719        self.dispatch_json::<SendmanyResponse>("sendmany", &params).await
1720    }
1721
1722    /// Send a p2p message to a peer specified by id.
1723    /// The message type and body must be provided, the message header will be generated.
1724    /// This RPC is for testing only.
1725    async fn sendmsgtopeer(
1726        &self,
1727        _peer_id: u64,
1728        _msg_type: String,
1729        _msg: String,
1730    ) -> Result<SendmsgtopeerResponse, TransportError> {
1731        let params = vec![
1732            serde_json::json!(_peer_id),
1733            serde_json::json!(_msg_type),
1734            serde_json::json!(_msg),
1735        ];
1736        self.dispatch_json::<SendmsgtopeerResponse>("sendmsgtopeer", &params).await
1737    }
1738
1739    /// Submit a raw transaction (serialized, hex-encoded) to local node and network.
1740    ///
1741    /// The transaction will be sent unconditionally to all peers, so using sendrawtransaction
1742    /// for manual rebroadcast may degrade privacy by leaking the transaction's origin, as
1743    /// nodes will normally not rebroadcast non-wallet transactions already in their mempool.
1744    ///
1745    /// A specific exception, RPC_TRANSACTION_ALREADY_IN_UTXO_SET, may throw if the transaction cannot be added to the mempool.
1746    ///
1747    /// Related RPCs: createrawtransaction, signrawtransactionwithkey
1748    async fn sendrawtransaction(
1749        &self,
1750        _hexstring: String,
1751        _maxfeerate: Option<f64>,
1752        _maxburnamount: Option<f64>,
1753    ) -> Result<SendrawtransactionResponse, TransportError> {
1754        let params = vec![
1755            serde_json::json!(_hexstring),
1756            serde_json::json!(_maxfeerate),
1757            serde_json::json!(_maxburnamount),
1758        ];
1759        self.dispatch_json::<SendrawtransactionResponse>("sendrawtransaction", &params).await
1760    }
1761
1762    /// Send an amount to a given address.
1763    /// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
1764    #[allow(clippy::too_many_arguments)]
1765    async fn sendtoaddress(
1766        &self,
1767        _address: String,
1768        _amount: bitcoin::Amount,
1769        _comment: Option<String>,
1770        _comment_to: Option<String>,
1771        _subtractfeefromamount: Option<bool>,
1772        _replaceable: Option<bool>,
1773        _conf_target: Option<u64>,
1774        _estimate_mode: Option<String>,
1775        _avoid_reuse: Option<bool>,
1776        _fee_rate: Option<f64>,
1777        _verbose: Option<bool>,
1778    ) -> Result<SendtoaddressResponse, TransportError> {
1779        let params = vec![
1780            serde_json::json!(_address),
1781            serde_json::json!(_amount),
1782            serde_json::json!(_comment),
1783            serde_json::json!(_comment_to),
1784            serde_json::json!(_subtractfeefromamount),
1785            serde_json::json!(_replaceable),
1786            serde_json::json!(_conf_target),
1787            serde_json::json!(_estimate_mode),
1788            serde_json::json!(_avoid_reuse),
1789            serde_json::json!(_fee_rate),
1790            serde_json::json!(_verbose),
1791        ];
1792        self.dispatch_json::<SendtoaddressResponse>("sendtoaddress", &params).await
1793    }
1794
1795    /// Attempts to add or remove an IP/Subnet from the banned list.
1796    async fn setban(
1797        &self,
1798        _subnet: String,
1799        _command: String,
1800        _bantime: Option<u64>,
1801        _absolute: Option<bool>,
1802    ) -> Result<(), TransportError> {
1803        let params = vec![
1804            serde_json::json!(_subnet),
1805            serde_json::json!(_command),
1806            serde_json::json!(_bantime),
1807            serde_json::json!(_absolute),
1808        ];
1809        self.dispatch_json::<()>("setban", &params).await
1810    }
1811
1812    /// Sets the label associated with the given address.
1813    async fn setlabel(&self, _address: String, _label: String) -> Result<(), TransportError> {
1814        let params = vec![serde_json::json!(_address), serde_json::json!(_label)];
1815        self.dispatch_json::<()>("setlabel", &params).await
1816    }
1817
1818    /// Set the local time to given timestamp (-regtest only)
1819    async fn setmocktime(&self, _timestamp: u64) -> Result<(), TransportError> {
1820        let params = vec![serde_json::json!(_timestamp)];
1821        self.dispatch_json::<()>("setmocktime", &params).await
1822    }
1823
1824    /// Disable/enable all p2p network activity.
1825    async fn setnetworkactive(
1826        &self,
1827        _state: bool,
1828    ) -> Result<SetnetworkactiveResponse, TransportError> {
1829        let params = vec![serde_json::json!(_state)];
1830        self.dispatch_json::<SetnetworkactiveResponse>("setnetworkactive", &params).await
1831    }
1832
1833    /// (DEPRECATED) Set the transaction fee rate in BTC/kvB for this wallet. Overrides the global -paytxfee command line parameter.
1834    /// Can be deactivated by passing 0 as the fee. In that case automatic fee selection will be used by default.
1835    async fn settxfee(&self, _amount: bitcoin::Amount) -> Result<SettxfeeResponse, TransportError> {
1836        let params = vec![serde_json::json!(_amount)];
1837        self.dispatch_json::<SettxfeeResponse>("settxfee", &params).await
1838    }
1839
1840    /// Change the state of the given wallet flag for a wallet.
1841    async fn setwalletflag(
1842        &self,
1843        _flag: String,
1844        _value: Option<bool>,
1845    ) -> Result<SetwalletflagResponse, TransportError> {
1846        let params = vec![serde_json::json!(_flag), serde_json::json!(_value)];
1847        self.dispatch_json::<SetwalletflagResponse>("setwalletflag", &params).await
1848    }
1849
1850    /// Sign a message with the private key of an address
1851    /// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
1852    async fn signmessage(
1853        &self,
1854        _address: String,
1855        _message: String,
1856    ) -> Result<SignmessageResponse, TransportError> {
1857        let params = vec![serde_json::json!(_address), serde_json::json!(_message)];
1858        self.dispatch_json::<SignmessageResponse>("signmessage", &params).await
1859    }
1860
1861    /// Sign a message with the private key of an address
1862    async fn signmessagewithprivkey(
1863        &self,
1864        _privkey: String,
1865        _message: String,
1866    ) -> Result<SignmessagewithprivkeyResponse, TransportError> {
1867        let params = vec![serde_json::json!(_privkey), serde_json::json!(_message)];
1868        self.dispatch_json::<SignmessagewithprivkeyResponse>("signmessagewithprivkey", &params)
1869            .await
1870    }
1871
1872    /// Sign inputs for raw transaction (serialized, hex-encoded).
1873    /// The second argument is an array of base58-encoded private
1874    /// keys that will be the only keys used to sign the transaction.
1875    /// The third optional argument (may be null) is an array of previous transaction outputs that
1876    /// this transaction depends on but may not yet be in the block chain.
1877    async fn signrawtransactionwithkey(
1878        &self,
1879        _hexstring: String,
1880        _privkeys: Vec<String>,
1881        _prevtxs: Option<Vec<serde_json::Value>>,
1882        _sighashtype: Option<String>,
1883    ) -> Result<SignrawtransactionwithkeyResponse, TransportError> {
1884        let params = vec![
1885            serde_json::json!(_hexstring),
1886            serde_json::json!(_privkeys),
1887            serde_json::json!(_prevtxs),
1888            serde_json::json!(_sighashtype),
1889        ];
1890        self.dispatch_json::<SignrawtransactionwithkeyResponse>(
1891            "signrawtransactionwithkey",
1892            &params,
1893        )
1894        .await
1895    }
1896
1897    /// Sign inputs for raw transaction (serialized, hex-encoded).
1898    /// The second optional argument (may be null) is an array of previous transaction outputs that
1899    /// this transaction depends on but may not yet be in the block chain.
1900    /// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
1901    async fn signrawtransactionwithwallet(
1902        &self,
1903        _hexstring: String,
1904        _prevtxs: Option<Vec<serde_json::Value>>,
1905        _sighashtype: Option<String>,
1906    ) -> Result<SignrawtransactionwithwalletResponse, TransportError> {
1907        let params = vec![
1908            serde_json::json!(_hexstring),
1909            serde_json::json!(_prevtxs),
1910            serde_json::json!(_sighashtype),
1911        ];
1912        self.dispatch_json::<SignrawtransactionwithwalletResponse>(
1913            "signrawtransactionwithwallet",
1914            &params,
1915        )
1916        .await
1917    }
1918
1919    /// Calculate the balance change resulting in the signing and broadcasting of the given transaction(s).
1920    async fn simulaterawtransaction(
1921        &self,
1922        _rawtxs: Option<Vec<serde_json::Value>>,
1923        _options: Option<serde_json::Value>,
1924    ) -> Result<SimulaterawtransactionResponse, TransportError> {
1925        let params = vec![serde_json::json!(_rawtxs), serde_json::json!(_options)];
1926        self.dispatch_json::<SimulaterawtransactionResponse>("simulaterawtransaction", &params)
1927            .await
1928    }
1929
1930    /// Request a graceful shutdown of Bitcoin Core.
1931    async fn stop(&self, _wait: Option<u64>) -> Result<StopResponse, TransportError> {
1932        let params = vec![serde_json::json!(_wait)];
1933        self.dispatch_json::<StopResponse>("stop", &params).await
1934    }
1935
1936    /// Attempts to submit new block to network.
1937    /// See https://en.bitcoin.it/wiki/BIP_0022 for full specification.
1938    async fn submitblock(
1939        &self,
1940        _hexdata: String,
1941        _dummy: Option<String>,
1942    ) -> Result<(), TransportError> {
1943        let params = vec![serde_json::json!(_hexdata), serde_json::json!(_dummy)];
1944        self.dispatch_json::<()>("submitblock", &params).await
1945    }
1946
1947    /// Decode the given hexdata as a header and submit it as a candidate chain tip if valid.
1948    /// Throws when the header is invalid.
1949    async fn submitheader(&self, _hexdata: String) -> Result<(), TransportError> {
1950        let params = vec![serde_json::json!(_hexdata)];
1951        self.dispatch_json::<()>("submitheader", &params).await
1952    }
1953
1954    /// Submit a package of raw transactions (serialized, hex-encoded) to local node.
1955    /// The package will be validated according to consensus and mempool policy rules. If any transaction passes, it will be accepted to mempool.
1956    /// This RPC is experimental and the interface may be unstable. Refer to doc/policy/packages.md for documentation on package policies.
1957    /// Warning: successful submission does not mean the transactions will propagate throughout the network.
1958    async fn submitpackage(
1959        &self,
1960        _package: Vec<serde_json::Value>,
1961        _maxfeerate: Option<f64>,
1962        _maxburnamount: Option<f64>,
1963    ) -> Result<SubmitpackageResponse, TransportError> {
1964        let params = vec![
1965            serde_json::json!(_package),
1966            serde_json::json!(_maxfeerate),
1967            serde_json::json!(_maxburnamount),
1968        ];
1969        self.dispatch_json::<SubmitpackageResponse>("submitpackage", &params).await
1970    }
1971
1972    /// Waits for the validation interface queue to catch up on everything that was there when we entered this function.
1973    async fn syncwithvalidationinterfacequeue(&self) -> Result<(), TransportError> {
1974        let params = vec![];
1975        self.dispatch_json::<()>("syncwithvalidationinterfacequeue", &params).await
1976    }
1977
1978    /// Returns result of mempool acceptance tests indicating if raw transaction(s) (serialized, hex-encoded) would be accepted by mempool.
1979    ///
1980    /// If multiple transactions are passed in, parents must come before children and package policies apply: the transactions cannot conflict with any mempool transactions or each other.
1981    ///
1982    /// If one transaction fails, other transactions may not be fully validated (the 'allowed' key will be blank).
1983    ///
1984    /// The maximum number of transactions allowed is 25.
1985    ///
1986    /// This checks if transactions violate the consensus or policy rules.
1987    ///
1988    /// See sendrawtransaction call.
1989    async fn testmempoolaccept(
1990        &self,
1991        _rawtxs: Vec<serde_json::Value>,
1992        _maxfeerate: Option<f64>,
1993    ) -> Result<TestmempoolacceptResponse, TransportError> {
1994        let params = vec![serde_json::json!(_rawtxs), serde_json::json!(_maxfeerate)];
1995        self.dispatch_json::<TestmempoolacceptResponse>("testmempoolaccept", &params).await
1996    }
1997
1998    /// Unloads the wallet referenced by the request endpoint or the wallet_name argument.
1999    /// If both are specified, they must be identical.
2000    async fn unloadwallet(
2001        &self,
2002        _wallet_name: Option<String>,
2003        _load_on_startup: Option<bool>,
2004    ) -> Result<UnloadwalletResponse, TransportError> {
2005        let params = vec![serde_json::json!(_wallet_name), serde_json::json!(_load_on_startup)];
2006        self.dispatch_json::<UnloadwalletResponse>("unloadwallet", &params).await
2007    }
2008
2009    /// Returns the total uptime of the server.
2010    async fn uptime(&self) -> Result<UptimeResponse, TransportError> {
2011        let params = vec![];
2012        self.dispatch_json::<UptimeResponse>("uptime", &params).await
2013    }
2014
2015    /// Updates all segwit inputs and outputs in a PSBT with data from output descriptors, the UTXO set, txindex, or the mempool.
2016    async fn utxoupdatepsbt(
2017        &self,
2018        _psbt: String,
2019        _descriptors: Option<Vec<serde_json::Value>>,
2020    ) -> Result<UtxoupdatepsbtResponse, TransportError> {
2021        let params = vec![serde_json::json!(_psbt), serde_json::json!(_descriptors)];
2022        self.dispatch_json::<UtxoupdatepsbtResponse>("utxoupdatepsbt", &params).await
2023    }
2024
2025    /// Return information about the given bitcoin address.
2026    async fn validateaddress(
2027        &self,
2028        _address: String,
2029    ) -> Result<ValidateaddressResponse, TransportError> {
2030        let params = vec![serde_json::json!(_address)];
2031        self.dispatch_json::<ValidateaddressResponse>("validateaddress", &params).await
2032    }
2033
2034    /// Verifies blockchain database.
2035    async fn verifychain(
2036        &self,
2037        _checklevel: Option<u32>,
2038        _nblocks: Option<u64>,
2039    ) -> Result<VerifychainResponse, TransportError> {
2040        let params = vec![serde_json::json!(_checklevel), serde_json::json!(_nblocks)];
2041        self.dispatch_json::<VerifychainResponse>("verifychain", &params).await
2042    }
2043
2044    /// Verify a signed message.
2045    async fn verifymessage(
2046        &self,
2047        _address: String,
2048        _signature: String,
2049        _message: String,
2050    ) -> Result<VerifymessageResponse, TransportError> {
2051        let params = vec![
2052            serde_json::json!(_address),
2053            serde_json::json!(_signature),
2054            serde_json::json!(_message),
2055        ];
2056        self.dispatch_json::<VerifymessageResponse>("verifymessage", &params).await
2057    }
2058
2059    /// Verifies that a proof points to a transaction in a block, returning the transaction it commits to
2060    /// and throwing an RPC error if the block is not in our best chain
2061    async fn verifytxoutproof(
2062        &self,
2063        _proof: String,
2064    ) -> Result<VerifytxoutproofResponse, TransportError> {
2065        let params = vec![serde_json::json!(_proof)];
2066        self.dispatch_json::<VerifytxoutproofResponse>("verifytxoutproof", &params).await
2067    }
2068
2069    /// Waits for a specific new block and returns useful info about it.
2070    ///
2071    /// Returns the current block on timeout or exit.
2072    ///
2073    /// Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
2074    async fn waitforblock(
2075        &self,
2076        _blockhash: bitcoin::BlockHash,
2077        _timeout: Option<u64>,
2078    ) -> Result<WaitforblockResponse, TransportError> {
2079        let params = vec![serde_json::json!(_blockhash), serde_json::json!(_timeout)];
2080        self.dispatch_json::<WaitforblockResponse>("waitforblock", &params).await
2081    }
2082
2083    /// Waits for (at least) block height and returns the height and hash
2084    /// of the current tip.
2085    ///
2086    /// Returns the current block on timeout or exit.
2087    ///
2088    /// Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
2089    async fn waitforblockheight(
2090        &self,
2091        _height: u64,
2092        _timeout: Option<u64>,
2093    ) -> Result<WaitforblockheightResponse, TransportError> {
2094        let params = vec![serde_json::json!(_height), serde_json::json!(_timeout)];
2095        self.dispatch_json::<WaitforblockheightResponse>("waitforblockheight", &params).await
2096    }
2097
2098    /// Waits for any new block and returns useful info about it.
2099    ///
2100    /// Returns the current block on timeout or exit.
2101    ///
2102    /// Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
2103    async fn waitfornewblock(
2104        &self,
2105        _timeout: Option<u64>,
2106        _current_tip: Option<String>,
2107    ) -> Result<WaitfornewblockResponse, TransportError> {
2108        let params = vec![serde_json::json!(_timeout), serde_json::json!(_current_tip)];
2109        self.dispatch_json::<WaitfornewblockResponse>("waitfornewblock", &params).await
2110    }
2111
2112    /// Creates and funds a transaction in the Partially Signed Transaction format.
2113    /// Implements the Creator and Updater roles.
2114    /// All existing inputs must either have their previous output transaction be in the wallet
2115    /// or be in the UTXO set. Solving data must be provided for non-wallet inputs.
2116    async fn walletcreatefundedpsbt(
2117        &self,
2118        params: WalletcreatefundedpsbtParams,
2119    ) -> Result<WalletcreatefundedpsbtResponse, TransportError> {
2120        let params = vec![serde_json::json!(params)];
2121        self.dispatch_json::<WalletcreatefundedpsbtResponse>("walletcreatefundedpsbt", &params)
2122            .await
2123    }
2124
2125    /// Display address on an external signer for verification.
2126    async fn walletdisplayaddress(
2127        &self,
2128        _address: String,
2129    ) -> Result<WalletdisplayaddressResponse, TransportError> {
2130        let params = vec![serde_json::json!(_address)];
2131        self.dispatch_json::<WalletdisplayaddressResponse>("walletdisplayaddress", &params).await
2132    }
2133
2134    /// Removes the wallet encryption key from memory, locking the wallet.
2135    /// After calling this method, you will need to call walletpassphrase again
2136    /// before being able to call any methods which require the wallet to be unlocked.
2137    async fn walletlock(&self) -> Result<(), TransportError> {
2138        let params = vec![];
2139        self.dispatch_json::<()>("walletlock", &params).await
2140    }
2141
2142    /// Stores the wallet decryption key in memory for 'timeout' seconds.
2143    /// This is needed prior to performing transactions related to private keys such as sending bitcoins
2144    ///
2145    /// Note:
2146    /// Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock
2147    /// time that overrides the old one.
2148    async fn walletpassphrase(
2149        &self,
2150        _passphrase: String,
2151        _timeout: u64,
2152    ) -> Result<(), TransportError> {
2153        let params = vec![serde_json::json!(_passphrase), serde_json::json!(_timeout)];
2154        self.dispatch_json::<()>("walletpassphrase", &params).await
2155    }
2156
2157    /// Changes the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.
2158    async fn walletpassphrasechange(
2159        &self,
2160        _oldpassphrase: String,
2161        _newpassphrase: String,
2162    ) -> Result<(), TransportError> {
2163        let params = vec![serde_json::json!(_oldpassphrase), serde_json::json!(_newpassphrase)];
2164        self.dispatch_json::<()>("walletpassphrasechange", &params).await
2165    }
2166
2167    /// Update a PSBT with input information from our wallet and then sign inputs
2168    /// that we can sign for.
2169    /// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
2170    async fn walletprocesspsbt(
2171        &self,
2172        _psbt: String,
2173        _sign: Option<bool>,
2174        _sighashtype: Option<String>,
2175        _bip32derivs: Option<bool>,
2176        _finalize: Option<bool>,
2177    ) -> Result<WalletprocesspsbtResponse, TransportError> {
2178        let params = vec![
2179            serde_json::json!(_psbt),
2180            serde_json::json!(_sign),
2181            serde_json::json!(_sighashtype),
2182            serde_json::json!(_bip32derivs),
2183            serde_json::json!(_finalize),
2184        ];
2185        self.dispatch_json::<WalletprocesspsbtResponse>("walletprocesspsbt", &params).await
2186    }
2187}
2188
2189/// Helper to route calls to the node or wallet namespace automatically.
2190pub trait RpcDispatchExt: TransportTrait + TransportExt {
2191    /// Dispatch JSON-RPC methods by name.
2192    fn dispatch_json<R: DeserializeOwned>(
2193        &self,
2194        method: &str,
2195        params: &[serde_json::Value],
2196    ) -> impl Future<Output = Result<R, TransportError>> + Send {
2197        async move { self.call(method, params).await }
2198    }
2199}
2200
2201impl<T: TransportTrait + TransportExt + ?Sized> RpcDispatchExt for T {}
2202
2203// helper trait, so any TransportTrait gets a wallet_call by default
2204pub trait WalletTransportExt: TransportTrait + TransportExt {
2205    fn wallet_call<T: serde::Serialize + std::marker::Sync, R: serde::de::DeserializeOwned>(
2206        &self,
2207        method: &str,
2208        params: &[T],
2209    ) -> impl std::future::Future<Output = Result<R, crate::transport::TransportError>> + Send {
2210        async {
2211            // Convert params to Value before passing to call
2212            let value_params: Vec<serde_json::Value> =
2213                params.iter().map(|p| serde_json::to_value(p).unwrap()).collect();
2214            self.call(method, &value_params).await
2215        }
2216    }
2217}
2218
2219impl<T: TransportTrait + TransportExt + ?Sized> WalletTransportExt for T {}
2220
2221// Provide default implementation for any type that implements TransportTrait + TransportExt
2222#[async_trait]
2223impl<T: TransportTrait + TransportExt + Send + Sync> BitcoinClientV30 for T {
2224    /// Mark in-wallet transaction <txid> as abandoned
2225    /// This will mark this transaction and all its in-wallet descendants as abandoned which will allow
2226    /// for their inputs to be respent.  It can be used to replace "stuck" or evicted transactions.
2227    /// It only works on transactions which are not included in a block and are not currently in the mempool.
2228    /// It has no effect on transactions which are already abandoned.
2229    async fn abandontransaction(&self, _txid: bitcoin::Txid) -> Result<(), TransportError> {
2230        let params = vec![serde_json::json!(_txid)];
2231        self.dispatch_json::<()>("abandontransaction", &params).await
2232    }
2233
2234    /// Stops current wallet rescan triggered by an RPC call, e.g. by a rescanblockchain call.
2235    /// Note: Use "getwalletinfo" to query the scanning progress.
2236    async fn abortrescan(&self) -> Result<AbortrescanResponse, TransportError> {
2237        let params = vec![];
2238        self.dispatch_json::<AbortrescanResponse>("abortrescan", &params).await
2239    }
2240
2241    /// Open an outbound connection to a specified node. This RPC is for testing only.
2242    async fn addconnection(
2243        &self,
2244        _address: String,
2245        _connection_type: String,
2246        _v2transport: bool,
2247    ) -> Result<AddconnectionResponse, TransportError> {
2248        let params = vec![
2249            serde_json::json!(_address),
2250            serde_json::json!(_connection_type),
2251            serde_json::json!(_v2transport),
2252        ];
2253        self.dispatch_json::<AddconnectionResponse>("addconnection", &params).await
2254    }
2255
2256    /// Attempts to add or remove a node from the addnode list.
2257    /// Or try a connection to a node once.
2258    /// Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be
2259    /// full nodes/support SegWit as other outbound peers are (though such peers will not be synced from).
2260    /// Addnode connections are limited to 8 at a time and are counted separately from the -maxconnections limit.
2261    async fn addnode(
2262        &self,
2263        _node: String,
2264        _command: String,
2265        _v2transport: Option<bool>,
2266    ) -> Result<(), TransportError> {
2267        let params = vec![
2268            serde_json::json!(_node),
2269            serde_json::json!(_command),
2270            serde_json::json!(_v2transport),
2271        ];
2272        self.dispatch_json::<()>("addnode", &params).await
2273    }
2274
2275    /// Add the address of a potential peer to an address manager table. This RPC is for testing only.
2276    async fn addpeeraddress(
2277        &self,
2278        _address: String,
2279        _port: u16,
2280        _tried: Option<bool>,
2281    ) -> Result<AddpeeraddressResponse, TransportError> {
2282        let params =
2283            vec![serde_json::json!(_address), serde_json::json!(_port), serde_json::json!(_tried)];
2284        self.dispatch_json::<AddpeeraddressResponse>("addpeeraddress", &params).await
2285    }
2286
2287    /// Analyzes and provides information about the current status of a PSBT and its inputs
2288    async fn analyzepsbt(&self, _psbt: String) -> Result<AnalyzepsbtResponse, TransportError> {
2289        let params = vec![serde_json::json!(_psbt)];
2290        self.dispatch_json::<AnalyzepsbtResponse>("analyzepsbt", &params).await
2291    }
2292
2293    /// Safely copies the current wallet file to the specified destination, which can either be a directory or a path with a filename.
2294    async fn backupwallet(&self, _destination: String) -> Result<(), TransportError> {
2295        let params = vec![serde_json::json!(_destination)];
2296        self.dispatch_json::<()>("backupwallet", &params).await
2297    }
2298
2299    /// Bumps the fee of a transaction T, replacing it with a new transaction B.
2300    /// A transaction with the given txid must be in the wallet.
2301    /// The command will pay the additional fee by reducing change outputs or adding inputs when necessary.
2302    /// It may add a new change output if one does not already exist.
2303    /// All inputs in the original transaction will be included in the replacement transaction.
2304    /// The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs.
2305    /// By default, the new fee will be calculated automatically using the estimatesmartfee RPC.
2306    /// The user can specify a confirmation target for estimatesmartfee.
2307    /// Alternatively, the user can specify a fee rate in sat/vB for the new transaction.
2308    /// At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee
2309    /// returned by getnetworkinfo) to enter the node's mempool.
2310    /// * WARNING: before version 0.21, fee_rate was in BTC/kvB. As of 0.21, fee_rate is in sat/vB. *
2311    async fn bumpfee(
2312        &self,
2313        _txid: bitcoin::Txid,
2314        _options: Option<serde_json::Value>,
2315    ) -> Result<BumpfeeResponse, TransportError> {
2316        let params = vec![serde_json::json!(_txid), serde_json::json!(_options)];
2317        self.dispatch_json::<BumpfeeResponse>("bumpfee", &params).await
2318    }
2319
2320    /// Clear all banned IPs.
2321    async fn clearbanned(&self) -> Result<(), TransportError> {
2322        let params = vec![];
2323        self.dispatch_json::<()>("clearbanned", &params).await
2324    }
2325
2326    /// Combine multiple partially signed Bitcoin transactions into one transaction.
2327    /// Implements the Combiner role.
2328    async fn combinepsbt(
2329        &self,
2330        _txs: Vec<serde_json::Value>,
2331    ) -> Result<CombinepsbtResponse, TransportError> {
2332        let params = vec![serde_json::json!(_txs)];
2333        self.dispatch_json::<CombinepsbtResponse>("combinepsbt", &params).await
2334    }
2335
2336    /// Combine multiple partially signed transactions into one transaction.
2337    /// The combined transaction may be another partially signed transaction or a
2338    /// fully signed transaction.
2339    async fn combinerawtransaction(
2340        &self,
2341        _txs: Vec<serde_json::Value>,
2342    ) -> Result<CombinerawtransactionResponse, TransportError> {
2343        let params = vec![serde_json::json!(_txs)];
2344        self.dispatch_json::<CombinerawtransactionResponse>("combinerawtransaction", &params).await
2345    }
2346
2347    /// Converts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction
2348    /// createpsbt and walletcreatefundedpsbt should be used for new applications.
2349    async fn converttopsbt(
2350        &self,
2351        _hexstring: String,
2352        _permitsigdata: Option<bool>,
2353        _iswitness: Option<bool>,
2354    ) -> Result<ConverttopsbtResponse, TransportError> {
2355        let params = vec![
2356            serde_json::json!(_hexstring),
2357            serde_json::json!(_permitsigdata),
2358            serde_json::json!(_iswitness),
2359        ];
2360        self.dispatch_json::<ConverttopsbtResponse>("converttopsbt", &params).await
2361    }
2362
2363    /// Creates a multi-signature address with n signatures of m keys required.
2364    /// It returns a json object with the address and redeemScript.
2365    async fn createmultisig(
2366        &self,
2367        _nrequired: u32,
2368        _keys: Vec<String>,
2369        _address_type: Option<String>,
2370    ) -> Result<CreatemultisigResponse, TransportError> {
2371        let params = vec![
2372            serde_json::json!(_nrequired),
2373            serde_json::json!(_keys),
2374            serde_json::json!(_address_type),
2375        ];
2376        self.dispatch_json::<CreatemultisigResponse>("createmultisig", &params).await
2377    }
2378
2379    /// Creates a transaction in the Partially Signed Transaction format.
2380    /// Implements the Creator role.
2381    /// Note that the transaction's inputs are not signed, and
2382    /// it is not stored in the wallet or transmitted to the network.
2383    async fn createpsbt(
2384        &self,
2385        _inputs: Vec<serde_json::Value>,
2386        _outputs: Vec<serde_json::Value>,
2387        _locktime: Option<u32>,
2388        _replaceable: Option<bool>,
2389        _version: Option<u32>,
2390    ) -> Result<CreatepsbtResponse, TransportError> {
2391        let params = vec![
2392            serde_json::json!(_inputs),
2393            serde_json::json!(_outputs),
2394            serde_json::json!(_locktime),
2395            serde_json::json!(_replaceable),
2396            serde_json::json!(_version),
2397        ];
2398        self.dispatch_json::<CreatepsbtResponse>("createpsbt", &params).await
2399    }
2400
2401    /// Create a transaction spending the given inputs and creating new outputs.
2402    /// Outputs can be addresses or data.
2403    /// Returns hex-encoded raw transaction.
2404    /// Note that the transaction's inputs are not signed, and
2405    /// it is not stored in the wallet or transmitted to the network.
2406    async fn createrawtransaction(
2407        &self,
2408        _inputs: Vec<serde_json::Value>,
2409        _outputs: Vec<serde_json::Value>,
2410        _locktime: Option<u32>,
2411        _replaceable: Option<bool>,
2412        _version: Option<u32>,
2413    ) -> Result<CreaterawtransactionResponse, TransportError> {
2414        let params = vec![
2415            serde_json::json!(_inputs),
2416            serde_json::json!(_outputs),
2417            serde_json::json!(_locktime),
2418            serde_json::json!(_replaceable),
2419            serde_json::json!(_version),
2420        ];
2421        self.dispatch_json::<CreaterawtransactionResponse>("createrawtransaction", &params).await
2422    }
2423
2424    /// Creates and loads a new wallet.
2425    #[allow(clippy::too_many_arguments)]
2426    async fn createwallet(
2427        &self,
2428        _wallet_name: String,
2429        _disable_private_keys: Option<bool>,
2430        _blank: Option<bool>,
2431        _passphrase: Option<String>,
2432        _avoid_reuse: Option<bool>,
2433        _descriptors: Option<bool>,
2434        _load_on_startup: Option<bool>,
2435        _external_signer: Option<bool>,
2436    ) -> Result<CreatewalletResponse, TransportError> {
2437        let params = vec![
2438            serde_json::json!(_wallet_name),
2439            serde_json::json!(_disable_private_keys),
2440            serde_json::json!(_blank),
2441            serde_json::json!(_passphrase),
2442            serde_json::json!(_avoid_reuse),
2443            serde_json::json!(_descriptors),
2444            serde_json::json!(_load_on_startup),
2445            serde_json::json!(_external_signer),
2446        ];
2447        self.dispatch_json::<CreatewalletResponse>("createwallet", &params).await
2448    }
2449
2450    /// Creates the wallet's descriptor for the given address type. The address type must be one that the wallet does not already have a descriptor for.
2451    /// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
2452    async fn createwalletdescriptor(
2453        &self,
2454        r#_type: String,
2455        _options: Option<serde_json::Value>,
2456    ) -> Result<CreatewalletdescriptorResponse, TransportError> {
2457        let params = vec![serde_json::json!(r#_type), serde_json::json!(_options)];
2458        self.dispatch_json::<CreatewalletdescriptorResponse>("createwalletdescriptor", &params)
2459            .await
2460    }
2461
2462    /// Return a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.
2463    async fn decodepsbt(&self, _psbt: String) -> Result<DecodepsbtResponse, TransportError> {
2464        let params = vec![serde_json::json!(_psbt)];
2465        self.dispatch_json::<DecodepsbtResponse>("decodepsbt", &params).await
2466    }
2467
2468    /// Return a JSON object representing the serialized, hex-encoded transaction.
2469    async fn decoderawtransaction(
2470        &self,
2471        _hexstring: String,
2472        _iswitness: Option<bool>,
2473    ) -> Result<DecoderawtransactionResponse, TransportError> {
2474        let params = vec![serde_json::json!(_hexstring), serde_json::json!(_iswitness)];
2475        self.dispatch_json::<DecoderawtransactionResponse>("decoderawtransaction", &params).await
2476    }
2477
2478    /// Decode a hex-encoded script.
2479    async fn decodescript(
2480        &self,
2481        _hexstring: String,
2482    ) -> Result<DecodescriptResponse, TransportError> {
2483        let params = vec![serde_json::json!(_hexstring)];
2484        self.dispatch_json::<DecodescriptResponse>("decodescript", &params).await
2485    }
2486
2487    /// Derives one or more addresses corresponding to an output descriptor.
2488    /// Examples of output descriptors are:
2489    /// pkh(<pubkey>)                                     P2PKH outputs for the given pubkey
2490    /// wpkh(<pubkey>)                                    Native segwit P2PKH outputs for the given pubkey
2491    /// sh(multi(<n>,<pubkey>,<pubkey>,...))              P2SH-multisig outputs for the given threshold and pubkeys
2492    /// raw(<hex script>)                                 Outputs whose output script equals the specified hex-encoded bytes
2493    /// tr(<pubkey>,multi_a(<n>,<pubkey>,<pubkey>,...))   P2TR-multisig outputs for the given threshold and pubkeys
2494    ///
2495    /// In the above, <pubkey> either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one
2496    /// or more path elements separated by "/", where "h" represents a hardened child key.
2497    /// For more information on output descriptors, see the documentation in the doc/descriptors.md file.
2498    async fn deriveaddresses(
2499        &self,
2500        _descriptor: String,
2501        _range: Option<serde_json::Value>,
2502    ) -> Result<DeriveaddressesResponse, TransportError> {
2503        let params = vec![serde_json::json!(_descriptor), serde_json::json!(_range)];
2504        self.dispatch_json::<DeriveaddressesResponse>("deriveaddresses", &params).await
2505    }
2506
2507    /// Update all segwit inputs in a PSBT with information from output descriptors, the UTXO set or the mempool.
2508    /// Then, sign the inputs we are able to with information from the output descriptors.
2509    async fn descriptorprocesspsbt(
2510        &self,
2511        _psbt: String,
2512        _descriptors: Vec<serde_json::Value>,
2513        _sighashtype: Option<String>,
2514        _bip32derivs: Option<bool>,
2515        _finalize: Option<bool>,
2516    ) -> Result<DescriptorprocesspsbtResponse, TransportError> {
2517        let params = vec![
2518            serde_json::json!(_psbt),
2519            serde_json::json!(_descriptors),
2520            serde_json::json!(_sighashtype),
2521            serde_json::json!(_bip32derivs),
2522            serde_json::json!(_finalize),
2523        ];
2524        self.dispatch_json::<DescriptorprocesspsbtResponse>("descriptorprocesspsbt", &params).await
2525    }
2526
2527    /// Immediately disconnects from the specified peer node.
2528    ///
2529    /// Strictly one out of 'address' and 'nodeid' can be provided to identify the node.
2530    ///
2531    /// To disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.
2532    async fn disconnectnode(
2533        &self,
2534        _address: Option<String>,
2535        _nodeid: Option<u64>,
2536    ) -> Result<(), TransportError> {
2537        let params = vec![serde_json::json!(_address), serde_json::json!(_nodeid)];
2538        self.dispatch_json::<()>("disconnectnode", &params).await
2539    }
2540
2541    /// Write the serialized UTXO set to a file. This can be used in loadtxoutset afterwards if this snapshot height is supported in the chainparams as well.
2542    ///
2543    /// Unless the "latest" type is requested, the node will roll back to the requested height and network activity will be suspended during this process. Because of this it is discouraged to interact with the node in any other way during the execution of this call to avoid inconsistent results and race conditions, particularly RPCs that interact with blockstorage.
2544    ///
2545    /// This call may take several minutes. Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
2546    async fn dumptxoutset(
2547        &self,
2548        _path: String,
2549        r#_type: Option<String>,
2550        _options: Option<serde_json::Value>,
2551    ) -> Result<DumptxoutsetResponse, TransportError> {
2552        let params =
2553            vec![serde_json::json!(_path), serde_json::json!(r#_type), serde_json::json!(_options)];
2554        self.dispatch_json::<DumptxoutsetResponse>("dumptxoutset", &params).await
2555    }
2556
2557    /// Simply echo back the input arguments. This command is for testing.
2558    ///
2559    /// It will return an internal bug report when arg9='trigger_internal_bug' is passed.
2560    ///
2561    /// The difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in bitcoin-cli and the GUI. There is no server-side difference.
2562    #[allow(clippy::too_many_arguments)]
2563    async fn echo(
2564        &self,
2565        _arg0: Option<String>,
2566        _arg1: Option<String>,
2567        _arg2: Option<String>,
2568        _arg3: Option<String>,
2569        _arg4: Option<String>,
2570        _arg5: Option<String>,
2571        _arg6: Option<String>,
2572        _arg7: Option<String>,
2573        _arg8: Option<String>,
2574        _arg9: Option<String>,
2575    ) -> Result<EchoResponse, TransportError> {
2576        let params = vec![
2577            serde_json::json!(_arg0),
2578            serde_json::json!(_arg1),
2579            serde_json::json!(_arg2),
2580            serde_json::json!(_arg3),
2581            serde_json::json!(_arg4),
2582            serde_json::json!(_arg5),
2583            serde_json::json!(_arg6),
2584            serde_json::json!(_arg7),
2585            serde_json::json!(_arg8),
2586            serde_json::json!(_arg9),
2587        ];
2588        self.dispatch_json::<EchoResponse>("echo", &params).await
2589    }
2590
2591    /// Echo back the input argument, passing it through a spawned process in a multiprocess build.
2592    /// This command is for testing.
2593    async fn echoipc(&self, _arg: String) -> Result<EchoipcResponse, TransportError> {
2594        let params = vec![serde_json::json!(_arg)];
2595        self.dispatch_json::<EchoipcResponse>("echoipc", &params).await
2596    }
2597
2598    /// Simply echo back the input arguments. This command is for testing.
2599    ///
2600    /// It will return an internal bug report when arg9='trigger_internal_bug' is passed.
2601    ///
2602    /// The difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in bitcoin-cli and the GUI. There is no server-side difference.
2603    #[allow(clippy::too_many_arguments)]
2604    async fn echojson(
2605        &self,
2606        _arg0: Option<String>,
2607        _arg1: Option<String>,
2608        _arg2: Option<String>,
2609        _arg3: Option<String>,
2610        _arg4: Option<String>,
2611        _arg5: Option<String>,
2612        _arg6: Option<String>,
2613        _arg7: Option<String>,
2614        _arg8: Option<String>,
2615        _arg9: Option<String>,
2616    ) -> Result<EchojsonResponse, TransportError> {
2617        let params = vec![
2618            serde_json::json!(_arg0),
2619            serde_json::json!(_arg1),
2620            serde_json::json!(_arg2),
2621            serde_json::json!(_arg3),
2622            serde_json::json!(_arg4),
2623            serde_json::json!(_arg5),
2624            serde_json::json!(_arg6),
2625            serde_json::json!(_arg7),
2626            serde_json::json!(_arg8),
2627            serde_json::json!(_arg9),
2628        ];
2629        self.dispatch_json::<EchojsonResponse>("echojson", &params).await
2630    }
2631
2632    /// Encrypts the wallet with 'passphrase'. This is for first time encryption.
2633    /// After this, any calls that interact with private keys such as sending or signing
2634    /// will require the passphrase to be set prior to making these calls.
2635    /// Use the walletpassphrase call for this, and then walletlock call.
2636    /// If the wallet is already encrypted, use the walletpassphrasechange call.
2637    /// ** IMPORTANT **
2638    /// For security reasons, the encryption process will generate a new HD seed, resulting
2639    /// in the creation of a fresh set of active descriptors. Therefore, it is crucial to
2640    /// securely back up the newly generated wallet file using the backupwallet RPC.
2641    async fn encryptwallet(
2642        &self,
2643        _passphrase: String,
2644    ) -> Result<EncryptwalletResponse, TransportError> {
2645        let params = vec![serde_json::json!(_passphrase)];
2646        self.dispatch_json::<EncryptwalletResponse>("encryptwallet", &params).await
2647    }
2648
2649    /// Returns a list of external signers from -signer.
2650    async fn enumeratesigners(&self) -> Result<EnumeratesignersResponse, TransportError> {
2651        let params = vec![];
2652        self.dispatch_json::<EnumeratesignersResponse>("enumeratesigners", &params).await
2653    }
2654
2655    /// WARNING: This interface is unstable and may disappear or change!
2656    ///
2657    /// WARNING: This is an advanced API call that is tightly coupled to the specific
2658    /// implementation of fee estimation. The parameters it can be called with
2659    /// and the results it returns will change if the internal implementation changes.
2660    ///
2661    /// Estimates the approximate fee per kilobyte needed for a transaction to begin
2662    /// confirmation within conf_target blocks if possible. Uses virtual transaction size as
2663    /// defined in BIP 141 (witness data is discounted).
2664    async fn estimaterawfee(
2665        &self,
2666        _conf_target: u64,
2667        _threshold: Option<u64>,
2668    ) -> Result<EstimaterawfeeResponse, TransportError> {
2669        let params = vec![serde_json::json!(_conf_target), serde_json::json!(_threshold)];
2670        self.dispatch_json::<EstimaterawfeeResponse>("estimaterawfee", &params).await
2671    }
2672
2673    /// Estimates the approximate fee per kilobyte needed for a transaction to begin
2674    /// confirmation within conf_target blocks if possible and return the number of blocks
2675    /// for which the estimate is valid. Uses virtual transaction size as defined
2676    /// in BIP 141 (witness data is discounted).
2677    async fn estimatesmartfee(
2678        &self,
2679        _conf_target: u64,
2680        _estimate_mode: Option<String>,
2681    ) -> Result<EstimatesmartfeeResponse, TransportError> {
2682        let params = vec![serde_json::json!(_conf_target), serde_json::json!(_estimate_mode)];
2683        self.dispatch_json::<EstimatesmartfeeResponse>("estimatesmartfee", &params).await
2684    }
2685
2686    /// Finalize the inputs of a PSBT. If the transaction is fully signed, it will produce a
2687    /// network serialized transaction which can be broadcast with sendrawtransaction. Otherwise a PSBT will be
2688    /// created which has the final_scriptSig and final_scriptwitness fields filled for inputs that are complete.
2689    /// Implements the Finalizer and Extractor roles.
2690    async fn finalizepsbt(
2691        &self,
2692        _psbt: String,
2693        _extract: Option<bool>,
2694    ) -> Result<FinalizepsbtResponse, TransportError> {
2695        let params = vec![serde_json::json!(_psbt), serde_json::json!(_extract)];
2696        self.dispatch_json::<FinalizepsbtResponse>("finalizepsbt", &params).await
2697    }
2698
2699    /// If the transaction has no inputs, they will be automatically selected to meet its out value.
2700    /// It will add at most one change output to the outputs.
2701    /// No existing outputs will be modified unless "subtractFeeFromOutputs" is specified.
2702    /// Note that inputs which were signed may need to be resigned after completion since in/outputs have been added.
2703    /// The inputs added will not be signed, use signrawtransactionwithkey
2704    /// or signrawtransactionwithwallet for that.
2705    /// All existing inputs must either have their previous output transaction be in the wallet
2706    /// or be in the UTXO set. Solving data must be provided for non-wallet inputs.
2707    /// Note that all inputs selected must be of standard form and P2SH scripts must be
2708    /// in the wallet using importdescriptors (to calculate fees).
2709    /// You can see whether this is the case by checking the "solvable" field in the listunspent output.
2710    /// Note that if specifying an exact fee rate, the resulting transaction may have a higher fee rate
2711    /// if the transaction has unconfirmed inputs. This is because the wallet will attempt to make the
2712    /// entire package have the given fee rate, not the resulting transaction.
2713    async fn fundrawtransaction(
2714        &self,
2715        _hexstring: String,
2716        _options: Option<serde_json::Value>,
2717        _iswitness: Option<bool>,
2718    ) -> Result<FundrawtransactionResponse, TransportError> {
2719        let params = vec![
2720            serde_json::json!(_hexstring),
2721            serde_json::json!(_options),
2722            serde_json::json!(_iswitness),
2723        ];
2724        self.dispatch_json::<FundrawtransactionResponse>("fundrawtransaction", &params).await
2725    }
2726
2727    /// has been replaced by the -generate cli option. Refer to -help for more information.
2728    async fn generate(&self) -> Result<(), TransportError> {
2729        let params = vec![];
2730        self.dispatch_json::<()>("generate", &params).await
2731    }
2732
2733    /// Mine a set of ordered transactions to a specified address or descriptor and return the block hash.
2734    async fn generateblock(
2735        &self,
2736        _output: String,
2737        _transactions: Vec<serde_json::Value>,
2738        _submit: Option<bool>,
2739    ) -> Result<GenerateblockResponse, TransportError> {
2740        let params = vec![
2741            serde_json::json!(_output),
2742            serde_json::json!(_transactions),
2743            serde_json::json!(_submit),
2744        ];
2745        self.dispatch_json::<GenerateblockResponse>("generateblock", &params).await
2746    }
2747
2748    /// Mine to a specified address and return the block hashes.
2749    async fn generatetoaddress(
2750        &self,
2751        _nblocks: u64,
2752        _address: String,
2753        _maxtries: Option<u64>,
2754    ) -> Result<GeneratetoaddressResponse, TransportError> {
2755        let params = vec![
2756            serde_json::json!(_nblocks),
2757            serde_json::json!(_address),
2758            serde_json::json!(_maxtries),
2759        ];
2760        self.dispatch_json::<GeneratetoaddressResponse>("generatetoaddress", &params).await
2761    }
2762
2763    /// Mine to a specified descriptor and return the block hashes.
2764    async fn generatetodescriptor(
2765        &self,
2766        _num_blocks: u64,
2767        _descriptor: String,
2768        _maxtries: Option<u64>,
2769    ) -> Result<GeneratetodescriptorResponse, TransportError> {
2770        let params = vec![
2771            serde_json::json!(_num_blocks),
2772            serde_json::json!(_descriptor),
2773            serde_json::json!(_maxtries),
2774        ];
2775        self.dispatch_json::<GeneratetodescriptorResponse>("generatetodescriptor", &params).await
2776    }
2777
2778    /// Returns information about the given added node, or all added nodes
2779    /// (note that onetry addnodes are not listed here)
2780    async fn getaddednodeinfo(
2781        &self,
2782        _node: Option<String>,
2783    ) -> Result<GetaddednodeinfoResponse, TransportError> {
2784        let params = vec![serde_json::json!(_node)];
2785        self.dispatch_json::<GetaddednodeinfoResponse>("getaddednodeinfo", &params).await
2786    }
2787
2788    /// Returns the list of addresses assigned the specified label.
2789    async fn getaddressesbylabel(
2790        &self,
2791        _label: String,
2792    ) -> Result<GetaddressesbylabelResponse, TransportError> {
2793        let params = vec![serde_json::json!(_label)];
2794        self.dispatch_json::<GetaddressesbylabelResponse>("getaddressesbylabel", &params).await
2795    }
2796
2797    /// Return information about the given bitcoin address.
2798    /// Some of the information will only be present if the address is in the active wallet.
2799    async fn getaddressinfo(
2800        &self,
2801        _address: String,
2802    ) -> Result<GetaddressinfoResponse, TransportError> {
2803        let params = vec![serde_json::json!(_address)];
2804        self.dispatch_json::<GetaddressinfoResponse>("getaddressinfo", &params).await
2805    }
2806
2807    /// Provides information about the node's address manager by returning the number of addresses in the `new` and `tried` tables and their sum for all networks.
2808    async fn getaddrmaninfo(&self) -> Result<GetaddrmaninfoResponse, TransportError> {
2809        let params = vec![];
2810        self.dispatch_json::<GetaddrmaninfoResponse>("getaddrmaninfo", &params).await
2811    }
2812
2813    /// Returns the total available balance.
2814    /// The available balance is what the wallet considers currently spendable, and is
2815    /// thus affected by options which limit spendability such as -spendzeroconfchange.
2816    async fn getbalance(
2817        &self,
2818        _dummy: Option<String>,
2819        _minconf: Option<u32>,
2820        _include_watchonly: Option<bool>,
2821        _avoid_reuse: Option<bool>,
2822    ) -> Result<GetbalanceResponse, TransportError> {
2823        let params = vec![
2824            serde_json::json!(_dummy),
2825            serde_json::json!(_minconf),
2826            serde_json::json!(_include_watchonly),
2827            serde_json::json!(_avoid_reuse),
2828        ];
2829        self.dispatch_json::<GetbalanceResponse>("getbalance", &params).await
2830    }
2831
2832    /// Returns an object with all balances in BTC.
2833    async fn getbalances(&self) -> Result<GetbalancesResponse, TransportError> {
2834        let params = vec![];
2835        self.dispatch_json::<GetbalancesResponse>("getbalances", &params).await
2836    }
2837
2838    /// Returns the hash of the best (tip) block in the most-work fully-validated chain.
2839    async fn getbestblockhash(&self) -> Result<GetbestblockhashResponse, TransportError> {
2840        let params = vec![];
2841        self.dispatch_json::<GetbestblockhashResponse>("getbestblockhash", &params).await
2842    }
2843
2844    /// If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.
2845    /// If verbosity is 1, returns an Object with information about block <hash>.
2846    /// If verbosity is 2, returns an Object with information about block <hash> and information about each transaction.
2847    /// If verbosity is 3, returns an Object with information about block <hash> and information about each transaction, including prevout information for inputs (only for unpruned blocks in the current best chain).
2848    async fn getblock(
2849        &self,
2850        _blockhash: bitcoin::BlockHash,
2851        _verbosity: Option<u32>,
2852    ) -> Result<GetblockResponse, TransportError> {
2853        let params = vec![serde_json::json!(_blockhash), serde_json::json!(_verbosity)];
2854        self.dispatch_json::<GetblockResponse>("getblock", &params).await
2855    }
2856
2857    /// Returns an object containing various state info regarding blockchain processing.
2858    async fn getblockchaininfo(&self) -> Result<GetblockchaininfoResponse, TransportError> {
2859        let params = vec![];
2860        self.dispatch_json::<GetblockchaininfoResponse>("getblockchaininfo", &params).await
2861    }
2862
2863    /// Returns the height of the most-work fully-validated chain.
2864    /// The genesis block has height 0.
2865    async fn getblockcount(&self) -> Result<GetblockcountResponse, TransportError> {
2866        let params = vec![];
2867        self.dispatch_json::<GetblockcountResponse>("getblockcount", &params).await
2868    }
2869
2870    /// Retrieve a BIP 157 content filter for a particular block.
2871    async fn getblockfilter(
2872        &self,
2873        _blockhash: bitcoin::BlockHash,
2874        _filtertype: Option<String>,
2875    ) -> Result<GetblockfilterResponse, TransportError> {
2876        let params = vec![serde_json::json!(_blockhash), serde_json::json!(_filtertype)];
2877        self.dispatch_json::<GetblockfilterResponse>("getblockfilter", &params).await
2878    }
2879
2880    /// Attempt to fetch block from a given peer.
2881    ///
2882    /// We must have the header for this block, e.g. using submitheader.
2883    /// The block will not have any undo data which can limit the usage of the block data in a context where the undo data is needed.
2884    /// Subsequent calls for the same block may cause the response from the previous peer to be ignored.
2885    /// Peers generally ignore requests for a stale block that they never fully verified, or one that is more than a month old.
2886    /// When a peer does not respond with a block, we will disconnect.
2887    /// Note: The block could be re-pruned as soon as it is received.
2888    ///
2889    /// Returns an empty JSON object if the request was successfully scheduled.
2890    async fn getblockfrompeer(
2891        &self,
2892        _blockhash: bitcoin::BlockHash,
2893        _peer_id: u64,
2894    ) -> Result<GetblockfrompeerResponse, TransportError> {
2895        let params = vec![serde_json::json!(_blockhash), serde_json::json!(_peer_id)];
2896        self.dispatch_json::<GetblockfrompeerResponse>("getblockfrompeer", &params).await
2897    }
2898
2899    /// Returns hash of block in best-block-chain at height provided.
2900    async fn getblockhash(&self, _height: u64) -> Result<GetblockhashResponse, TransportError> {
2901        let params = vec![serde_json::json!(_height)];
2902        self.dispatch_json::<GetblockhashResponse>("getblockhash", &params).await
2903    }
2904
2905    /// If verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.
2906    /// If verbose is true, returns an Object with information about blockheader <hash>.
2907    async fn getblockheader(
2908        &self,
2909        _blockhash: bitcoin::BlockHash,
2910        _verbose: Option<bool>,
2911    ) -> Result<GetblockheaderResponse, TransportError> {
2912        let params = vec![serde_json::json!(_blockhash), serde_json::json!(_verbose)];
2913        self.dispatch_json::<GetblockheaderResponse>("getblockheader", &params).await
2914    }
2915
2916    /// Compute per block statistics for a given window. All amounts are in satoshis.
2917    /// It won't work for some heights with pruning.
2918    async fn getblockstats(
2919        &self,
2920        _hash_or_height: HashOrHeight,
2921        _stats: Option<Vec<String>>,
2922    ) -> Result<GetblockstatsResponse, TransportError> {
2923        let params = vec![serde_json::json!(_hash_or_height), serde_json::json!(_stats)];
2924        self.dispatch_json::<GetblockstatsResponse>("getblockstats", &params).await
2925    }
2926
2927    /// If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.
2928    /// It returns data needed to construct a block to work on.
2929    /// For full specification, see BIPs 22, 23, 9, and 145:
2930    /// https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki
2931    /// https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki
2932    /// https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes
2933    /// https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki
2934    async fn getblocktemplate(
2935        &self,
2936        _template_request: serde_json::Value,
2937    ) -> Result<(), TransportError> {
2938        let params = vec![serde_json::json!(_template_request)];
2939        self.dispatch_json::<()>("getblocktemplate", &params).await
2940    }
2941
2942    /// Return information about chainstates.
2943    async fn getchainstates(&self) -> Result<GetchainstatesResponse, TransportError> {
2944        let params = vec![];
2945        self.dispatch_json::<GetchainstatesResponse>("getchainstates", &params).await
2946    }
2947
2948    /// Return information about all known tips in the block tree, including the main chain as well as orphaned branches.
2949    async fn getchaintips(&self) -> Result<GetchaintipsResponse, TransportError> {
2950        let params = vec![];
2951        self.dispatch_json::<GetchaintipsResponse>("getchaintips", &params).await
2952    }
2953
2954    /// Compute statistics about the total number and rate of transactions in the chain.
2955    async fn getchaintxstats(
2956        &self,
2957        _nblocks: Option<u64>,
2958        _blockhash: Option<bitcoin::BlockHash>,
2959    ) -> Result<GetchaintxstatsResponse, TransportError> {
2960        let params = vec![serde_json::json!(_nblocks), serde_json::json!(_blockhash)];
2961        self.dispatch_json::<GetchaintxstatsResponse>("getchaintxstats", &params).await
2962    }
2963
2964    /// Returns the number of connections to other nodes.
2965    async fn getconnectioncount(&self) -> Result<GetconnectioncountResponse, TransportError> {
2966        let params = vec![];
2967        self.dispatch_json::<GetconnectioncountResponse>("getconnectioncount", &params).await
2968    }
2969
2970    /// Returns an object containing various state info regarding deployments of consensus changes.
2971    async fn getdeploymentinfo(
2972        &self,
2973        _blockhash: Option<bitcoin::BlockHash>,
2974    ) -> Result<GetdeploymentinfoResponse, TransportError> {
2975        let params = vec![serde_json::json!(_blockhash)];
2976        self.dispatch_json::<GetdeploymentinfoResponse>("getdeploymentinfo", &params).await
2977    }
2978
2979    /// Get spend and receive activity associated with a set of descriptors for a set of blocks. This command pairs well with the `relevant_blocks` output of `scanblocks()`.
2980    /// This call may take several minutes. If you encounter timeouts, try specifying no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
2981    async fn getdescriptoractivity(
2982        &self,
2983        _blockhashes: Vec<serde_json::Value>,
2984        _scanobjects: Vec<serde_json::Value>,
2985        _include_mempool: Option<bool>,
2986    ) -> Result<GetdescriptoractivityResponse, TransportError> {
2987        let params = vec![
2988            serde_json::json!(_blockhashes),
2989            serde_json::json!(_scanobjects),
2990            serde_json::json!(_include_mempool),
2991        ];
2992        self.dispatch_json::<GetdescriptoractivityResponse>("getdescriptoractivity", &params).await
2993    }
2994
2995    /// Analyses a descriptor.
2996    async fn getdescriptorinfo(
2997        &self,
2998        _descriptor: String,
2999    ) -> Result<GetdescriptorinfoResponse, TransportError> {
3000        let params = vec![serde_json::json!(_descriptor)];
3001        self.dispatch_json::<GetdescriptorinfoResponse>("getdescriptorinfo", &params).await
3002    }
3003
3004    /// Returns the proof-of-work difficulty as a multiple of the minimum difficulty.
3005    async fn getdifficulty(&self) -> Result<GetdifficultyResponse, TransportError> {
3006        let params = vec![];
3007        self.dispatch_json::<GetdifficultyResponse>("getdifficulty", &params).await
3008    }
3009
3010    /// List all BIP 32 HD keys in the wallet and which descriptors use them.
3011    async fn gethdkeys(
3012        &self,
3013        _options: Option<serde_json::Value>,
3014    ) -> Result<GethdkeysResponse, TransportError> {
3015        let params = vec![serde_json::json!(_options)];
3016        self.dispatch_json::<GethdkeysResponse>("gethdkeys", &params).await
3017    }
3018
3019    /// Returns the status of one or all available indices currently running in the node.
3020    async fn getindexinfo(
3021        &self,
3022        _index_name: Option<String>,
3023    ) -> Result<GetindexinfoResponse, TransportError> {
3024        let params = vec![serde_json::json!(_index_name)];
3025        self.dispatch_json::<GetindexinfoResponse>("getindexinfo", &params).await
3026    }
3027
3028    /// Returns an object containing information about memory usage.
3029    async fn getmemoryinfo(
3030        &self,
3031        _mode: Option<String>,
3032    ) -> Result<GetmemoryinfoResponse, TransportError> {
3033        let params = vec![serde_json::json!(_mode)];
3034        self.dispatch_json::<GetmemoryinfoResponse>("getmemoryinfo", &params).await
3035    }
3036
3037    /// If txid is in the mempool, returns all in-mempool ancestors.
3038    async fn getmempoolancestors(
3039        &self,
3040        _txid: bitcoin::Txid,
3041        _verbose: Option<bool>,
3042    ) -> Result<GetmempoolancestorsResponse, TransportError> {
3043        let params = vec![serde_json::json!(_txid), serde_json::json!(_verbose)];
3044        self.dispatch_json::<GetmempoolancestorsResponse>("getmempoolancestors", &params).await
3045    }
3046
3047    /// If txid is in the mempool, returns all in-mempool descendants.
3048    async fn getmempooldescendants(
3049        &self,
3050        _txid: bitcoin::Txid,
3051        _verbose: Option<bool>,
3052    ) -> Result<GetmempooldescendantsResponse, TransportError> {
3053        let params = vec![serde_json::json!(_txid), serde_json::json!(_verbose)];
3054        self.dispatch_json::<GetmempooldescendantsResponse>("getmempooldescendants", &params).await
3055    }
3056
3057    /// Returns mempool data for given transaction
3058    async fn getmempoolentry(
3059        &self,
3060        _txid: bitcoin::Txid,
3061    ) -> Result<GetmempoolentryResponse, TransportError> {
3062        let params = vec![serde_json::json!(_txid)];
3063        self.dispatch_json::<GetmempoolentryResponse>("getmempoolentry", &params).await
3064    }
3065
3066    /// Returns details on the active state of the TX memory pool.
3067    async fn getmempoolinfo(&self) -> Result<GetmempoolinfoResponse, TransportError> {
3068        let params = vec![];
3069        self.dispatch_json::<GetmempoolinfoResponse>("getmempoolinfo", &params).await
3070    }
3071
3072    /// Returns a json object containing mining-related information.
3073    async fn getmininginfo(&self) -> Result<GetmininginfoResponse, TransportError> {
3074        let params = vec![];
3075        self.dispatch_json::<GetmininginfoResponse>("getmininginfo", &params).await
3076    }
3077
3078    /// Returns information about network traffic, including bytes in, bytes out,
3079    /// and current system time.
3080    async fn getnettotals(&self) -> Result<GetnettotalsResponse, TransportError> {
3081        let params = vec![];
3082        self.dispatch_json::<GetnettotalsResponse>("getnettotals", &params).await
3083    }
3084
3085    /// Returns the estimated network hashes per second based on the last n blocks.
3086    /// Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.
3087    /// Pass in [height] to estimate the network speed at the time when a certain block was found.
3088    async fn getnetworkhashps(
3089        &self,
3090        _nblocks: Option<u64>,
3091        _height: Option<u64>,
3092    ) -> Result<GetnetworkhashpsResponse, TransportError> {
3093        let params = vec![serde_json::json!(_nblocks), serde_json::json!(_height)];
3094        self.dispatch_json::<GetnetworkhashpsResponse>("getnetworkhashps", &params).await
3095    }
3096
3097    /// Returns an object containing various state info regarding P2P networking.
3098    async fn getnetworkinfo(&self) -> Result<GetnetworkinfoResponse, TransportError> {
3099        let params = vec![];
3100        self.dispatch_json::<GetnetworkinfoResponse>("getnetworkinfo", &params).await
3101    }
3102
3103    /// Returns a new Bitcoin address for receiving payments.
3104    /// If 'label' is specified, it is added to the address book
3105    /// so payments received with the address will be associated with 'label'.
3106    async fn getnewaddress(
3107        &self,
3108        _label: Option<String>,
3109        _address_type: Option<String>,
3110    ) -> Result<GetnewaddressResponse, TransportError> {
3111        let params = vec![serde_json::json!(_label), serde_json::json!(_address_type)];
3112        self.dispatch_json::<GetnewaddressResponse>("getnewaddress", &params).await
3113    }
3114
3115    /// Return known addresses, after filtering for quality and recency.
3116    /// These can potentially be used to find new peers in the network.
3117    /// The total number of addresses known to the node may be higher.
3118    async fn getnodeaddresses(
3119        &self,
3120        _count: Option<u64>,
3121        _network: Option<String>,
3122    ) -> Result<GetnodeaddressesResponse, TransportError> {
3123        let params = vec![serde_json::json!(_count), serde_json::json!(_network)];
3124        self.dispatch_json::<GetnodeaddressesResponse>("getnodeaddresses", &params).await
3125    }
3126
3127    /// Shows transactions in the tx orphanage.
3128    ///
3129    /// EXPERIMENTAL warning: this call may be changed in future releases.
3130    async fn getorphantxs(
3131        &self,
3132        _verbosity: Option<u32>,
3133    ) -> Result<GetorphantxsResponse, TransportError> {
3134        let params = vec![serde_json::json!(_verbosity)];
3135        self.dispatch_json::<GetorphantxsResponse>("getorphantxs", &params).await
3136    }
3137
3138    /// Returns data about each connected network peer as a json array of objects.
3139    async fn getpeerinfo(&self) -> Result<GetpeerinfoResponse, TransportError> {
3140        let params = vec![];
3141        self.dispatch_json::<GetpeerinfoResponse>("getpeerinfo", &params).await
3142    }
3143
3144    /// Returns a map of all user-created (see prioritisetransaction) fee deltas by txid, and whether the tx is present in mempool.
3145    async fn getprioritisedtransactions(
3146        &self,
3147    ) -> Result<GetprioritisedtransactionsResponse, TransportError> {
3148        let params = vec![];
3149        self.dispatch_json::<GetprioritisedtransactionsResponse>(
3150            "getprioritisedtransactions",
3151            &params,
3152        )
3153        .await
3154    }
3155
3156    /// EXPERIMENTAL warning: this call may be changed in future releases.
3157    ///
3158    /// Returns information on all address manager entries for the new and tried tables.
3159    async fn getrawaddrman(&self) -> Result<GetrawaddrmanResponse, TransportError> {
3160        let params = vec![];
3161        self.dispatch_json::<GetrawaddrmanResponse>("getrawaddrman", &params).await
3162    }
3163
3164    /// Returns a new Bitcoin address, for receiving change.
3165    /// This is for use with raw transactions, NOT normal use.
3166    async fn getrawchangeaddress(
3167        &self,
3168        _address_type: Option<String>,
3169    ) -> Result<GetrawchangeaddressResponse, TransportError> {
3170        let params = vec![serde_json::json!(_address_type)];
3171        self.dispatch_json::<GetrawchangeaddressResponse>("getrawchangeaddress", &params).await
3172    }
3173
3174    /// Returns all transaction ids in memory pool as a json array of string transaction ids.
3175    ///
3176    /// Hint: use getmempoolentry to fetch a specific transaction from the mempool.
3177    async fn getrawmempool(
3178        &self,
3179        _verbose: Option<bool>,
3180        _mempool_sequence: Option<bool>,
3181    ) -> Result<GetrawmempoolResponse, TransportError> {
3182        let params = vec![serde_json::json!(_verbose), serde_json::json!(_mempool_sequence)];
3183        self.dispatch_json::<GetrawmempoolResponse>("getrawmempool", &params).await
3184    }
3185
3186    /// By default, this call only returns a transaction if it is in the mempool. If -txindex is enabled
3187    /// and no blockhash argument is passed, it will return the transaction if it is in the mempool or any block.
3188    /// If a blockhash argument is passed, it will return the transaction if
3189    /// the specified block is available and the transaction is in that block.
3190    ///
3191    /// Hint: Use gettransaction for wallet transactions.
3192    ///
3193    /// If verbosity is 0 or omitted, returns the serialized transaction as a hex-encoded string.
3194    /// If verbosity is 1, returns a JSON Object with information about the transaction.
3195    /// If verbosity is 2, returns a JSON Object with information about the transaction, including fee and prevout information.
3196    async fn getrawtransaction(
3197        &self,
3198        _txid: bitcoin::Txid,
3199        _verbosity: Option<u32>,
3200        _blockhash: Option<bitcoin::BlockHash>,
3201    ) -> Result<GetrawtransactionResponse, TransportError> {
3202        let params = vec![
3203            serde_json::json!(_txid),
3204            serde_json::json!(_verbosity),
3205            serde_json::json!(_blockhash),
3206        ];
3207        self.dispatch_json::<GetrawtransactionResponse>("getrawtransaction", &params).await
3208    }
3209
3210    /// Returns the total amount received by the given address in transactions with at least minconf confirmations.
3211    async fn getreceivedbyaddress(
3212        &self,
3213        _address: String,
3214        _minconf: Option<u32>,
3215        _include_immature_coinbase: Option<bool>,
3216    ) -> Result<GetreceivedbyaddressResponse, TransportError> {
3217        let params = vec![
3218            serde_json::json!(_address),
3219            serde_json::json!(_minconf),
3220            serde_json::json!(_include_immature_coinbase),
3221        ];
3222        self.dispatch_json::<GetreceivedbyaddressResponse>("getreceivedbyaddress", &params).await
3223    }
3224
3225    /// Returns the total amount received by addresses with <label> in transactions with at least [minconf] confirmations.
3226    async fn getreceivedbylabel(
3227        &self,
3228        _label: String,
3229        _minconf: Option<u32>,
3230        _include_immature_coinbase: Option<bool>,
3231    ) -> Result<GetreceivedbylabelResponse, TransportError> {
3232        let params = vec![
3233            serde_json::json!(_label),
3234            serde_json::json!(_minconf),
3235            serde_json::json!(_include_immature_coinbase),
3236        ];
3237        self.dispatch_json::<GetreceivedbylabelResponse>("getreceivedbylabel", &params).await
3238    }
3239
3240    /// Returns details of the RPC server.
3241    async fn getrpcinfo(&self) -> Result<GetrpcinfoResponse, TransportError> {
3242        let params = vec![];
3243        self.dispatch_json::<GetrpcinfoResponse>("getrpcinfo", &params).await
3244    }
3245
3246    /// Get detailed information about in-wallet transaction <txid>
3247    async fn gettransaction(
3248        &self,
3249        _txid: bitcoin::Txid,
3250        _include_watchonly: Option<bool>,
3251        _verbose: Option<bool>,
3252    ) -> Result<GettransactionResponse, TransportError> {
3253        let params = vec![
3254            serde_json::json!(_txid),
3255            serde_json::json!(_include_watchonly),
3256            serde_json::json!(_verbose),
3257        ];
3258        self.dispatch_json::<GettransactionResponse>("gettransaction", &params).await
3259    }
3260
3261    /// Returns details about an unspent transaction output.
3262    async fn gettxout(
3263        &self,
3264        _txid: bitcoin::Txid,
3265        _n: u32,
3266        _include_mempool: Option<bool>,
3267    ) -> Result<(), TransportError> {
3268        let params = vec![
3269            serde_json::json!(_txid),
3270            serde_json::json!(_n),
3271            serde_json::json!(_include_mempool),
3272        ];
3273        self.dispatch_json::<()>("gettxout", &params).await
3274    }
3275
3276    /// Returns a hex-encoded proof that "txid" was included in a block.
3277    ///
3278    /// NOTE: By default this function only works sometimes. This is when there is an
3279    /// unspent output in the utxo for this transaction. To make it always work,
3280    /// you need to maintain a transaction index, using the -txindex command line option or
3281    /// specify the block in which the transaction is included manually (by blockhash).
3282    async fn gettxoutproof(
3283        &self,
3284        _txids: Vec<bitcoin::Txid>,
3285        _blockhash: Option<bitcoin::BlockHash>,
3286    ) -> Result<GettxoutproofResponse, TransportError> {
3287        let params = vec![serde_json::json!(_txids), serde_json::json!(_blockhash)];
3288        self.dispatch_json::<GettxoutproofResponse>("gettxoutproof", &params).await
3289    }
3290
3291    /// Returns statistics about the unspent transaction output set.
3292    /// Note this call may take some time if you are not using coinstatsindex.
3293    async fn gettxoutsetinfo(
3294        &self,
3295        _hash_type: Option<String>,
3296        _hash_or_height: Option<HashOrHeight>,
3297        _use_index: Option<bool>,
3298    ) -> Result<GettxoutsetinfoResponse, TransportError> {
3299        let params = vec![
3300            serde_json::json!(_hash_type),
3301            serde_json::json!(_hash_or_height),
3302            serde_json::json!(_use_index),
3303        ];
3304        self.dispatch_json::<GettxoutsetinfoResponse>("gettxoutsetinfo", &params).await
3305    }
3306
3307    /// Scans the mempool to find transactions spending any of the given outputs
3308    async fn gettxspendingprevout(
3309        &self,
3310        _outputs: Vec<serde_json::Value>,
3311    ) -> Result<GettxspendingprevoutResponse, TransportError> {
3312        let params = vec![serde_json::json!(_outputs)];
3313        self.dispatch_json::<GettxspendingprevoutResponse>("gettxspendingprevout", &params).await
3314    }
3315
3316    /// Returns an object containing various wallet state info.
3317    async fn getwalletinfo(&self) -> Result<GetwalletinfoResponse, TransportError> {
3318        let params = vec![];
3319        self.dispatch_json::<GetwalletinfoResponse>("getwalletinfo", &params).await
3320    }
3321
3322    /// Returns information about the active ZeroMQ notifications.
3323    async fn getzmqnotifications(&self) -> Result<GetzmqnotificationsResponse, TransportError> {
3324        let params = vec![];
3325        self.dispatch_json::<GetzmqnotificationsResponse>("getzmqnotifications", &params).await
3326    }
3327
3328    /// List all commands, or get help for a specified command.
3329    async fn help(&self, _command: Option<String>) -> Result<HelpResponse, TransportError> {
3330        let params = vec![serde_json::json!(_command)];
3331        self.dispatch_json::<HelpResponse>("help", &params).await
3332    }
3333
3334    /// Import descriptors. This will trigger a rescan of the blockchain based on the earliest timestamp of all descriptors being imported. Requires a new wallet backup.
3335    /// When importing descriptors with multipath key expressions, if the multipath specifier contains exactly two elements, the descriptor produced from the second element will be imported as an internal descriptor.
3336    ///
3337    /// Note: This call can take over an hour to complete if using an early timestamp; during that time, other rpc calls
3338    /// may report that the imported keys, addresses or scripts exist but related transactions are still missing.
3339    /// The rescan is significantly faster if block filters are available (using startup option "-blockfilterindex=1").
3340    async fn importdescriptors(
3341        &self,
3342        _requests: Vec<serde_json::Value>,
3343    ) -> Result<ImportdescriptorsResponse, TransportError> {
3344        let params = vec![serde_json::json!(_requests)];
3345        self.dispatch_json::<ImportdescriptorsResponse>("importdescriptors", &params).await
3346    }
3347
3348    /// Import a mempool.dat file and attempt to add its contents to the mempool.
3349    /// Warning: Importing untrusted files is dangerous, especially if metadata from the file is taken over.
3350    async fn importmempool(
3351        &self,
3352        _filepath: String,
3353        _options: Option<serde_json::Value>,
3354    ) -> Result<ImportmempoolResponse, TransportError> {
3355        let params = vec![serde_json::json!(_filepath), serde_json::json!(_options)];
3356        self.dispatch_json::<ImportmempoolResponse>("importmempool", &params).await
3357    }
3358
3359    /// Imports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.
3360    async fn importprunedfunds(
3361        &self,
3362        _rawtransaction: String,
3363        _txoutproof: String,
3364    ) -> Result<(), TransportError> {
3365        let params = vec![serde_json::json!(_rawtransaction), serde_json::json!(_txoutproof)];
3366        self.dispatch_json::<()>("importprunedfunds", &params).await
3367    }
3368
3369    /// Permanently marks a block as invalid, as if it violated a consensus rule.
3370    async fn invalidateblock(&self, _blockhash: bitcoin::BlockHash) -> Result<(), TransportError> {
3371        let params = vec![serde_json::json!(_blockhash)];
3372        self.dispatch_json::<()>("invalidateblock", &params).await
3373    }
3374
3375    /// Joins multiple distinct PSBTs with different inputs and outputs into one PSBT with inputs and outputs from all of the PSBTs
3376    /// No input in any of the PSBTs can be in more than one of the PSBTs.
3377    async fn joinpsbts(
3378        &self,
3379        _txs: Vec<serde_json::Value>,
3380    ) -> Result<JoinpsbtsResponse, TransportError> {
3381        let params = vec![serde_json::json!(_txs)];
3382        self.dispatch_json::<JoinpsbtsResponse>("joinpsbts", &params).await
3383    }
3384
3385    /// Refills each descriptor keypool in the wallet up to the specified number of new keys.
3386    /// By default, descriptor wallets have 4 active ranged descriptors ("legacy", "p2sh-segwit", "bech32", "bech32m"), each with 1000 entries.
3387    ///
3388    /// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
3389    async fn keypoolrefill(&self, _newsize: Option<u64>) -> Result<(), TransportError> {
3390        let params = vec![serde_json::json!(_newsize)];
3391        self.dispatch_json::<()>("keypoolrefill", &params).await
3392    }
3393
3394    /// Lists groups of addresses which have had their common ownership
3395    /// made public by common use as inputs or as the resulting change
3396    /// in past transactions
3397    async fn listaddressgroupings(&self) -> Result<ListaddressgroupingsResponse, TransportError> {
3398        let params = vec![];
3399        self.dispatch_json::<ListaddressgroupingsResponse>("listaddressgroupings", &params).await
3400    }
3401
3402    /// List all manually banned IPs/Subnets.
3403    async fn listbanned(&self) -> Result<ListbannedResponse, TransportError> {
3404        let params = vec![];
3405        self.dispatch_json::<ListbannedResponse>("listbanned", &params).await
3406    }
3407
3408    /// List all descriptors present in a wallet.
3409    async fn listdescriptors(
3410        &self,
3411        _private: Option<bool>,
3412    ) -> Result<ListdescriptorsResponse, TransportError> {
3413        let params = vec![serde_json::json!(_private)];
3414        self.dispatch_json::<ListdescriptorsResponse>("listdescriptors", &params).await
3415    }
3416
3417    /// Returns the list of all labels, or labels that are assigned to addresses with a specific purpose.
3418    async fn listlabels(
3419        &self,
3420        _purpose: Option<String>,
3421    ) -> Result<ListlabelsResponse, TransportError> {
3422        let params = vec![serde_json::json!(_purpose)];
3423        self.dispatch_json::<ListlabelsResponse>("listlabels", &params).await
3424    }
3425
3426    /// Returns list of temporarily unspendable outputs.
3427    /// See the lockunspent call to lock and unlock transactions for spending.
3428    async fn listlockunspent(&self) -> Result<ListlockunspentResponse, TransportError> {
3429        let params = vec![];
3430        self.dispatch_json::<ListlockunspentResponse>("listlockunspent", &params).await
3431    }
3432
3433    /// List balances by receiving address.
3434    async fn listreceivedbyaddress(
3435        &self,
3436        _minconf: Option<u32>,
3437        _include_empty: Option<bool>,
3438        _include_watchonly: Option<bool>,
3439        _address_filter: Option<String>,
3440        _include_immature_coinbase: Option<bool>,
3441    ) -> Result<ListreceivedbyaddressResponse, TransportError> {
3442        let params = vec![
3443            serde_json::json!(_minconf),
3444            serde_json::json!(_include_empty),
3445            serde_json::json!(_include_watchonly),
3446            serde_json::json!(_address_filter),
3447            serde_json::json!(_include_immature_coinbase),
3448        ];
3449        self.dispatch_json::<ListreceivedbyaddressResponse>("listreceivedbyaddress", &params).await
3450    }
3451
3452    /// List received transactions by label.
3453    async fn listreceivedbylabel(
3454        &self,
3455        _minconf: Option<u32>,
3456        _include_empty: Option<bool>,
3457        _include_watchonly: Option<bool>,
3458        _include_immature_coinbase: Option<bool>,
3459    ) -> Result<ListreceivedbylabelResponse, TransportError> {
3460        let params = vec![
3461            serde_json::json!(_minconf),
3462            serde_json::json!(_include_empty),
3463            serde_json::json!(_include_watchonly),
3464            serde_json::json!(_include_immature_coinbase),
3465        ];
3466        self.dispatch_json::<ListreceivedbylabelResponse>("listreceivedbylabel", &params).await
3467    }
3468
3469    /// Get all transactions in blocks since block [blockhash], or all transactions if omitted.
3470    /// If "blockhash" is no longer a part of the main chain, transactions from the fork point onward are included.
3471    /// Additionally, if include_removed is set, transactions affecting the wallet which were removed are returned in the "removed" array.
3472    async fn listsinceblock(
3473        &self,
3474        _blockhash: Option<bitcoin::BlockHash>,
3475        _target_confirmations: Option<u64>,
3476        _include_watchonly: Option<bool>,
3477        _include_removed: Option<bool>,
3478        _include_change: Option<bool>,
3479        _label: Option<String>,
3480    ) -> Result<ListsinceblockResponse, TransportError> {
3481        let params = vec![
3482            serde_json::json!(_blockhash),
3483            serde_json::json!(_target_confirmations),
3484            serde_json::json!(_include_watchonly),
3485            serde_json::json!(_include_removed),
3486            serde_json::json!(_include_change),
3487            serde_json::json!(_label),
3488        ];
3489        self.dispatch_json::<ListsinceblockResponse>("listsinceblock", &params).await
3490    }
3491
3492    /// If a label name is provided, this will return only incoming transactions paying to addresses with the specified label.
3493    ///
3494    /// Returns up to 'count' most recent transactions skipping the first 'from' transactions.
3495    async fn listtransactions(
3496        &self,
3497        _label: Option<String>,
3498        _count: Option<u64>,
3499        _skip: Option<u64>,
3500        _include_watchonly: Option<bool>,
3501    ) -> Result<ListtransactionsResponse, TransportError> {
3502        let params = vec![
3503            serde_json::json!(_label),
3504            serde_json::json!(_count),
3505            serde_json::json!(_skip),
3506            serde_json::json!(_include_watchonly),
3507        ];
3508        self.dispatch_json::<ListtransactionsResponse>("listtransactions", &params).await
3509    }
3510
3511    /// Returns array of unspent transaction outputs
3512    /// with between minconf and maxconf (inclusive) confirmations.
3513    /// Optionally filter to only include txouts paid to specified addresses.
3514    async fn listunspent(
3515        &self,
3516        _minconf: Option<u32>,
3517        _maxconf: Option<u32>,
3518        _addresses: Option<Vec<String>>,
3519        _include_unsafe: Option<bool>,
3520        _query_options: Option<serde_json::Value>,
3521    ) -> Result<ListunspentResponse, TransportError> {
3522        let params = vec![
3523            serde_json::json!(_minconf),
3524            serde_json::json!(_maxconf),
3525            serde_json::json!(_addresses),
3526            serde_json::json!(_include_unsafe),
3527            serde_json::json!(_query_options),
3528        ];
3529        self.dispatch_json::<ListunspentResponse>("listunspent", &params).await
3530    }
3531
3532    /// Returns a list of wallets in the wallet directory.
3533    async fn listwalletdir(&self) -> Result<ListwalletdirResponse, TransportError> {
3534        let params = vec![];
3535        self.dispatch_json::<ListwalletdirResponse>("listwalletdir", &params).await
3536    }
3537
3538    /// Returns a list of currently loaded wallets.
3539    /// For full information on the wallet, use "getwalletinfo"
3540    async fn listwallets(&self) -> Result<ListwalletsResponse, TransportError> {
3541        let params = vec![];
3542        self.dispatch_json::<ListwalletsResponse>("listwallets", &params).await
3543    }
3544
3545    /// Load the serialized UTXO set from a file.
3546    /// Once this snapshot is loaded, its contents will be deserialized into a second chainstate data structure, which is then used to sync to the network's tip. Meanwhile, the original chainstate will complete the initial block download process in the background, eventually validating up to the block that the snapshot is based upon.
3547    ///
3548    /// The result is a usable bitcoind instance that is current with the network tip in a matter of minutes rather than hours. UTXO snapshot are typically obtained from third-party sources (HTTP, torrent, etc.) which is reasonable since their contents are always checked by hash.
3549    ///
3550    /// You can find more information on this process in the `assumeutxo` design document (<https://github.com/bitcoin/bitcoin/blob/master/doc/design/assumeutxo.md>).
3551    async fn loadtxoutset(&self, _path: String) -> Result<LoadtxoutsetResponse, TransportError> {
3552        let params = vec![serde_json::json!(_path)];
3553        self.dispatch_json::<LoadtxoutsetResponse>("loadtxoutset", &params).await
3554    }
3555
3556    /// Loads a wallet from a wallet file or directory.
3557    /// Note that all wallet command-line options used when starting bitcoind will be
3558    /// applied to the new wallet.
3559    async fn loadwallet(
3560        &self,
3561        _filename: String,
3562        _load_on_startup: Option<bool>,
3563    ) -> Result<LoadwalletResponse, TransportError> {
3564        let params = vec![serde_json::json!(_filename), serde_json::json!(_load_on_startup)];
3565        self.dispatch_json::<LoadwalletResponse>("loadwallet", &params).await
3566    }
3567
3568    /// Updates list of temporarily unspendable outputs.
3569    /// Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs.
3570    /// If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked.
3571    /// A locked transaction output will not be chosen by automatic coin selection, when spending bitcoins.
3572    /// Manually selected coins are automatically unlocked.
3573    /// Locks are stored in memory only, unless persistent=true, in which case they will be written to the
3574    /// wallet database and loaded on node start. Unwritten (persistent=false) locks are always cleared
3575    /// (by virtue of process exit) when a node stops or fails. Unlocking will clear both persistent and not.
3576    /// Also see the listunspent call
3577    async fn lockunspent(
3578        &self,
3579        _unlock: bool,
3580        _transactions: Option<Vec<serde_json::Value>>,
3581        _persistent: Option<bool>,
3582    ) -> Result<LockunspentResponse, TransportError> {
3583        let params = vec![
3584            serde_json::json!(_unlock),
3585            serde_json::json!(_transactions),
3586            serde_json::json!(_persistent),
3587        ];
3588        self.dispatch_json::<LockunspentResponse>("lockunspent", &params).await
3589    }
3590
3591    /// Gets and sets the logging configuration.
3592    /// When called without an argument, returns the list of categories with status that are currently being debug logged or not.
3593    /// When called with arguments, adds or removes categories from debug logging and return the lists above.
3594    /// The arguments are evaluated in order "include", "exclude".
3595    /// If an item is both included and excluded, it will thus end up being excluded.
3596    /// The valid logging categories are: addrman, bench, blockstorage, cmpctblock, coindb, estimatefee, http, i2p, ipc, leveldb, libevent, mempool, mempoolrej, net, proxy, prune, qt, rand, reindex, rpc, scan, selectcoins, tor, txpackages, txreconciliation, validation, walletdb, zmq
3597    /// In addition, the following are available as category names with special meanings:
3598    /// - "all",  "1" : represent all logging categories.
3599    async fn logging(
3600        &self,
3601        _include: Option<Vec<serde_json::Value>>,
3602        _exclude: Option<Vec<serde_json::Value>>,
3603    ) -> Result<LoggingResponse, TransportError> {
3604        let params = vec![serde_json::json!(_include), serde_json::json!(_exclude)];
3605        self.dispatch_json::<LoggingResponse>("logging", &params).await
3606    }
3607
3608    /// Migrate the wallet to a descriptor wallet.
3609    /// A new wallet backup will need to be made.
3610    ///
3611    /// The migration process will create a backup of the wallet before migrating. This backup
3612    /// file will be named <wallet name>-<timestamp>.legacy.bak and can be found in the directory
3613    /// for this wallet. In the event of an incorrect migration, the backup can be restored using restorewallet.
3614    /// Encrypted wallets must have the passphrase provided as an argument to this call.
3615    ///
3616    /// This RPC may take a long time to complete. Increasing the RPC client timeout is recommended.
3617    async fn migratewallet(
3618        &self,
3619        _wallet_name: Option<String>,
3620        _passphrase: Option<String>,
3621    ) -> Result<MigratewalletResponse, TransportError> {
3622        let params = vec![serde_json::json!(_wallet_name), serde_json::json!(_passphrase)];
3623        self.dispatch_json::<MigratewalletResponse>("migratewallet", &params).await
3624    }
3625
3626    /// Bump the scheduler into the future (-regtest only)
3627    async fn mockscheduler(&self, _delta_time: u64) -> Result<(), TransportError> {
3628        let params = vec![serde_json::json!(_delta_time)];
3629        self.dispatch_json::<()>("mockscheduler", &params).await
3630    }
3631
3632    /// Requests that a ping be sent to all other nodes, to measure ping time.
3633    /// Results are provided in getpeerinfo.
3634    /// Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.
3635    async fn ping(&self) -> Result<(), TransportError> {
3636        let params = vec![];
3637        self.dispatch_json::<()>("ping", &params).await
3638    }
3639
3640    /// Treats a block as if it were received before others with the same work.
3641    ///
3642    /// A later preciousblock call can override the effect of an earlier one.
3643    ///
3644    /// The effects of preciousblock are not retained across restarts.
3645    async fn preciousblock(&self, _blockhash: bitcoin::BlockHash) -> Result<(), TransportError> {
3646        let params = vec![serde_json::json!(_blockhash)];
3647        self.dispatch_json::<()>("preciousblock", &params).await
3648    }
3649
3650    /// Accepts the transaction into mined blocks at a higher (or lower) priority
3651    async fn prioritisetransaction(
3652        &self,
3653        params: PrioritisetransactionParams,
3654    ) -> Result<PrioritisetransactionResponse, TransportError> {
3655        let params = vec![serde_json::json!(params)];
3656        self.dispatch_json::<PrioritisetransactionResponse>("prioritisetransaction", &params).await
3657    }
3658
3659    /// Attempts to delete block and undo data up to a specified height or timestamp, if eligible for pruning.
3660    /// Requires `-prune` to be enabled at startup. While pruned data may be re-fetched in some cases (e.g., via `getblockfrompeer`), local deletion is irreversible.
3661    async fn pruneblockchain(
3662        &self,
3663        _height: u64,
3664    ) -> Result<PruneblockchainResponse, TransportError> {
3665        let params = vec![serde_json::json!(_height)];
3666        self.dispatch_json::<PruneblockchainResponse>("pruneblockchain", &params).await
3667    }
3668
3669    /// Bumps the fee of a transaction T, replacing it with a new transaction B.
3670    /// Returns a PSBT instead of creating and signing a new transaction.
3671    /// A transaction with the given txid must be in the wallet.
3672    /// The command will pay the additional fee by reducing change outputs or adding inputs when necessary.
3673    /// It may add a new change output if one does not already exist.
3674    /// All inputs in the original transaction will be included in the replacement transaction.
3675    /// The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs.
3676    /// By default, the new fee will be calculated automatically using the estimatesmartfee RPC.
3677    /// The user can specify a confirmation target for estimatesmartfee.
3678    /// Alternatively, the user can specify a fee rate in sat/vB for the new transaction.
3679    /// At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee
3680    /// returned by getnetworkinfo) to enter the node's mempool.
3681    /// * WARNING: before version 0.21, fee_rate was in BTC/kvB. As of 0.21, fee_rate is in sat/vB. *
3682    async fn psbtbumpfee(
3683        &self,
3684        _txid: bitcoin::Txid,
3685        _options: Option<serde_json::Value>,
3686    ) -> Result<PsbtbumpfeeResponse, TransportError> {
3687        let params = vec![serde_json::json!(_txid), serde_json::json!(_options)];
3688        self.dispatch_json::<PsbtbumpfeeResponse>("psbtbumpfee", &params).await
3689    }
3690
3691    /// Removes invalidity status of a block, its ancestors and its descendants, reconsider them for activation.
3692    /// This can be used to undo the effects of invalidateblock.
3693    async fn reconsiderblock(&self, _blockhash: bitcoin::BlockHash) -> Result<(), TransportError> {
3694        let params = vec![serde_json::json!(_blockhash)];
3695        self.dispatch_json::<()>("reconsiderblock", &params).await
3696    }
3697
3698    /// Deletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.
3699    async fn removeprunedfunds(&self, _txid: bitcoin::Txid) -> Result<(), TransportError> {
3700        let params = vec![serde_json::json!(_txid)];
3701        self.dispatch_json::<()>("removeprunedfunds", &params).await
3702    }
3703
3704    /// Rescan the local blockchain for wallet related transactions.
3705    /// Note: Use "getwalletinfo" to query the scanning progress.
3706    /// The rescan is significantly faster if block filters are available
3707    /// (using startup option "-blockfilterindex=1").
3708    async fn rescanblockchain(
3709        &self,
3710        _start_height: Option<u64>,
3711        _stop_height: Option<u64>,
3712    ) -> Result<RescanblockchainResponse, TransportError> {
3713        let params = vec![serde_json::json!(_start_height), serde_json::json!(_stop_height)];
3714        self.dispatch_json::<RescanblockchainResponse>("rescanblockchain", &params).await
3715    }
3716
3717    /// Restores and loads a wallet from backup.
3718    ///
3719    /// The rescan is significantly faster if block filters are available
3720    /// (using startup option "-blockfilterindex=1").
3721    async fn restorewallet(
3722        &self,
3723        _wallet_name: String,
3724        _backup_file: String,
3725        _load_on_startup: Option<bool>,
3726    ) -> Result<RestorewalletResponse, TransportError> {
3727        let params = vec![
3728            serde_json::json!(_wallet_name),
3729            serde_json::json!(_backup_file),
3730            serde_json::json!(_load_on_startup),
3731        ];
3732        self.dispatch_json::<RestorewalletResponse>("restorewallet", &params).await
3733    }
3734
3735    /// Dumps the mempool to disk. It will fail until the previous dump is fully loaded.
3736    async fn savemempool(&self) -> Result<SavemempoolResponse, TransportError> {
3737        let params = vec![];
3738        self.dispatch_json::<SavemempoolResponse>("savemempool", &params).await
3739    }
3740
3741    /// Return relevant blockhashes for given descriptors (requires blockfilterindex).
3742    /// This call may take several minutes. Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
3743    async fn scanblocks(
3744        &self,
3745        _action: String,
3746        _scanobjects: Option<Vec<serde_json::Value>>,
3747        _start_height: Option<u64>,
3748        _stop_height: Option<u64>,
3749        _filtertype: Option<String>,
3750        _options: Option<serde_json::Value>,
3751    ) -> Result<(), TransportError> {
3752        let params = vec![
3753            serde_json::json!(_action),
3754            serde_json::json!(_scanobjects),
3755            serde_json::json!(_start_height),
3756            serde_json::json!(_stop_height),
3757            serde_json::json!(_filtertype),
3758            serde_json::json!(_options),
3759        ];
3760        self.dispatch_json::<()>("scanblocks", &params).await
3761    }
3762
3763    /// Scans the unspent transaction output set for entries that match certain output descriptors.
3764    /// Examples of output descriptors are:
3765    /// addr(<address>)                      Outputs whose output script corresponds to the specified address (does not include P2PK)
3766    /// raw(<hex script>)                    Outputs whose output script equals the specified hex-encoded bytes
3767    /// combo(<pubkey>)                      P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH outputs for the given pubkey
3768    /// pkh(<pubkey>)                        P2PKH outputs for the given pubkey
3769    /// sh(multi(<n>,<pubkey>,<pubkey>,...)) P2SH-multisig outputs for the given threshold and pubkeys
3770    /// tr(<pubkey>)                         P2TR
3771    /// tr(<pubkey>,{pk(<pubkey>)})          P2TR with single fallback pubkey in tapscript
3772    /// rawtr(<pubkey>)                      P2TR with the specified key as output key rather than inner
3773    /// wsh(and_v(v:pk(<pubkey>),after(2)))  P2WSH miniscript with mandatory pubkey and a timelock
3774    ///
3775    /// In the above, <pubkey> either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one
3776    /// or more path elements separated by "/", and optionally ending in "/*" (unhardened), or "/*'" or "/*h" (hardened) to specify all
3777    /// unhardened or hardened child keys.
3778    /// In the latter case, a range needs to be specified by below if different from 1000.
3779    /// For more information on output descriptors, see the documentation in the doc/descriptors.md file.
3780    async fn scantxoutset(
3781        &self,
3782        _action: String,
3783        _scanobjects: Option<Vec<serde_json::Value>>,
3784    ) -> Result<ScantxoutsetResponse, TransportError> {
3785        let params = vec![serde_json::json!(_action), serde_json::json!(_scanobjects)];
3786        self.dispatch_json::<ScantxoutsetResponse>("scantxoutset", &params).await
3787    }
3788
3789    /// Return RPC command JSON Schema descriptions.
3790    async fn schema(&self) -> Result<SchemaResponse, TransportError> {
3791        let params = vec![];
3792        self.dispatch_json::<SchemaResponse>("schema", &params).await
3793    }
3794
3795    /// EXPERIMENTAL warning: this call may be changed in future releases.
3796    ///
3797    /// Send a transaction.
3798    async fn send(
3799        &self,
3800        _outputs: Vec<serde_json::Value>,
3801        _conf_target: Option<u64>,
3802        _estimate_mode: Option<String>,
3803        _fee_rate: Option<f64>,
3804        _options: Option<serde_json::Value>,
3805        _version: Option<u32>,
3806    ) -> Result<SendResponse, TransportError> {
3807        let params = vec![
3808            serde_json::json!(_outputs),
3809            serde_json::json!(_conf_target),
3810            serde_json::json!(_estimate_mode),
3811            serde_json::json!(_fee_rate),
3812            serde_json::json!(_options),
3813            serde_json::json!(_version),
3814        ];
3815        self.dispatch_json::<SendResponse>("send", &params).await
3816    }
3817
3818    /// EXPERIMENTAL warning: this call may be changed in future releases.
3819    ///
3820    /// Spend the value of all (or specific) confirmed UTXOs and unconfirmed change in the wallet to one or more recipients.
3821    /// Unconfirmed inbound UTXOs and locked UTXOs will not be spent. Sendall will respect the avoid_reuse wallet flag.
3822    /// If your wallet contains many small inputs, either because it received tiny payments or as a result of accumulating change, consider using `send_max` to exclude inputs that are worth less than the fees needed to spend them.
3823    async fn sendall(
3824        &self,
3825        _recipients: Vec<serde_json::Value>,
3826        _conf_target: Option<u64>,
3827        _estimate_mode: Option<String>,
3828        _fee_rate: Option<f64>,
3829        _options: Option<serde_json::Value>,
3830    ) -> Result<SendallResponse, TransportError> {
3831        let params = vec![
3832            serde_json::json!(_recipients),
3833            serde_json::json!(_conf_target),
3834            serde_json::json!(_estimate_mode),
3835            serde_json::json!(_fee_rate),
3836            serde_json::json!(_options),
3837        ];
3838        self.dispatch_json::<SendallResponse>("sendall", &params).await
3839    }
3840
3841    /// Send multiple times. Amounts are double-precision floating point numbers.
3842    /// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
3843    #[allow(clippy::too_many_arguments)]
3844    async fn sendmany(&self, params: SendmanyParams) -> Result<SendmanyResponse, TransportError> {
3845        let params = vec![serde_json::json!(params)];
3846        self.dispatch_json::<SendmanyResponse>("sendmany", &params).await
3847    }
3848
3849    /// Send a p2p message to a peer specified by id.
3850    /// The message type and body must be provided, the message header will be generated.
3851    /// This RPC is for testing only.
3852    async fn sendmsgtopeer(
3853        &self,
3854        _peer_id: u64,
3855        _msg_type: String,
3856        _msg: String,
3857    ) -> Result<SendmsgtopeerResponse, TransportError> {
3858        let params = vec![
3859            serde_json::json!(_peer_id),
3860            serde_json::json!(_msg_type),
3861            serde_json::json!(_msg),
3862        ];
3863        self.dispatch_json::<SendmsgtopeerResponse>("sendmsgtopeer", &params).await
3864    }
3865
3866    /// Submit a raw transaction (serialized, hex-encoded) to local node and network.
3867    ///
3868    /// The transaction will be sent unconditionally to all peers, so using sendrawtransaction
3869    /// for manual rebroadcast may degrade privacy by leaking the transaction's origin, as
3870    /// nodes will normally not rebroadcast non-wallet transactions already in their mempool.
3871    ///
3872    /// A specific exception, RPC_TRANSACTION_ALREADY_IN_UTXO_SET, may throw if the transaction cannot be added to the mempool.
3873    ///
3874    /// Related RPCs: createrawtransaction, signrawtransactionwithkey
3875    async fn sendrawtransaction(
3876        &self,
3877        _hexstring: String,
3878        _maxfeerate: Option<f64>,
3879        _maxburnamount: Option<f64>,
3880    ) -> Result<SendrawtransactionResponse, TransportError> {
3881        let params = vec![
3882            serde_json::json!(_hexstring),
3883            serde_json::json!(_maxfeerate),
3884            serde_json::json!(_maxburnamount),
3885        ];
3886        self.dispatch_json::<SendrawtransactionResponse>("sendrawtransaction", &params).await
3887    }
3888
3889    /// Send an amount to a given address.
3890    /// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
3891    #[allow(clippy::too_many_arguments)]
3892    async fn sendtoaddress(
3893        &self,
3894        _address: String,
3895        _amount: bitcoin::Amount,
3896        _comment: Option<String>,
3897        _comment_to: Option<String>,
3898        _subtractfeefromamount: Option<bool>,
3899        _replaceable: Option<bool>,
3900        _conf_target: Option<u64>,
3901        _estimate_mode: Option<String>,
3902        _avoid_reuse: Option<bool>,
3903        _fee_rate: Option<f64>,
3904        _verbose: Option<bool>,
3905    ) -> Result<SendtoaddressResponse, TransportError> {
3906        let params = vec![
3907            serde_json::json!(_address),
3908            serde_json::json!(_amount),
3909            serde_json::json!(_comment),
3910            serde_json::json!(_comment_to),
3911            serde_json::json!(_subtractfeefromamount),
3912            serde_json::json!(_replaceable),
3913            serde_json::json!(_conf_target),
3914            serde_json::json!(_estimate_mode),
3915            serde_json::json!(_avoid_reuse),
3916            serde_json::json!(_fee_rate),
3917            serde_json::json!(_verbose),
3918        ];
3919        self.dispatch_json::<SendtoaddressResponse>("sendtoaddress", &params).await
3920    }
3921
3922    /// Attempts to add or remove an IP/Subnet from the banned list.
3923    async fn setban(
3924        &self,
3925        _subnet: String,
3926        _command: String,
3927        _bantime: Option<u64>,
3928        _absolute: Option<bool>,
3929    ) -> Result<(), TransportError> {
3930        let params = vec![
3931            serde_json::json!(_subnet),
3932            serde_json::json!(_command),
3933            serde_json::json!(_bantime),
3934            serde_json::json!(_absolute),
3935        ];
3936        self.dispatch_json::<()>("setban", &params).await
3937    }
3938
3939    /// Sets the label associated with the given address.
3940    async fn setlabel(&self, _address: String, _label: String) -> Result<(), TransportError> {
3941        let params = vec![serde_json::json!(_address), serde_json::json!(_label)];
3942        self.dispatch_json::<()>("setlabel", &params).await
3943    }
3944
3945    /// Set the local time to given timestamp (-regtest only)
3946    async fn setmocktime(&self, _timestamp: u64) -> Result<(), TransportError> {
3947        let params = vec![serde_json::json!(_timestamp)];
3948        self.dispatch_json::<()>("setmocktime", &params).await
3949    }
3950
3951    /// Disable/enable all p2p network activity.
3952    async fn setnetworkactive(
3953        &self,
3954        _state: bool,
3955    ) -> Result<SetnetworkactiveResponse, TransportError> {
3956        let params = vec![serde_json::json!(_state)];
3957        self.dispatch_json::<SetnetworkactiveResponse>("setnetworkactive", &params).await
3958    }
3959
3960    /// (DEPRECATED) Set the transaction fee rate in BTC/kvB for this wallet. Overrides the global -paytxfee command line parameter.
3961    /// Can be deactivated by passing 0 as the fee. In that case automatic fee selection will be used by default.
3962    async fn settxfee(&self, _amount: bitcoin::Amount) -> Result<SettxfeeResponse, TransportError> {
3963        let params = vec![serde_json::json!(_amount)];
3964        self.dispatch_json::<SettxfeeResponse>("settxfee", &params).await
3965    }
3966
3967    /// Change the state of the given wallet flag for a wallet.
3968    async fn setwalletflag(
3969        &self,
3970        _flag: String,
3971        _value: Option<bool>,
3972    ) -> Result<SetwalletflagResponse, TransportError> {
3973        let params = vec![serde_json::json!(_flag), serde_json::json!(_value)];
3974        self.dispatch_json::<SetwalletflagResponse>("setwalletflag", &params).await
3975    }
3976
3977    /// Sign a message with the private key of an address
3978    /// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
3979    async fn signmessage(
3980        &self,
3981        _address: String,
3982        _message: String,
3983    ) -> Result<SignmessageResponse, TransportError> {
3984        let params = vec![serde_json::json!(_address), serde_json::json!(_message)];
3985        self.dispatch_json::<SignmessageResponse>("signmessage", &params).await
3986    }
3987
3988    /// Sign a message with the private key of an address
3989    async fn signmessagewithprivkey(
3990        &self,
3991        _privkey: String,
3992        _message: String,
3993    ) -> Result<SignmessagewithprivkeyResponse, TransportError> {
3994        let params = vec![serde_json::json!(_privkey), serde_json::json!(_message)];
3995        self.dispatch_json::<SignmessagewithprivkeyResponse>("signmessagewithprivkey", &params)
3996            .await
3997    }
3998
3999    /// Sign inputs for raw transaction (serialized, hex-encoded).
4000    /// The second argument is an array of base58-encoded private
4001    /// keys that will be the only keys used to sign the transaction.
4002    /// The third optional argument (may be null) is an array of previous transaction outputs that
4003    /// this transaction depends on but may not yet be in the block chain.
4004    async fn signrawtransactionwithkey(
4005        &self,
4006        _hexstring: String,
4007        _privkeys: Vec<String>,
4008        _prevtxs: Option<Vec<serde_json::Value>>,
4009        _sighashtype: Option<String>,
4010    ) -> Result<SignrawtransactionwithkeyResponse, TransportError> {
4011        let params = vec![
4012            serde_json::json!(_hexstring),
4013            serde_json::json!(_privkeys),
4014            serde_json::json!(_prevtxs),
4015            serde_json::json!(_sighashtype),
4016        ];
4017        self.dispatch_json::<SignrawtransactionwithkeyResponse>(
4018            "signrawtransactionwithkey",
4019            &params,
4020        )
4021        .await
4022    }
4023
4024    /// Sign inputs for raw transaction (serialized, hex-encoded).
4025    /// The second optional argument (may be null) is an array of previous transaction outputs that
4026    /// this transaction depends on but may not yet be in the block chain.
4027    /// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
4028    async fn signrawtransactionwithwallet(
4029        &self,
4030        _hexstring: String,
4031        _prevtxs: Option<Vec<serde_json::Value>>,
4032        _sighashtype: Option<String>,
4033    ) -> Result<SignrawtransactionwithwalletResponse, TransportError> {
4034        let params = vec![
4035            serde_json::json!(_hexstring),
4036            serde_json::json!(_prevtxs),
4037            serde_json::json!(_sighashtype),
4038        ];
4039        self.dispatch_json::<SignrawtransactionwithwalletResponse>(
4040            "signrawtransactionwithwallet",
4041            &params,
4042        )
4043        .await
4044    }
4045
4046    /// Calculate the balance change resulting in the signing and broadcasting of the given transaction(s).
4047    async fn simulaterawtransaction(
4048        &self,
4049        _rawtxs: Option<Vec<serde_json::Value>>,
4050        _options: Option<serde_json::Value>,
4051    ) -> Result<SimulaterawtransactionResponse, TransportError> {
4052        let params = vec![serde_json::json!(_rawtxs), serde_json::json!(_options)];
4053        self.dispatch_json::<SimulaterawtransactionResponse>("simulaterawtransaction", &params)
4054            .await
4055    }
4056
4057    /// Request a graceful shutdown of Bitcoin Core.
4058    async fn stop(&self, _wait: Option<u64>) -> Result<StopResponse, TransportError> {
4059        let params = vec![serde_json::json!(_wait)];
4060        self.dispatch_json::<StopResponse>("stop", &params).await
4061    }
4062
4063    /// Attempts to submit new block to network.
4064    /// See https://en.bitcoin.it/wiki/BIP_0022 for full specification.
4065    async fn submitblock(
4066        &self,
4067        _hexdata: String,
4068        _dummy: Option<String>,
4069    ) -> Result<(), TransportError> {
4070        let params = vec![serde_json::json!(_hexdata), serde_json::json!(_dummy)];
4071        self.dispatch_json::<()>("submitblock", &params).await
4072    }
4073
4074    /// Decode the given hexdata as a header and submit it as a candidate chain tip if valid.
4075    /// Throws when the header is invalid.
4076    async fn submitheader(&self, _hexdata: String) -> Result<(), TransportError> {
4077        let params = vec![serde_json::json!(_hexdata)];
4078        self.dispatch_json::<()>("submitheader", &params).await
4079    }
4080
4081    /// Submit a package of raw transactions (serialized, hex-encoded) to local node.
4082    /// The package will be validated according to consensus and mempool policy rules. If any transaction passes, it will be accepted to mempool.
4083    /// This RPC is experimental and the interface may be unstable. Refer to doc/policy/packages.md for documentation on package policies.
4084    /// Warning: successful submission does not mean the transactions will propagate throughout the network.
4085    async fn submitpackage(
4086        &self,
4087        _package: Vec<serde_json::Value>,
4088        _maxfeerate: Option<f64>,
4089        _maxburnamount: Option<f64>,
4090    ) -> Result<SubmitpackageResponse, TransportError> {
4091        let params = vec![
4092            serde_json::json!(_package),
4093            serde_json::json!(_maxfeerate),
4094            serde_json::json!(_maxburnamount),
4095        ];
4096        self.dispatch_json::<SubmitpackageResponse>("submitpackage", &params).await
4097    }
4098
4099    /// Waits for the validation interface queue to catch up on everything that was there when we entered this function.
4100    async fn syncwithvalidationinterfacequeue(&self) -> Result<(), TransportError> {
4101        let params = vec![];
4102        self.dispatch_json::<()>("syncwithvalidationinterfacequeue", &params).await
4103    }
4104
4105    /// Returns result of mempool acceptance tests indicating if raw transaction(s) (serialized, hex-encoded) would be accepted by mempool.
4106    ///
4107    /// If multiple transactions are passed in, parents must come before children and package policies apply: the transactions cannot conflict with any mempool transactions or each other.
4108    ///
4109    /// If one transaction fails, other transactions may not be fully validated (the 'allowed' key will be blank).
4110    ///
4111    /// The maximum number of transactions allowed is 25.
4112    ///
4113    /// This checks if transactions violate the consensus or policy rules.
4114    ///
4115    /// See sendrawtransaction call.
4116    async fn testmempoolaccept(
4117        &self,
4118        _rawtxs: Vec<serde_json::Value>,
4119        _maxfeerate: Option<f64>,
4120    ) -> Result<TestmempoolacceptResponse, TransportError> {
4121        let params = vec![serde_json::json!(_rawtxs), serde_json::json!(_maxfeerate)];
4122        self.dispatch_json::<TestmempoolacceptResponse>("testmempoolaccept", &params).await
4123    }
4124
4125    /// Unloads the wallet referenced by the request endpoint or the wallet_name argument.
4126    /// If both are specified, they must be identical.
4127    async fn unloadwallet(
4128        &self,
4129        _wallet_name: Option<String>,
4130        _load_on_startup: Option<bool>,
4131    ) -> Result<UnloadwalletResponse, TransportError> {
4132        let params = vec![serde_json::json!(_wallet_name), serde_json::json!(_load_on_startup)];
4133        self.dispatch_json::<UnloadwalletResponse>("unloadwallet", &params).await
4134    }
4135
4136    /// Returns the total uptime of the server.
4137    async fn uptime(&self) -> Result<UptimeResponse, TransportError> {
4138        let params = vec![];
4139        self.dispatch_json::<UptimeResponse>("uptime", &params).await
4140    }
4141
4142    /// Updates all segwit inputs and outputs in a PSBT with data from output descriptors, the UTXO set, txindex, or the mempool.
4143    async fn utxoupdatepsbt(
4144        &self,
4145        _psbt: String,
4146        _descriptors: Option<Vec<serde_json::Value>>,
4147    ) -> Result<UtxoupdatepsbtResponse, TransportError> {
4148        let params = vec![serde_json::json!(_psbt), serde_json::json!(_descriptors)];
4149        self.dispatch_json::<UtxoupdatepsbtResponse>("utxoupdatepsbt", &params).await
4150    }
4151
4152    /// Return information about the given bitcoin address.
4153    async fn validateaddress(
4154        &self,
4155        _address: String,
4156    ) -> Result<ValidateaddressResponse, TransportError> {
4157        let params = vec![serde_json::json!(_address)];
4158        self.dispatch_json::<ValidateaddressResponse>("validateaddress", &params).await
4159    }
4160
4161    /// Verifies blockchain database.
4162    async fn verifychain(
4163        &self,
4164        _checklevel: Option<u32>,
4165        _nblocks: Option<u64>,
4166    ) -> Result<VerifychainResponse, TransportError> {
4167        let params = vec![serde_json::json!(_checklevel), serde_json::json!(_nblocks)];
4168        self.dispatch_json::<VerifychainResponse>("verifychain", &params).await
4169    }
4170
4171    /// Verify a signed message.
4172    async fn verifymessage(
4173        &self,
4174        _address: String,
4175        _signature: String,
4176        _message: String,
4177    ) -> Result<VerifymessageResponse, TransportError> {
4178        let params = vec![
4179            serde_json::json!(_address),
4180            serde_json::json!(_signature),
4181            serde_json::json!(_message),
4182        ];
4183        self.dispatch_json::<VerifymessageResponse>("verifymessage", &params).await
4184    }
4185
4186    /// Verifies that a proof points to a transaction in a block, returning the transaction it commits to
4187    /// and throwing an RPC error if the block is not in our best chain
4188    async fn verifytxoutproof(
4189        &self,
4190        _proof: String,
4191    ) -> Result<VerifytxoutproofResponse, TransportError> {
4192        let params = vec![serde_json::json!(_proof)];
4193        self.dispatch_json::<VerifytxoutproofResponse>("verifytxoutproof", &params).await
4194    }
4195
4196    /// Waits for a specific new block and returns useful info about it.
4197    ///
4198    /// Returns the current block on timeout or exit.
4199    ///
4200    /// Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
4201    async fn waitforblock(
4202        &self,
4203        _blockhash: bitcoin::BlockHash,
4204        _timeout: Option<u64>,
4205    ) -> Result<WaitforblockResponse, TransportError> {
4206        let params = vec![serde_json::json!(_blockhash), serde_json::json!(_timeout)];
4207        self.dispatch_json::<WaitforblockResponse>("waitforblock", &params).await
4208    }
4209
4210    /// Waits for (at least) block height and returns the height and hash
4211    /// of the current tip.
4212    ///
4213    /// Returns the current block on timeout or exit.
4214    ///
4215    /// Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
4216    async fn waitforblockheight(
4217        &self,
4218        _height: u64,
4219        _timeout: Option<u64>,
4220    ) -> Result<WaitforblockheightResponse, TransportError> {
4221        let params = vec![serde_json::json!(_height), serde_json::json!(_timeout)];
4222        self.dispatch_json::<WaitforblockheightResponse>("waitforblockheight", &params).await
4223    }
4224
4225    /// Waits for any new block and returns useful info about it.
4226    ///
4227    /// Returns the current block on timeout or exit.
4228    ///
4229    /// Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
4230    async fn waitfornewblock(
4231        &self,
4232        _timeout: Option<u64>,
4233        _current_tip: Option<String>,
4234    ) -> Result<WaitfornewblockResponse, TransportError> {
4235        let params = vec![serde_json::json!(_timeout), serde_json::json!(_current_tip)];
4236        self.dispatch_json::<WaitfornewblockResponse>("waitfornewblock", &params).await
4237    }
4238
4239    /// Creates and funds a transaction in the Partially Signed Transaction format.
4240    /// Implements the Creator and Updater roles.
4241    /// All existing inputs must either have their previous output transaction be in the wallet
4242    /// or be in the UTXO set. Solving data must be provided for non-wallet inputs.
4243    async fn walletcreatefundedpsbt(
4244        &self,
4245        params: WalletcreatefundedpsbtParams,
4246    ) -> Result<WalletcreatefundedpsbtResponse, TransportError> {
4247        let params = vec![serde_json::json!(params)];
4248        self.dispatch_json::<WalletcreatefundedpsbtResponse>("walletcreatefundedpsbt", &params)
4249            .await
4250    }
4251
4252    /// Display address on an external signer for verification.
4253    async fn walletdisplayaddress(
4254        &self,
4255        _address: String,
4256    ) -> Result<WalletdisplayaddressResponse, TransportError> {
4257        let params = vec![serde_json::json!(_address)];
4258        self.dispatch_json::<WalletdisplayaddressResponse>("walletdisplayaddress", &params).await
4259    }
4260
4261    /// Removes the wallet encryption key from memory, locking the wallet.
4262    /// After calling this method, you will need to call walletpassphrase again
4263    /// before being able to call any methods which require the wallet to be unlocked.
4264    async fn walletlock(&self) -> Result<(), TransportError> {
4265        let params = vec![];
4266        self.dispatch_json::<()>("walletlock", &params).await
4267    }
4268
4269    /// Stores the wallet decryption key in memory for 'timeout' seconds.
4270    /// This is needed prior to performing transactions related to private keys such as sending bitcoins
4271    ///
4272    /// Note:
4273    /// Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock
4274    /// time that overrides the old one.
4275    async fn walletpassphrase(
4276        &self,
4277        _passphrase: String,
4278        _timeout: u64,
4279    ) -> Result<(), TransportError> {
4280        let params = vec![serde_json::json!(_passphrase), serde_json::json!(_timeout)];
4281        self.dispatch_json::<()>("walletpassphrase", &params).await
4282    }
4283
4284    /// Changes the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.
4285    async fn walletpassphrasechange(
4286        &self,
4287        _oldpassphrase: String,
4288        _newpassphrase: String,
4289    ) -> Result<(), TransportError> {
4290        let params = vec![serde_json::json!(_oldpassphrase), serde_json::json!(_newpassphrase)];
4291        self.dispatch_json::<()>("walletpassphrasechange", &params).await
4292    }
4293
4294    /// Update a PSBT with input information from our wallet and then sign inputs
4295    /// that we can sign for.
4296    /// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
4297    async fn walletprocesspsbt(
4298        &self,
4299        _psbt: String,
4300        _sign: Option<bool>,
4301        _sighashtype: Option<String>,
4302        _bip32derivs: Option<bool>,
4303        _finalize: Option<bool>,
4304    ) -> Result<WalletprocesspsbtResponse, TransportError> {
4305        let params = vec![
4306            serde_json::json!(_psbt),
4307            serde_json::json!(_sign),
4308            serde_json::json!(_sighashtype),
4309            serde_json::json!(_bip32derivs),
4310            serde_json::json!(_finalize),
4311        ];
4312        self.dispatch_json::<WalletprocesspsbtResponse>("walletprocesspsbt", &params).await
4313    }
4314}