ethos-bitcoind 30.2.11

Generated client for ethos-bitcoind.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
//! Parameter structs for RPC method calls
use serde::Serialize;

use crate::types::FeeRate;

mod serde_fee_rate {
    pub mod maxfeerate_opt {
        use serde::{Deserialize, Deserializer, Serializer};

        use crate::types::FeeRate;

        #[allow(clippy::ref_option)]
        pub fn serialize<S>(f: &Option<FeeRate>, s: S) -> Result<S::Ok, S::Error>
        where
            S: Serializer,
        {
            match f {
                Some(r) => s.serialize_some(&((r.to_sat_per_kvb_floor() as f64) / 100_000_000.0)),
                None => s.serialize_none(),
            }
        }

        #[allow(dead_code)]
        pub fn deserialize<'d, D: Deserializer<'d>>(d: D) -> Result<Option<FeeRate>, D::Error> {
            let opt: Option<f64> = Option::deserialize(d)?;
            Ok(opt.map(|v| {
                let sat_per_kvb = (v * 100_000_000.0).round().clamp(0.0, u32::MAX as f64) as u32;
                FeeRate::from_sat_per_kvb(sat_per_kvb)
            }))
        }
    }
}

/// (De)serializes HashMap<Address, Amount> with values as BTC floats (for sendmany "amounts" param).
pub mod serde_amounts_map {
    use std::collections::HashMap;

    use bitcoin::address::NetworkUnchecked;
    use bitcoin::Address;
    use serde::{Deserialize, Deserializer, Serializer};

    pub fn serialize<S>(
        map: &HashMap<Address<NetworkUnchecked>, bitcoin::Amount>,
        s: S,
    ) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        use serde::ser::SerializeMap;
        let mut m = s.serialize_map(Some(map.len()))?;
        for (k, v) in map {
            m.serialize_entry(k, &v.to_btc())?;
        }
        m.end()
    }

    pub fn deserialize<'de, D>(
        d: D,
    ) -> Result<HashMap<Address<NetworkUnchecked>, bitcoin::Amount>, D::Error>
    where
        D: Deserializer<'de>,
    {
        let map = HashMap::<Address<NetworkUnchecked>, f64>::deserialize(d)?;
        map.into_iter()
            .map(|(k, v)| {
                bitcoin::Amount::from_btc(v).map(|a| (k, a)).map_err(serde::de::Error::custom)
            })
            .collect()
    }
}

/// Reference wrapper for the sendmany "amounts" map; serializes to JSON with amounts as BTC.
#[derive(Debug)]
pub struct SendmanyAmountsRef<'a>(
    pub  &'a std::collections::HashMap<
        bitcoin::Address<bitcoin::address::NetworkUnchecked>,
        bitcoin::Amount,
    >,
);

impl serde::Serialize for SendmanyAmountsRef<'_> {
    fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serde_amounts_map::serialize(self.0, s)
    }
}

/// One recipient for the sendall RPC (address and optional amount in BTC).
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq)]
pub struct SendallRecipient {
    /// Destination address (unchecked; use `.assume_checked()` or `.require_network()` when needed).
    pub address: bitcoin::Address<bitcoin::address::NetworkUnchecked>,
    /// Optional amount (omit to send remaining balance). Serialized as BTC in JSON.
    #[serde(default, with = "bitcoin::amount::serde::as_btc::opt")]
    pub amount: Option<bitcoin::Amount>,
}

/// Request options for the getblocktemplate RPC (mode, capabilities, rules).
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq)]
pub struct GetBlockTemplateRequest {
    /// Optional mode: \"template\", \"proposal\", or omitted.
    pub mode: Option<String>,
    /// Optional list of capability strings.
    pub capabilities: Option<Vec<String>>,
    /// Optional list of rule strings.
    pub rules: Option<Vec<String>>,
}

/// Mark in-wallet transaction &lt;txid&gt; as abandoned
/// This will mark this transaction and all its in-wallet descendants as abandoned which will allow
/// for their inputs to be respent.  It can be used to replace "stuck" or evicted transactions.
/// It only works on transactions which are not included in a block and are not currently in the mempool.
/// It has no effect on transactions which are already abandoned.
#[derive(Debug, Serialize)]
pub struct AbandontransactionParams {
    /// The transaction id
    pub txid: bitcoin::Txid,
}

/// Open an outbound connection to a specified node. This RPC is for testing only.
#[derive(Debug, Serialize)]
pub struct AddconnectionParams {
    /// The IP address and port to attempt connecting to.
    pub address: bitcoin::Address,
    /// Type of connection to open ("outbound-full-relay", "block-relay-only", "addr-fetch" or "feeler").
    pub connection_type: String,
    /// Attempt to connect using BIP324 v2 transport protocol
    pub v2transport: bool,
}

/// Attempts to add or remove a node from the addnode list.
/// Or try a connection to a node once.
/// Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be
/// full nodes/support SegWit as other outbound peers are (though such peers will not be synced from).
/// Addnode connections are limited to 8 at a time and are counted separately from the -maxconnections limit.
#[derive(Debug, Serialize)]
pub struct AddnodeParams {
    /// The IP address/hostname optionally followed by :port of the peer to connect to
    pub node: String,
    /// 'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once
    pub command: String,
    /// Attempt to connect using BIP324 v2 transport protocol (ignored for 'remove' command)
    pub v2transport: Option<bool>,
}

/// Add the address of a potential peer to an address manager table. This RPC is for testing only.
#[derive(Debug, Serialize)]
pub struct AddpeeraddressParams {
    /// The IP address of the peer
    pub address: bitcoin::Address,
    /// The port of the peer
    pub port: i64,
    /// If true, attempt to add the peer to the tried addresses table
    pub tried: Option<bool>,
}

/// Analyzes and provides information about the current status of a PSBT and its inputs
#[derive(Debug, Serialize)]
pub struct AnalyzepsbtParams {
    /// A base64 string of a PSBT
    pub psbt: String,
}

/// Safely copies the current wallet file to the specified destination, which can either be a directory or a path with a filename.
#[derive(Debug, Serialize)]
pub struct BackupwalletParams {
    /// The destination directory or file
    pub destination: String,
}

/// Bumps the fee of a transaction T, replacing it with a new transaction B.
/// A transaction with the given txid must be in the wallet.
/// The command will pay the additional fee by reducing change outputs or adding inputs when necessary.
/// It may add a new change output if one does not already exist.
/// All inputs in the original transaction will be included in the replacement transaction.
/// The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs.
/// By default, the new fee will be calculated automatically using the estimatesmartfee RPC.
/// The user can specify a confirmation target for estimatesmartfee.
/// Alternatively, the user can specify a fee rate in sat/vB for the new transaction.
/// At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee
/// returned by getnetworkinfo) to enter the node's mempool.
/// * WARNING: before version 0.21, fee_rate was in BTC/kvB. As of 0.21, fee_rate is in sat/vB. *
#[derive(Debug, Serialize)]
pub struct BumpfeeParams {
    /// The txid to be bumped
    pub txid: bitcoin::Txid,
    pub options: Option<serde_json::Value>,
}

/// Combine multiple partially signed Bitcoin transactions into one transaction.
/// Implements the Combiner role.
#[derive(Debug, Serialize)]
pub struct CombinepsbtParams {
    /// The base64 strings of partially signed transactions
    pub txs: Vec<serde_json::Value>,
}

/// Combine multiple partially signed transactions into one transaction.
/// The combined transaction may be another partially signed transaction or a
/// fully signed transaction.
#[derive(Debug, Serialize)]
pub struct CombinerawtransactionParams {
    /// The hex strings of partially signed transactions
    pub txs: Vec<serde_json::Value>,
}

/// Converts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction
/// createpsbt and walletcreatefundedpsbt should be used for new applications.
#[derive(Debug, Serialize)]
pub struct ConverttopsbtParams {
    /// The hex string of a raw transaction
    #[serde(rename = "hexstring")]
    pub hex_string: String,
    /// If true, any signatures in the input will be discarded and conversion
    /// will continue. If false, RPC will fail if any signatures are present.
    #[serde(rename = "permitsigdata")]
    pub permit_sig_data: Option<bool>,
    /// Whether the transaction hex is a serialized witness transaction.
    /// If iswitness is not present, heuristic tests will be used in decoding.
    /// If true, only witness deserialization will be tried.
    /// If false, only non-witness deserialization will be tried.
    /// This boolean should reflect whether the transaction has inputs
    /// (e.g. fully valid, or on-chain transactions), if known by the caller.
    #[serde(rename = "iswitness")]
    pub is_witness: Option<bool>,
}

/// Creates a multi-signature address with n signatures of m keys required.
/// It returns a json object with the address and redeemScript.
#[derive(Debug, Serialize)]
pub struct CreatemultisigParams {
    /// The number of required signatures out of the m keys.
    pub nrequired: i64,
    /// The hex-encoded public keys.
    pub keys: Vec<serde_json::Value>,
    /// The address type to use. Options are "legacy", "p2sh-segwit", and "bech32".
    pub address_type: Option<String>,
}

/// Creates a transaction in the Partially Signed Transaction format.
/// Implements the Creator role.
/// Note that the transaction's inputs are not signed, and
/// it is not stored in the wallet or transmitted to the network.
#[derive(Debug, Serialize)]
pub struct CreatepsbtParams {
    /// The inputs
    pub inputs: Vec<serde_json::Value>,
    /// The outputs specified as key-value pairs.
    /// Each key may only appear once, i.e. there can only be one 'data' output, and no address may be duplicated.
    /// At least one output of either type must be specified.
    /// For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also
    /// accepted as second parameter.
    pub outputs: Vec<serde_json::Value>,
    /// Raw locktime. Non-0 value also locktime-activates inputs
    #[serde(rename = "locktime")]
    pub lock_time: Option<i64>,
    /// Marks this transaction as BIP125-replaceable.
    /// Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible.
    pub replaceable: Option<bool>,
    /// Transaction version
    pub version: Option<i64>,
}

/// Create a transaction spending the given inputs and creating new outputs.
/// Outputs can be addresses or data.
/// Returns hex-encoded raw transaction.
/// Note that the transaction's inputs are not signed, and
/// it is not stored in the wallet or transmitted to the network.
#[derive(Debug, Serialize)]
pub struct CreaterawtransactionParams {
    /// The inputs
    pub inputs: Vec<serde_json::Value>,
    /// The outputs specified as key-value pairs.
    /// Each key may only appear once, i.e. there can only be one 'data' output, and no address may be duplicated.
    /// At least one output of either type must be specified.
    /// For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also
    /// accepted as second parameter.
    pub outputs: Vec<serde_json::Value>,
    /// Raw locktime. Non-0 value also locktime-activates inputs
    #[serde(rename = "locktime")]
    pub lock_time: Option<i64>,
    /// Marks this transaction as BIP125-replaceable.
    /// Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible.
    pub replaceable: Option<bool>,
    /// Transaction version
    pub version: Option<i64>,
}

/// Creates and loads a new wallet.
#[derive(Debug, Serialize)]
pub struct CreatewalletParams {
    /// The name for the new wallet. If this is a path, the wallet will be created at the path location.
    pub wallet_name: String,
    /// Disable the possibility of private keys (only watchonlys are possible in this mode).
    pub disable_private_keys: Option<bool>,
    /// Create a blank wallet. A blank wallet has no keys.
    pub blank: Option<bool>,
    /// Encrypt the wallet with this passphrase.
    pub passphrase: Option<String>,
    /// Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind.
    pub avoid_reuse: Option<bool>,
    /// If set, must be "true"
    pub descriptors: Option<bool>,
    /// Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged.
    pub load_on_startup: Option<bool>,
    /// Use an external signer such as a hardware wallet. Requires -signer to be configured. Wallet creation will fail if keys cannot be fetched. Requires disable_private_keys and descriptors set to true.
    pub external_signer: Option<bool>,
}

/// 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.
/// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
#[derive(Debug, Serialize)]
pub struct CreatewalletdescriptorParams {
    /// The address type the descriptor will produce. Options are "legacy", "p2sh-segwit", "bech32", "bech32m".
    #[serde(rename = "type")]
    pub r#type: String,
    pub options: Option<serde_json::Value>,
}

/// Return a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.
#[derive(Debug, Serialize)]
pub struct DecodepsbtParams {
    /// The PSBT base64 string
    pub psbt: String,
}

/// Return a JSON object representing the serialized, hex-encoded transaction.
#[derive(Debug, Serialize)]
pub struct DecoderawtransactionParams {
    /// The transaction hex string
    #[serde(rename = "hexstring")]
    pub hex_string: String,
    /// Whether the transaction hex is a serialized witness transaction.
    /// If iswitness is not present, heuristic tests will be used in decoding.
    /// If true, only witness deserialization will be tried.
    /// If false, only non-witness deserialization will be tried.
    /// This boolean should reflect whether the transaction has inputs
    /// (e.g. fully valid, or on-chain transactions), if known by the caller.
    #[serde(rename = "iswitness")]
    pub is_witness: Option<bool>,
}

/// Decode a hex-encoded script.
#[derive(Debug, Serialize)]
pub struct DecodescriptParams {
    /// the hex-encoded script
    #[serde(rename = "hexstring")]
    pub hex_string: String,
}

/// Derives one or more addresses corresponding to an output descriptor.
/// Examples of output descriptors are:
/// pkh(&lt;pubkey&gt;)                                     P2PKH outputs for the given pubkey
/// wpkh(&lt;pubkey&gt;)                                    Native segwit P2PKH outputs for the given pubkey
/// sh(multi(&lt;n&gt;,&lt;pubkey&gt;,&lt;pubkey&gt;,...))              P2SH-multisig outputs for the given threshold and pubkeys
/// raw(&lt;hex script&gt;)                                 Outputs whose output script equals the specified hex-encoded bytes
/// tr(&lt;pubkey&gt;,multi_a(&lt;n&gt;,&lt;pubkey&gt;,&lt;pubkey&gt;,...))   P2TR-multisig outputs for the given threshold and pubkeys
/// In the above, &lt;pubkey&gt; either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one
/// or more path elements separated by "/", where "h" represents a hardened child key.
/// For more information on output descriptors, see the documentation in the doc/descriptors.md file.
#[derive(Debug, Serialize)]
pub struct DeriveaddressesParams {
    /// The descriptor.
    pub descriptor: String,
    /// If a ranged descriptor is used, this specifies the end or the range (in \[begin,end\] notation) to derive.
    pub range: Option<serde_json::Value>,
}

/// Update all segwit inputs in a PSBT with information from output descriptors, the UTXO set or the mempool.
/// Then, sign the inputs we are able to with information from the output descriptors.
#[derive(Debug, Serialize)]
pub struct DescriptorprocesspsbtParams {
    /// The transaction base64 string
    pub psbt: String,
    /// An array of either strings or objects
    pub descriptors: Vec<serde_json::Value>,
    /// The signature hash type to sign with if not specified by the PSBT. Must be one of
    /// "DEFAULT"
    /// "ALL"
    /// "NONE"
    /// "SINGLE"
    /// "ALL|ANYONECANPAY"
    /// "NONE|ANYONECANPAY"
    /// "SINGLE|ANYONECANPAY"
    #[serde(rename = "sighashtype")]
    pub sighash_type: Option<String>,
    /// Include BIP 32 derivation paths for public keys if we know them
    #[serde(rename = "bip32derivs")]
    pub bip32_derivs: Option<bool>,
    /// Also finalize inputs if possible
    pub finalize: Option<bool>,
}

/// Immediately disconnects from the specified peer node.
/// Strictly one out of 'address' and 'nodeid' can be provided to identify the node.
/// To disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.
#[derive(Debug, Serialize)]
pub struct DisconnectnodeParams {
    /// The IP address/port of the node
    pub address: Option<bitcoin::Address>,
    /// The node ID (see getpeerinfo for node IDs)
    pub nodeid: Option<i64>,
}

/// 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.
/// 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.
/// This call may take several minutes. Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
#[derive(Debug, Serialize)]
pub struct DumptxoutsetParams {
    /// Path to the output file. If relative, will be prefixed by datadir.
    pub path: String,
    /// The type of snapshot to create. Can be "latest" to create a snapshot of the current UTXO set or "rollback" to temporarily roll back the state of the node to a historical block before creating the snapshot of a historical UTXO set. This parameter can be omitted if a separate "rollback" named parameter is specified indicating the height or hash of a specific historical block. If "rollback" is specified and separate "rollback" named parameter is not specified, this will roll back to the latest valid snapshot block that can currently be loaded with loadtxoutset.
    #[serde(rename = "type")]
    pub r#type: Option<String>,
    pub options: Option<serde_json::Value>,
}

/// Simply echo back the input arguments. This command is for testing.
/// It will return an internal bug report when arg9='trigger_internal_bug' is passed.
/// 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.
#[derive(Debug, Serialize)]
pub struct EchoParams {
    pub arg0: Option<String>,
    pub arg1: Option<String>,
    pub arg2: Option<String>,
    pub arg3: Option<String>,
    pub arg4: Option<String>,
    pub arg5: Option<String>,
    pub arg6: Option<String>,
    pub arg7: Option<String>,
    pub arg8: Option<String>,
    pub arg9: Option<String>,
}

/// Echo back the input argument, passing it through a spawned process in a multiprocess build.
/// This command is for testing.
#[derive(Debug, Serialize)]
pub struct EchoipcParams {
    /// The string to echo
    pub arg: String,
}

/// Simply echo back the input arguments. This command is for testing.
/// It will return an internal bug report when arg9='trigger_internal_bug' is passed.
/// 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.
#[derive(Debug, Serialize)]
pub struct EchojsonParams {
    pub arg0: Option<String>,
    pub arg1: Option<String>,
    pub arg2: Option<String>,
    pub arg3: Option<String>,
    pub arg4: Option<String>,
    pub arg5: Option<String>,
    pub arg6: Option<String>,
    pub arg7: Option<String>,
    pub arg8: Option<String>,
    pub arg9: Option<String>,
}

/// Encrypts the wallet with 'passphrase'. This is for first time encryption.
/// After this, any calls that interact with private keys such as sending or signing
/// will require the passphrase to be set prior to making these calls.
/// Use the walletpassphrase call for this, and then walletlock call.
/// If the wallet is already encrypted, use the walletpassphrasechange call.
/// ** IMPORTANT **
/// For security reasons, the encryption process will generate a new HD seed, resulting
/// in the creation of a fresh set of active descriptors. Therefore, it is crucial to
/// securely back up the newly generated wallet file using the backupwallet RPC.
#[derive(Debug, Serialize)]
pub struct EncryptwalletParams {
    /// The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long.
    pub passphrase: String,
}

/// WARNING: This interface is unstable and may disappear or change!
/// WARNING: This is an advanced API call that is tightly coupled to the specific
/// implementation of fee estimation. The parameters it can be called with
/// and the results it returns will change if the internal implementation changes.
/// Estimates the approximate fee per kilobyte needed for a transaction to begin
/// confirmation within conf_target blocks if possible. Uses virtual transaction size as
/// defined in BIP 141 (witness data is discounted).
#[derive(Debug, Serialize)]
pub struct EstimaterawfeeParams {
    /// Confirmation target in blocks (1 - 1008)
    pub conf_target: i64,
    /// The proportion of transactions in a given feerate range that must have been
    /// confirmed within conf_target in order to consider those feerates as high enough and proceed to check
    /// lower buckets.
    pub threshold: Option<i64>,
}

/// Estimates the approximate fee per kilobyte needed for a transaction to begin
/// confirmation within conf_target blocks if possible and return the number of blocks
/// for which the estimate is valid. Uses virtual transaction size as defined
/// in BIP 141 (witness data is discounted).
#[derive(Debug, Serialize)]
pub struct EstimatesmartfeeParams {
    /// Confirmation target in blocks (1 - 1008)
    pub conf_target: i64,
    /// The fee estimate mode.
    /// unset, economical, conservative
    /// unset means no mode set (default mode will be used).
    /// economical estimates use a shorter time horizon, making them more
    /// responsive to short-term drops in the prevailing fee market. This mode
    /// potentially returns a lower fee rate estimate.
    /// conservative estimates use a longer time horizon, making them
    /// less responsive to short-term drops in the prevailing fee market. This mode
    /// potentially returns a higher fee rate estimate.
    pub estimate_mode: Option<String>,
}

/// Finalize the inputs of a PSBT. If the transaction is fully signed, it will produce a
/// network serialized transaction which can be broadcast with sendrawtransaction. Otherwise a PSBT will be
/// created which has the final_scriptSig and final_scriptwitness fields filled for inputs that are complete.
/// Implements the Finalizer and Extractor roles.
#[derive(Debug, Serialize)]
pub struct FinalizepsbtParams {
    /// A base64 string of a PSBT
    pub psbt: String,
    /// If true and the transaction is complete,
    /// extract and return the complete transaction in normal network serialization instead of the PSBT.
    pub extract: Option<bool>,
}

/// If the transaction has no inputs, they will be automatically selected to meet its out value.
/// It will add at most one change output to the outputs.
/// No existing outputs will be modified unless "subtractFeeFromOutputs" is specified.
/// Note that inputs which were signed may need to be resigned after completion since in/outputs have been added.
/// The inputs added will not be signed, use signrawtransactionwithkey
/// or signrawtransactionwithwallet for that.
/// All existing inputs must either have their previous output transaction be in the wallet
/// or be in the UTXO set. Solving data must be provided for non-wallet inputs.
/// Note that all inputs selected must be of standard form and P2SH scripts must be
/// in the wallet using importdescriptors (to calculate fees).
/// You can see whether this is the case by checking the "solvable" field in the listunspent output.
/// Note that if specifying an exact fee rate, the resulting transaction may have a higher fee rate
/// if the transaction has unconfirmed inputs. This is because the wallet will attempt to make the
/// entire package have the given fee rate, not the resulting transaction.
#[derive(Debug, Serialize)]
pub struct FundrawtransactionParams {
    /// The hex string of the raw transaction
    #[serde(rename = "hexstring")]
    pub hex_string: String,
    pub options: Option<serde_json::Value>,
    /// Whether the transaction hex is a serialized witness transaction.
    /// If iswitness is not present, heuristic tests will be used in decoding.
    /// If true, only witness deserialization will be tried.
    /// If false, only non-witness deserialization will be tried.
    /// This boolean should reflect whether the transaction has inputs
    /// (e.g. fully valid, or on-chain transactions), if known by the caller.
    #[serde(rename = "iswitness")]
    pub is_witness: Option<bool>,
}

/// Mine a set of ordered transactions to a specified address or descriptor and return the block hash.
#[derive(Debug, Serialize)]
pub struct GenerateblockParams {
    /// The address or descriptor to send the newly generated bitcoin to.
    pub output: String,
    /// An array of hex strings which are either txids or raw transactions.
    /// Txids must reference transactions currently in the mempool.
    /// All transactions must be valid and in valid order, otherwise the block will be rejected.
    pub transactions: Vec<serde_json::Value>,
    /// Whether to submit the block before the RPC call returns or to return it as hex.
    pub submit: Option<bool>,
}

/// Mine to a specified address and return the block hashes.
#[derive(Debug, Serialize)]
pub struct GeneratetoaddressParams {
    /// How many blocks are generated.
    pub nblocks: i64,
    /// The address to send the newly generated bitcoin to.
    pub address: bitcoin::Address,
    /// How many iterations to try.
    pub maxtries: Option<i64>,
}

/// Mine to a specified descriptor and return the block hashes.
#[derive(Debug, Serialize)]
pub struct GeneratetodescriptorParams {
    /// How many blocks are generated.
    pub num_blocks: i64,
    /// The descriptor to send the newly generated bitcoin to.
    pub descriptor: String,
    /// How many iterations to try.
    pub maxtries: Option<i64>,
}

/// Returns information about the given added node, or all added nodes
/// (note that onetry addnodes are not listed here)
#[derive(Debug, Serialize)]
pub struct GetaddednodeinfoParams {
    /// If provided, return information about this specific node, otherwise all nodes are returned.
    pub node: Option<String>,
}

/// Returns the list of addresses assigned the specified label.
#[derive(Debug, Serialize)]
pub struct GetaddressesbylabelParams {
    /// The label.
    pub label: String,
}

/// Return information about the given bitcoin address.
/// Some of the information will only be present if the address is in the active wallet.
#[derive(Debug, Serialize)]
pub struct GetaddressinfoParams {
    /// The bitcoin address for which to get information.
    pub address: bitcoin::Address,
}

/// Returns the total available balance.
/// The available balance is what the wallet considers currently spendable, and is
/// thus affected by options which limit spendability such as -spendzeroconfchange.
#[derive(Debug, Serialize)]
pub struct GetbalanceParams {
    /// Remains for backward compatibility. Must be excluded or set to "*".
    pub dummy: Option<String>,
    /// Only include transactions confirmed at least this many times.
    #[serde(rename = "minconf")]
    pub min_conf: Option<i64>,
    /// No longer used
    pub include_watchonly: Option<bool>,
    /// (only available if avoid_reuse wallet flag is set) Do not include balance in dirty outputs; addresses are considered dirty if they have previously been used in a transaction.
    pub avoid_reuse: Option<bool>,
}

/// If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.
/// If verbosity is 1, returns an Object with information about block &lt;hash&gt;.
/// If verbosity is 2, returns an Object with information about block &lt;hash&gt; and information about each transaction.
/// If verbosity is 3, returns an Object with information about block &lt;hash&gt; and information about each transaction, including prevout information for inputs (only for unpruned blocks in the current best chain).
#[derive(Debug, Serialize)]
pub struct GetblockParams {
    /// The block hash
    #[serde(rename = "blockhash")]
    pub block_hash: bitcoin::BlockHash,
    /// 0 for hex-encoded data, 1 for a JSON object, 2 for JSON object with transaction data, and 3 for JSON object with transaction data including prevout information for inputs
    pub verbosity: Option<i64>,
}

/// Retrieve a BIP 157 content filter for a particular block.
#[derive(Debug, Serialize)]
pub struct GetblockfilterParams {
    /// The hash of the block
    #[serde(rename = "blockhash")]
    pub block_hash: bitcoin::BlockHash,
    /// The type name of the filter
    pub filtertype: Option<String>,
}

/// Attempt to fetch block from a given peer.
/// We must have the header for this block, e.g. using submitheader.
/// 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.
/// Subsequent calls for the same block may cause the response from the previous peer to be ignored.
/// Peers generally ignore requests for a stale block that they never fully verified, or one that is more than a month old.
/// When a peer does not respond with a block, we will disconnect.
/// Note: The block could be re-pruned as soon as it is received.
/// Returns an empty JSON object if the request was successfully scheduled.
#[derive(Debug, Serialize)]
pub struct GetblockfrompeerParams {
    /// The block hash to try to fetch
    #[serde(rename = "blockhash")]
    pub block_hash: bitcoin::BlockHash,
    /// The peer to fetch it from (see getpeerinfo for peer IDs)
    pub peer_id: i64,
}

/// Returns hash of block in best-block-chain at height provided.
#[derive(Debug, Serialize)]
pub struct GetblockhashParams {
    /// The height index
    pub height: i64,
}

/// If verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.
/// If verbose is true, returns an Object with information about blockheader &lt;hash&gt;.
#[derive(Debug, Serialize)]
pub struct GetblockheaderParams {
    /// The block hash
    #[serde(rename = "blockhash")]
    pub block_hash: bitcoin::BlockHash,
    /// true for a json object, false for the hex-encoded data
    pub verbose: Option<bool>,
}

/// Compute per block statistics for a given window. All amounts are in satoshis.
/// It won't work for some heights with pruning.
#[derive(Debug, Serialize)]
pub struct GetblockstatsParams {
    /// The block hash or height of the target block
    pub hash_or_height: i64,
    /// Values to plot (see result below)
    pub stats: Option<Vec<serde_json::Value>>,
}

/// If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.
/// It returns data needed to construct a block to work on.
/// For full specification, see BIPs 22, 23, 9, and 145:
/// <https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki>
/// <https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki>
/// <https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes>
/// <https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki>
#[derive(Debug, Serialize)]
pub struct GetblocktemplateParams {
    /// Format of the template
    pub template_request: GetBlockTemplateRequest,
}

/// Compute statistics about the total number and rate of transactions in the chain.
#[derive(Debug, Serialize)]
pub struct GetchaintxstatsParams {
    /// Size of the window in number of blocks
    pub nblocks: Option<i64>,
    /// The hash of the block that ends the window.
    #[serde(rename = "blockhash")]
    pub block_hash: Option<bitcoin::BlockHash>,
}

/// Returns an object containing various state info regarding deployments of consensus changes.
#[derive(Debug, Serialize)]
pub struct GetdeploymentinfoParams {
    /// The block hash at which to query deployment state
    #[serde(rename = "blockhash")]
    pub block_hash: Option<bitcoin::BlockHash>,
}

/// 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()`.
/// This call may take several minutes. If you encounter timeouts, try specifying no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
#[derive(Debug, Serialize)]
pub struct GetdescriptoractivityParams {
    /// The list of blockhashes to examine for activity. Order doesn't matter. Must be along main chain or an error is thrown.
    pub blockhashes: Vec<serde_json::Value>,
    /// The list of descriptors (scan objects) to examine for activity. Every scan object is either a string descriptor or an object:
    pub scanobjects: Vec<serde_json::Value>,
    /// Whether to include unconfirmed activity
    pub include_mempool: Option<bool>,
}

/// Analyses a descriptor.
#[derive(Debug, Serialize)]
pub struct GetdescriptorinfoParams {
    /// The descriptor.
    pub descriptor: String,
}

/// List all BIP 32 HD keys in the wallet and which descriptors use them.
#[derive(Debug, Serialize)]
pub struct GethdkeysParams {
    pub options: Option<serde_json::Value>,
}

/// Returns the status of one or all available indices currently running in the node.
#[derive(Debug, Serialize)]
pub struct GetindexinfoParams {
    /// Filter results for an index with a specific name.
    pub index_name: Option<String>,
}

/// Returns an object containing information about memory usage.
#[derive(Debug, Serialize)]
pub struct GetmemoryinfoParams {
    /// determines what kind of information is returned.
    /// - "stats" returns general statistics about memory usage in the daemon.
    /// - "mallocinfo" returns an XML string describing low-level heap state (only available if compiled with glibc).
    pub mode: Option<String>,
}

/// If txid is in the mempool, returns all in-mempool ancestors.
#[derive(Debug, Serialize)]
pub struct GetmempoolancestorsParams {
    /// The transaction id (must be in mempool)
    pub txid: bitcoin::Txid,
    /// True for a json object, false for array of transaction ids
    pub verbose: Option<bool>,
}

/// If txid is in the mempool, returns all in-mempool descendants.
#[derive(Debug, Serialize)]
pub struct GetmempooldescendantsParams {
    /// The transaction id (must be in mempool)
    pub txid: bitcoin::Txid,
    /// True for a json object, false for array of transaction ids
    pub verbose: Option<bool>,
}

/// Returns mempool data for given transaction
#[derive(Debug, Serialize)]
pub struct GetmempoolentryParams {
    /// The transaction id (must be in mempool)
    pub txid: bitcoin::Txid,
}

/// Returns the estimated network hashes per second based on the last n blocks.
/// Pass in \[blocks\] to override # of blocks, -1 specifies since last difficulty change.
/// Pass in \[height\] to estimate the network speed at the time when a certain block was found.
#[derive(Debug, Serialize)]
pub struct GetnetworkhashpsParams {
    /// The number of previous blocks to calculate estimate from, or -1 for blocks since last difficulty change.
    pub nblocks: Option<i64>,
    /// To estimate at the time of the given height.
    pub height: Option<i64>,
}

/// Returns a new Bitcoin address for receiving payments.
/// If 'label' is specified, it is added to the address book
/// so payments received with the address will be associated with 'label'.
#[derive(Debug, Serialize)]
pub struct GetnewaddressParams {
    /// The label name for the address to be linked to. It can also be set to the empty string "" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name.
    pub label: Option<String>,
    /// The address type to use. Options are "legacy", "p2sh-segwit", "bech32", "bech32m".
    pub address_type: Option<String>,
}

/// Return known addresses, after filtering for quality and recency.
/// These can potentially be used to find new peers in the network.
/// The total number of addresses known to the node may be higher.
#[derive(Debug, Serialize)]
pub struct GetnodeaddressesParams {
    /// The maximum number of addresses to return. Specify 0 to return all known addresses.
    pub count: Option<i64>,
    /// Return only addresses of the specified network. Can be one of: ipv4, ipv6, onion, i2p, cjdns.
    pub network: Option<String>,
}

/// Shows transactions in the tx orphanage.
/// EXPERIMENTAL warning: this call may be changed in future releases.
#[derive(Debug, Serialize)]
pub struct GetorphantxsParams {
    /// 0 for an array of txids (may contain duplicates), 1 for an array of objects with tx details, and 2 for details from (1) and tx hex
    pub verbosity: Option<i64>,
}

/// Returns a new Bitcoin address, for receiving change.
/// This is for use with raw transactions, NOT normal use.
#[derive(Debug, Serialize)]
pub struct GetrawchangeaddressParams {
    /// The address type to use. Options are "legacy", "p2sh-segwit", "bech32", "bech32m".
    pub address_type: Option<String>,
}

/// Returns all transaction ids in memory pool as a json array of string transaction ids.
/// Hint: use getmempoolentry to fetch a specific transaction from the mempool.
#[derive(Debug, Serialize)]
pub struct GetrawmempoolParams {
    /// True for a json object, false for array of transaction ids
    pub verbose: Option<bool>,
    /// If verbose=false, returns a json object with transaction list and mempool sequence number attached.
    pub mempool_sequence: Option<bool>,
}

/// By default, this call only returns a transaction if it is in the mempool. If -txindex is enabled
/// and no blockhash argument is passed, it will return the transaction if it is in the mempool or any block.
/// If a blockhash argument is passed, it will return the transaction if
/// the specified block is available and the transaction is in that block.
/// Hint: Use gettransaction for wallet transactions.
/// If verbosity is 0 or omitted, returns the serialized transaction as a hex-encoded string.
/// If verbosity is 1, returns a JSON Object with information about the transaction.
/// If verbosity is 2, returns a JSON Object with information about the transaction, including fee and prevout information.
#[derive(Debug, Serialize)]
pub struct GetrawtransactionParams {
    /// The transaction id
    pub txid: bitcoin::Txid,
    /// 0 for hex-encoded data, 1 for a JSON object, and 2 for JSON object with fee and prevout
    pub verbosity: Option<i64>,
    /// The block in which to look for the transaction
    #[serde(rename = "blockhash")]
    pub block_hash: Option<bitcoin::BlockHash>,
}

/// Returns the total amount received by the given address in transactions with at least minconf confirmations.
#[derive(Debug, Serialize)]
pub struct GetreceivedbyaddressParams {
    /// The bitcoin address for transactions.
    pub address: bitcoin::Address,
    /// Only include transactions confirmed at least this many times.
    #[serde(rename = "minconf")]
    pub min_conf: Option<i64>,
    /// Include immature coinbase transactions.
    pub include_immature_coinbase: Option<bool>,
}

/// Returns the total amount received by addresses with &lt;label&gt; in transactions with at least \[minconf\] confirmations.
#[derive(Debug, Serialize)]
pub struct GetreceivedbylabelParams {
    /// The selected label, may be the default label using "".
    pub label: String,
    /// Only include transactions confirmed at least this many times.
    #[serde(rename = "minconf")]
    pub min_conf: Option<i64>,
    /// Include immature coinbase transactions.
    pub include_immature_coinbase: Option<bool>,
}

/// Get detailed information about in-wallet transaction &lt;txid&gt;
#[derive(Debug, Serialize)]
pub struct GettransactionParams {
    /// The transaction id
    pub txid: bitcoin::Txid,
    /// (DEPRECATED) No longer used
    pub include_watchonly: Option<bool>,
    /// Whether to include a `decoded` field containing the decoded transaction (equivalent to RPC decoderawtransaction)
    pub verbose: Option<bool>,
}

/// Returns details about an unspent transaction output.
#[derive(Debug, Serialize)]
pub struct GettxoutParams {
    /// The transaction id
    pub txid: bitcoin::Txid,
    /// vout number
    pub n: i64,
    /// Whether to include the mempool. Note that an unspent output that is spent in the mempool won't appear.
    pub include_mempool: Option<bool>,
}

/// Returns a hex-encoded proof that "txid" was included in a block.
/// NOTE: By default this function only works sometimes. This is when there is an
/// unspent output in the utxo for this transaction. To make it always work,
/// you need to maintain a transaction index, using the -txindex command line option or
/// specify the block in which the transaction is included manually (by blockhash).
#[derive(Debug, Serialize)]
pub struct GettxoutproofParams {
    /// The txids to filter
    pub txids: Vec<serde_json::Value>,
    /// If specified, looks for txid in the block with this hash
    #[serde(rename = "blockhash")]
    pub block_hash: Option<bitcoin::BlockHash>,
}

/// Returns statistics about the unspent transaction output set.
/// Note this call may take some time if you are not using coinstatsindex.
#[derive(Debug, Serialize)]
pub struct GettxoutsetinfoParams {
    /// Which UTXO set hash should be calculated. Options: 'hash_serialized_3' (the legacy algorithm), 'muhash', 'none'.
    pub hash_type: Option<String>,
    /// The block hash or height of the target height (only available with coinstatsindex).
    pub hash_or_height: Option<i64>,
    /// Use coinstatsindex, if available.
    pub use_index: Option<bool>,
}

/// Scans the mempool (and the txospenderindex, if available) to find transactions spending any of the given outputs
#[derive(Debug, Serialize)]
pub struct GettxspendingprevoutParams {
    /// The transaction outputs that we want to check, and within each, the txid (string) vout (numeric).
    pub outputs: Vec<serde_json::Value>,
    pub options: Option<serde_json::Value>,
}

/// List all commands, or get help for a specified command.
#[derive(Debug, Serialize)]
pub struct HelpParams {
    /// The command to get help on
    pub command: Option<String>,
}

/// 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.
/// 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.
/// Note: This call can take over an hour to complete if using an early timestamp; during that time, other rpc calls
/// may report that the imported keys, addresses or scripts exist but related transactions are still missing.
/// The rescan is significantly faster if block filters are available (using startup option "-blockfilterindex=1").
#[derive(Debug, Serialize)]
pub struct ImportdescriptorsParams {
    /// Data to be imported
    pub requests: Vec<serde_json::Value>,
}

/// Import a mempool.dat file and attempt to add its contents to the mempool.
/// Warning: Importing untrusted files is dangerous, especially if metadata from the file is taken over.
#[derive(Debug, Serialize)]
pub struct ImportmempoolParams {
    /// The mempool file
    #[serde(rename = "filepath")]
    pub file_path: String,
    pub options: Option<serde_json::Value>,
}

/// 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.
#[derive(Debug, Serialize)]
pub struct ImportprunedfundsParams {
    /// A raw transaction in hex funding an already-existing address in wallet
    pub rawtransaction: String,
    /// The hex output from gettxoutproof that contains the transaction
    pub txoutproof: String,
}

/// Permanently marks a block as invalid, as if it violated a consensus rule.
#[derive(Debug, Serialize)]
pub struct InvalidateblockParams {
    /// the hash of the block to mark as invalid
    #[serde(rename = "blockhash")]
    pub block_hash: bitcoin::BlockHash,
}

/// Joins multiple distinct PSBTs with different inputs and outputs into one PSBT with inputs and outputs from all of the PSBTs
/// No input in any of the PSBTs can be in more than one of the PSBTs.
#[derive(Debug, Serialize)]
pub struct JoinpsbtsParams {
    /// The base64 strings of partially signed transactions
    pub txs: Vec<serde_json::Value>,
}

/// Refills each descriptor keypool in the wallet up to the specified number of new keys.
/// By default, descriptor wallets have 4 active ranged descriptors ("legacy", "p2sh-segwit", "bech32", "bech32m"), each with 1000 entries.
/// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
#[derive(Debug, Serialize)]
pub struct KeypoolrefillParams {
    /// The new keypool size
    pub newsize: Option<i64>,
}

/// List all descriptors present in a wallet.
#[derive(Debug, Serialize)]
pub struct ListdescriptorsParams {
    /// Show private descriptors.
    pub private: Option<bool>,
}

/// Returns the list of all labels, or labels that are assigned to addresses with a specific purpose.
#[derive(Debug, Serialize)]
pub struct ListlabelsParams {
    /// Address purpose to list labels for ('send','receive'). An empty string is the same as not providing this argument.
    pub purpose: Option<String>,
}

/// List balances by receiving address.
#[derive(Debug, Serialize)]
pub struct ListreceivedbyaddressParams {
    /// The minimum number of confirmations before payments are included.
    #[serde(rename = "minconf")]
    pub min_conf: Option<i64>,
    /// Whether to include addresses that haven't received any payments.
    pub include_empty: Option<bool>,
    /// (DEPRECATED) No longer used
    pub include_watchonly: Option<bool>,
    /// If present and non-empty, only return information on this address.
    pub address_filter: Option<String>,
    /// Include immature coinbase transactions.
    pub include_immature_coinbase: Option<bool>,
}

/// List received transactions by label.
#[derive(Debug, Serialize)]
pub struct ListreceivedbylabelParams {
    /// The minimum number of confirmations before payments are included.
    #[serde(rename = "minconf")]
    pub min_conf: Option<i64>,
    /// Whether to include labels that haven't received any payments.
    pub include_empty: Option<bool>,
    /// (DEPRECATED) No longer used
    pub include_watchonly: Option<bool>,
    /// Include immature coinbase transactions.
    pub include_immature_coinbase: Option<bool>,
}

/// Get all transactions in blocks since block \[blockhash\], or all transactions if omitted.
/// If "blockhash" is no longer a part of the main chain, transactions from the fork point onward are included.
/// Additionally, if include_removed is set, transactions affecting the wallet which were removed are returned in the "removed" array.
#[derive(Debug, Serialize)]
pub struct ListsinceblockParams {
    /// If set, the block hash to list transactions since, otherwise list all transactions.
    #[serde(rename = "blockhash")]
    pub block_hash: Option<bitcoin::BlockHash>,
    /// Return the nth block hash from the main chain. e.g. 1 would mean the best block hash. Note: this is not used as a filter, but only affects \[lastblock\] in the return value
    pub target_confirmations: Option<i64>,
    /// (DEPRECATED) No longer used
    pub include_watchonly: Option<bool>,
    /// Show transactions that were removed due to a reorg in the "removed" array
    /// (not guaranteed to work on pruned nodes)
    pub include_removed: Option<bool>,
    /// Also add entries for change outputs.
    pub include_change: Option<bool>,
    /// Return only incoming transactions paying to addresses with the specified label.
    pub label: Option<String>,
}

/// If a label name is provided, this will return only incoming transactions paying to addresses with the specified label.
/// Returns up to 'count' most recent transactions ordered from oldest to newest while skipping the first number of
/// transactions specified in the 'skip' argument. A transaction can have multiple entries in this RPC response.
/// For instance, a wallet transaction that pays three addresses — one wallet-owned and two external — will produce
/// four entries. The payment to the wallet-owned address appears both as a send entry and as a receive entry.
/// As a result, the RPC response will contain one entry in the receive category and three entries in the send category.
#[derive(Debug, Serialize)]
pub struct ListtransactionsParams {
    /// If set, should be a valid label name to return only incoming transactions
    /// with the specified label, or "*" to disable filtering and return all transactions.
    pub label: Option<String>,
    /// The number of transactions to return
    pub count: Option<i64>,
    /// The number of transactions to skip
    pub skip: Option<i64>,
    /// (DEPRECATED) No longer used
    pub include_watchonly: Option<bool>,
}

/// Returns array of unspent transaction outputs
/// with between minconf and maxconf (inclusive) confirmations.
/// Optionally filter to only include txouts paid to specified addresses.
#[derive(Debug, Serialize)]
pub struct ListunspentParams {
    /// The minimum confirmations to filter
    #[serde(rename = "minconf")]
    pub min_conf: Option<i64>,
    /// The maximum confirmations to filter
    #[serde(rename = "maxconf")]
    pub max_conf: Option<i64>,
    /// The bitcoin addresses to filter
    pub addresses: Option<Vec<serde_json::Value>>,
    /// Include outputs that are not safe to spend
    /// See description of "safe" attribute below.
    pub include_unsafe: Option<bool>,
    pub query_options: Option<serde_json::Value>,
}

/// Load the serialized UTXO set from a file.
/// 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.
/// 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.
/// You can find more information on this process in the `assumeutxo` design document (<https://github.com/bitcoin/bitcoin/blob/master/doc/design/assumeutxo.md>).
#[derive(Debug, Serialize)]
pub struct LoadtxoutsetParams {
    /// path to the snapshot file. If relative, will be prefixed by datadir.
    pub path: String,
}

/// Loads a wallet from a wallet file or directory.
/// Note that all wallet command-line options used when starting bitcoind will be
/// applied to the new wallet.
#[derive(Debug, Serialize)]
pub struct LoadwalletParams {
    /// The path to the directory of the wallet to be loaded, either absolute or relative to the "wallets" directory. The "wallets" directory is set by the -walletdir option and defaults to the "wallets" folder within the data directory.
    pub filename: String,
    /// Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged.
    pub load_on_startup: Option<bool>,
}

/// Updates list of temporarily unspendable outputs.
/// Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs.
/// If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked.
/// A locked transaction output will not be chosen by automatic coin selection, when spending bitcoins.
/// Manually selected coins are automatically unlocked.
/// Locks are stored in memory only, unless persistent=true, in which case they will be written to the
/// wallet database and loaded on node start. Unwritten (persistent=false) locks are always cleared
/// (by virtue of process exit) when a node stops or fails. Unlocking will clear both persistent and not.
/// Also see the listunspent call
#[derive(Debug, Serialize)]
pub struct LockunspentParams {
    /// Whether to unlock (true) or lock (false) the specified transactions
    pub unlock: bool,
    /// The transaction outputs and within each, the txid (string) vout (numeric).
    pub transactions: Option<Vec<serde_json::Value>>,
    /// Whether to write/erase this lock in the wallet database, or keep the change in memory only. Ignored for unlocking.
    pub persistent: Option<bool>,
}

/// Gets and sets the logging configuration.
/// When called without an argument, returns the list of categories with status that are currently being debug logged or not.
/// When called with arguments, adds or removes categories from debug logging and return the lists above.
/// The arguments are evaluated in order "include", "exclude".
/// If an item is both included and excluded, it will thus end up being excluded.
/// The valid logging categories are: addrman, bench, blockstorage, cmpctblock, coindb, estimatefee, http, i2p, ipc, kernel, leveldb, libevent, mempool, mempoolrej, net, privatebroadcast, proxy, prune, qt, rand, reindex, rpc, scan, selectcoins, tor, txpackages, txreconciliation, validation, walletdb, zmq
/// In addition, the following are available as category names with special meanings:
/// - "all",  "1" : represent all logging categories.
#[derive(Debug, Serialize)]
pub struct LoggingParams {
    /// The categories to add to debug logging
    pub include: Option<Vec<serde_json::Value>>,
    /// The categories to remove from debug logging
    pub exclude: Option<Vec<serde_json::Value>>,
}

/// Migrate the wallet to a descriptor wallet.
/// A new wallet backup will need to be made.
/// The migration process will create a backup of the wallet before migrating. This backup
/// file will be named &lt;wallet name&gt;-&lt;timestamp&gt;.legacy.bak and can be found in the directory
/// for this wallet. In the event of an incorrect migration, the backup can be restored using restorewallet.
/// Encrypted wallets must have the passphrase provided as an argument to this call.
/// This RPC may take a long time to complete. Increasing the RPC client timeout is recommended.
#[derive(Debug, Serialize)]
pub struct MigratewalletParams {
    /// The name of the wallet to migrate. If provided both here and in the RPC endpoint, the two must be identical.
    pub wallet_name: Option<String>,
    /// The wallet passphrase
    pub passphrase: Option<String>,
}

/// Bump the scheduler into the future (-regtest only)
#[derive(Debug, Serialize)]
pub struct MockschedulerParams {
    /// Number of seconds to forward the scheduler into the future.
    pub delta_time: i64,
}

/// Treats a block as if it were received before others with the same work.
/// A later preciousblock call can override the effect of an earlier one.
/// The effects of preciousblock are not retained across restarts.
#[derive(Debug, Serialize)]
pub struct PreciousblockParams {
    /// the hash of the block to mark as precious
    #[serde(rename = "blockhash")]
    pub block_hash: bitcoin::BlockHash,
}

/// Accepts the transaction into mined blocks at a higher (or lower) priority
#[derive(Debug, Serialize)]
pub struct PrioritisetransactionParams {
    /// The transaction id.
    pub txid: bitcoin::Txid,
    /// API-Compatibility for previous API. Must be zero or null.
    /// DEPRECATED. For forward compatibility use named arguments and omit this parameter.
    pub dummy: Option<i64>,
    /// The fee value (in satoshis) to add (or subtract, if negative).
    /// Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX.
    /// The fee is not actually paid, only the algorithm for selecting transactions into a block
    /// considers the transaction as it would have paid a higher (or lower) fee.
    pub fee_delta: i64,
}

/// Attempts to delete block and undo data up to a specified height or timestamp, if eligible for pruning.
/// 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.
#[derive(Debug, Serialize)]
pub struct PruneblockchainParams {
    /// The block height to prune up to. May be set to a discrete height, or to a UNIX epoch time
    /// to prune blocks whose block time is at least 2 hours older than the provided timestamp.
    pub height: i64,
}

/// Bumps the fee of a transaction T, replacing it with a new transaction B.
/// Returns a PSBT instead of creating and signing a new transaction.
/// A transaction with the given txid must be in the wallet.
/// The command will pay the additional fee by reducing change outputs or adding inputs when necessary.
/// It may add a new change output if one does not already exist.
/// All inputs in the original transaction will be included in the replacement transaction.
/// The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs.
/// By default, the new fee will be calculated automatically using the estimatesmartfee RPC.
/// The user can specify a confirmation target for estimatesmartfee.
/// Alternatively, the user can specify a fee rate in sat/vB for the new transaction.
/// At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee
/// returned by getnetworkinfo) to enter the node's mempool.
/// * WARNING: before version 0.21, fee_rate was in BTC/kvB. As of 0.21, fee_rate is in sat/vB. *
#[derive(Debug, Serialize)]
pub struct PsbtbumpfeeParams {
    /// The txid to be bumped
    pub txid: bitcoin::Txid,
    pub options: Option<serde_json::Value>,
}

/// Removes invalidity status of a block, its ancestors and its descendants, reconsider them for activation.
/// This can be used to undo the effects of invalidateblock.
#[derive(Debug, Serialize)]
pub struct ReconsiderblockParams {
    /// the hash of the block to reconsider
    #[serde(rename = "blockhash")]
    pub block_hash: bitcoin::BlockHash,
}

/// Deletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.
#[derive(Debug, Serialize)]
pub struct RemoveprunedfundsParams {
    /// The hex-encoded id of the transaction you are deleting
    pub txid: bitcoin::Txid,
}

/// Rescan the local blockchain for wallet related transactions.
/// Note: Use "getwalletinfo" to query the scanning progress.
/// The rescan is significantly faster if block filters are available
/// (using startup option "-blockfilterindex=1").
#[derive(Debug, Serialize)]
pub struct RescanblockchainParams {
    /// block height where the rescan should start
    pub start_height: Option<i64>,
    /// the last block height that should be scanned. If none is provided it will rescan up to the tip at return time of this call.
    pub stop_height: Option<i64>,
}

/// Restores and loads a wallet from backup.
/// The rescan is significantly faster if block filters are available
/// (using startup option "-blockfilterindex=1").
#[derive(Debug, Serialize)]
pub struct RestorewalletParams {
    /// The name that will be applied to the restored wallet
    pub wallet_name: String,
    /// The backup file that will be used to restore the wallet.
    pub backup_file: String,
    /// Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged.
    pub load_on_startup: Option<bool>,
}

/// Return relevant blockhashes for given descriptors (requires blockfilterindex).
/// This call may take several minutes. Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
#[derive(Debug, Serialize)]
pub struct ScanblocksParams {
    /// The action to execute
    /// "start" for starting a scan
    /// "abort" for aborting the current scan (returns true when abort was successful)
    /// "status" for progress report (in %) of the current scan
    pub action: String,
    /// Array of scan objects. Required for "start" action
    /// Every scan object is either a string descriptor or an object:
    pub scanobjects: Option<Vec<serde_json::Value>>,
    /// Height to start to scan from
    pub start_height: Option<i64>,
    /// Height to stop to scan
    pub stop_height: Option<i64>,
    /// The type name of the filter
    pub filtertype: Option<String>,
    pub options: Option<serde_json::Value>,
}

/// Scans the unspent transaction output set for entries that match certain output descriptors.
/// Examples of output descriptors are:
/// addr(&lt;address&gt;)                      Outputs whose output script corresponds to the specified address (does not include P2PK)
/// raw(&lt;hex script&gt;)                    Outputs whose output script equals the specified hex-encoded bytes
/// combo(&lt;pubkey&gt;)                      P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH outputs for the given pubkey
/// pkh(&lt;pubkey&gt;)                        P2PKH outputs for the given pubkey
/// sh(multi(&lt;n&gt;,&lt;pubkey&gt;,&lt;pubkey&gt;,...)) P2SH-multisig outputs for the given threshold and pubkeys
/// tr(&lt;pubkey&gt;)                         P2TR
/// tr(&lt;pubkey&gt;,{pk(&lt;pubkey&gt;)})          P2TR with single fallback pubkey in tapscript
/// rawtr(&lt;pubkey&gt;)                      P2TR with the specified key as output key rather than inner
/// wsh(and_v(v:pk(&lt;pubkey&gt;),after(2)))  P2WSH miniscript with mandatory pubkey and a timelock
/// In the above, &lt;pubkey&gt; either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one
/// or more path elements separated by "/", and optionally ending in "/*" (unhardened), or "/*'" or "/*h" (hardened) to specify all
/// unhardened or hardened child keys.
/// In the latter case, a range needs to be specified by below if different from 1000.
/// For more information on output descriptors, see the documentation in the doc/descriptors.md file.
#[derive(Debug, Serialize)]
pub struct ScantxoutsetParams {
    /// The action to execute
    /// "start" for starting a scan
    /// "abort" for aborting the current scan (returns true when abort was successful)
    /// "status" for progress report (in %) of the current scan
    pub action: String,
    /// Array of scan objects. Required for "start" action
    /// Every scan object is either a string descriptor or an object:
    pub scanobjects: Option<Vec<serde_json::Value>>,
}

/// EXPERIMENTAL warning: this call may be changed in future releases.
/// Send a transaction.
#[derive(Debug, Serialize)]
pub struct SendParams {
    /// The outputs specified as key-value pairs.
    /// Each key may only appear once, i.e. there can only be one 'data' output, and no address may be duplicated.
    /// At least one output of either type must be specified.
    /// For convenience, a dictionary, which holds the key-value pairs directly, is also accepted.
    pub outputs: Vec<serde_json::Value>,
    /// Confirmation target in blocks
    pub conf_target: Option<i64>,
    /// The fee estimate mode, must be one of (case insensitive):
    /// unset, economical, conservative
    /// unset means no mode set (economical mode is used if the transaction is replaceable;
    /// otherwise, conservative mode is used).
    /// economical estimates use a shorter time horizon, making them more
    /// responsive to short-term drops in the prevailing fee market. This mode
    /// potentially returns a lower fee rate estimate.
    /// conservative estimates use a longer time horizon, making them
    /// less responsive to short-term drops in the prevailing fee market. This mode
    /// potentially returns a higher fee rate estimate.
    pub estimate_mode: Option<String>,
    /// Specify a fee rate in sat/vB.
    #[serde(with = "bitcoin_units::fee_rate::serde::as_sat_per_vb_floor::opt")]
    pub fee_rate: Option<FeeRate>,
    pub options: Option<serde_json::Value>,
    /// Transaction version
    pub version: Option<i64>,
}

/// EXPERIMENTAL warning: this call may be changed in future releases.
/// Spend the value of all (or specific) confirmed UTXOs and unconfirmed change in the wallet to one or more recipients.
/// Unconfirmed inbound UTXOs and locked UTXOs will not be spent. Sendall will respect the avoid_reuse wallet flag.
/// 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.
#[derive(Debug, Serialize)]
pub struct SendallParams {
    /// The sendall destinations. Each address may only appear once.
    /// Optionally some recipients can be specified with an amount to perform payments, but at least one address must appear without a specified amount.
    pub recipients: Vec<SendallRecipient>,
    /// Confirmation target in blocks
    pub conf_target: Option<i64>,
    /// The fee estimate mode, must be one of (case insensitive):
    /// unset, economical, conservative
    /// unset means no mode set (economical mode is used if the transaction is replaceable;
    /// otherwise, conservative mode is used).
    /// economical estimates use a shorter time horizon, making them more
    /// responsive to short-term drops in the prevailing fee market. This mode
    /// potentially returns a lower fee rate estimate.
    /// conservative estimates use a longer time horizon, making them
    /// less responsive to short-term drops in the prevailing fee market. This mode
    /// potentially returns a higher fee rate estimate.
    pub estimate_mode: Option<String>,
    /// Specify a fee rate in sat/vB.
    #[serde(with = "bitcoin_units::fee_rate::serde::as_sat_per_vb_floor::opt")]
    pub fee_rate: Option<FeeRate>,
    pub options: Option<serde_json::Value>,
}

/// Send multiple times. Amounts are double-precision floating point numbers.
/// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
#[derive(Debug, Serialize)]
pub struct SendmanyParams {
    /// Must be set to "" for backwards compatibility.
    pub dummy: Option<String>,
    /// The addresses and amounts
    #[serde(with = "crate::bitcoin_core_client::params::serde_amounts_map")]
    pub amounts: std::collections::HashMap<
        bitcoin::Address<bitcoin::address::NetworkUnchecked>,
        bitcoin::Amount,
    >,
    /// Ignored dummy value
    #[serde(rename = "minconf")]
    pub min_conf: Option<i64>,
    /// A comment
    pub comment: Option<String>,
    /// The addresses.
    /// The fee will be equally deducted from the amount of each selected address.
    /// Those recipients will receive less bitcoins than you enter in their corresponding amount field.
    /// If no addresses are specified here, the sender pays the fee.
    pub subtractfeefrom: Option<Vec<bitcoin::Address<bitcoin::address::NetworkUnchecked>>>,
    /// Signal that this transaction can be replaced by a transaction (BIP 125)
    pub replaceable: Option<bool>,
    /// Confirmation target in blocks
    pub conf_target: Option<i64>,
    /// The fee estimate mode, must be one of (case insensitive):
    /// unset, economical, conservative
    /// unset means no mode set (economical mode is used if the transaction is replaceable;
    /// otherwise, conservative mode is used).
    /// economical estimates use a shorter time horizon, making them more
    /// responsive to short-term drops in the prevailing fee market. This mode
    /// potentially returns a lower fee rate estimate.
    /// conservative estimates use a longer time horizon, making them
    /// less responsive to short-term drops in the prevailing fee market. This mode
    /// potentially returns a higher fee rate estimate.
    pub estimate_mode: Option<String>,
    /// Specify a fee rate in sat/vB.
    #[serde(with = "bitcoin_units::fee_rate::serde::as_sat_per_vb_floor::opt")]
    pub fee_rate: Option<FeeRate>,
    /// If true, return extra information about the transaction.
    pub verbose: Option<bool>,
}

/// Send a p2p message to a peer specified by id.
/// The message type and body must be provided, the message header will be generated.
/// This RPC is for testing only.
#[derive(Debug, Serialize)]
pub struct SendmsgtopeerParams {
    /// The peer to send the message to.
    pub peer_id: i64,
    /// The message type (maximum length 12)
    pub msg_type: String,
    /// The serialized message body to send, in hex, without a message header
    pub msg: String,
}

/// Submit a raw transaction (serialized, hex-encoded) to the network.
/// If -privatebroadcast is disabled, then the transaction will be put into the
/// local mempool of the node and will be sent unconditionally to all currently
/// connected peers, so using sendrawtransaction for manual rebroadcast will degrade
/// privacy by leaking the transaction's origin, as nodes will normally not
/// rebroadcast non-wallet transactions already in their mempool.
/// If -privatebroadcast is enabled, then the transaction will be sent only via
/// dedicated, short-lived connections to Tor or I2P peers or IPv4/IPv6 peers
/// via the Tor network. This conceals the transaction's origin. The transaction
/// will only enter the local mempool when it is received back from the network.
/// A specific exception, RPC_TRANSACTION_ALREADY_IN_UTXO_SET, may throw if the transaction cannot be added to the mempool.
/// Related RPCs: createrawtransaction, signrawtransactionwithkey
#[derive(Debug, Serialize)]
pub struct SendrawtransactionParams {
    /// The hex string of the raw transaction
    #[serde(rename = "hexstring")]
    pub hex_string: String,
    /// Reject transactions whose fee rate is higher than the specified value, expressed in BTC/kvB.
    /// Fee rates larger than 1BTC/kvB are rejected.
    /// Set to 0 to accept any fee rate.
    #[serde(with = "crate::bitcoin_core_client::params::serde_fee_rate::maxfeerate_opt")]
    #[serde(rename = "maxfeerate")]
    pub max_fee_rate: Option<FeeRate>,
    /// Reject transactions with provably unspendable outputs (e.g. 'datacarrier' outputs that use the OP_RETURN opcode) greater than the specified value, expressed in BTC.
    /// If burning funds through unspendable outputs is desired, increase this value.
    /// This check is based on heuristics and does not guarantee spendability of outputs.
    #[serde(rename = "maxburnamount")]
    pub max_burn_amount: Option<bitcoin::Amount>,
}

/// Send an amount to a given address.
/// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
#[derive(Debug, Serialize)]
pub struct SendtoaddressParams {
    /// The bitcoin address to send to.
    pub address: bitcoin::Address,
    /// The amount in BTC to send. eg 0.1
    pub amount: bitcoin::Amount,
    /// A comment used to store what the transaction is for.
    /// This is not part of the transaction, just kept in your wallet.
    pub comment: Option<String>,
    /// A comment to store the name of the person or organization
    /// to which you're sending the transaction. This is not part of the
    /// transaction, just kept in your wallet.
    pub comment_to: Option<String>,
    /// The fee will be deducted from the amount being sent.
    /// The recipient will receive less bitcoins than you enter in the amount field.
    #[serde(rename = "subtractfeefromamount")]
    pub subtract_fee_from_amount: Option<bool>,
    /// Signal that this transaction can be replaced by a transaction (BIP 125)
    pub replaceable: Option<bool>,
    /// Confirmation target in blocks
    pub conf_target: Option<i64>,
    /// The fee estimate mode, must be one of (case insensitive):
    /// unset, economical, conservative
    /// unset means no mode set (economical mode is used if the transaction is replaceable;
    /// otherwise, conservative mode is used).
    /// economical estimates use a shorter time horizon, making them more
    /// responsive to short-term drops in the prevailing fee market. This mode
    /// potentially returns a lower fee rate estimate.
    /// conservative estimates use a longer time horizon, making them
    /// less responsive to short-term drops in the prevailing fee market. This mode
    /// potentially returns a higher fee rate estimate.
    pub estimate_mode: Option<String>,
    /// (only available if avoid_reuse wallet flag is set) Avoid spending from dirty addresses; addresses are considered
    /// dirty if they have previously been used in a transaction. If true, this also activates avoidpartialspends, grouping outputs by their addresses.
    pub avoid_reuse: Option<bool>,
    /// Specify a fee rate in sat/vB.
    #[serde(with = "bitcoin_units::fee_rate::serde::as_sat_per_vb_floor::opt")]
    pub fee_rate: Option<FeeRate>,
    /// If true, return extra information about the transaction.
    pub verbose: Option<bool>,
}

/// Attempts to add or remove an IP/Subnet from the banned list.
#[derive(Debug, Serialize)]
pub struct SetbanParams {
    /// The IP/Subnet (see getpeerinfo for nodes IP) with an optional netmask (default is /32 = single IP)
    pub subnet: String,
    /// 'add' to add an IP/Subnet to the list, 'remove' to remove an IP/Subnet from the list
    pub command: String,
    /// time in seconds how long (or until when if \[absolute\] is set) the IP is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)
    #[serde(rename = "bantime")]
    pub ban_time: Option<i64>,
    /// If set, the bantime must be an absolute timestamp expressed in UNIX epoch time
    pub absolute: Option<bool>,
}

/// Sets the label associated with the given address.
#[derive(Debug, Serialize)]
pub struct SetlabelParams {
    /// The bitcoin address to be associated with a label.
    pub address: bitcoin::Address,
    /// The label to assign to the address.
    pub label: String,
}

/// Set the local time to given timestamp (-regtest only)
#[derive(Debug, Serialize)]
pub struct SetmocktimeParams {
    /// UNIX epoch time
    /// Pass 0 to go back to using the system time.
    pub timestamp: i64,
}

/// Disable/enable all p2p network activity.
#[derive(Debug, Serialize)]
pub struct SetnetworkactiveParams {
    /// true to enable networking, false to disable
    pub state: bool,
}

/// Change the state of the given wallet flag for a wallet.
#[derive(Debug, Serialize)]
pub struct SetwalletflagParams {
    /// The name of the flag to change. Current available flags: avoid_reuse
    pub flag: String,
    /// The new state.
    pub value: Option<bool>,
}

/// Sign a message with the private key of an address
/// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
#[derive(Debug, Serialize)]
pub struct SignmessageParams {
    /// The bitcoin address to use for the private key.
    pub address: bitcoin::Address,
    /// The message to create a signature of.
    pub message: String,
}

/// Sign a message with the private key of an address
#[derive(Debug, Serialize)]
pub struct SignmessagewithprivkeyParams {
    /// The private key to sign the message with.
    pub privkey: String,
    /// The message to create a signature of.
    pub message: String,
}

/// Sign inputs for raw transaction (serialized, hex-encoded).
/// The second argument is an array of base58-encoded private
/// keys that will be the only keys used to sign the transaction.
/// The third optional argument (may be null) is an array of previous transaction outputs that
/// this transaction depends on but may not yet be in the block chain.
#[derive(Debug, Serialize)]
pub struct SignrawtransactionwithkeyParams {
    /// The transaction hex string
    #[serde(rename = "hexstring")]
    pub hex_string: String,
    /// The base58-encoded private keys for signing
    #[serde(rename = "privkeys")]
    pub priv_keys: Vec<serde_json::Value>,
    /// The previous dependent transaction outputs
    #[serde(rename = "prevtxs")]
    pub prev_txs: Option<Vec<serde_json::Value>>,
    /// The signature hash type. Must be one of:
    /// "DEFAULT"
    /// "ALL"
    /// "NONE"
    /// "SINGLE"
    /// "ALL|ANYONECANPAY"
    /// "NONE|ANYONECANPAY"
    /// "SINGLE|ANYONECANPAY"
    #[serde(rename = "sighashtype")]
    pub sighash_type: Option<String>,
}

/// Sign inputs for raw transaction (serialized, hex-encoded).
/// The second optional argument (may be null) is an array of previous transaction outputs that
/// this transaction depends on but may not yet be in the block chain.
/// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
#[derive(Debug, Serialize)]
pub struct SignrawtransactionwithwalletParams {
    /// The transaction hex string
    #[serde(rename = "hexstring")]
    pub hex_string: String,
    /// The previous dependent transaction outputs
    #[serde(rename = "prevtxs")]
    pub prev_txs: Option<Vec<serde_json::Value>>,
    /// The signature hash type. Must be one of
    /// "DEFAULT"
    /// "ALL"
    /// "NONE"
    /// "SINGLE"
    /// "ALL|ANYONECANPAY"
    /// "NONE|ANYONECANPAY"
    /// "SINGLE|ANYONECANPAY"
    #[serde(rename = "sighashtype")]
    pub sighash_type: Option<String>,
}

/// Calculate the balance change resulting in the signing and broadcasting of the given transaction(s).
#[derive(Debug, Serialize)]
pub struct SimulaterawtransactionParams {
    /// An array of hex strings of raw transactions.
    pub rawtxs: Option<Vec<serde_json::Value>>,
    pub options: Option<serde_json::Value>,
}

/// Request a graceful shutdown of Bitcoin Core.
#[derive(Debug, Serialize)]
pub struct StopParams {
    /// how long to wait in ms
    pub wait: Option<i64>,
}

/// Attempts to submit new block to network.
/// See <https://en.bitcoin.it/wiki/BIP_0022> for full specification.
#[derive(Debug, Serialize)]
pub struct SubmitblockParams {
    /// the hex-encoded block data to submit
    pub hexdata: String,
    /// dummy value, for compatibility with BIP22. This value is ignored.
    pub dummy: Option<String>,
}

/// Decode the given hexdata as a header and submit it as a candidate chain tip if valid.
/// Throws when the header is invalid.
#[derive(Debug, Serialize)]
pub struct SubmitheaderParams {
    /// the hex-encoded block header data
    pub hexdata: String,
}

/// Submit a package of raw transactions (serialized, hex-encoded) to local node.
/// The package will be validated according to consensus and mempool policy rules. If any transaction passes, it will be accepted to mempool.
/// This RPC is experimental and the interface may be unstable. Refer to doc/policy/packages.md for documentation on package policies.
/// Warning: successful submission does not mean the transactions will propagate throughout the network.
#[derive(Debug, Serialize)]
pub struct SubmitpackageParams {
    /// An array of raw transactions.
    /// The package must consist of a transaction with (some, all, or none of) its unconfirmed parents. A single transaction is permitted.
    /// None of the parents may depend on each other. Parents that are already in mempool do not need to be present in the package.
    /// The package must be topologically sorted, with the child being the last element in the array if there are multiple elements.
    pub package: Vec<serde_json::Value>,
    /// Reject transactions whose fee rate is higher than the specified value, expressed in BTC/kvB.
    /// Fee rates larger than 1BTC/kvB are rejected.
    /// Set to 0 to accept any fee rate.
    #[serde(with = "crate::bitcoin_core_client::params::serde_fee_rate::maxfeerate_opt")]
    #[serde(rename = "maxfeerate")]
    pub max_fee_rate: Option<FeeRate>,
    /// Reject transactions with provably unspendable outputs (e.g. 'datacarrier' outputs that use the OP_RETURN opcode) greater than the specified value, expressed in BTC.
    /// If burning funds through unspendable outputs is desired, increase this value.
    /// This check is based on heuristics and does not guarantee spendability of outputs.
    #[serde(rename = "maxburnamount")]
    pub max_burn_amount: Option<bitcoin::Amount>,
}

/// Returns result of mempool acceptance tests indicating if raw transaction(s) (serialized, hex-encoded) would be accepted by mempool.
/// 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.
/// If one transaction fails, other transactions may not be fully validated (the 'allowed' key will be blank).
/// The maximum number of transactions allowed is 25.
/// This checks if transactions violate the consensus or policy rules.
/// See sendrawtransaction call.
#[derive(Debug, Serialize)]
pub struct TestmempoolacceptParams {
    /// An array of hex strings of raw transactions.
    pub rawtxs: Vec<serde_json::Value>,
    /// Reject transactions whose fee rate is higher than the specified value, expressed in BTC/kvB.
    /// Fee rates larger than 1BTC/kvB are rejected.
    /// Set to 0 to accept any fee rate.
    #[serde(with = "crate::bitcoin_core_client::params::serde_fee_rate::maxfeerate_opt")]
    #[serde(rename = "maxfeerate")]
    pub max_fee_rate: Option<FeeRate>,
}

/// Unloads the wallet referenced by the request endpoint or the wallet_name argument.
/// If both are specified, they must be identical.
#[derive(Debug, Serialize)]
pub struct UnloadwalletParams {
    /// The name of the wallet to unload. If provided both here and in the RPC endpoint, the two must be identical.
    pub wallet_name: Option<String>,
    /// Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged.
    pub load_on_startup: Option<bool>,
}

/// Updates all segwit inputs and outputs in a PSBT with data from output descriptors, the UTXO set, txindex, or the mempool.
#[derive(Debug, Serialize)]
pub struct UtxoupdatepsbtParams {
    /// A base64 string of a PSBT
    pub psbt: String,
    /// An array of either strings or objects
    pub descriptors: Option<Vec<serde_json::Value>>,
}

/// Return information about the given bitcoin address.
#[derive(Debug, Serialize)]
pub struct ValidateaddressParams {
    /// The bitcoin address to validate
    pub address: bitcoin::Address,
}

/// Verifies blockchain database.
#[derive(Debug, Serialize)]
pub struct VerifychainParams {
    /// How thorough the block verification is:
    /// - level 0 reads the blocks from disk
    /// - level 1 verifies block validity
    /// - level 2 verifies undo data
    /// - level 3 checks disconnection of tip blocks
    /// - level 4 tries to reconnect the blocks
    /// - each level includes the checks of the previous levels
    pub checklevel: Option<i64>,
    /// The number of blocks to check.
    pub nblocks: Option<i64>,
}

/// Verify a signed message.
#[derive(Debug, Serialize)]
pub struct VerifymessageParams {
    /// The bitcoin address to use for the signature.
    pub address: bitcoin::Address,
    /// The signature provided by the signer in base 64 encoding (see signmessage).
    pub signature: String,
    /// The message that was signed.
    pub message: String,
}

/// Verifies that a proof points to a transaction in a block, returning the transaction it commits to
/// and throwing an RPC error if the block is not in our best chain
#[derive(Debug, Serialize)]
pub struct VerifytxoutproofParams {
    /// The hex-encoded proof generated by gettxoutproof
    pub proof: String,
}

/// Waits for a specific new block and returns useful info about it.
/// Returns the current block on timeout or exit.
/// Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
#[derive(Debug, Serialize)]
pub struct WaitforblockParams {
    /// Block hash to wait for.
    #[serde(rename = "blockhash")]
    pub block_hash: bitcoin::BlockHash,
    /// Time in milliseconds to wait for a response. 0 indicates no timeout.
    pub timeout: Option<i64>,
}

/// Waits for (at least) block height and returns the height and hash
/// of the current tip.
/// Returns the current block on timeout or exit.
/// Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
#[derive(Debug, Serialize)]
pub struct WaitforblockheightParams {
    /// Block height to wait for.
    pub height: i64,
    /// Time in milliseconds to wait for a response. 0 indicates no timeout.
    pub timeout: Option<i64>,
}

/// Waits for any new block and returns useful info about it.
/// Returns the current block on timeout or exit.
/// Make sure to use no RPC timeout (bitcoin-cli -rpcclienttimeout=0)
#[derive(Debug, Serialize)]
pub struct WaitfornewblockParams {
    /// Time in milliseconds to wait for a response. 0 indicates no timeout.
    pub timeout: Option<i64>,
    /// Method waits for the chain tip to differ from this.
    pub current_tip: Option<String>,
}

/// Creates and funds a transaction in the Partially Signed Transaction format.
/// Implements the Creator and Updater roles.
/// All existing inputs must either have their previous output transaction be in the wallet
/// or be in the UTXO set. Solving data must be provided for non-wallet inputs.
#[derive(Debug, Serialize)]
pub struct WalletcreatefundedpsbtParams {
    /// Leave empty to add inputs automatically. See add_inputs option.
    pub inputs: Option<Vec<serde_json::Value>>,
    /// The outputs specified as key-value pairs.
    /// Each key may only appear once, i.e. there can only be one 'data' output, and no address may be duplicated.
    /// At least one output of either type must be specified.
    /// For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also
    /// accepted as second parameter.
    pub outputs: Vec<serde_json::Value>,
    /// Raw locktime. Non-0 value also locktime-activates inputs
    #[serde(rename = "locktime")]
    pub lock_time: Option<i64>,
    pub options: Option<serde_json::Value>,
    /// Include BIP 32 derivation paths for public keys if we know them
    #[serde(rename = "bip32derivs")]
    pub bip32_derivs: Option<bool>,
    /// Transaction version
    pub version: Option<i64>,
}

/// Display address on an external signer for verification.
#[derive(Debug, Serialize)]
pub struct WalletdisplayaddressParams {
    /// bitcoin address to display
    pub address: bitcoin::Address,
}

/// Stores the wallet decryption key in memory for 'timeout' seconds.
/// This is needed prior to performing transactions related to private keys such as sending bitcoins
/// Note:
/// Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock
/// time that overrides the old one.
#[derive(Debug, Serialize)]
pub struct WalletpassphraseParams {
    /// The wallet passphrase
    pub passphrase: String,
    /// The time to keep the decryption key in seconds; capped at 100000000 (~3 years).
    pub timeout: i64,
}

/// Changes the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.
#[derive(Debug, Serialize)]
pub struct WalletpassphrasechangeParams {
    /// The current passphrase
    #[serde(rename = "oldpassphrase")]
    pub old_passphrase: String,
    /// The new passphrase
    #[serde(rename = "newpassphrase")]
    pub new_passphrase: String,
}

/// Update a PSBT with input information from our wallet and then sign inputs
/// that we can sign for.
/// Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
#[derive(Debug, Serialize)]
pub struct WalletprocesspsbtParams {
    /// The transaction base64 string
    pub psbt: String,
    /// Also sign the transaction when updating (requires wallet to be unlocked)
    pub sign: Option<bool>,
    /// The signature hash type to sign with if not specified by the PSBT. Must be one of
    /// "DEFAULT"
    /// "ALL"
    /// "NONE"
    /// "SINGLE"
    /// "ALL|ANYONECANPAY"
    /// "NONE|ANYONECANPAY"
    /// "SINGLE|ANYONECANPAY"
    #[serde(rename = "sighashtype")]
    pub sighash_type: Option<String>,
    /// Include BIP 32 derivation paths for public keys if we know them
    #[serde(rename = "bip32derivs")]
    pub bip32_derivs: Option<bool>,
    /// Also finalize inputs if possible
    pub finalize: Option<bool>,
}