@mr-zwets/bchn-api-wrapper 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.claude/settings.local.json +8 -0
  2. package/.github/workflows/ci.yaml +36 -0
  3. package/CLAUDE.md +70 -0
  4. package/README.md +121 -129
  5. package/dist/interfaces/interfaces.d.ts +13 -0
  6. package/dist/interfaces/restInterfaces/interfaces.d.ts +124 -18
  7. package/dist/interfaces/rpcInterfaces/blockchain.d.ts +293 -102
  8. package/dist/interfaces/rpcInterfaces/control.d.ts +6 -0
  9. package/dist/interfaces/rpcInterfaces/generating.d.ts +2 -0
  10. package/dist/interfaces/rpcInterfaces/mining.d.ts +9 -0
  11. package/dist/interfaces/rpcInterfaces/network.d.ts +18 -0
  12. package/dist/interfaces/rpcInterfaces/rawtransactions.d.ts +21 -0
  13. package/dist/interfaces/rpcInterfaces/util.d.ts +5 -0
  14. package/dist/interfaces/rpcInterfaces/wallet.d.ts +54 -0
  15. package/dist/interfaces/rpcInterfaces/zmq.d.ts +1 -0
  16. package/dist/restClient.d.ts +13 -1
  17. package/dist/restClient.js +19 -6
  18. package/dist/rpcClient.d.ts +7 -0
  19. package/dist/rpcClient.js +7 -0
  20. package/package.json +7 -8
  21. package/pnpm-lock.yaml +1279 -0
  22. package/src/index.ts +3 -3
  23. package/src/interfaces/interfaces.ts +96 -86
  24. package/src/interfaces/restInterfaces/interfaces.ts +235 -116
  25. package/src/interfaces/rpcInterfaces/blockchain.ts +932 -758
  26. package/src/interfaces/rpcInterfaces/control.ts +68 -62
  27. package/src/interfaces/rpcInterfaces/generating.ts +23 -21
  28. package/src/interfaces/rpcInterfaces/index.ts +13 -13
  29. package/src/interfaces/rpcInterfaces/mining.ts +151 -143
  30. package/src/interfaces/rpcInterfaces/network.ts +213 -195
  31. package/src/interfaces/rpcInterfaces/rawtransactions.ts +332 -314
  32. package/src/interfaces/rpcInterfaces/util.ts +56 -52
  33. package/src/interfaces/rpcInterfaces/wallet.ts +728 -674
  34. package/src/interfaces/rpcInterfaces/zmq.ts +12 -11
  35. package/src/restClient.ts +134 -119
  36. package/src/rpcClient.ts +100 -93
  37. package/src/utils/errors.ts +6 -6
  38. package/src/utils/utils.ts +55 -55
  39. package/test/restClient.test.ts +33 -31
  40. package/test/rpcClient.test.ts +119 -115
  41. package/test/setupTests.ts +56 -54
  42. package/test/tsconfig.json +4 -4
  43. package/tsconfig.json +13 -13
  44. package/vitest.config.ts +8 -8
  45. package/CHANGELOG.md +0 -7
@@ -1,759 +1,933 @@
1
- /* --- Blockchain Commands --- */
2
- // progress 33/33
3
-
4
- import type { TokenData, Transaction, TransactionInput } from "../interfaces.js";
5
-
6
- export interface FinalizeBlock {
7
- method: 'finalizeblock';
8
- params: [
9
- blockhash: string
10
- ];
11
- }
12
-
13
- export interface GetBestBlockHash {
14
- method: 'getbestblockhash';
15
- params: [];
16
- response: string;
17
- }
18
-
19
- interface GetBlockBase {
20
- method: 'getblock';
21
- params: [
22
- blockhash: string,
23
- verbosity?: number | boolean
24
- ];
25
- }
26
-
27
- // Verbosity = 0 (or false)
28
- export interface GetBlockVerbosity0 extends GetBlockBase {
29
- params: [
30
- blockhash: string,
31
- verbosity?: 0 | false
32
- ];
33
- response: string
34
- }
35
-
36
- // Verbosity = 1 (or true)
37
- export interface GetBlockVerbosity1 extends GetBlockBase {
38
- params: [
39
- blockhash: string,
40
- verbosity?: 1 | true
41
- ];
42
- response: {
43
- hash: string;
44
- confirmations: number;
45
- size: number;
46
- height: number;
47
- version: number;
48
- versionHex: string;
49
- merkleroot: string;
50
- tx : string[]
51
- time: number;
52
- mediantime: number;
53
- nonce: number;
54
- bits: string;
55
- difficulty: number;
56
- chainwork: string;
57
- nTx: number;
58
- previousblockhash: string;
59
- nextblockhash: string;
60
- ablastate: {
61
- epsilon: number;
62
- beta: number;
63
- blocksize: number;
64
- blocksizelimit: number;
65
- nextblocksizelimit: number;
66
- }
67
- }
68
- }
69
-
70
- // Verbosity = 2
71
- export interface GetBlockVerbosity2 extends GetBlockBase {
72
- params: [
73
- blockhash: string,
74
- verbosity: 2
75
- ];
76
- response: {
77
- hash: string;
78
- confirmations: number;
79
- size: number;
80
- height: number;
81
- version: number;
82
- versionHex: string;
83
- merkleroot: string;
84
- tx: {
85
- txid: string;
86
- fee?: number;
87
- }[];
88
- time: number;
89
- mediantime: number;
90
- nonce: number;
91
- bits: string;
92
- difficulty: number;
93
- chainwork: string;
94
- nTx: number;
95
- previousblockhash: string;
96
- nextblockhash: string;
97
- ablastate?: {
98
- epsilon: number;
99
- beta: number;
100
- blocksize: number;
101
- blocksizelimit: number;
102
- nextblocksizelimit: number;
103
- };
104
- };
105
- }
106
-
107
- export interface TransactionInputWithPrevout extends TransactionInput {
108
- prevout?: {
109
- generated: boolean;
110
- height: number;
111
- value: number;
112
- scriptPubKey: {
113
- asm: string;
114
- hex: string;
115
- type: 'nonstandard' | 'pubkey' | 'pubkeyhash' | 'scripthash' | 'multisig' | 'nulldata';
116
- address?: string;
117
- };
118
- tokenData?: TokenData;
119
- };
120
- }
121
-
122
- // GetBlockVerbosity3 uses enhanced TransactionInputWithPrevout
123
- export interface TransactionWithPrevout extends Omit<Transaction, 'vin'> {
124
- vin: TransactionInputWithPrevout[]; // Use the extended input type with `prevout`
125
- }
126
-
127
- // Verbosity = 3
128
- export interface GetBlockVerbosity3 extends GetBlockBase {
129
- params: [
130
- blockhash: string,
131
- verbosity: 3
132
- ];
133
- response: {
134
- hash: string;
135
- confirmations: number;
136
- size: number;
137
- height: number;
138
- version: number;
139
- versionHex: string;
140
- merkleroot: string;
141
- tx: TransactionWithPrevout[];
142
- time: number;
143
- mediantime: number;
144
- nonce: number;
145
- bits: string;
146
- difficulty: number;
147
- chainwork: string;
148
- nTx: number;
149
- previousblockhash: string;
150
- nextblockhash: string;
151
- ablastate?: {
152
- epsilon: number;
153
- beta: number;
154
- blocksize: number;
155
- blocksizelimit: number;
156
- nextblocksizelimit: number;
157
- };
158
- };
159
- }
160
-
161
- export interface GetBlockchainInfo {
162
- method: 'getblockchaininfo';
163
- params: [];
164
- response: {
165
- chain: 'main' | 'test' | 'regtest';
166
- blocks: number;
167
- headers: number;
168
- bestblockhash: string;
169
- difficulty: number;
170
- mediantime: number;
171
- verificationprogress: number;
172
- initialblockdownload: boolean;
173
- chainwork: string;
174
- size_on_disk: number;
175
- pruned: boolean;
176
- pruneheight: number;
177
- automatic_pruning: boolean;
178
- prune_target_size?: number;
179
- warnings: string;
180
- }
181
- }
182
-
183
- export interface GetBlockCount {
184
- method: 'getblockcount';
185
- params: [];
186
- response: number;
187
- }
188
-
189
- export interface GetBlockHash {
190
- method: 'getblockhash';
191
- params: [
192
- height: number
193
- ];
194
- response: string;
195
- }
196
-
197
- export interface GetBlockHeaderBase {
198
- method: 'getblockheader';
199
- params: [
200
- hash_or_height: string| number,
201
- verbosity?: boolean | number
202
- ];
203
- }
204
-
205
- export interface GetBlockHeaderVerbosity0 extends GetBlockHeaderBase {
206
- params: [
207
- hash_or_height: string| number,
208
- verbosity?: false | 0
209
- ];
210
- response: string;
211
- }
212
-
213
- export interface GetBlockHeaderVerbosity1 extends GetBlockHeaderBase {
214
- params: [
215
- hash_or_height: string| number,
216
- verbosity?: true | 1
217
- ];
218
- response: {
219
- hash: string;
220
- confirmations: number;
221
- height: number;
222
- version: number;
223
- versionHex: string;
224
- merkleroot: string;
225
- time: number;
226
- mediantime: number;
227
- nonce: number;
228
- bits: string;
229
- difficulty: number;
230
- chainwork: string;
231
- nTx: number;
232
- previousblockhash: string;
233
- nextblockhash: string;
234
- ablastate : {
235
- epsilon: number;
236
- beta: number;
237
- blocksize: number;
238
- blocksizelimit: number;
239
- nextblocksizelimit: number;
240
- }
241
- };
242
- }
243
-
244
- export interface GetBlockStats {
245
- method: 'getblockheader';
246
- params: [
247
- hash_or_height: string| number,
248
- stats?: string[]
249
- ];
250
- response: {
251
- avgfee: number;
252
- avgfeerate: number;
253
- avgtxsize: number;
254
- blockhash: string;
255
- feerate_percentiles: {
256
- "10th_percentile_feerate": number;
257
- "25th_percentile_feerate": number;
258
- "50th_percentile_feerate": number;
259
- "75th_percentile_feerate": number;
260
- "90th_percentile_feerate": number;
261
- };
262
- height: number;
263
- ins: number;
264
- maxfee: number;
265
- maxfeerate: number;
266
- maxtxsize: number;
267
- medianfee: number;
268
- mediantime: number;
269
- mediantxsize: number;
270
- minfee: number;
271
- minfeerate: number;
272
- mintxsize: number;
273
- outs: number;
274
- subsidy: number;
275
- time: number;
276
- total_out: number;
277
- total_size: number;
278
- totalfee: number;
279
- txs: number;
280
- utxo_increase: number;
281
- utxo_size_inc: number;
282
- }
283
-
284
- }
285
-
286
- export interface GetChainTips {
287
- method: 'getchaintips';
288
- params: [];
289
- response: {
290
- height: number
291
- hash: string
292
- branchlen:number
293
- status: 'active' | 'parked' | 'headers-only' | 'valid-headers' | 'valid-fork' | 'active'
294
- }[]
295
- }
296
-
297
- export interface GetChainTxStats {
298
- method: 'getchaintxstats';
299
- params: [
300
- nblocks?: number,
301
- blockhash?: string
302
- ];
303
- response: {
304
- time: number;
305
- txcount: number;
306
- window_final_block_hash: string;
307
- window_block_count: number;
308
- window_tx_count: number | undefined;
309
- window_interval: number | undefined;
310
- txrate: number;
311
- }
312
- }
313
-
314
- export interface GetDifficulty {
315
- method: 'getdifficulty';
316
- params: [];
317
- response: number;
318
- }
319
-
320
- interface GetDsProofBase {
321
- method: 'getdsproof';
322
- params: [
323
- dspid_or_txid_or_outpoint: string | { txid: string; vout: number },
324
- verbosity?: number | boolean,
325
- recursive?: boolean
326
- ];
327
- }
328
-
329
- // Verbosity = 0 (or false)
330
- export interface GetDsProofVerbosity0 extends GetDsProofBase {
331
- params: [
332
- dspid_or_txid_or_outpoint: string | { txid: string; vout: number },
333
- verbosity?: 0 | false,
334
- recursive?: boolean
335
- ];
336
- response: {
337
- hex: string;
338
- txid: string | null;
339
- path?: string[]; // Optional for recursive = true
340
- };
341
- }
342
-
343
- // Verbosity = 1
344
- export interface GetDsProofVerbosity1 extends GetDsProofBase {
345
- params: [
346
- dspid_or_txid_or_outpoint: string | { txid: string; vout: number },
347
- verbosity?: 1,
348
- recursive?: boolean
349
- ];
350
- response: {
351
- hex: string;
352
- txid: string | null;
353
- path?: string[]; // Optional for recursive = true
354
- descendants?: string[]
355
- };
356
- }
357
-
358
- // Verbosity = 2 (or true)
359
- export interface GetDsProofVerbosity2 extends GetDsProofBase {
360
- params: [
361
- dspid_or_txid_or_outpoint: string | { txid: string; vout: number },
362
- verbosity?: 2 | true,
363
- recursive?: boolean
364
- ];
365
- response: {
366
- dspid: string;
367
- txid: string | null;
368
- outpoint: {
369
- txid: string;
370
- vout: number;
371
- };
372
- descendants?: string[];
373
- path?: string[]; // Optional for recursive = true
374
- };
375
- }
376
-
377
- interface Spender {
378
- txversion: number,
379
- sequence: number,
380
- locktime: number,
381
- hashprevoutputs: string,
382
- hashsequence: string,
383
- hashoutputs: string,
384
- pushdata: {
385
- asm: string,
386
- hex: string
387
- }
388
- }
389
-
390
- // Verbosity = 3
391
- export interface GetDsProofVerbosity3 extends GetDsProofVerbosity2 {
392
- response: {
393
- dspid: string;
394
- txid: string | null;
395
- outpoint: {
396
- txid: string;
397
- vout: number;
398
- };
399
- spenders: Spender[];
400
- descendants?: string[];
401
- path?: string[]; // Optional for recursive = true
402
- };
403
- }
404
-
405
- export interface GetDsProofListBase {
406
- method: 'getdsprooflist';
407
- params: [
408
- verbosity?: number | boolean,
409
- include_orphans?: boolean
410
- ];
411
- }
412
-
413
- // Verbosity = 0 (or false)
414
- export interface GetDsProofListVerbosity0 extends GetDsProofListBase {
415
- params: [
416
- verbosity?: 0 | false,
417
- include_orphans?: boolean
418
- ];
419
- response: string[]
420
- }
421
-
422
- // Verbosity = 1
423
- export interface GetDsProofListVerbosity1 extends GetDsProofListBase {
424
- params: [
425
- verbosity?: 1,
426
- include_orphans?: boolean
427
- ];
428
- response: {
429
- hex: string;
430
- txid: string | null;
431
- }[]
432
- }
433
-
434
- // Verbosity = 2 (or true)
435
- export interface GetDsProofListVerbosity2 extends GetDsProofListBase {
436
- params: [
437
- verbosity?: 2 | true,
438
- include_orphans?: boolean
439
- ];
440
- response: {
441
- dspid: string;
442
- txid: string | null;
443
- outpoint: {
444
- txid: string;
445
- vout: number;
446
- };
447
- }[]
448
- }
449
-
450
- // Verbosity = 3
451
- export interface GetDsProofListVerbosity3 extends GetDsProofListBase {
452
- response: {
453
- dspid: string;
454
- txid: string | null;
455
- outpoint: {
456
- txid: string;
457
- vout: number;
458
- };
459
- spenders: Spender[]
460
- }[]
461
- }
462
-
463
- export interface GetDsProofScore {
464
- method: 'getdsproofscore';
465
- params: [
466
- txid: string
467
- ];
468
- response: number;
469
- }
470
-
471
- export interface GetFinalizedBlockHash {
472
- method: 'getfinalizedblockhash';
473
- params: [];
474
- response: string;
475
- }
476
-
477
- interface GetMempoolAncestorsBase {
478
- method: 'getmempoolancestors';
479
- params: [
480
- txid: string,
481
- verbose?: boolean | number
482
- ];
483
- }
484
-
485
- // Verbosity 0 (false)
486
- export interface GetMempoolAncestorsVerbosity0 extends GetMempoolAncestorsBase {
487
- params: [
488
- txid: string,
489
- verbose?: false | 0
490
- ];
491
- response: string[];
492
- }
493
-
494
- // Verbosity 1 (true)
495
- export interface GetMempoolAncestorsVerbosity1 extends GetMempoolAncestorsBase {
496
- params: [
497
- txid: string,
498
- verbose?: true | 1
499
- ];
500
- response: {
501
- [transactionid: string]: {
502
- size: number;
503
- time: number;
504
- fees: {
505
- base: number;
506
- modified: number;
507
- };
508
- depends: string[];
509
- spentby: string[];
510
- };
511
- };
512
- }
513
-
514
- interface GetMempoolDescendantsBase {
515
- method: 'getmempooldescendants';
516
- params: [
517
- txid: string,
518
- verbose?: boolean | number
519
- ];
520
- }
521
-
522
- // Verbosity 0 (false)
523
- export interface GetMempoolDescendantsVerbosity0 extends GetMempoolDescendantsBase {
524
- params: [
525
- txid: string,
526
- verbose?: false | 0
527
- ];
528
- response: string[];
529
- }
530
-
531
- // Verbosity 1 (true)
532
- export interface GetMempoolDescendantsVerbosity1 extends GetMempoolDescendantsBase {
533
- params: [
534
- txid: string,
535
- verbose?: true | 1
536
- ];
537
- response: {
538
- [transactionid: string]: {
539
- size: number;
540
- time: number;
541
- fees: {
542
- base: number;
543
- modified: number;
544
- };
545
- depends: string[];
546
- spentby: string[];
547
- };
548
- };
549
- }
550
-
551
- export interface GetMempoolEntry {
552
- method: 'getmempoolentry';
553
- params: [
554
- txid: string
555
- ];
556
- response: {
557
- size: number;
558
- time: number;
559
- fees: {
560
- base: number;
561
- modified: number;
562
- };
563
- depends: string[];
564
- spentby: string[];
565
- };
566
- }
567
-
568
- export interface GetMempoolInfo {
569
- method: 'getmempoolinfo';
570
- params: [];
571
- response: {
572
- loaded: boolean;
573
- size: number;
574
- bytes: number;
575
- usage: number;
576
- maxmempool: number;
577
- mempoolminfee: number;
578
- minrelaytxfee: number;
579
- }
580
- }
581
-
582
- interface GetRawMempoolBase {
583
- method: 'getrawmempool';
584
- params: [
585
- verbose?: boolean | number
586
- ];
587
- }
588
-
589
- // Verbosity 0 (false)
590
- export interface GetRawMempoolVerbosity0 extends GetRawMempoolBase {
591
- params: [
592
- verbose?: false | 0
593
- ];
594
- response: string[];
595
- }
596
-
597
- // Verbosity 1 (true)
598
- export interface GetRawMempoolVerbosity1 extends GetRawMempoolBase {
599
- params: [
600
- verbose?: true | 1
601
- ];
602
- response: {
603
- [transactionid: string]: {
604
- size: number;
605
- time: number;
606
- fees: {
607
- base: number;
608
- modified: number;
609
- };
610
- depends: string[];
611
- spentby: string[];
612
- };
613
- };
614
- }
615
-
616
- export interface GetTxOut {
617
- method: 'gettxout';
618
- params: [
619
- txid: string,
620
- vout: number,
621
- include_mempool?: boolean
622
- ];
623
- response: {
624
- bestblock: string;
625
- confirmations: number
626
- value: number;
627
- scriptPubKey: {
628
- asm: string;
629
- hex: string;
630
- type: string;
631
- addresses: string[];
632
- }
633
- tokenData?: TokenData;
634
- coinbase: boolean;
635
- }
636
- }
637
-
638
- export interface GetTxOutProof {
639
- method: 'gettxoutproof';
640
- params: [
641
- txids: string[],
642
- blockhash?: string
643
- ];
644
- response: string;
645
- }
646
-
647
-
648
- export interface GetTxOutSetInfo {
649
- method: 'gettxoutsetinfo';
650
- params: [
651
- txid: string
652
- ];
653
- response: {
654
- height: number;
655
- bestblock: string;
656
- transactions: number;
657
- txouts: number;
658
- bogosize: number;
659
- hash_serialized: string;
660
- disk_size: number;
661
- total_amount: number;
662
- }
663
- }
664
-
665
- export interface InvalidateBlock {
666
- method: 'invalidateblock';
667
- params: [
668
- blockhash: string
669
- ];
670
- response: null;
671
- }
672
-
673
- export interface ParkBlock {
674
- method: 'parkblock';
675
- params: [
676
- blockhash: string
677
- ];
678
- response: null;
679
- }
680
-
681
- export interface PreciousBlock {
682
- method: 'preciousblock';
683
- params: [
684
- blockhash: string
685
- ];
686
- response: null;
687
- }
688
-
689
- export interface PruneBlockchain {
690
- method: 'pruneblockchain';
691
- params: [
692
- height: number
693
- ];
694
- response: number;
695
- }
696
-
697
- export interface ReconsiderBlock {
698
- method: 'reconsiderblock';
699
- params: [
700
- blockhash: string
701
- ];
702
- response: null;
703
- }
704
-
705
- export interface SaveMempool {
706
- method: 'savemempool';
707
- params: [];
708
- response: null;
709
- }
710
-
711
- export interface ScanTxOutSet {
712
- method: 'scantxoutset';
713
- params: [
714
- action: 'start' | 'abort' | 'status',
715
- scanobjects?: Array<string | {
716
- desc: string;
717
- range?: number;
718
- }>
719
- ];
720
- response: {
721
- unspents: Array<{
722
- txid: string;
723
- vout: number;
724
- scriptPubKey: string;
725
- amount: number;
726
- height: number;
727
- tokenData?: TokenData;
728
- }>;
729
- total_amount: number;
730
- token_total_amount?: {
731
- [category: string]: string;
732
- };
733
- } | boolean;
734
- }
735
-
736
- export interface UnparkBlock {
737
- method: 'unparkblock';
738
- params: [
739
- blockhash: string
740
- ];
741
- response: null;
742
- }
743
-
744
- export interface VerifyChain {
745
- method: 'verifychain';
746
- params: [
747
- checklevel?: number,
748
- nblocks?: number
749
- ];
750
- response: boolean;
751
- }
752
-
753
- export interface VerifyTxOutProof {
754
- method: 'verifytxoutproof';
755
- params: [
756
- proof: string
757
- ];
758
- response: string[];
1
+ /* --- Blockchain Commands --- */
2
+ // progress 33/33
3
+
4
+ import type { TokenData, Transaction, TransactionInput } from "../interfaces.js";
5
+
6
+ /** Finalize a block by hash (Avalanche post-consensus). */
7
+ export interface FinalizeBlock {
8
+ method: 'finalizeblock';
9
+ params: [
10
+ blockhash: string
11
+ ];
12
+ }
13
+
14
+ /** Returns the hash of the best (tip) block in the most-work chain. */
15
+ export interface GetBestBlockHash {
16
+ method: 'getbestblockhash';
17
+ params: [];
18
+ response: string;
19
+ }
20
+
21
+ interface GetBlockBase {
22
+ method: 'getblock';
23
+ params: [
24
+ blockhash: string,
25
+ verbosity?: number | boolean
26
+ ];
27
+ }
28
+
29
+ /** Adaptive Block Limit Algorithm state (activated May 2024). */
30
+ export interface AblaState {
31
+ epsilon: number;
32
+ beta: number;
33
+ blocksize: number;
34
+ blocksizelimit: number;
35
+ nextblocksizelimit: number;
36
+ }
37
+
38
+ /**
39
+ * Base block response fields shared across verbosity levels.
40
+ * @note `previousblockhash` not present on genesis block (height 0).
41
+ * @note `nextblockhash` not present on chain tip.
42
+ */
43
+ interface BlockResponseBase {
44
+ hash: string;
45
+ confirmations: number;
46
+ size: number;
47
+ height: number;
48
+ version: number;
49
+ versionHex: string;
50
+ merkleroot: string;
51
+ time: number;
52
+ mediantime: number;
53
+ nonce: number;
54
+ bits: string;
55
+ difficulty: number;
56
+ chainwork: string;
57
+ nTx: number;
58
+ previousblockhash: string;
59
+ nextblockhash: string;
60
+ }
61
+
62
+ /** Verbosity 0: Returns hex-encoded block data. */
63
+ export interface GetBlockVerbosity0 extends GetBlockBase {
64
+ params: [
65
+ blockhash: string,
66
+ verbosity?: 0 | false
67
+ ];
68
+ response: string
69
+ }
70
+
71
+ /** Verbosity 1 response: block with tx IDs as string array. */
72
+ interface BlockResponseVerbosity1 extends BlockResponseBase {
73
+ tx: string[];
74
+ }
75
+
76
+ /** Verbosity 1: Block with tx IDs - works for any block. */
77
+ export interface GetBlockVerbosity1 extends GetBlockBase {
78
+ params: [
79
+ blockhash: string,
80
+ verbosity?: 1 | true
81
+ ];
82
+ response: BlockResponseVerbosity1 & { ablastate?: AblaState };
83
+ }
84
+
85
+ /** Verbosity 1: Block with tx IDs - for blocks before ABLA activation (May 2024). */
86
+ export interface GetBlockVerbosity1PreAbla extends GetBlockBase {
87
+ params: [
88
+ blockhash: string,
89
+ verbosity?: 1 | true
90
+ ];
91
+ response: BlockResponseVerbosity1;
92
+ }
93
+
94
+ /** Verbosity 1: Block with tx IDs - for blocks after ABLA activation (May 2024). */
95
+ export interface GetBlockVerbosity1PostAbla extends GetBlockBase {
96
+ params: [
97
+ blockhash: string,
98
+ verbosity?: 1 | true
99
+ ];
100
+ response: BlockResponseVerbosity1 & { ablastate: AblaState };
101
+ }
102
+
103
+ /** Verbosity 2 response: block with tx objects containing txid and fee. */
104
+ interface BlockResponseVerbosity2 extends BlockResponseBase {
105
+ tx: {
106
+ txid: string;
107
+ fee?: number;
108
+ }[];
109
+ }
110
+
111
+ /** Verbosity 2: Block with txid/fee objects - works for any block. */
112
+ export interface GetBlockVerbosity2 extends GetBlockBase {
113
+ params: [
114
+ blockhash: string,
115
+ verbosity: 2
116
+ ];
117
+ response: BlockResponseVerbosity2 & { ablastate?: AblaState };
118
+ }
119
+
120
+ /** Verbosity 2: Block with txid/fee objects - for blocks before ABLA activation (May 2024). */
121
+ export interface GetBlockVerbosity2PreAbla extends GetBlockBase {
122
+ params: [
123
+ blockhash: string,
124
+ verbosity: 2
125
+ ];
126
+ response: BlockResponseVerbosity2;
127
+ }
128
+
129
+ /** Verbosity 2: Block with txid/fee objects - for blocks after ABLA activation (May 2024). */
130
+ export interface GetBlockVerbosity2PostAbla extends GetBlockBase {
131
+ params: [
132
+ blockhash: string,
133
+ verbosity: 2
134
+ ];
135
+ response: BlockResponseVerbosity2 & { ablastate: AblaState };
136
+ }
137
+
138
+ /** Transaction input extended with previous output data. */
139
+ export interface TransactionInputWithPrevout extends TransactionInput {
140
+ prevout?: {
141
+ generated: boolean;
142
+ height: number;
143
+ value: number;
144
+ scriptPubKey: {
145
+ asm: string;
146
+ hex: string;
147
+ type: 'nonstandard' | 'pubkey' | 'pubkeyhash' | 'scripthash' | 'multisig' | 'nulldata';
148
+ address?: string;
149
+ };
150
+ tokenData?: TokenData;
151
+ };
152
+ }
153
+
154
+ /** Transaction with prevout data on inputs (used by verbosity 3). */
155
+ export interface TransactionWithPrevout extends Omit<Transaction, 'vin'> {
156
+ vin: TransactionInputWithPrevout[]; // Use the extended input type with `prevout`
157
+ }
158
+
159
+ /** Verbosity 3 response: full transaction details with prevout. */
160
+ interface BlockResponseVerbosity3 extends BlockResponseBase {
161
+ tx: TransactionWithPrevout[];
162
+ }
163
+
164
+ /** Verbosity 3: Block with full tx objects including prevout - works for any block. */
165
+ export interface GetBlockVerbosity3 extends GetBlockBase {
166
+ params: [
167
+ blockhash: string,
168
+ verbosity: 3
169
+ ];
170
+ response: BlockResponseVerbosity3 & { ablastate?: AblaState };
171
+ }
172
+
173
+ /** Verbosity 3: Block with full tx objects including prevout - for blocks before ABLA activation (May 2024). */
174
+ export interface GetBlockVerbosity3PreAbla extends GetBlockBase {
175
+ params: [
176
+ blockhash: string,
177
+ verbosity: 3
178
+ ];
179
+ response: BlockResponseVerbosity3;
180
+ }
181
+
182
+ /** Verbosity 3: Block with full tx objects including prevout - for blocks after ABLA activation (May 2024). */
183
+ export interface GetBlockVerbosity3PostAbla extends GetBlockBase {
184
+ params: [
185
+ blockhash: string,
186
+ verbosity: 3
187
+ ];
188
+ response: BlockResponseVerbosity3 & { ablastate: AblaState };
189
+ }
190
+
191
+ /** Script fingerprint and pattern info for bytecode analysis (v29.0.0+). */
192
+ export interface ByteCodePattern {
193
+ fingerprint: string;
194
+ pattern: string;
195
+ patternArgsInfo?: string[];
196
+ }
197
+
198
+ /** Script with optional bytecode pattern metadata (v29.0.0+). */
199
+ export interface ScriptPubKeyWithPattern {
200
+ asm: string;
201
+ hex: string;
202
+ type: 'nonstandard' | 'pubkey' | 'pubkeyhash' | 'scripthash' | 'multisig' | 'nulldata';
203
+ address?: string;
204
+ byteCodePattern?: ByteCodePattern;
205
+ }
206
+
207
+ /** Transaction input with prevout and pattern info (v29.0.0+). */
208
+ export interface TransactionInputWithPattern extends TransactionInput {
209
+ prevout?: {
210
+ generated: boolean;
211
+ height: number;
212
+ value: number;
213
+ scriptPubKey: ScriptPubKeyWithPattern;
214
+ tokenData?: TokenData;
215
+ };
216
+ redeemScript?: {
217
+ asm: string;
218
+ hex: string;
219
+ type: string;
220
+ byteCodePattern?: ByteCodePattern;
221
+ p2shType?: string;
222
+ };
223
+ }
224
+
225
+ /** Transaction output with pattern-enabled scriptPubKey (v29.0.0+). */
226
+ export interface TransactionOutputWithPattern {
227
+ value: number;
228
+ n: number;
229
+ scriptPubKey: ScriptPubKeyWithPattern;
230
+ tokenData?: TokenData;
231
+ }
232
+
233
+ /** Transaction with bytecode patterns (v29.0.0+). */
234
+ export interface TransactionWithPattern {
235
+ txid: string;
236
+ hash: string;
237
+ size: number;
238
+ version: number;
239
+ locktime: number;
240
+ vin: TransactionInputWithPattern[];
241
+ vout: TransactionOutputWithPattern[];
242
+ fee?: number;
243
+ }
244
+
245
+ /** Verbosity 4 response: includes byteCodePattern (v29.0.0+). */
246
+ interface BlockResponseVerbosity4 extends BlockResponseBase {
247
+ tx: TransactionWithPattern[];
248
+ }
249
+
250
+ /** Verbosity 4: Block with bytecode patterns (v29.0.0+) - works for any block. */
251
+ export interface GetBlockVerbosity4 extends GetBlockBase {
252
+ params: [
253
+ blockhash: string,
254
+ verbosity: 4
255
+ ];
256
+ response: BlockResponseVerbosity4 & { ablastate?: AblaState };
257
+ }
258
+
259
+ /** Verbosity 4: Block with bytecode patterns (v29.0.0+) - for blocks before ABLA activation (May 2024). */
260
+ export interface GetBlockVerbosity4PreAbla extends GetBlockBase {
261
+ params: [
262
+ blockhash: string,
263
+ verbosity: 4
264
+ ];
265
+ response: BlockResponseVerbosity4;
266
+ }
267
+
268
+ /** Verbosity 4: Block with bytecode patterns (v29.0.0+) - for blocks after ABLA activation (May 2024). */
269
+ export interface GetBlockVerbosity4PostAbla extends GetBlockBase {
270
+ params: [
271
+ blockhash: string,
272
+ verbosity: 4
273
+ ];
274
+ response: BlockResponseVerbosity4 & { ablastate: AblaState };
275
+ }
276
+
277
+ /** Returns blockchain state, sync progress, and upcoming upgrade info. */
278
+ export interface GetBlockchainInfo {
279
+ method: 'getblockchaininfo';
280
+ params: [];
281
+ response: {
282
+ chain: 'main' | 'test' | 'regtest';
283
+ blocks: number;
284
+ headers: number;
285
+ bestblockhash: string;
286
+ difficulty: number;
287
+ mediantime: number;
288
+ verificationprogress: number;
289
+ initialblockdownload: boolean;
290
+ chainwork: string;
291
+ size_on_disk: number;
292
+ pruned: boolean;
293
+ pruneheight: number;
294
+ automatic_pruning: boolean;
295
+ prune_target_size?: number;
296
+ warnings: string;
297
+ upgrade_status: {
298
+ name: string;
299
+ mempool_activated: boolean;
300
+ mempool_activation_mtp: number;
301
+ block_preactivation_height: number;
302
+ block_preactivation_hash: string;
303
+ block_postactivation_height: number;
304
+ block_postactivation_hash: string;
305
+ software_expiration_time: number;
306
+ };
307
+ }
308
+ }
309
+
310
+ /** Returns the current block height. */
311
+ export interface GetBlockCount {
312
+ method: 'getblockcount';
313
+ params: [];
314
+ response: number;
315
+ }
316
+
317
+ /** Returns block hash at given height. */
318
+ export interface GetBlockHash {
319
+ method: 'getblockhash';
320
+ params: [
321
+ height: number
322
+ ];
323
+ response: string;
324
+ }
325
+
326
+ export interface GetBlockHeaderBase {
327
+ method: 'getblockheader';
328
+ params: [
329
+ hash_or_height: string| number,
330
+ verbosity?: boolean | number
331
+ ];
332
+ }
333
+
334
+ /** Verbosity 0: Returns hex-encoded block header. */
335
+ export interface GetBlockHeaderVerbosity0 extends GetBlockHeaderBase {
336
+ params: [
337
+ hash_or_height: string| number,
338
+ verbosity?: false | 0
339
+ ];
340
+ response: string;
341
+ }
342
+
343
+ /**
344
+ * Base header response fields.
345
+ * @note `previousblockhash` not present on genesis block (height 0).
346
+ * @note `nextblockhash` not present on chain tip.
347
+ */
348
+ interface HeaderResponseBase {
349
+ hash: string;
350
+ confirmations: number;
351
+ height: number;
352
+ version: number;
353
+ versionHex: string;
354
+ merkleroot: string;
355
+ time: number;
356
+ mediantime: number;
357
+ nonce: number;
358
+ bits: string;
359
+ difficulty: number;
360
+ chainwork: string;
361
+ nTx: number;
362
+ previousblockhash: string;
363
+ nextblockhash: string;
364
+ }
365
+
366
+ /** Verbosity 1: Parsed header object - works for any block. */
367
+ export interface GetBlockHeaderVerbosity1 extends GetBlockHeaderBase {
368
+ params: [
369
+ hash_or_height: string| number,
370
+ verbosity?: true | 1
371
+ ];
372
+ response: HeaderResponseBase & { ablastate?: AblaState };
373
+ }
374
+
375
+ /** Verbosity 1: Parsed header object - for blocks before ABLA activation (May 2024). */
376
+ export interface GetBlockHeaderVerbosity1PreAbla extends GetBlockHeaderBase {
377
+ params: [
378
+ hash_or_height: string| number,
379
+ verbosity?: true | 1
380
+ ];
381
+ response: HeaderResponseBase;
382
+ }
383
+
384
+ /** Verbosity 1: Parsed header object - for blocks after ABLA activation (May 2024). */
385
+ export interface GetBlockHeaderVerbosity1PostAbla extends GetBlockHeaderBase {
386
+ params: [
387
+ hash_or_height: string| number,
388
+ verbosity?: true | 1
389
+ ];
390
+ response: HeaderResponseBase & { ablastate: AblaState };
391
+ }
392
+
393
+ /** Returns fee/size statistics for a block. */
394
+ export interface GetBlockStats {
395
+ method: 'getblockheader';
396
+ params: [
397
+ hash_or_height: string| number,
398
+ stats?: string[]
399
+ ];
400
+ response: {
401
+ avgfee: number;
402
+ avgfeerate: number;
403
+ avgtxsize: number;
404
+ blockhash: string;
405
+ feerate_percentiles: {
406
+ "10th_percentile_feerate": number;
407
+ "25th_percentile_feerate": number;
408
+ "50th_percentile_feerate": number;
409
+ "75th_percentile_feerate": number;
410
+ "90th_percentile_feerate": number;
411
+ };
412
+ height: number;
413
+ ins: number;
414
+ maxfee: number;
415
+ maxfeerate: number;
416
+ maxtxsize: number;
417
+ medianfee: number;
418
+ mediantime: number;
419
+ mediantxsize: number;
420
+ minfee: number;
421
+ minfeerate: number;
422
+ mintxsize: number;
423
+ outs: number;
424
+ subsidy: number;
425
+ time: number;
426
+ total_out: number;
427
+ total_size: number;
428
+ totalfee: number;
429
+ txs: number;
430
+ utxo_increase: number;
431
+ utxo_size_inc: number;
432
+ }
433
+
434
+ }
435
+
436
+ /** Returns all known chain tips including forks. */
437
+ export interface GetChainTips {
438
+ method: 'getchaintips';
439
+ params: [];
440
+ response: {
441
+ height: number
442
+ hash: string
443
+ branchlen:number
444
+ status: 'active' | 'parked' | 'headers-only' | 'valid-headers' | 'valid-fork' | 'active'
445
+ }[]
446
+ }
447
+
448
+ /** Returns transaction statistics over a block window. */
449
+ export interface GetChainTxStats {
450
+ method: 'getchaintxstats';
451
+ params: [
452
+ nblocks?: number,
453
+ blockhash?: string
454
+ ];
455
+ response: {
456
+ time: number;
457
+ txcount: number;
458
+ window_final_block_hash: string;
459
+ window_block_count: number;
460
+ window_tx_count: number | undefined;
461
+ window_interval: number | undefined;
462
+ txrate: number;
463
+ }
464
+ }
465
+
466
+ /** Returns current network difficulty. */
467
+ export interface GetDifficulty {
468
+ method: 'getdifficulty';
469
+ params: [];
470
+ response: number;
471
+ }
472
+
473
+ interface GetDsProofBase {
474
+ method: 'getdsproof';
475
+ params: [
476
+ dspid_or_txid_or_outpoint: string | { txid: string; vout: number },
477
+ verbosity?: number | boolean,
478
+ recursive?: boolean
479
+ ];
480
+ }
481
+
482
+ /** Verbosity 0: Double-spend proof as hex. */
483
+ export interface GetDsProofVerbosity0 extends GetDsProofBase {
484
+ params: [
485
+ dspid_or_txid_or_outpoint: string | { txid: string; vout: number },
486
+ verbosity?: 0 | false,
487
+ recursive?: boolean
488
+ ];
489
+ response: {
490
+ hex: string;
491
+ txid: string | null;
492
+ path?: string[]; // Optional for recursive = true
493
+ };
494
+ }
495
+
496
+ /** Verbosity 1: Double-spend proof with descendants. */
497
+ export interface GetDsProofVerbosity1 extends GetDsProofBase {
498
+ params: [
499
+ dspid_or_txid_or_outpoint: string | { txid: string; vout: number },
500
+ verbosity?: 1,
501
+ recursive?: boolean
502
+ ];
503
+ response: {
504
+ hex: string;
505
+ txid: string | null;
506
+ path?: string[]; // Optional for recursive = true
507
+ descendants?: string[]
508
+ };
509
+ }
510
+
511
+ /** Verbosity 2: Double-spend proof with parsed outpoint. */
512
+ export interface GetDsProofVerbosity2 extends GetDsProofBase {
513
+ params: [
514
+ dspid_or_txid_or_outpoint: string | { txid: string; vout: number },
515
+ verbosity?: 2 | true,
516
+ recursive?: boolean
517
+ ];
518
+ response: {
519
+ dspid: string;
520
+ txid: string | null;
521
+ outpoint: {
522
+ txid: string;
523
+ vout: number;
524
+ };
525
+ descendants?: string[];
526
+ path?: string[]; // Optional for recursive = true
527
+ };
528
+ }
529
+
530
+ /** Double-spend proof spender data. */
531
+ interface Spender {
532
+ txversion: number,
533
+ sequence: number,
534
+ locktime: number,
535
+ hashprevoutputs: string,
536
+ hashsequence: string,
537
+ hashoutputs: string,
538
+ pushdata: {
539
+ asm: string,
540
+ hex: string
541
+ }
542
+ }
543
+
544
+ /** Verbosity 3: Double-spend proof with full spender details. */
545
+ export interface GetDsProofVerbosity3 extends GetDsProofVerbosity2 {
546
+ response: {
547
+ dspid: string;
548
+ txid: string | null;
549
+ outpoint: {
550
+ txid: string;
551
+ vout: number;
552
+ };
553
+ spenders: Spender[];
554
+ descendants?: string[];
555
+ path?: string[]; // Optional for recursive = true
556
+ };
557
+ }
558
+
559
+ export interface GetDsProofListBase {
560
+ method: 'getdsprooflist';
561
+ params: [
562
+ verbosity?: number | boolean,
563
+ include_orphans?: boolean
564
+ ];
565
+ }
566
+
567
+ /** Verbosity 0: List of double-spend proof IDs. */
568
+ export interface GetDsProofListVerbosity0 extends GetDsProofListBase {
569
+ params: [
570
+ verbosity?: 0 | false,
571
+ include_orphans?: boolean
572
+ ];
573
+ response: string[]
574
+ }
575
+
576
+ /** Verbosity 1: List of double-spend proofs as hex with txid. */
577
+ export interface GetDsProofListVerbosity1 extends GetDsProofListBase {
578
+ params: [
579
+ verbosity?: 1,
580
+ include_orphans?: boolean
581
+ ];
582
+ response: {
583
+ hex: string;
584
+ txid: string | null;
585
+ }[]
586
+ }
587
+
588
+ /** Verbosity 2: List of double-spend proofs with parsed outpoints. */
589
+ export interface GetDsProofListVerbosity2 extends GetDsProofListBase {
590
+ params: [
591
+ verbosity?: 2 | true,
592
+ include_orphans?: boolean
593
+ ];
594
+ response: {
595
+ dspid: string;
596
+ txid: string | null;
597
+ outpoint: {
598
+ txid: string;
599
+ vout: number;
600
+ };
601
+ }[]
602
+ }
603
+
604
+ /** Verbosity 3: List of double-spend proofs with full spender details. */
605
+ export interface GetDsProofListVerbosity3 extends GetDsProofListBase {
606
+ response: {
607
+ dspid: string;
608
+ txid: string | null;
609
+ outpoint: {
610
+ txid: string;
611
+ vout: number;
612
+ };
613
+ spenders: Spender[]
614
+ }[]
615
+ }
616
+
617
+ /** Returns double-spend proof score for a transaction. */
618
+ export interface GetDsProofScore {
619
+ method: 'getdsproofscore';
620
+ params: [
621
+ txid: string
622
+ ];
623
+ response: number;
624
+ }
625
+
626
+ /** Returns the hash of the last finalized block. */
627
+ export interface GetFinalizedBlockHash {
628
+ method: 'getfinalizedblockhash';
629
+ params: [];
630
+ response: string;
631
+ }
632
+
633
+ interface GetMempoolAncestorsBase {
634
+ method: 'getmempoolancestors';
635
+ params: [
636
+ txid: string,
637
+ verbose?: boolean | number
638
+ ];
639
+ }
640
+
641
+ /** Verbosity 0: Returns ancestor txids as array. */
642
+ export interface GetMempoolAncestorsVerbosity0 extends GetMempoolAncestorsBase {
643
+ params: [
644
+ txid: string,
645
+ verbose?: false | 0
646
+ ];
647
+ response: string[];
648
+ }
649
+
650
+ /** Verbosity 1: Returns ancestor txids with detailed mempool info. */
651
+ export interface GetMempoolAncestorsVerbosity1 extends GetMempoolAncestorsBase {
652
+ params: [
653
+ txid: string,
654
+ verbose?: true | 1
655
+ ];
656
+ response: {
657
+ [transactionid: string]: {
658
+ size: number;
659
+ time: number;
660
+ fees: {
661
+ base: number;
662
+ modified: number;
663
+ };
664
+ depends: string[];
665
+ spentby: string[];
666
+ };
667
+ };
668
+ }
669
+
670
+ interface GetMempoolDescendantsBase {
671
+ method: 'getmempooldescendants';
672
+ params: [
673
+ txid: string,
674
+ verbose?: boolean | number
675
+ ];
676
+ }
677
+
678
+ /** Verbosity 0: Returns descendant txids as array. */
679
+ export interface GetMempoolDescendantsVerbosity0 extends GetMempoolDescendantsBase {
680
+ params: [
681
+ txid: string,
682
+ verbose?: false | 0
683
+ ];
684
+ response: string[];
685
+ }
686
+
687
+ /** Verbosity 1: Returns descendant txids with detailed mempool info. */
688
+ export interface GetMempoolDescendantsVerbosity1 extends GetMempoolDescendantsBase {
689
+ params: [
690
+ txid: string,
691
+ verbose?: true | 1
692
+ ];
693
+ response: {
694
+ [transactionid: string]: {
695
+ size: number;
696
+ time: number;
697
+ fees: {
698
+ base: number;
699
+ modified: number;
700
+ };
701
+ depends: string[];
702
+ spentby: string[];
703
+ };
704
+ };
705
+ }
706
+
707
+ /** Returns mempool entry for a specific transaction. */
708
+ export interface GetMempoolEntry {
709
+ method: 'getmempoolentry';
710
+ params: [
711
+ txid: string
712
+ ];
713
+ response: {
714
+ size: number;
715
+ time: number;
716
+ fees: {
717
+ base: number;
718
+ modified: number;
719
+ };
720
+ depends: string[];
721
+ spentby: string[];
722
+ };
723
+ }
724
+
725
+ /** Returns mempool statistics and configuration. */
726
+ export interface GetMempoolInfo {
727
+ method: 'getmempoolinfo';
728
+ params: [];
729
+ response: {
730
+ loaded: boolean;
731
+ size: number;
732
+ bytes: number;
733
+ usage: number;
734
+ maxmempool: number;
735
+ mempoolminfee: number;
736
+ minrelaytxfee: number;
737
+ permitbaremultisig: boolean;
738
+ maxdatacarriersize: number;
739
+ }
740
+ }
741
+
742
+ interface GetRawMempoolBase {
743
+ method: 'getrawmempool';
744
+ params: [
745
+ verbose?: boolean | number
746
+ ];
747
+ }
748
+
749
+ /** Verbosity 0: Returns all mempool txids as array. */
750
+ export interface GetRawMempoolVerbosity0 extends GetRawMempoolBase {
751
+ params: [
752
+ verbose?: false | 0
753
+ ];
754
+ response: string[];
755
+ }
756
+
757
+ /** Verbosity 1: Returns all mempool txids with detailed info. */
758
+ export interface GetRawMempoolVerbosity1 extends GetRawMempoolBase {
759
+ params: [
760
+ verbose?: true | 1
761
+ ];
762
+ response: {
763
+ [transactionid: string]: {
764
+ size: number;
765
+ time: number;
766
+ fees: {
767
+ base: number;
768
+ modified: number;
769
+ };
770
+ depends: string[];
771
+ spentby: string[];
772
+ };
773
+ };
774
+ }
775
+
776
+ /** Returns details about an unspent transaction output. */
777
+ export interface GetTxOut {
778
+ method: 'gettxout';
779
+ params: [
780
+ txid: string,
781
+ vout: number,
782
+ include_mempool?: boolean
783
+ ];
784
+ response: {
785
+ bestblock: string;
786
+ confirmations: number
787
+ value: number;
788
+ scriptPubKey: {
789
+ asm: string;
790
+ hex: string;
791
+ type: string;
792
+ addresses: string[];
793
+ }
794
+ tokenData?: TokenData;
795
+ coinbase: boolean;
796
+ }
797
+ }
798
+
799
+ /** Returns a merkle proof that transaction(s) are in a block. */
800
+ export interface GetTxOutProof {
801
+ method: 'gettxoutproof';
802
+ params: [
803
+ txids: string[],
804
+ blockhash?: string
805
+ ];
806
+ response: string;
807
+ }
808
+
809
+ /** Returns UTXO set statistics. */
810
+ export interface GetTxOutSetInfo {
811
+ method: 'gettxoutsetinfo';
812
+ params: [
813
+ hash_type?: 'hash_serialized_3' | 'ecmh' | 'muhash',
814
+ hash_or_height?: string | number,
815
+ use_index?: boolean
816
+ ];
817
+ response: {
818
+ height: number;
819
+ bestblock: string;
820
+ transactions: number;
821
+ txouts: number;
822
+ bogosize: number;
823
+ hash_serialized_3: string;
824
+ disk_size: number;
825
+ total_amount: number;
826
+ }
827
+ }
828
+
829
+ /** Permanently marks a block as invalid (cannot be part of best chain). */
830
+ export interface InvalidateBlock {
831
+ method: 'invalidateblock';
832
+ params: [
833
+ blockhash: string
834
+ ];
835
+ response: null;
836
+ }
837
+
838
+ /** Marks a block as parked (temporarily invalid). */
839
+ export interface ParkBlock {
840
+ method: 'parkblock';
841
+ params: [
842
+ blockhash: string
843
+ ];
844
+ response: null;
845
+ }
846
+
847
+ /** Treats a block as if it were received before others with same work. */
848
+ export interface PreciousBlock {
849
+ method: 'preciousblock';
850
+ params: [
851
+ blockhash: string
852
+ ];
853
+ response: null;
854
+ }
855
+
856
+ /** Prunes blockchain up to specified height. Returns height of last pruned block. */
857
+ export interface PruneBlockchain {
858
+ method: 'pruneblockchain';
859
+ params: [
860
+ height: number
861
+ ];
862
+ response: number;
863
+ }
864
+
865
+ /** Removes invalidity status from a block and its descendants. */
866
+ export interface ReconsiderBlock {
867
+ method: 'reconsiderblock';
868
+ params: [
869
+ blockhash: string
870
+ ];
871
+ response: null;
872
+ }
873
+
874
+ /** Saves mempool to disk. */
875
+ export interface SaveMempool {
876
+ method: 'savemempool';
877
+ params: [];
878
+ response: null;
879
+ }
880
+
881
+ /** Scans UTXO set for outputs matching descriptors. */
882
+ export interface ScanTxOutSet {
883
+ method: 'scantxoutset';
884
+ params: [
885
+ action: 'start' | 'abort' | 'status',
886
+ scanobjects?: Array<string | {
887
+ desc: string;
888
+ range?: number;
889
+ }>
890
+ ];
891
+ response: {
892
+ unspents: Array<{
893
+ txid: string;
894
+ vout: number;
895
+ scriptPubKey: string;
896
+ amount: number;
897
+ height: number;
898
+ tokenData?: TokenData;
899
+ }>;
900
+ total_amount: number;
901
+ token_total_amount?: {
902
+ [category: string]: string;
903
+ };
904
+ } | boolean;
905
+ }
906
+
907
+ /** Removes parked status from a block and its descendants. */
908
+ export interface UnparkBlock {
909
+ method: 'unparkblock';
910
+ params: [
911
+ blockhash: string
912
+ ];
913
+ response: null;
914
+ }
915
+
916
+ /** Verifies blockchain database. */
917
+ export interface VerifyChain {
918
+ method: 'verifychain';
919
+ params: [
920
+ checklevel?: number,
921
+ nblocks?: number
922
+ ];
923
+ response: boolean;
924
+ }
925
+
926
+ /** Verifies a merkle proof and returns the txids it commits to. */
927
+ export interface VerifyTxOutProof {
928
+ method: 'verifytxoutproof';
929
+ params: [
930
+ proof: string
931
+ ];
932
+ response: string[];
759
933
  }