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

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