@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,10 +1,12 @@
|
|
|
1
1
|
import type { TokenData, Transaction, TransactionInput } from "../interfaces.js";
|
|
2
|
+
/** Finalize a block by hash (Avalanche post-consensus). */
|
|
2
3
|
export interface FinalizeBlock {
|
|
3
4
|
method: 'finalizeblock';
|
|
4
5
|
params: [
|
|
5
6
|
blockhash: string
|
|
6
7
|
];
|
|
7
8
|
}
|
|
9
|
+
/** Returns the hash of the best (tip) block in the most-work chain. */
|
|
8
10
|
export interface GetBestBlockHash {
|
|
9
11
|
method: 'getbestblockhash';
|
|
10
12
|
params: [];
|
|
@@ -17,6 +19,38 @@ interface GetBlockBase {
|
|
|
17
19
|
verbosity?: number | boolean
|
|
18
20
|
];
|
|
19
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. */
|
|
20
54
|
export interface GetBlockVerbosity0 extends GetBlockBase {
|
|
21
55
|
params: [
|
|
22
56
|
blockhash: string,
|
|
@@ -24,73 +58,74 @@ export interface GetBlockVerbosity0 extends GetBlockBase {
|
|
|
24
58
|
];
|
|
25
59
|
response: string;
|
|
26
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. */
|
|
27
66
|
export interface GetBlockVerbosity1 extends GetBlockBase {
|
|
28
67
|
params: [
|
|
29
68
|
blockhash: string,
|
|
30
69
|
verbosity?: 1 | true
|
|
31
70
|
];
|
|
32
|
-
response: {
|
|
33
|
-
|
|
34
|
-
confirmations: number;
|
|
35
|
-
size: number;
|
|
36
|
-
height: number;
|
|
37
|
-
version: number;
|
|
38
|
-
versionHex: string;
|
|
39
|
-
merkleroot: string;
|
|
40
|
-
tx: string[];
|
|
41
|
-
time: number;
|
|
42
|
-
mediantime: number;
|
|
43
|
-
nonce: number;
|
|
44
|
-
bits: string;
|
|
45
|
-
difficulty: number;
|
|
46
|
-
chainwork: string;
|
|
47
|
-
nTx: number;
|
|
48
|
-
previousblockhash: string;
|
|
49
|
-
nextblockhash: string;
|
|
50
|
-
ablastate: {
|
|
51
|
-
epsilon: number;
|
|
52
|
-
beta: number;
|
|
53
|
-
blocksize: number;
|
|
54
|
-
blocksizelimit: number;
|
|
55
|
-
nextblocksizelimit: number;
|
|
56
|
-
};
|
|
71
|
+
response: BlockResponseVerbosity1 & {
|
|
72
|
+
ablastate?: AblaState;
|
|
57
73
|
};
|
|
58
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. */
|
|
59
101
|
export interface GetBlockVerbosity2 extends GetBlockBase {
|
|
60
102
|
params: [
|
|
61
103
|
blockhash: string,
|
|
62
104
|
verbosity: 2
|
|
63
105
|
];
|
|
64
|
-
response: {
|
|
65
|
-
|
|
66
|
-
confirmations: number;
|
|
67
|
-
size: number;
|
|
68
|
-
height: number;
|
|
69
|
-
version: number;
|
|
70
|
-
versionHex: string;
|
|
71
|
-
merkleroot: string;
|
|
72
|
-
tx: {
|
|
73
|
-
txid: string;
|
|
74
|
-
fee?: number;
|
|
75
|
-
}[];
|
|
76
|
-
time: number;
|
|
77
|
-
mediantime: number;
|
|
78
|
-
nonce: number;
|
|
79
|
-
bits: string;
|
|
80
|
-
difficulty: number;
|
|
81
|
-
chainwork: string;
|
|
82
|
-
nTx: number;
|
|
83
|
-
previousblockhash: string;
|
|
84
|
-
nextblockhash: string;
|
|
85
|
-
ablastate?: {
|
|
86
|
-
epsilon: number;
|
|
87
|
-
beta: number;
|
|
88
|
-
blocksize: number;
|
|
89
|
-
blocksizelimit: number;
|
|
90
|
-
nextblocksizelimit: number;
|
|
91
|
-
};
|
|
106
|
+
response: BlockResponseVerbosity2 & {
|
|
107
|
+
ablastate?: AblaState;
|
|
92
108
|
};
|
|
93
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. */
|
|
94
129
|
export interface TransactionInputWithPrevout extends TransactionInput {
|
|
95
130
|
prevout?: {
|
|
96
131
|
generated: boolean;
|
|
@@ -105,41 +140,124 @@ export interface TransactionInputWithPrevout extends TransactionInput {
|
|
|
105
140
|
tokenData?: TokenData;
|
|
106
141
|
};
|
|
107
142
|
}
|
|
143
|
+
/** Transaction with prevout data on inputs (used by verbosity 3). */
|
|
108
144
|
export interface TransactionWithPrevout extends Omit<Transaction, 'vin'> {
|
|
109
145
|
vin: TransactionInputWithPrevout[];
|
|
110
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. */
|
|
111
152
|
export interface GetBlockVerbosity3 extends GetBlockBase {
|
|
112
153
|
params: [
|
|
113
154
|
blockhash: string,
|
|
114
155
|
verbosity: 3
|
|
115
156
|
];
|
|
116
|
-
response: {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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;
|
|
120
197
|
height: number;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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;
|
|
141
240
|
};
|
|
142
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. */
|
|
143
261
|
export interface GetBlockchainInfo {
|
|
144
262
|
method: 'getblockchaininfo';
|
|
145
263
|
params: [];
|
|
@@ -159,13 +277,25 @@ export interface GetBlockchainInfo {
|
|
|
159
277
|
automatic_pruning: boolean;
|
|
160
278
|
prune_target_size?: number;
|
|
161
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
|
+
};
|
|
162
290
|
};
|
|
163
291
|
}
|
|
292
|
+
/** Returns the current block height. */
|
|
164
293
|
export interface GetBlockCount {
|
|
165
294
|
method: 'getblockcount';
|
|
166
295
|
params: [];
|
|
167
296
|
response: number;
|
|
168
297
|
}
|
|
298
|
+
/** Returns block hash at given height. */
|
|
169
299
|
export interface GetBlockHash {
|
|
170
300
|
method: 'getblockhash';
|
|
171
301
|
params: [
|
|
@@ -180,6 +310,7 @@ export interface GetBlockHeaderBase {
|
|
|
180
310
|
verbosity?: boolean | number
|
|
181
311
|
];
|
|
182
312
|
}
|
|
313
|
+
/** Verbosity 0: Returns hex-encoded block header. */
|
|
183
314
|
export interface GetBlockHeaderVerbosity0 extends GetBlockHeaderBase {
|
|
184
315
|
params: [
|
|
185
316
|
hash_or_height: string | number,
|
|
@@ -187,36 +318,57 @@ export interface GetBlockHeaderVerbosity0 extends GetBlockHeaderBase {
|
|
|
187
318
|
];
|
|
188
319
|
response: string;
|
|
189
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. */
|
|
190
344
|
export interface GetBlockHeaderVerbosity1 extends GetBlockHeaderBase {
|
|
191
345
|
params: [
|
|
192
346
|
hash_or_height: string | number,
|
|
193
347
|
verbosity?: true | 1
|
|
194
348
|
];
|
|
195
|
-
response: {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
blocksizelimit: number;
|
|
216
|
-
nextblocksizelimit: number;
|
|
217
|
-
};
|
|
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;
|
|
218
369
|
};
|
|
219
370
|
}
|
|
371
|
+
/** Returns fee/size statistics for a block. */
|
|
220
372
|
export interface GetBlockStats {
|
|
221
373
|
method: 'getblockheader';
|
|
222
374
|
params: [
|
|
@@ -257,6 +409,7 @@ export interface GetBlockStats {
|
|
|
257
409
|
utxo_size_inc: number;
|
|
258
410
|
};
|
|
259
411
|
}
|
|
412
|
+
/** Returns all known chain tips including forks. */
|
|
260
413
|
export interface GetChainTips {
|
|
261
414
|
method: 'getchaintips';
|
|
262
415
|
params: [];
|
|
@@ -267,6 +420,7 @@ export interface GetChainTips {
|
|
|
267
420
|
status: 'active' | 'parked' | 'headers-only' | 'valid-headers' | 'valid-fork' | 'active';
|
|
268
421
|
}[];
|
|
269
422
|
}
|
|
423
|
+
/** Returns transaction statistics over a block window. */
|
|
270
424
|
export interface GetChainTxStats {
|
|
271
425
|
method: 'getchaintxstats';
|
|
272
426
|
params: [
|
|
@@ -283,6 +437,7 @@ export interface GetChainTxStats {
|
|
|
283
437
|
txrate: number;
|
|
284
438
|
};
|
|
285
439
|
}
|
|
440
|
+
/** Returns current network difficulty. */
|
|
286
441
|
export interface GetDifficulty {
|
|
287
442
|
method: 'getdifficulty';
|
|
288
443
|
params: [];
|
|
@@ -299,6 +454,7 @@ interface GetDsProofBase {
|
|
|
299
454
|
recursive?: boolean
|
|
300
455
|
];
|
|
301
456
|
}
|
|
457
|
+
/** Verbosity 0: Double-spend proof as hex. */
|
|
302
458
|
export interface GetDsProofVerbosity0 extends GetDsProofBase {
|
|
303
459
|
params: [
|
|
304
460
|
dspid_or_txid_or_outpoint: string | {
|
|
@@ -314,6 +470,7 @@ export interface GetDsProofVerbosity0 extends GetDsProofBase {
|
|
|
314
470
|
path?: string[];
|
|
315
471
|
};
|
|
316
472
|
}
|
|
473
|
+
/** Verbosity 1: Double-spend proof with descendants. */
|
|
317
474
|
export interface GetDsProofVerbosity1 extends GetDsProofBase {
|
|
318
475
|
params: [
|
|
319
476
|
dspid_or_txid_or_outpoint: string | {
|
|
@@ -330,6 +487,7 @@ export interface GetDsProofVerbosity1 extends GetDsProofBase {
|
|
|
330
487
|
descendants?: string[];
|
|
331
488
|
};
|
|
332
489
|
}
|
|
490
|
+
/** Verbosity 2: Double-spend proof with parsed outpoint. */
|
|
333
491
|
export interface GetDsProofVerbosity2 extends GetDsProofBase {
|
|
334
492
|
params: [
|
|
335
493
|
dspid_or_txid_or_outpoint: string | {
|
|
@@ -350,6 +508,7 @@ export interface GetDsProofVerbosity2 extends GetDsProofBase {
|
|
|
350
508
|
path?: string[];
|
|
351
509
|
};
|
|
352
510
|
}
|
|
511
|
+
/** Double-spend proof spender data. */
|
|
353
512
|
interface Spender {
|
|
354
513
|
txversion: number;
|
|
355
514
|
sequence: number;
|
|
@@ -362,6 +521,7 @@ interface Spender {
|
|
|
362
521
|
hex: string;
|
|
363
522
|
};
|
|
364
523
|
}
|
|
524
|
+
/** Verbosity 3: Double-spend proof with full spender details. */
|
|
365
525
|
export interface GetDsProofVerbosity3 extends GetDsProofVerbosity2 {
|
|
366
526
|
response: {
|
|
367
527
|
dspid: string;
|
|
@@ -382,6 +542,7 @@ export interface GetDsProofListBase {
|
|
|
382
542
|
include_orphans?: boolean
|
|
383
543
|
];
|
|
384
544
|
}
|
|
545
|
+
/** Verbosity 0: List of double-spend proof IDs. */
|
|
385
546
|
export interface GetDsProofListVerbosity0 extends GetDsProofListBase {
|
|
386
547
|
params: [
|
|
387
548
|
verbosity?: 0 | false,
|
|
@@ -389,6 +550,7 @@ export interface GetDsProofListVerbosity0 extends GetDsProofListBase {
|
|
|
389
550
|
];
|
|
390
551
|
response: string[];
|
|
391
552
|
}
|
|
553
|
+
/** Verbosity 1: List of double-spend proofs as hex with txid. */
|
|
392
554
|
export interface GetDsProofListVerbosity1 extends GetDsProofListBase {
|
|
393
555
|
params: [
|
|
394
556
|
verbosity?: 1,
|
|
@@ -399,6 +561,7 @@ export interface GetDsProofListVerbosity1 extends GetDsProofListBase {
|
|
|
399
561
|
txid: string | null;
|
|
400
562
|
}[];
|
|
401
563
|
}
|
|
564
|
+
/** Verbosity 2: List of double-spend proofs with parsed outpoints. */
|
|
402
565
|
export interface GetDsProofListVerbosity2 extends GetDsProofListBase {
|
|
403
566
|
params: [
|
|
404
567
|
verbosity?: 2 | true,
|
|
@@ -413,6 +576,7 @@ export interface GetDsProofListVerbosity2 extends GetDsProofListBase {
|
|
|
413
576
|
};
|
|
414
577
|
}[];
|
|
415
578
|
}
|
|
579
|
+
/** Verbosity 3: List of double-spend proofs with full spender details. */
|
|
416
580
|
export interface GetDsProofListVerbosity3 extends GetDsProofListBase {
|
|
417
581
|
response: {
|
|
418
582
|
dspid: string;
|
|
@@ -424,6 +588,7 @@ export interface GetDsProofListVerbosity3 extends GetDsProofListBase {
|
|
|
424
588
|
spenders: Spender[];
|
|
425
589
|
}[];
|
|
426
590
|
}
|
|
591
|
+
/** Returns double-spend proof score for a transaction. */
|
|
427
592
|
export interface GetDsProofScore {
|
|
428
593
|
method: 'getdsproofscore';
|
|
429
594
|
params: [
|
|
@@ -431,6 +596,7 @@ export interface GetDsProofScore {
|
|
|
431
596
|
];
|
|
432
597
|
response: number;
|
|
433
598
|
}
|
|
599
|
+
/** Returns the hash of the last finalized block. */
|
|
434
600
|
export interface GetFinalizedBlockHash {
|
|
435
601
|
method: 'getfinalizedblockhash';
|
|
436
602
|
params: [];
|
|
@@ -443,6 +609,7 @@ interface GetMempoolAncestorsBase {
|
|
|
443
609
|
verbose?: boolean | number
|
|
444
610
|
];
|
|
445
611
|
}
|
|
612
|
+
/** Verbosity 0: Returns ancestor txids as array. */
|
|
446
613
|
export interface GetMempoolAncestorsVerbosity0 extends GetMempoolAncestorsBase {
|
|
447
614
|
params: [
|
|
448
615
|
txid: string,
|
|
@@ -450,6 +617,7 @@ export interface GetMempoolAncestorsVerbosity0 extends GetMempoolAncestorsBase {
|
|
|
450
617
|
];
|
|
451
618
|
response: string[];
|
|
452
619
|
}
|
|
620
|
+
/** Verbosity 1: Returns ancestor txids with detailed mempool info. */
|
|
453
621
|
export interface GetMempoolAncestorsVerbosity1 extends GetMempoolAncestorsBase {
|
|
454
622
|
params: [
|
|
455
623
|
txid: string,
|
|
@@ -475,6 +643,7 @@ interface GetMempoolDescendantsBase {
|
|
|
475
643
|
verbose?: boolean | number
|
|
476
644
|
];
|
|
477
645
|
}
|
|
646
|
+
/** Verbosity 0: Returns descendant txids as array. */
|
|
478
647
|
export interface GetMempoolDescendantsVerbosity0 extends GetMempoolDescendantsBase {
|
|
479
648
|
params: [
|
|
480
649
|
txid: string,
|
|
@@ -482,6 +651,7 @@ export interface GetMempoolDescendantsVerbosity0 extends GetMempoolDescendantsBa
|
|
|
482
651
|
];
|
|
483
652
|
response: string[];
|
|
484
653
|
}
|
|
654
|
+
/** Verbosity 1: Returns descendant txids with detailed mempool info. */
|
|
485
655
|
export interface GetMempoolDescendantsVerbosity1 extends GetMempoolDescendantsBase {
|
|
486
656
|
params: [
|
|
487
657
|
txid: string,
|
|
@@ -500,6 +670,7 @@ export interface GetMempoolDescendantsVerbosity1 extends GetMempoolDescendantsBa
|
|
|
500
670
|
};
|
|
501
671
|
};
|
|
502
672
|
}
|
|
673
|
+
/** Returns mempool entry for a specific transaction. */
|
|
503
674
|
export interface GetMempoolEntry {
|
|
504
675
|
method: 'getmempoolentry';
|
|
505
676
|
params: [
|
|
@@ -516,6 +687,7 @@ export interface GetMempoolEntry {
|
|
|
516
687
|
spentby: string[];
|
|
517
688
|
};
|
|
518
689
|
}
|
|
690
|
+
/** Returns mempool statistics and configuration. */
|
|
519
691
|
export interface GetMempoolInfo {
|
|
520
692
|
method: 'getmempoolinfo';
|
|
521
693
|
params: [];
|
|
@@ -527,6 +699,8 @@ export interface GetMempoolInfo {
|
|
|
527
699
|
maxmempool: number;
|
|
528
700
|
mempoolminfee: number;
|
|
529
701
|
minrelaytxfee: number;
|
|
702
|
+
permitbaremultisig: boolean;
|
|
703
|
+
maxdatacarriersize: number;
|
|
530
704
|
};
|
|
531
705
|
}
|
|
532
706
|
interface GetRawMempoolBase {
|
|
@@ -535,12 +709,14 @@ interface GetRawMempoolBase {
|
|
|
535
709
|
verbose?: boolean | number
|
|
536
710
|
];
|
|
537
711
|
}
|
|
712
|
+
/** Verbosity 0: Returns all mempool txids as array. */
|
|
538
713
|
export interface GetRawMempoolVerbosity0 extends GetRawMempoolBase {
|
|
539
714
|
params: [
|
|
540
715
|
verbose?: false | 0
|
|
541
716
|
];
|
|
542
717
|
response: string[];
|
|
543
718
|
}
|
|
719
|
+
/** Verbosity 1: Returns all mempool txids with detailed info. */
|
|
544
720
|
export interface GetRawMempoolVerbosity1 extends GetRawMempoolBase {
|
|
545
721
|
params: [
|
|
546
722
|
verbose?: true | 1
|
|
@@ -558,6 +734,7 @@ export interface GetRawMempoolVerbosity1 extends GetRawMempoolBase {
|
|
|
558
734
|
};
|
|
559
735
|
};
|
|
560
736
|
}
|
|
737
|
+
/** Returns details about an unspent transaction output. */
|
|
561
738
|
export interface GetTxOut {
|
|
562
739
|
method: 'gettxout';
|
|
563
740
|
params: [
|
|
@@ -579,6 +756,7 @@ export interface GetTxOut {
|
|
|
579
756
|
coinbase: boolean;
|
|
580
757
|
};
|
|
581
758
|
}
|
|
759
|
+
/** Returns a merkle proof that transaction(s) are in a block. */
|
|
582
760
|
export interface GetTxOutProof {
|
|
583
761
|
method: 'gettxoutproof';
|
|
584
762
|
params: [
|
|
@@ -587,10 +765,13 @@ export interface GetTxOutProof {
|
|
|
587
765
|
];
|
|
588
766
|
response: string;
|
|
589
767
|
}
|
|
768
|
+
/** Returns UTXO set statistics. */
|
|
590
769
|
export interface GetTxOutSetInfo {
|
|
591
770
|
method: 'gettxoutsetinfo';
|
|
592
771
|
params: [
|
|
593
|
-
|
|
772
|
+
hash_type?: 'hash_serialized_3' | 'ecmh' | 'muhash',
|
|
773
|
+
hash_or_height?: string | number,
|
|
774
|
+
use_index?: boolean
|
|
594
775
|
];
|
|
595
776
|
response: {
|
|
596
777
|
height: number;
|
|
@@ -598,11 +779,12 @@ export interface GetTxOutSetInfo {
|
|
|
598
779
|
transactions: number;
|
|
599
780
|
txouts: number;
|
|
600
781
|
bogosize: number;
|
|
601
|
-
|
|
782
|
+
hash_serialized_3: string;
|
|
602
783
|
disk_size: number;
|
|
603
784
|
total_amount: number;
|
|
604
785
|
};
|
|
605
786
|
}
|
|
787
|
+
/** Permanently marks a block as invalid (cannot be part of best chain). */
|
|
606
788
|
export interface InvalidateBlock {
|
|
607
789
|
method: 'invalidateblock';
|
|
608
790
|
params: [
|
|
@@ -610,6 +792,7 @@ export interface InvalidateBlock {
|
|
|
610
792
|
];
|
|
611
793
|
response: null;
|
|
612
794
|
}
|
|
795
|
+
/** Marks a block as parked (temporarily invalid). */
|
|
613
796
|
export interface ParkBlock {
|
|
614
797
|
method: 'parkblock';
|
|
615
798
|
params: [
|
|
@@ -617,6 +800,7 @@ export interface ParkBlock {
|
|
|
617
800
|
];
|
|
618
801
|
response: null;
|
|
619
802
|
}
|
|
803
|
+
/** Treats a block as if it were received before others with same work. */
|
|
620
804
|
export interface PreciousBlock {
|
|
621
805
|
method: 'preciousblock';
|
|
622
806
|
params: [
|
|
@@ -624,6 +808,7 @@ export interface PreciousBlock {
|
|
|
624
808
|
];
|
|
625
809
|
response: null;
|
|
626
810
|
}
|
|
811
|
+
/** Prunes blockchain up to specified height. Returns height of last pruned block. */
|
|
627
812
|
export interface PruneBlockchain {
|
|
628
813
|
method: 'pruneblockchain';
|
|
629
814
|
params: [
|
|
@@ -631,6 +816,7 @@ export interface PruneBlockchain {
|
|
|
631
816
|
];
|
|
632
817
|
response: number;
|
|
633
818
|
}
|
|
819
|
+
/** Removes invalidity status from a block and its descendants. */
|
|
634
820
|
export interface ReconsiderBlock {
|
|
635
821
|
method: 'reconsiderblock';
|
|
636
822
|
params: [
|
|
@@ -638,11 +824,13 @@ export interface ReconsiderBlock {
|
|
|
638
824
|
];
|
|
639
825
|
response: null;
|
|
640
826
|
}
|
|
827
|
+
/** Saves mempool to disk. */
|
|
641
828
|
export interface SaveMempool {
|
|
642
829
|
method: 'savemempool';
|
|
643
830
|
params: [];
|
|
644
831
|
response: null;
|
|
645
832
|
}
|
|
833
|
+
/** Scans UTXO set for outputs matching descriptors. */
|
|
646
834
|
export interface ScanTxOutSet {
|
|
647
835
|
method: 'scantxoutset';
|
|
648
836
|
params: [
|
|
@@ -667,6 +855,7 @@ export interface ScanTxOutSet {
|
|
|
667
855
|
};
|
|
668
856
|
} | boolean;
|
|
669
857
|
}
|
|
858
|
+
/** Removes parked status from a block and its descendants. */
|
|
670
859
|
export interface UnparkBlock {
|
|
671
860
|
method: 'unparkblock';
|
|
672
861
|
params: [
|
|
@@ -674,6 +863,7 @@ export interface UnparkBlock {
|
|
|
674
863
|
];
|
|
675
864
|
response: null;
|
|
676
865
|
}
|
|
866
|
+
/** Verifies blockchain database. */
|
|
677
867
|
export interface VerifyChain {
|
|
678
868
|
method: 'verifychain';
|
|
679
869
|
params: [
|
|
@@ -682,6 +872,7 @@ export interface VerifyChain {
|
|
|
682
872
|
];
|
|
683
873
|
response: boolean;
|
|
684
874
|
}
|
|
875
|
+
/** Verifies a merkle proof and returns the txids it commits to. */
|
|
685
876
|
export interface VerifyTxOutProof {
|
|
686
877
|
method: 'verifytxoutproof';
|
|
687
878
|
params: [
|