@mr-zwets/bchn-api-wrapper 1.0.1
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/CHANGELOG.md +7 -0
- package/README.md +129 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/interfaces/interfaces.d.ts +70 -0
- package/dist/interfaces/interfaces.js +1 -0
- package/dist/interfaces/restInterfaces/interfaces.d.ts +109 -0
- package/dist/interfaces/restInterfaces/interfaces.js +1 -0
- package/dist/interfaces/rpcInterfaces/blockchain.d.ts +692 -0
- package/dist/interfaces/rpcInterfaces/blockchain.js +3 -0
- package/dist/interfaces/rpcInterfaces/control.d.ts +54 -0
- package/dist/interfaces/rpcInterfaces/control.js +3 -0
- package/dist/interfaces/rpcInterfaces/generating.d.ts +17 -0
- package/dist/interfaces/rpcInterfaces/generating.js +3 -0
- package/dist/interfaces/rpcInterfaces/index.d.ts +9 -0
- package/dist/interfaces/rpcInterfaces/index.js +12 -0
- package/dist/interfaces/rpcInterfaces/mining.d.ts +131 -0
- package/dist/interfaces/rpcInterfaces/mining.js +3 -0
- package/dist/interfaces/rpcInterfaces/network.d.ts +179 -0
- package/dist/interfaces/rpcInterfaces/network.js +3 -0
- package/dist/interfaces/rpcInterfaces/rawtransactions.d.ts +283 -0
- package/dist/interfaces/rpcInterfaces/rawtransactions.js +3 -0
- package/dist/interfaces/rpcInterfaces/util.d.ts +44 -0
- package/dist/interfaces/rpcInterfaces/util.js +3 -0
- package/dist/interfaces/rpcInterfaces/wallet.d.ts +620 -0
- package/dist/interfaces/rpcInterfaces/wallet.js +3 -0
- package/dist/interfaces/rpcInterfaces/zmq.d.ts +8 -0
- package/dist/interfaces/rpcInterfaces/zmq.js +3 -0
- package/dist/restClient.d.ts +17 -0
- package/dist/restClient.js +100 -0
- package/dist/rpcClient.d.ts +12 -0
- package/dist/rpcClient.js +85 -0
- package/dist/utils/errors.d.ts +3 -0
- package/dist/utils/errors.js +6 -0
- package/dist/utils/utils.d.ts +11 -0
- package/dist/utils/utils.js +49 -0
- package/package.json +40 -0
- package/src/index.ts +4 -0
- package/src/interfaces/interfaces.ts +87 -0
- package/src/interfaces/restInterfaces/interfaces.ts +117 -0
- package/src/interfaces/rpcInterfaces/blockchain.ts +759 -0
- package/src/interfaces/rpcInterfaces/control.ts +62 -0
- package/src/interfaces/rpcInterfaces/generating.ts +21 -0
- package/src/interfaces/rpcInterfaces/index.ts +14 -0
- package/src/interfaces/rpcInterfaces/mining.ts +143 -0
- package/src/interfaces/rpcInterfaces/network.ts +195 -0
- package/src/interfaces/rpcInterfaces/rawtransactions.ts +314 -0
- package/src/interfaces/rpcInterfaces/util.ts +52 -0
- package/src/interfaces/rpcInterfaces/wallet.ts +674 -0
- package/src/interfaces/rpcInterfaces/zmq.ts +11 -0
- package/src/restClient.ts +119 -0
- package/src/rpcClient.ts +93 -0
- package/src/utils/errors.ts +6 -0
- package/src/utils/utils.ts +55 -0
- package/test/restClient.test.ts +32 -0
- package/test/rpcClient.test.ts +115 -0
- package/test/setupTests.ts +54 -0
- package/test/tsconfig.json +4 -0
- package/tsconfig.json +13 -0
- package/vitest.config.ts +9 -0
|
@@ -0,0 +1,759 @@
|
|
|
1
|
+
/* --- Blockchain Commands --- */
|
|
2
|
+
// progress 33/33
|
|
3
|
+
|
|
4
|
+
import type { TokenData, Transaction, TransactionInput } from "../interfaces.js";
|
|
5
|
+
|
|
6
|
+
export interface FinalizeBlock {
|
|
7
|
+
method: 'finalizeblock';
|
|
8
|
+
params: [
|
|
9
|
+
blockhash: string
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface GetBestBlockHash {
|
|
14
|
+
method: 'getbestblockhash';
|
|
15
|
+
params: [];
|
|
16
|
+
response: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface GetBlockBase {
|
|
20
|
+
method: 'getblock';
|
|
21
|
+
params: [
|
|
22
|
+
blockhash: string,
|
|
23
|
+
verbosity?: number | boolean
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Verbosity = 0 (or false)
|
|
28
|
+
export interface GetBlockVerbosity0 extends GetBlockBase {
|
|
29
|
+
params: [
|
|
30
|
+
blockhash: string,
|
|
31
|
+
verbosity?: 0 | false
|
|
32
|
+
];
|
|
33
|
+
response: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Verbosity = 1 (or true)
|
|
37
|
+
export interface GetBlockVerbosity1 extends GetBlockBase {
|
|
38
|
+
params: [
|
|
39
|
+
blockhash: string,
|
|
40
|
+
verbosity?: 1 | true
|
|
41
|
+
];
|
|
42
|
+
response: {
|
|
43
|
+
hash: string;
|
|
44
|
+
confirmations: number;
|
|
45
|
+
size: number;
|
|
46
|
+
height: number;
|
|
47
|
+
version: number;
|
|
48
|
+
versionHex: string;
|
|
49
|
+
merkleroot: string;
|
|
50
|
+
tx : string[]
|
|
51
|
+
time: number;
|
|
52
|
+
mediantime: number;
|
|
53
|
+
nonce: number;
|
|
54
|
+
bits: string;
|
|
55
|
+
difficulty: number;
|
|
56
|
+
chainwork: string;
|
|
57
|
+
nTx: number;
|
|
58
|
+
previousblockhash: string;
|
|
59
|
+
nextblockhash: string;
|
|
60
|
+
ablastate: {
|
|
61
|
+
epsilon: number;
|
|
62
|
+
beta: number;
|
|
63
|
+
blocksize: number;
|
|
64
|
+
blocksizelimit: number;
|
|
65
|
+
nextblocksizelimit: number;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Verbosity = 2
|
|
71
|
+
export interface GetBlockVerbosity2 extends GetBlockBase {
|
|
72
|
+
params: [
|
|
73
|
+
blockhash: string,
|
|
74
|
+
verbosity: 2
|
|
75
|
+
];
|
|
76
|
+
response: {
|
|
77
|
+
hash: string;
|
|
78
|
+
confirmations: number;
|
|
79
|
+
size: number;
|
|
80
|
+
height: number;
|
|
81
|
+
version: number;
|
|
82
|
+
versionHex: string;
|
|
83
|
+
merkleroot: string;
|
|
84
|
+
tx: {
|
|
85
|
+
txid: string;
|
|
86
|
+
fee?: number;
|
|
87
|
+
}[];
|
|
88
|
+
time: number;
|
|
89
|
+
mediantime: number;
|
|
90
|
+
nonce: number;
|
|
91
|
+
bits: string;
|
|
92
|
+
difficulty: number;
|
|
93
|
+
chainwork: string;
|
|
94
|
+
nTx: number;
|
|
95
|
+
previousblockhash: string;
|
|
96
|
+
nextblockhash: string;
|
|
97
|
+
ablastate?: {
|
|
98
|
+
epsilon: number;
|
|
99
|
+
beta: number;
|
|
100
|
+
blocksize: number;
|
|
101
|
+
blocksizelimit: number;
|
|
102
|
+
nextblocksizelimit: number;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface TransactionInputWithPrevout extends TransactionInput {
|
|
108
|
+
prevout?: {
|
|
109
|
+
generated: boolean;
|
|
110
|
+
height: number;
|
|
111
|
+
value: number;
|
|
112
|
+
scriptPubKey: {
|
|
113
|
+
asm: string;
|
|
114
|
+
hex: string;
|
|
115
|
+
type: 'nonstandard' | 'pubkey' | 'pubkeyhash' | 'scripthash' | 'multisig' | 'nulldata';
|
|
116
|
+
address?: string;
|
|
117
|
+
};
|
|
118
|
+
tokenData?: TokenData;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// GetBlockVerbosity3 uses enhanced TransactionInputWithPrevout
|
|
123
|
+
export interface TransactionWithPrevout extends Omit<Transaction, 'vin'> {
|
|
124
|
+
vin: TransactionInputWithPrevout[]; // Use the extended input type with `prevout`
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Verbosity = 3
|
|
128
|
+
export interface GetBlockVerbosity3 extends GetBlockBase {
|
|
129
|
+
params: [
|
|
130
|
+
blockhash: string,
|
|
131
|
+
verbosity: 3
|
|
132
|
+
];
|
|
133
|
+
response: {
|
|
134
|
+
hash: string;
|
|
135
|
+
confirmations: number;
|
|
136
|
+
size: number;
|
|
137
|
+
height: number;
|
|
138
|
+
version: number;
|
|
139
|
+
versionHex: string;
|
|
140
|
+
merkleroot: string;
|
|
141
|
+
tx: TransactionWithPrevout[];
|
|
142
|
+
time: number;
|
|
143
|
+
mediantime: number;
|
|
144
|
+
nonce: number;
|
|
145
|
+
bits: string;
|
|
146
|
+
difficulty: number;
|
|
147
|
+
chainwork: string;
|
|
148
|
+
nTx: number;
|
|
149
|
+
previousblockhash: string;
|
|
150
|
+
nextblockhash: string;
|
|
151
|
+
ablastate?: {
|
|
152
|
+
epsilon: number;
|
|
153
|
+
beta: number;
|
|
154
|
+
blocksize: number;
|
|
155
|
+
blocksizelimit: number;
|
|
156
|
+
nextblocksizelimit: number;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface GetBlockchainInfo {
|
|
162
|
+
method: 'getblockchaininfo';
|
|
163
|
+
params: [];
|
|
164
|
+
response: {
|
|
165
|
+
chain: 'main' | 'test' | 'regtest';
|
|
166
|
+
blocks: number;
|
|
167
|
+
headers: number;
|
|
168
|
+
bestblockhash: string;
|
|
169
|
+
difficulty: number;
|
|
170
|
+
mediantime: number;
|
|
171
|
+
verificationprogress: number;
|
|
172
|
+
initialblockdownload: boolean;
|
|
173
|
+
chainwork: string;
|
|
174
|
+
size_on_disk: number;
|
|
175
|
+
pruned: boolean;
|
|
176
|
+
pruneheight: number;
|
|
177
|
+
automatic_pruning: boolean;
|
|
178
|
+
prune_target_size?: number;
|
|
179
|
+
warnings: string;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface GetBlockCount {
|
|
184
|
+
method: 'getblockcount';
|
|
185
|
+
params: [];
|
|
186
|
+
response: number;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface GetBlockHash {
|
|
190
|
+
method: 'getblockhash';
|
|
191
|
+
params: [
|
|
192
|
+
height: number
|
|
193
|
+
];
|
|
194
|
+
response: string;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface GetBlockHeaderBase {
|
|
198
|
+
method: 'getblockheader';
|
|
199
|
+
params: [
|
|
200
|
+
hash_or_height: string| number,
|
|
201
|
+
verbosity?: boolean | number
|
|
202
|
+
];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface GetBlockHeaderVerbosity0 extends GetBlockHeaderBase {
|
|
206
|
+
params: [
|
|
207
|
+
hash_or_height: string| number,
|
|
208
|
+
verbosity?: false | 0
|
|
209
|
+
];
|
|
210
|
+
response: string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface GetBlockHeaderVerbosity1 extends GetBlockHeaderBase {
|
|
214
|
+
params: [
|
|
215
|
+
hash_or_height: string| number,
|
|
216
|
+
verbosity?: true | 1
|
|
217
|
+
];
|
|
218
|
+
response: {
|
|
219
|
+
hash: string;
|
|
220
|
+
confirmations: number;
|
|
221
|
+
height: number;
|
|
222
|
+
version: number;
|
|
223
|
+
versionHex: string;
|
|
224
|
+
merkleroot: string;
|
|
225
|
+
time: number;
|
|
226
|
+
mediantime: number;
|
|
227
|
+
nonce: number;
|
|
228
|
+
bits: string;
|
|
229
|
+
difficulty: number;
|
|
230
|
+
chainwork: string;
|
|
231
|
+
nTx: number;
|
|
232
|
+
previousblockhash: string;
|
|
233
|
+
nextblockhash: string;
|
|
234
|
+
ablastate : {
|
|
235
|
+
epsilon: number;
|
|
236
|
+
beta: number;
|
|
237
|
+
blocksize: number;
|
|
238
|
+
blocksizelimit: number;
|
|
239
|
+
nextblocksizelimit: number;
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface GetBlockStats {
|
|
245
|
+
method: 'getblockheader';
|
|
246
|
+
params: [
|
|
247
|
+
hash_or_height: string| number,
|
|
248
|
+
stats?: string[]
|
|
249
|
+
];
|
|
250
|
+
response: {
|
|
251
|
+
avgfee: number;
|
|
252
|
+
avgfeerate: number;
|
|
253
|
+
avgtxsize: number;
|
|
254
|
+
blockhash: string;
|
|
255
|
+
feerate_percentiles: {
|
|
256
|
+
"10th_percentile_feerate": number;
|
|
257
|
+
"25th_percentile_feerate": number;
|
|
258
|
+
"50th_percentile_feerate": number;
|
|
259
|
+
"75th_percentile_feerate": number;
|
|
260
|
+
"90th_percentile_feerate": number;
|
|
261
|
+
};
|
|
262
|
+
height: number;
|
|
263
|
+
ins: number;
|
|
264
|
+
maxfee: number;
|
|
265
|
+
maxfeerate: number;
|
|
266
|
+
maxtxsize: number;
|
|
267
|
+
medianfee: number;
|
|
268
|
+
mediantime: number;
|
|
269
|
+
mediantxsize: number;
|
|
270
|
+
minfee: number;
|
|
271
|
+
minfeerate: number;
|
|
272
|
+
mintxsize: number;
|
|
273
|
+
outs: number;
|
|
274
|
+
subsidy: number;
|
|
275
|
+
time: number;
|
|
276
|
+
total_out: number;
|
|
277
|
+
total_size: number;
|
|
278
|
+
totalfee: number;
|
|
279
|
+
txs: number;
|
|
280
|
+
utxo_increase: number;
|
|
281
|
+
utxo_size_inc: number;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export interface GetChainTips {
|
|
287
|
+
method: 'getchaintips';
|
|
288
|
+
params: [];
|
|
289
|
+
response: {
|
|
290
|
+
height: number
|
|
291
|
+
hash: string
|
|
292
|
+
branchlen:number
|
|
293
|
+
status: 'active' | 'parked' | 'headers-only' | 'valid-headers' | 'valid-fork' | 'active'
|
|
294
|
+
}[]
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export interface GetChainTxStats {
|
|
298
|
+
method: 'getchaintxstats';
|
|
299
|
+
params: [
|
|
300
|
+
nblocks?: number,
|
|
301
|
+
blockhash?: string
|
|
302
|
+
];
|
|
303
|
+
response: {
|
|
304
|
+
time: number;
|
|
305
|
+
txcount: number;
|
|
306
|
+
window_final_block_hash: string;
|
|
307
|
+
window_block_count: number;
|
|
308
|
+
window_tx_count: number | undefined;
|
|
309
|
+
window_interval: number | undefined;
|
|
310
|
+
txrate: number;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export interface GetDifficulty {
|
|
315
|
+
method: 'getdifficulty';
|
|
316
|
+
params: [];
|
|
317
|
+
response: number;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
interface GetDsProofBase {
|
|
321
|
+
method: 'getdsproof';
|
|
322
|
+
params: [
|
|
323
|
+
dspid_or_txid_or_outpoint: string | { txid: string; vout: number },
|
|
324
|
+
verbosity?: number | boolean,
|
|
325
|
+
recursive?: boolean
|
|
326
|
+
];
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Verbosity = 0 (or false)
|
|
330
|
+
export interface GetDsProofVerbosity0 extends GetDsProofBase {
|
|
331
|
+
params: [
|
|
332
|
+
dspid_or_txid_or_outpoint: string | { txid: string; vout: number },
|
|
333
|
+
verbosity?: 0 | false,
|
|
334
|
+
recursive?: boolean
|
|
335
|
+
];
|
|
336
|
+
response: {
|
|
337
|
+
hex: string;
|
|
338
|
+
txid: string | null;
|
|
339
|
+
path?: string[]; // Optional for recursive = true
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// Verbosity = 1
|
|
344
|
+
export interface GetDsProofVerbosity1 extends GetDsProofBase {
|
|
345
|
+
params: [
|
|
346
|
+
dspid_or_txid_or_outpoint: string | { txid: string; vout: number },
|
|
347
|
+
verbosity?: 1,
|
|
348
|
+
recursive?: boolean
|
|
349
|
+
];
|
|
350
|
+
response: {
|
|
351
|
+
hex: string;
|
|
352
|
+
txid: string | null;
|
|
353
|
+
path?: string[]; // Optional for recursive = true
|
|
354
|
+
descendants?: string[]
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// Verbosity = 2 (or true)
|
|
359
|
+
export interface GetDsProofVerbosity2 extends GetDsProofBase {
|
|
360
|
+
params: [
|
|
361
|
+
dspid_or_txid_or_outpoint: string | { txid: string; vout: number },
|
|
362
|
+
verbosity?: 2 | true,
|
|
363
|
+
recursive?: boolean
|
|
364
|
+
];
|
|
365
|
+
response: {
|
|
366
|
+
dspid: string;
|
|
367
|
+
txid: string | null;
|
|
368
|
+
outpoint: {
|
|
369
|
+
txid: string;
|
|
370
|
+
vout: number;
|
|
371
|
+
};
|
|
372
|
+
descendants?: string[];
|
|
373
|
+
path?: string[]; // Optional for recursive = true
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
interface Spender {
|
|
378
|
+
txversion: number,
|
|
379
|
+
sequence: number,
|
|
380
|
+
locktime: number,
|
|
381
|
+
hashprevoutputs: string,
|
|
382
|
+
hashsequence: string,
|
|
383
|
+
hashoutputs: string,
|
|
384
|
+
pushdata: {
|
|
385
|
+
asm: string,
|
|
386
|
+
hex: string
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// Verbosity = 3
|
|
391
|
+
export interface GetDsProofVerbosity3 extends GetDsProofVerbosity2 {
|
|
392
|
+
response: {
|
|
393
|
+
dspid: string;
|
|
394
|
+
txid: string | null;
|
|
395
|
+
outpoint: {
|
|
396
|
+
txid: string;
|
|
397
|
+
vout: number;
|
|
398
|
+
};
|
|
399
|
+
spenders: Spender[];
|
|
400
|
+
descendants?: string[];
|
|
401
|
+
path?: string[]; // Optional for recursive = true
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export interface GetDsProofListBase {
|
|
406
|
+
method: 'getdsprooflist';
|
|
407
|
+
params: [
|
|
408
|
+
verbosity?: number | boolean,
|
|
409
|
+
include_orphans?: boolean
|
|
410
|
+
];
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// Verbosity = 0 (or false)
|
|
414
|
+
export interface GetDsProofListVerbosity0 extends GetDsProofListBase {
|
|
415
|
+
params: [
|
|
416
|
+
verbosity?: 0 | false,
|
|
417
|
+
include_orphans?: boolean
|
|
418
|
+
];
|
|
419
|
+
response: string[]
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// Verbosity = 1
|
|
423
|
+
export interface GetDsProofListVerbosity1 extends GetDsProofListBase {
|
|
424
|
+
params: [
|
|
425
|
+
verbosity?: 1,
|
|
426
|
+
include_orphans?: boolean
|
|
427
|
+
];
|
|
428
|
+
response: {
|
|
429
|
+
hex: string;
|
|
430
|
+
txid: string | null;
|
|
431
|
+
}[]
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Verbosity = 2 (or true)
|
|
435
|
+
export interface GetDsProofListVerbosity2 extends GetDsProofListBase {
|
|
436
|
+
params: [
|
|
437
|
+
verbosity?: 2 | true,
|
|
438
|
+
include_orphans?: boolean
|
|
439
|
+
];
|
|
440
|
+
response: {
|
|
441
|
+
dspid: string;
|
|
442
|
+
txid: string | null;
|
|
443
|
+
outpoint: {
|
|
444
|
+
txid: string;
|
|
445
|
+
vout: number;
|
|
446
|
+
};
|
|
447
|
+
}[]
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// Verbosity = 3
|
|
451
|
+
export interface GetDsProofListVerbosity3 extends GetDsProofListBase {
|
|
452
|
+
response: {
|
|
453
|
+
dspid: string;
|
|
454
|
+
txid: string | null;
|
|
455
|
+
outpoint: {
|
|
456
|
+
txid: string;
|
|
457
|
+
vout: number;
|
|
458
|
+
};
|
|
459
|
+
spenders: Spender[]
|
|
460
|
+
}[]
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export interface GetDsProofScore {
|
|
464
|
+
method: 'getdsproofscore';
|
|
465
|
+
params: [
|
|
466
|
+
txid: string
|
|
467
|
+
];
|
|
468
|
+
response: number;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export interface GetFinalizedBlockHash {
|
|
472
|
+
method: 'getfinalizedblockhash';
|
|
473
|
+
params: [];
|
|
474
|
+
response: string;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
interface GetMempoolAncestorsBase {
|
|
478
|
+
method: 'getmempoolancestors';
|
|
479
|
+
params: [
|
|
480
|
+
txid: string,
|
|
481
|
+
verbose?: boolean | number
|
|
482
|
+
];
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// Verbosity 0 (false)
|
|
486
|
+
export interface GetMempoolAncestorsVerbosity0 extends GetMempoolAncestorsBase {
|
|
487
|
+
params: [
|
|
488
|
+
txid: string,
|
|
489
|
+
verbose?: false | 0
|
|
490
|
+
];
|
|
491
|
+
response: string[];
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// Verbosity 1 (true)
|
|
495
|
+
export interface GetMempoolAncestorsVerbosity1 extends GetMempoolAncestorsBase {
|
|
496
|
+
params: [
|
|
497
|
+
txid: string,
|
|
498
|
+
verbose?: true | 1
|
|
499
|
+
];
|
|
500
|
+
response: {
|
|
501
|
+
[transactionid: string]: {
|
|
502
|
+
size: number;
|
|
503
|
+
time: number;
|
|
504
|
+
fees: {
|
|
505
|
+
base: number;
|
|
506
|
+
modified: number;
|
|
507
|
+
};
|
|
508
|
+
depends: string[];
|
|
509
|
+
spentby: string[];
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
interface GetMempoolDescendantsBase {
|
|
515
|
+
method: 'getmempooldescendants';
|
|
516
|
+
params: [
|
|
517
|
+
txid: string,
|
|
518
|
+
verbose?: boolean | number
|
|
519
|
+
];
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// Verbosity 0 (false)
|
|
523
|
+
export interface GetMempoolDescendantsVerbosity0 extends GetMempoolDescendantsBase {
|
|
524
|
+
params: [
|
|
525
|
+
txid: string,
|
|
526
|
+
verbose?: false | 0
|
|
527
|
+
];
|
|
528
|
+
response: string[];
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// Verbosity 1 (true)
|
|
532
|
+
export interface GetMempoolDescendantsVerbosity1 extends GetMempoolDescendantsBase {
|
|
533
|
+
params: [
|
|
534
|
+
txid: string,
|
|
535
|
+
verbose?: true | 1
|
|
536
|
+
];
|
|
537
|
+
response: {
|
|
538
|
+
[transactionid: string]: {
|
|
539
|
+
size: number;
|
|
540
|
+
time: number;
|
|
541
|
+
fees: {
|
|
542
|
+
base: number;
|
|
543
|
+
modified: number;
|
|
544
|
+
};
|
|
545
|
+
depends: string[];
|
|
546
|
+
spentby: string[];
|
|
547
|
+
};
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
export interface GetMempoolEntry {
|
|
552
|
+
method: 'getmempoolentry';
|
|
553
|
+
params: [
|
|
554
|
+
txid: string
|
|
555
|
+
];
|
|
556
|
+
response: {
|
|
557
|
+
size: number;
|
|
558
|
+
time: number;
|
|
559
|
+
fees: {
|
|
560
|
+
base: number;
|
|
561
|
+
modified: number;
|
|
562
|
+
};
|
|
563
|
+
depends: string[];
|
|
564
|
+
spentby: string[];
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
export interface GetMempoolInfo {
|
|
569
|
+
method: 'getmempoolinfo';
|
|
570
|
+
params: [];
|
|
571
|
+
response: {
|
|
572
|
+
loaded: boolean;
|
|
573
|
+
size: number;
|
|
574
|
+
bytes: number;
|
|
575
|
+
usage: number;
|
|
576
|
+
maxmempool: number;
|
|
577
|
+
mempoolminfee: number;
|
|
578
|
+
minrelaytxfee: number;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
interface GetRawMempoolBase {
|
|
583
|
+
method: 'getrawmempool';
|
|
584
|
+
params: [
|
|
585
|
+
verbose?: boolean | number
|
|
586
|
+
];
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// Verbosity 0 (false)
|
|
590
|
+
export interface GetRawMempoolVerbosity0 extends GetRawMempoolBase {
|
|
591
|
+
params: [
|
|
592
|
+
verbose?: false | 0
|
|
593
|
+
];
|
|
594
|
+
response: string[];
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// Verbosity 1 (true)
|
|
598
|
+
export interface GetRawMempoolVerbosity1 extends GetRawMempoolBase {
|
|
599
|
+
params: [
|
|
600
|
+
verbose?: true | 1
|
|
601
|
+
];
|
|
602
|
+
response: {
|
|
603
|
+
[transactionid: string]: {
|
|
604
|
+
size: number;
|
|
605
|
+
time: number;
|
|
606
|
+
fees: {
|
|
607
|
+
base: number;
|
|
608
|
+
modified: number;
|
|
609
|
+
};
|
|
610
|
+
depends: string[];
|
|
611
|
+
spentby: string[];
|
|
612
|
+
};
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
export interface GetTxOut {
|
|
617
|
+
method: 'gettxout';
|
|
618
|
+
params: [
|
|
619
|
+
txid: string,
|
|
620
|
+
vout: number,
|
|
621
|
+
include_mempool?: boolean
|
|
622
|
+
];
|
|
623
|
+
response: {
|
|
624
|
+
bestblock: string;
|
|
625
|
+
confirmations: number
|
|
626
|
+
value: number;
|
|
627
|
+
scriptPubKey: {
|
|
628
|
+
asm: string;
|
|
629
|
+
hex: string;
|
|
630
|
+
type: string;
|
|
631
|
+
addresses: string[];
|
|
632
|
+
}
|
|
633
|
+
tokenData?: TokenData;
|
|
634
|
+
coinbase: boolean;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export interface GetTxOutProof {
|
|
639
|
+
method: 'gettxoutproof';
|
|
640
|
+
params: [
|
|
641
|
+
txids: string[],
|
|
642
|
+
blockhash?: string
|
|
643
|
+
];
|
|
644
|
+
response: string;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
export interface GetTxOutSetInfo {
|
|
649
|
+
method: 'gettxoutsetinfo';
|
|
650
|
+
params: [
|
|
651
|
+
txid: string
|
|
652
|
+
];
|
|
653
|
+
response: {
|
|
654
|
+
height: number;
|
|
655
|
+
bestblock: string;
|
|
656
|
+
transactions: number;
|
|
657
|
+
txouts: number;
|
|
658
|
+
bogosize: number;
|
|
659
|
+
hash_serialized: string;
|
|
660
|
+
disk_size: number;
|
|
661
|
+
total_amount: number;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
export interface InvalidateBlock {
|
|
666
|
+
method: 'invalidateblock';
|
|
667
|
+
params: [
|
|
668
|
+
blockhash: string
|
|
669
|
+
];
|
|
670
|
+
response: null;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
export interface ParkBlock {
|
|
674
|
+
method: 'parkblock';
|
|
675
|
+
params: [
|
|
676
|
+
blockhash: string
|
|
677
|
+
];
|
|
678
|
+
response: null;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
export interface PreciousBlock {
|
|
682
|
+
method: 'preciousblock';
|
|
683
|
+
params: [
|
|
684
|
+
blockhash: string
|
|
685
|
+
];
|
|
686
|
+
response: null;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
export interface PruneBlockchain {
|
|
690
|
+
method: 'pruneblockchain';
|
|
691
|
+
params: [
|
|
692
|
+
height: number
|
|
693
|
+
];
|
|
694
|
+
response: number;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
export interface ReconsiderBlock {
|
|
698
|
+
method: 'reconsiderblock';
|
|
699
|
+
params: [
|
|
700
|
+
blockhash: string
|
|
701
|
+
];
|
|
702
|
+
response: null;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
export interface SaveMempool {
|
|
706
|
+
method: 'savemempool';
|
|
707
|
+
params: [];
|
|
708
|
+
response: null;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
export interface ScanTxOutSet {
|
|
712
|
+
method: 'scantxoutset';
|
|
713
|
+
params: [
|
|
714
|
+
action: 'start' | 'abort' | 'status',
|
|
715
|
+
scanobjects?: Array<string | {
|
|
716
|
+
desc: string;
|
|
717
|
+
range?: number;
|
|
718
|
+
}>
|
|
719
|
+
];
|
|
720
|
+
response: {
|
|
721
|
+
unspents: Array<{
|
|
722
|
+
txid: string;
|
|
723
|
+
vout: number;
|
|
724
|
+
scriptPubKey: string;
|
|
725
|
+
amount: number;
|
|
726
|
+
height: number;
|
|
727
|
+
tokenData?: TokenData;
|
|
728
|
+
}>;
|
|
729
|
+
total_amount: number;
|
|
730
|
+
token_total_amount?: {
|
|
731
|
+
[category: string]: string;
|
|
732
|
+
};
|
|
733
|
+
} | boolean;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
export interface UnparkBlock {
|
|
737
|
+
method: 'unparkblock';
|
|
738
|
+
params: [
|
|
739
|
+
blockhash: string
|
|
740
|
+
];
|
|
741
|
+
response: null;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
export interface VerifyChain {
|
|
745
|
+
method: 'verifychain';
|
|
746
|
+
params: [
|
|
747
|
+
checklevel?: number,
|
|
748
|
+
nblocks?: number
|
|
749
|
+
];
|
|
750
|
+
response: boolean;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
export interface VerifyTxOutProof {
|
|
754
|
+
method: 'verifytxoutproof';
|
|
755
|
+
params: [
|
|
756
|
+
proof: string
|
|
757
|
+
];
|
|
758
|
+
response: string[];
|
|
759
|
+
}
|