@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,674 @@
1
+ import type { TokenData } from "../interfaces.js";
2
+ /** Marks an in-wallet transaction as abandoned (only works on unconfirmed tx). */
3
+ export interface AbandonTransaction {
4
+ method: 'abandontransaction';
5
+ params: [
6
+ txid: string
7
+ ];
8
+ response: null;
9
+ }
10
+ /** Stops current wallet rescan. */
11
+ export interface AbortRescan {
12
+ method: 'abortrescan';
13
+ params: [];
14
+ response: null;
15
+ }
16
+ /** Adds a multisig address to the wallet. */
17
+ export interface AddMultisigAddress {
18
+ method: 'addmultisigaddress';
19
+ params: [
20
+ nrequired: number,
21
+ keys: string[],
22
+ label?: string
23
+ ];
24
+ response: {
25
+ address: string;
26
+ redeemScript: string;
27
+ };
28
+ }
29
+ /** Backs up wallet to specified file. */
30
+ export interface BackupWallet {
31
+ method: 'backupwallet';
32
+ params: [
33
+ destination: string
34
+ ];
35
+ response: null;
36
+ }
37
+ /** Creates a new wallet. */
38
+ export interface CreateWallet {
39
+ method: 'createwallet';
40
+ params: [
41
+ wallet_name: string,
42
+ disable_private_keys?: boolean,
43
+ blank?: boolean
44
+ ];
45
+ response: {
46
+ name: string;
47
+ warning?: string;
48
+ };
49
+ }
50
+ /** Dumps all wallet keys to a file. */
51
+ export interface DumpWallet {
52
+ method: 'dumpwallet';
53
+ params: [
54
+ filename: string
55
+ ];
56
+ response: {
57
+ filename: string;
58
+ };
59
+ }
60
+ /** Returns private key for an address. */
61
+ export interface DumpPrivKey {
62
+ method: 'dumpprivkey';
63
+ params: [
64
+ address: string
65
+ ];
66
+ response: string;
67
+ }
68
+ /** Encrypts wallet with passphrase (requires restart). */
69
+ export interface EncryptWallet {
70
+ method: 'encryptwallet';
71
+ params: [
72
+ passphrase: string
73
+ ];
74
+ response: string;
75
+ }
76
+ /** Returns addresses assigned to a label. */
77
+ export interface GetAddressesByLabel {
78
+ method: 'getaddressesbylabel';
79
+ params: [
80
+ label: string
81
+ ];
82
+ response: {
83
+ [address: string]: {
84
+ purpose: string;
85
+ };
86
+ };
87
+ }
88
+ /** Returns detailed information about an address. */
89
+ export interface GetAddressInfo {
90
+ method: 'getaddressinfo';
91
+ params: [string];
92
+ response: {
93
+ address: string;
94
+ scriptPubKey: string;
95
+ ismine: boolean;
96
+ iswatchonly: boolean;
97
+ isscript: boolean;
98
+ ischange: boolean;
99
+ script?: 'nonstandard' | 'pubkey' | 'pubkeyhash' | 'scripthash' | 'multisig' | 'nulldata';
100
+ hex?: string;
101
+ pubkeys?: string[];
102
+ sigsrequired?: number;
103
+ pubkey?: string;
104
+ embedded?: object;
105
+ iscompressed: boolean;
106
+ label: string;
107
+ timestamp?: number;
108
+ hdkeypath?: string;
109
+ hdseedid?: string;
110
+ hdmasterkeyid?: string;
111
+ labels: {
112
+ name: string;
113
+ purpose: 'send' | 'receive';
114
+ }[];
115
+ };
116
+ }
117
+ /** Returns wallet balance. */
118
+ export interface GetBalance {
119
+ method: 'getbalance';
120
+ params: [
121
+ dummy?: string,
122
+ minconf?: number,
123
+ include_watchonly?: boolean
124
+ ];
125
+ response: number;
126
+ }
127
+ /** Generates a new address for receiving payments. */
128
+ export interface GetNewAddress {
129
+ method: 'getnewaddress';
130
+ params: [
131
+ label?: string
132
+ ];
133
+ response: string;
134
+ }
135
+ /** Returns a new address for receiving change. */
136
+ export interface GetRawChangeAddress {
137
+ method: 'getrawchangeaddress';
138
+ params: [];
139
+ response: string;
140
+ }
141
+ /** Returns total amount received by an address. */
142
+ export interface GetReceivedByAddress {
143
+ method: 'getreceivedbyaddress';
144
+ params: [
145
+ address: string,
146
+ minconf?: number
147
+ ];
148
+ response: number;
149
+ }
150
+ /** Returns total amount received by addresses with a label. */
151
+ export interface GetReceivedByLabel {
152
+ method: 'getreceivedbylabel';
153
+ params: [
154
+ label: string,
155
+ minconf?: number
156
+ ];
157
+ response: number;
158
+ }
159
+ /** Returns detailed information about an in-wallet transaction. */
160
+ export interface GetTransaction {
161
+ method: 'gettransaction';
162
+ params: [
163
+ txid: string,
164
+ include_watchonly?: boolean
165
+ ];
166
+ response: {
167
+ amount: number;
168
+ fee?: number;
169
+ confirmations: number;
170
+ blockhash?: string;
171
+ blockindex?: number;
172
+ blocktime?: number;
173
+ txid: string;
174
+ time: number;
175
+ timereceived: number;
176
+ 'bip125-replaceable': 'yes' | 'no' | 'unknown';
177
+ details: {
178
+ address: string;
179
+ category: 'send' | 'receive';
180
+ amount: number;
181
+ label?: string;
182
+ vout: number;
183
+ fee?: number;
184
+ abandoned?: boolean;
185
+ }[];
186
+ hex: string;
187
+ };
188
+ }
189
+ /** Returns unconfirmed balance. */
190
+ export interface GetUnconfirmedBalance {
191
+ method: 'getunconfirmedbalance';
192
+ params: [];
193
+ response: number;
194
+ }
195
+ /** Returns wallet state info. */
196
+ export interface GetWalletInfo {
197
+ method: 'getwalletinfo';
198
+ params: [];
199
+ response: {
200
+ walletname: string;
201
+ walletversion: number;
202
+ balance: number;
203
+ unconfirmed_balance: number;
204
+ immature_balance: number;
205
+ txcount: number;
206
+ keypoololdest: number;
207
+ keypoolsize: number;
208
+ keypoolsize_hd_internal: number;
209
+ unlocked_until: number;
210
+ paytxfee: number;
211
+ hdseedid?: string;
212
+ hdmasterkeyid?: string;
213
+ private_keys_enabled: boolean;
214
+ };
215
+ }
216
+ /** Imports an address or script for watching (without private key). */
217
+ export interface ImportAddress {
218
+ method: 'importaddress';
219
+ params: [
220
+ address: string,
221
+ label?: string,
222
+ rescan?: boolean,
223
+ p2sh?: boolean
224
+ ];
225
+ response: number;
226
+ }
227
+ /** Imports multiple addresses/scripts/keys. */
228
+ export interface ImportMulti {
229
+ method: 'importmulti';
230
+ params: [
231
+ requests: {
232
+ scriptPubKey: string | {
233
+ address: string;
234
+ };
235
+ timestamp: number | 'now';
236
+ redeemscript?: string;
237
+ pubkeys?: string[];
238
+ keys?: string[];
239
+ internal?: boolean;
240
+ watchonly?: boolean;
241
+ label?: string;
242
+ }[],
243
+ options?: {
244
+ rescan?: boolean;
245
+ }
246
+ ];
247
+ response: {
248
+ success: boolean;
249
+ error?: {
250
+ code: number;
251
+ message: string;
252
+ };
253
+ }[];
254
+ }
255
+ /** Imports a private key. */
256
+ export interface ImportPrivKey {
257
+ method: 'importprivkey';
258
+ params: [
259
+ privkey: string,
260
+ label?: string,
261
+ rescan?: boolean
262
+ ];
263
+ response: null;
264
+ }
265
+ /** Imports funds without rescan (requires merkle proof). */
266
+ export interface ImportPrunedFunds {
267
+ method: 'importprunedfunds';
268
+ params: [
269
+ rawtransaction: string,
270
+ txoutproof: string
271
+ ];
272
+ response: null;
273
+ }
274
+ /** Imports a public key for watching. */
275
+ export interface ImportPubKey {
276
+ method: 'importpubkey';
277
+ params: [
278
+ pubkey: string,
279
+ label?: string,
280
+ rescan?: boolean
281
+ ];
282
+ response: null;
283
+ }
284
+ /** Imports keys from a wallet dump file. */
285
+ export interface ImportWallet {
286
+ method: 'importwallet';
287
+ params: [
288
+ filename: string
289
+ ];
290
+ response: null;
291
+ }
292
+ /** Refills the keypool. */
293
+ export interface KeyPoolRefill {
294
+ method: 'keypoolrefill';
295
+ params: [
296
+ newsize?: number
297
+ ];
298
+ response: null;
299
+ }
300
+ /** Returns addresses grouped by common ownership. */
301
+ export interface ListAddressGroupings {
302
+ method: 'listaddressgroupings';
303
+ params: [];
304
+ response: [
305
+ [
306
+ {
307
+ address: string;
308
+ amount: number;
309
+ label?: string;
310
+ }[]
311
+ ][]
312
+ ];
313
+ }
314
+ /** Returns all labels in the wallet. */
315
+ export interface ListLabels {
316
+ method: 'listlabels';
317
+ params: [
318
+ purpose?: string
319
+ ];
320
+ response: string[];
321
+ }
322
+ /** Returns list of locked unspent outputs. */
323
+ export interface ListLockUnspent {
324
+ method: 'listlockunspent';
325
+ params: [];
326
+ response: {
327
+ txid: string;
328
+ vout: number;
329
+ }[];
330
+ }
331
+ /** Lists transactions received by address. */
332
+ export interface ListReceivedByAddress {
333
+ method: 'listreceivedbyaddress';
334
+ params: [
335
+ minconf?: number,
336
+ include_empty?: boolean,
337
+ include_watchonly?: boolean,
338
+ address_filter?: string
339
+ ];
340
+ response: {
341
+ involvesWatchonly?: boolean;
342
+ address: string;
343
+ amount: number;
344
+ confirmations: number;
345
+ label: string;
346
+ txids: string[];
347
+ }[];
348
+ }
349
+ /** Lists transactions received by label. */
350
+ export interface ListReceivedByLabel {
351
+ method: 'listreceivedbylabel';
352
+ params: [
353
+ minconf?: number,
354
+ include_empty?: boolean,
355
+ include_watchonly?: boolean
356
+ ];
357
+ response: {
358
+ involvesWatchonly?: boolean;
359
+ amount: number;
360
+ confirmations: number;
361
+ label: string;
362
+ }[];
363
+ }
364
+ /** Wallet transaction representation. */
365
+ interface TransactionWallet {
366
+ address?: string;
367
+ category: 'send' | 'receive';
368
+ amount: number;
369
+ vout: number;
370
+ fee?: number;
371
+ confirmations: number;
372
+ blockhash?: string;
373
+ blockindex?: number;
374
+ blocktime?: number;
375
+ txid: string;
376
+ time: number;
377
+ timereceived: number;
378
+ abandoned?: boolean;
379
+ comment?: string;
380
+ label?: string;
381
+ to?: string;
382
+ }
383
+ /** Returns transactions since a block. */
384
+ export interface ListSinceBlock {
385
+ method: 'listsinceblock';
386
+ params: [
387
+ blockhash?: string,
388
+ target_confirmations?: number,
389
+ include_watchonly?: boolean,
390
+ include_removed?: boolean
391
+ ];
392
+ response: {
393
+ transactions: TransactionWallet[];
394
+ removed?: TransactionWallet[];
395
+ lastblock: string;
396
+ };
397
+ }
398
+ /** Returns recent transactions for the wallet. */
399
+ export interface ListTransactions {
400
+ method: 'listtransactions';
401
+ params: [
402
+ label?: string,
403
+ count?: number,
404
+ skip?: number,
405
+ include_watchonly?: boolean
406
+ ];
407
+ response: TransactionWallet[];
408
+ }
409
+ /** Returns unspent outputs in the wallet. */
410
+ export interface ListUnspent {
411
+ method: 'listunspent';
412
+ params: [
413
+ minconf?: number,
414
+ maxconf?: number,
415
+ addresses?: string[],
416
+ include_unsafe?: boolean,
417
+ query_options?: {
418
+ minimumAmount?: number | string;
419
+ maximumAmount?: number | string;
420
+ maximumCount?: number;
421
+ minimumSumAmount?: number | string;
422
+ includeTokens?: boolean;
423
+ tokensOnly?: boolean;
424
+ }
425
+ ];
426
+ response: ListUnspentItem[];
427
+ }
428
+ /** Single UTXO from listunspent. */
429
+ export interface ListUnspentItem {
430
+ txid: string;
431
+ vout: number;
432
+ address: string;
433
+ label: string;
434
+ scriptPubKey: string;
435
+ amount: number;
436
+ tokenData?: TokenData;
437
+ confirmations: number;
438
+ redeemScript: string;
439
+ spendable: boolean;
440
+ solvable: boolean;
441
+ safe: boolean;
442
+ }
443
+ /** Returns list of available wallets. */
444
+ export interface ListWalletDir {
445
+ method: 'listwalletdir';
446
+ params: [];
447
+ response: {
448
+ wallets: {
449
+ name: string;
450
+ }[];
451
+ };
452
+ }
453
+ /** Returns list of loaded wallets. */
454
+ export interface ListWallets {
455
+ method: 'importaddress';
456
+ params: [];
457
+ response: string[];
458
+ }
459
+ /** Loads a wallet from file. */
460
+ export interface LoadWallet {
461
+ method: 'loadwallet';
462
+ params: [
463
+ filename: string
464
+ ];
465
+ response: {
466
+ name: string;
467
+ warning?: string;
468
+ };
469
+ }
470
+ /** Locks or unlocks unspent outputs. */
471
+ export interface LockUnspent {
472
+ method: 'lockunspent';
473
+ params: [
474
+ unlock: boolean,
475
+ transactions?: {
476
+ txid: string;
477
+ vout: number;
478
+ }[]
479
+ ];
480
+ response: boolean;
481
+ }
482
+ /** Removes imported pruned funds from wallet. */
483
+ export interface RemovePrunedFunds {
484
+ method: 'removeprunedfunds';
485
+ params: [
486
+ txid: string
487
+ ];
488
+ response: null;
489
+ }
490
+ /** Rescans blockchain for wallet transactions. */
491
+ export interface RescanBlockchain {
492
+ method: 'rescanblockchain';
493
+ params: [
494
+ start_height?: number,
495
+ stop_height?: number
496
+ ];
497
+ response: {
498
+ start_height: number;
499
+ stop_height: number;
500
+ };
501
+ }
502
+ /** Sends to multiple recipients. */
503
+ export interface SendMany {
504
+ method: 'sendmany';
505
+ params: [
506
+ dummy: string,
507
+ amounts: {
508
+ [address: string]: number | string;
509
+ },
510
+ minconf?: number,
511
+ comment?: string,
512
+ subtractfeefrom?: string[],
513
+ coinsel?: number,
514
+ include_unsafe?: boolean
515
+ ];
516
+ response: string;
517
+ }
518
+ /** Sends to a single address. */
519
+ export interface SendToAddress {
520
+ method: 'sendtoaddress';
521
+ params: [
522
+ address: string,
523
+ amount: number | string,
524
+ comment?: string,
525
+ comment_to?: string,
526
+ subtractfeefromamount?: boolean,
527
+ coinsel?: number,
528
+ include_unsafe?: boolean
529
+ ];
530
+ response: string;
531
+ }
532
+ /** Sets the HD seed for the wallet. */
533
+ export interface SetHdSeed {
534
+ method: 'sethdseed';
535
+ params: [
536
+ newkeypool?: boolean,
537
+ seed?: string
538
+ ];
539
+ response: null;
540
+ }
541
+ /** Sets the label for an address. */
542
+ export interface SetLabel {
543
+ method: 'setlabel';
544
+ params: [
545
+ address: string,
546
+ label: string
547
+ ];
548
+ response: null;
549
+ }
550
+ /** Sets the transaction fee per kB. */
551
+ export interface SetTxFee {
552
+ method: 'settxfee';
553
+ params: [
554
+ amount: number | string
555
+ ];
556
+ response: boolean;
557
+ }
558
+ /** Signs a message with an address's private key. */
559
+ export interface SignMessage {
560
+ method: 'signmessage';
561
+ params: [
562
+ address: string,
563
+ message: string
564
+ ];
565
+ response: string;
566
+ }
567
+ /** Signs a raw transaction with wallet keys. */
568
+ export interface SignRawTransactionWithWallet {
569
+ method: 'signrawtransactionwithwallet';
570
+ params: [
571
+ hexstring: string,
572
+ prevtxs?: {
573
+ txid: string;
574
+ vout: number;
575
+ scriptPubKey: string;
576
+ redeemScript?: string;
577
+ amount: number | string;
578
+ tokenData?: TokenData;
579
+ }[],
580
+ sighashtype?: string
581
+ ];
582
+ response: {
583
+ hex: string;
584
+ complete: boolean;
585
+ errors?: {
586
+ txid: string;
587
+ vout: number;
588
+ scriptSig: string;
589
+ sequence: number;
590
+ error: string;
591
+ }[];
592
+ };
593
+ }
594
+ /** Unloads a wallet. */
595
+ export interface UnloadWallet {
596
+ method: 'unloadwallet';
597
+ params: [
598
+ wallet_name?: string
599
+ ];
600
+ response: null;
601
+ }
602
+ /** Creates and funds a PSBT. */
603
+ export interface WalletCreateFundedPsbt {
604
+ method: 'walletcreatefundedpsbt';
605
+ params: [
606
+ inputs: {
607
+ txid: string;
608
+ vout: number;
609
+ sequence: number;
610
+ }[],
611
+ outputs: {
612
+ address?: number | string | {
613
+ amount: number | string;
614
+ tokenData?: TokenData;
615
+ };
616
+ data?: string | string[];
617
+ }[],
618
+ locktime?: number,
619
+ options?: {
620
+ include_unsafe?: boolean;
621
+ changeAddress?: string;
622
+ changePosition?: number;
623
+ includeWatching?: boolean;
624
+ lockUnspents?: boolean;
625
+ feeRate?: number | string;
626
+ subtractFeeFromOutputs?: number[];
627
+ },
628
+ bip32derivs?: boolean
629
+ ];
630
+ response: {
631
+ psbt: string;
632
+ fee: number;
633
+ changepos: number;
634
+ };
635
+ }
636
+ /** Locks the encrypted wallet. */
637
+ export interface WalletLock {
638
+ method: 'walletlock';
639
+ params: [];
640
+ response: null;
641
+ }
642
+ /** Unlocks the wallet for a specified time. */
643
+ export interface WalletPassphrase {
644
+ method: 'walletpassphrase';
645
+ params: [
646
+ passphrase: string,
647
+ timeout: number
648
+ ];
649
+ response: null;
650
+ }
651
+ /** Changes the wallet passphrase. */
652
+ export interface WalletPassphraseChange {
653
+ method: 'walletpassphrasechange';
654
+ params: [
655
+ oldpassphrase: string,
656
+ newpassphrase: string
657
+ ];
658
+ response: null;
659
+ }
660
+ /** Processes a PSBT with wallet data. */
661
+ export interface WalletProcessPsbt {
662
+ method: 'walletprocesspsbt';
663
+ params: [
664
+ psbt: string,
665
+ sign?: boolean,
666
+ sighashtype?: string,
667
+ bip32derivs?: boolean
668
+ ];
669
+ response: {
670
+ psbt: string;
671
+ complete: boolean;
672
+ };
673
+ }
674
+ export {};
@@ -0,0 +1,3 @@
1
+ /* --- Wallet Commands --- */
2
+ // progress 52/52
3
+ export {};
@@ -0,0 +1,9 @@
1
+ /** Returns active ZMQ notification endpoints. */
2
+ export interface GetZmqNotifications {
3
+ method: 'getzmqnotifications';
4
+ params: [];
5
+ response: {
6
+ type: string;
7
+ address: string;
8
+ }[];
9
+ }
@@ -0,0 +1,3 @@
1
+ /* --- Zmq Commands --- */
2
+ // progress 1/1
3
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { RestClientConfig, formatOptions, ResponseType } from "./interfaces/interfaces.js";
2
+ import type { BlockInfoNoTxDetails, BlockInfoTxDetails, BlockInfoWithPatterns, ChainInfo, HeaderInfo, MempoolContent, MempoolInfo, TxDetails, TxDetailsWithPatterns, UtxosInfo } from "./interfaces/restInterfaces/interfaces.js";
3
+ /** REST client for read-only BCHN blockchain access via the REST interface. */
4
+ export declare class BchnRestClient {
5
+ private baseUrl;
6
+ private timeoutMs;
7
+ private logger;
8
+ constructor(config: RestClientConfig);
9
+ private fetchFromNode;
10
+ /** Returns transaction details by txid. */
11
+ getTransaction<TFormat extends formatOptions = 'json'>(txid: string, format?: TFormat): Promise<ResponseType<TFormat, TxDetails>>;
12
+ /** Returns block data. Use includeTxDetails=true for full transaction objects. */
13
+ getBlock<TFormat extends formatOptions = 'json'>(blockhash: string, includeTxDetails: true, format?: TFormat): Promise<TFormat extends 'json' ? BlockInfoTxDetails : string>;
14
+ getBlock<TFormat extends formatOptions = 'json'>(blockhash: string, includeTxDetails: false, format?: TFormat): Promise<TFormat extends 'json' ? BlockInfoNoTxDetails : string>;
15
+ /** Returns block headers starting from a specific block hash. */
16
+ getBlockHeaders<TFormat extends formatOptions = 'json'>(count: number, blockhash: string, format?: TFormat): Promise<ResponseType<TFormat, HeaderInfo>>;
17
+ /** Returns current chain state (network, sync progress, best block). */
18
+ getChainInfo(): Promise<ChainInfo>;
19
+ /** Queries UTXO set for specific outpoints. Outpoints format: "txid-vout". */
20
+ getUTXOs<TFormat extends formatOptions = 'json'>(checkmempool: boolean, outpoints: string[], format?: TFormat): Promise<ResponseType<TFormat, UtxosInfo>>;
21
+ /** Returns mempool statistics (size, bytes, fee rates). */
22
+ getMempoolInfo(): Promise<MempoolInfo>;
23
+ /** Returns all transactions currently in the mempool. */
24
+ getMempoolContents(): Promise<MempoolContent>;
25
+ /** Returns block with bytecode pattern data (v29.0.0+). */
26
+ getBlockWithPatterns(blockhash: string): Promise<BlockInfoWithPatterns>;
27
+ /** Returns transaction with bytecode pattern data (v29.0.0+). */
28
+ getTransactionWithPatterns(txid: string): Promise<TxDetailsWithPatterns>;
29
+ }