@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.
- package/.claude/settings.local.json +8 -0
- package/.github/workflows/ci.yaml +36 -0
- package/CLAUDE.md +70 -0
- package/README.md +121 -129
- package/dist/interfaces/interfaces.d.ts +13 -0
- package/dist/interfaces/restInterfaces/interfaces.d.ts +124 -18
- package/dist/interfaces/rpcInterfaces/blockchain.d.ts +293 -102
- package/dist/interfaces/rpcInterfaces/control.d.ts +6 -0
- package/dist/interfaces/rpcInterfaces/generating.d.ts +2 -0
- package/dist/interfaces/rpcInterfaces/mining.d.ts +9 -0
- package/dist/interfaces/rpcInterfaces/network.d.ts +18 -0
- package/dist/interfaces/rpcInterfaces/rawtransactions.d.ts +21 -0
- package/dist/interfaces/rpcInterfaces/util.d.ts +5 -0
- package/dist/interfaces/rpcInterfaces/wallet.d.ts +54 -0
- package/dist/interfaces/rpcInterfaces/zmq.d.ts +1 -0
- package/dist/restClient.d.ts +13 -1
- package/dist/restClient.js +19 -6
- package/dist/rpcClient.d.ts +7 -0
- package/dist/rpcClient.js +7 -0
- package/package.json +7 -8
- package/pnpm-lock.yaml +1279 -0
- package/src/index.ts +3 -3
- package/src/interfaces/interfaces.ts +96 -86
- package/src/interfaces/restInterfaces/interfaces.ts +235 -116
- package/src/interfaces/rpcInterfaces/blockchain.ts +932 -758
- package/src/interfaces/rpcInterfaces/control.ts +68 -62
- package/src/interfaces/rpcInterfaces/generating.ts +23 -21
- package/src/interfaces/rpcInterfaces/index.ts +13 -13
- package/src/interfaces/rpcInterfaces/mining.ts +151 -143
- package/src/interfaces/rpcInterfaces/network.ts +213 -195
- package/src/interfaces/rpcInterfaces/rawtransactions.ts +332 -314
- package/src/interfaces/rpcInterfaces/util.ts +56 -52
- package/src/interfaces/rpcInterfaces/wallet.ts +728 -674
- package/src/interfaces/rpcInterfaces/zmq.ts +12 -11
- package/src/restClient.ts +134 -119
- package/src/rpcClient.ts +100 -93
- package/src/utils/errors.ts +6 -6
- package/src/utils/utils.ts +55 -55
- package/test/restClient.test.ts +33 -31
- package/test/rpcClient.test.ts +119 -115
- package/test/setupTests.ts +56 -54
- package/test/tsconfig.json +4 -4
- package/tsconfig.json +13 -13
- package/vitest.config.ts +8 -8
- 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
|
-
|
|
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
|
-
export interface
|
|
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
|
-
response: {
|
|
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
|
-
export interface
|
|
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
|
-
response:
|
|
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
|
-
response:
|
|
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
|
-
|
|
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
|
}
|