@did-btcr2/bitcoin 0.3.3 → 0.4.0
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/dist/cjs/bitcoin.js +82 -83
- package/dist/cjs/bitcoin.js.map +1 -1
- package/dist/cjs/client/http.js +9 -0
- package/dist/cjs/client/http.js.map +1 -0
- package/dist/cjs/client/rest/address.js +20 -28
- package/dist/cjs/client/rest/address.js.map +1 -1
- package/dist/cjs/client/rest/block.js +23 -22
- package/dist/cjs/client/rest/block.js.map +1 -1
- package/dist/cjs/client/rest/index.js +30 -83
- package/dist/cjs/client/rest/index.js.map +1 -1
- package/dist/cjs/client/rest/protocol.js +129 -0
- package/dist/cjs/client/rest/protocol.js.map +1 -0
- package/dist/cjs/client/rest/transaction.js +19 -21
- package/dist/cjs/client/rest/transaction.js.map +1 -1
- package/dist/cjs/client/rpc/index.js +77 -338
- package/dist/cjs/client/rpc/index.js.map +1 -1
- package/dist/cjs/client/rpc/interface.js +1 -6
- package/dist/cjs/client/rpc/interface.js.map +1 -1
- package/dist/cjs/client/rpc/json-rpc.js +40 -63
- package/dist/cjs/client/rpc/json-rpc.js.map +1 -1
- package/dist/cjs/client/rpc/protocol.js +134 -0
- package/dist/cjs/client/rpc/protocol.js.map +1 -0
- package/dist/cjs/constants.js +16 -5
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/index.js +21 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types.js +5 -55
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/bitcoin.js +82 -83
- package/dist/esm/bitcoin.js.map +1 -1
- package/dist/esm/client/http.js +9 -0
- package/dist/esm/client/http.js.map +1 -0
- package/dist/esm/client/rest/address.js +20 -28
- package/dist/esm/client/rest/address.js.map +1 -1
- package/dist/esm/client/rest/block.js +23 -22
- package/dist/esm/client/rest/block.js.map +1 -1
- package/dist/esm/client/rest/index.js +30 -83
- package/dist/esm/client/rest/index.js.map +1 -1
- package/dist/esm/client/rest/protocol.js +129 -0
- package/dist/esm/client/rest/protocol.js.map +1 -0
- package/dist/esm/client/rest/transaction.js +19 -21
- package/dist/esm/client/rest/transaction.js.map +1 -1
- package/dist/esm/client/rpc/index.js +77 -338
- package/dist/esm/client/rpc/index.js.map +1 -1
- package/dist/esm/client/rpc/interface.js +1 -6
- package/dist/esm/client/rpc/interface.js.map +1 -1
- package/dist/esm/client/rpc/json-rpc.js +40 -63
- package/dist/esm/client/rpc/json-rpc.js.map +1 -1
- package/dist/esm/client/rpc/protocol.js +134 -0
- package/dist/esm/client/rpc/protocol.js.map +1 -0
- package/dist/esm/constants.js +16 -5
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/index.js +21 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types.js +5 -55
- package/dist/esm/types.js.map +1 -1
- package/dist/types/bitcoin.d.ts +66 -45
- package/dist/types/bitcoin.d.ts.map +1 -1
- package/dist/types/client/http.d.ts +21 -0
- package/dist/types/client/http.d.ts.map +1 -0
- package/dist/types/client/rest/address.d.ts +16 -19
- package/dist/types/client/rest/address.d.ts.map +1 -1
- package/dist/types/client/rest/block.d.ts +24 -16
- package/dist/types/client/rest/block.d.ts.map +1 -1
- package/dist/types/client/rest/index.d.ts +20 -51
- package/dist/types/client/rest/index.d.ts.map +1 -1
- package/dist/types/client/rest/protocol.d.ts +58 -0
- package/dist/types/client/rest/protocol.d.ts.map +1 -0
- package/dist/types/client/rest/transaction.d.ts +16 -17
- package/dist/types/client/rest/transaction.d.ts.map +1 -1
- package/dist/types/client/rpc/index.d.ts +105 -253
- package/dist/types/client/rpc/index.d.ts.map +1 -1
- package/dist/types/client/rpc/interface.d.ts +1 -4
- package/dist/types/client/rpc/interface.d.ts.map +1 -1
- package/dist/types/client/rpc/json-rpc.d.ts +20 -18
- package/dist/types/client/rpc/json-rpc.d.ts.map +1 -1
- package/dist/types/client/rpc/protocol.d.ts +82 -0
- package/dist/types/client/rpc/protocol.d.ts.map +1 -0
- package/dist/types/constants.d.ts +16 -5
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/errors.d.ts +4 -3
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/index.d.ts +20 -13
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +98 -696
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/bitcoin.ts +104 -117
- package/src/client/http.ts +28 -0
- package/src/client/rest/address.ts +24 -30
- package/src/client/rest/block.ts +29 -26
- package/src/client/rest/index.ts +37 -93
- package/src/client/rest/protocol.ts +153 -0
- package/src/client/rest/transaction.ts +23 -23
- package/src/client/rpc/index.ts +142 -380
- package/src/client/rpc/interface.ts +42 -51
- package/src/client/rpc/json-rpc.ts +53 -60
- package/src/client/rpc/protocol.ts +160 -0
- package/src/constants.ts +17 -5
- package/src/errors.ts +10 -3
- package/src/index.ts +81 -13
- package/src/types.ts +332 -973
package/src/types.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UnixTimestamp } from '@did-btcr2/common';
|
|
2
|
+
|
|
3
|
+
/** Bitcoin network names supported by this package. */
|
|
4
|
+
export type NetworkName =
|
|
5
|
+
| 'bitcoin'
|
|
6
|
+
| 'testnet3'
|
|
7
|
+
| 'testnet4'
|
|
8
|
+
| 'signet'
|
|
9
|
+
| 'mutinynet'
|
|
10
|
+
| 'regtest';
|
|
11
|
+
|
|
12
|
+
// ── REST types ──────────────────────────────────────────────────────
|
|
2
13
|
|
|
3
14
|
export type TransactionStatus = {
|
|
4
15
|
confirmed: boolean;
|
|
@@ -25,6 +36,7 @@ export interface Vout {
|
|
|
25
36
|
scriptpubkey_address?: string;
|
|
26
37
|
value: number;
|
|
27
38
|
}
|
|
39
|
+
|
|
28
40
|
export interface ChainStats {
|
|
29
41
|
funded_txo_count: number;
|
|
30
42
|
funded_txo_sum: number;
|
|
@@ -40,11 +52,13 @@ export interface MempoolStats {
|
|
|
40
52
|
spent_txo_sum: number;
|
|
41
53
|
tx_count: number;
|
|
42
54
|
}
|
|
55
|
+
|
|
43
56
|
export interface AddressInfo {
|
|
44
57
|
address: string;
|
|
45
58
|
chain_stats: ChainStats;
|
|
46
59
|
mempool_stats: MempoolStats;
|
|
47
60
|
}
|
|
61
|
+
|
|
48
62
|
export interface RawTransactionRest {
|
|
49
63
|
txid: string;
|
|
50
64
|
version: number;
|
|
@@ -63,1064 +77,409 @@ export interface AddressUtxo {
|
|
|
63
77
|
status: TransactionStatus;
|
|
64
78
|
value: number;
|
|
65
79
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
80
|
+
|
|
81
|
+
/** Block data as returned by the Esplora REST API. */
|
|
82
|
+
export interface EsploraBlock {
|
|
83
|
+
id: string;
|
|
84
|
+
height: number;
|
|
85
|
+
version: number;
|
|
86
|
+
timestamp: number;
|
|
87
|
+
tx_count: number;
|
|
88
|
+
size: number;
|
|
89
|
+
weight: number;
|
|
90
|
+
merkle_root: string;
|
|
91
|
+
previousblockhash: string;
|
|
92
|
+
mediantime: number;
|
|
93
|
+
nonce: number;
|
|
94
|
+
bits: number;
|
|
95
|
+
difficulty: number;
|
|
69
96
|
}
|
|
70
97
|
|
|
71
|
-
export
|
|
98
|
+
export interface RestConfig {
|
|
72
99
|
host: string;
|
|
73
|
-
headers?:
|
|
74
|
-
constructor({ host, headers }: RestClientConfigParams) {
|
|
75
|
-
this.host = host;
|
|
76
|
-
this.headers = headers;
|
|
77
|
-
}
|
|
100
|
+
headers?: Record<string, string>;
|
|
78
101
|
}
|
|
79
102
|
|
|
80
103
|
export interface RestApiCallParams {
|
|
81
104
|
path: string;
|
|
82
105
|
url?: string;
|
|
83
|
-
method?:
|
|
84
|
-
body?:
|
|
85
|
-
headers?:
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export interface RestResponse extends Response {
|
|
89
|
-
[key: string]: any;
|
|
106
|
+
method?: 'GET' | 'POST';
|
|
107
|
+
body?: string | Record<string, unknown>;
|
|
108
|
+
headers?: Record<string, string>;
|
|
90
109
|
}
|
|
91
110
|
|
|
92
|
-
export type
|
|
93
|
-
rpc: {
|
|
94
|
-
username: string;
|
|
95
|
-
password: string;
|
|
96
|
-
host: string;
|
|
97
|
-
version: string;
|
|
98
|
-
allowDefaultWallet: boolean;
|
|
99
|
-
},
|
|
100
|
-
rest: {
|
|
101
|
-
host: string;
|
|
102
|
-
headers?: Record<string, string>;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export type AvailableNetworks = {
|
|
107
|
-
bitcoin: true;
|
|
108
|
-
testnet3: true;
|
|
109
|
-
testnet4: true;
|
|
110
|
-
signet: true;
|
|
111
|
-
mutinynet: true;
|
|
112
|
-
regtest: true;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export interface ReturnFormatOptions {
|
|
116
|
-
extension?: 'json' | 'bin' | 'hex';
|
|
117
|
-
}
|
|
118
|
-
export type TxId = string;
|
|
119
|
-
export interface BlockHashOptions extends ReturnFormatOptions {
|
|
120
|
-
summary?: boolean;
|
|
121
|
-
}
|
|
111
|
+
export type RestResponse = Response;
|
|
122
112
|
|
|
123
|
-
|
|
124
|
-
headers?: Record<string, string>;
|
|
125
|
-
host?: string;
|
|
126
|
-
logger?: any;
|
|
127
|
-
password?: string;
|
|
128
|
-
timeout?: number;
|
|
129
|
-
username?: string;
|
|
130
|
-
version?: string;
|
|
131
|
-
wallet?: string;
|
|
132
|
-
allowDefaultWallet?: boolean;
|
|
133
|
-
}
|
|
113
|
+
// ── RPC types ───────────────────────────────────────────────────────
|
|
134
114
|
|
|
135
|
-
export
|
|
136
|
-
network?: string;
|
|
115
|
+
export interface RpcConfig {
|
|
137
116
|
headers?: Record<string, string>;
|
|
138
117
|
host?: string;
|
|
139
|
-
logger?: any;
|
|
140
118
|
password?: string;
|
|
141
|
-
timeout?: number;
|
|
142
119
|
username?: string;
|
|
143
|
-
version?: string;
|
|
144
120
|
wallet?: string;
|
|
145
121
|
allowDefaultWallet?: boolean;
|
|
146
|
-
|
|
147
|
-
constructor(options: RpcClientConfig = {
|
|
148
|
-
headers : {},
|
|
149
|
-
host : 'http://localhost',
|
|
150
|
-
logger : console,
|
|
151
|
-
password : '',
|
|
152
|
-
timeout : 30000,
|
|
153
|
-
username : '',
|
|
154
|
-
version : '0.21.1',
|
|
155
|
-
wallet : '',
|
|
156
|
-
allowDefaultWallet : false,
|
|
157
|
-
}) {
|
|
158
|
-
this.headers = options.headers;
|
|
159
|
-
this.host = options.host;
|
|
160
|
-
this.logger = options.logger;
|
|
161
|
-
this.password = options.password;
|
|
162
|
-
this.timeout = options.timeout;
|
|
163
|
-
this.username = options.username;
|
|
164
|
-
this.version = options.version;
|
|
165
|
-
this.wallet = options.wallet;
|
|
166
|
-
this.allowDefaultWallet = options.allowDefaultWallet;
|
|
167
|
-
}
|
|
168
122
|
}
|
|
169
123
|
|
|
170
|
-
export
|
|
171
|
-
agentOptions?: any;
|
|
172
|
-
headers?: boolean;
|
|
173
|
-
host?: string;
|
|
174
|
-
logger?: Function;
|
|
175
|
-
network?: 'mainnet' | 'regtest' | 'testnet';
|
|
176
|
-
password?: string;
|
|
177
|
-
port?: string | number;
|
|
178
|
-
ssl?: any;
|
|
179
|
-
timeout?: number;
|
|
180
|
-
username?: string;
|
|
181
|
-
version?: string;
|
|
182
|
-
}
|
|
124
|
+
export type FeeEstimateMode = 'UNSET' | 'ECONOMICAL' | 'CONSERVATIVE';
|
|
183
125
|
|
|
184
|
-
export type
|
|
126
|
+
export type TxIn = {
|
|
127
|
+
coinbase?: string;
|
|
128
|
+
txid?: string;
|
|
129
|
+
vout?: number;
|
|
130
|
+
scriptSig?: {
|
|
185
131
|
asm: string;
|
|
186
132
|
hex: string;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
ps2h?: string;
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
export type FundRawTxOptions = {
|
|
194
|
-
changeAddress?: string;
|
|
195
|
-
chnagePosition?: number;
|
|
196
|
-
includeWatching?: boolean;
|
|
197
|
-
lockUnspents?: boolean;
|
|
198
|
-
feeRate?: number;
|
|
199
|
-
subtractFeeFromOutputs?: number[];
|
|
200
|
-
replaceable?: boolean;
|
|
201
|
-
conf_target?: number;
|
|
202
|
-
estimate_mode: FeeEstimateMode;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* unset
|
|
207
|
-
* - no mode set
|
|
208
|
-
* economical
|
|
209
|
-
* - used if the transaction is replaceable
|
|
210
|
-
* - uses shorter time horizon to estimate
|
|
211
|
-
* - more responsive to short-term drops in the prevailing fee market
|
|
212
|
-
* - potentially returns a lower fee rate estimate
|
|
213
|
-
* conservative
|
|
214
|
-
* - used is the transaction is not replaceable
|
|
215
|
-
* - use a longer time horizon to estimate
|
|
216
|
-
* - less responsive to short-term drops in the prevailing fee market
|
|
217
|
-
* - potentially returns a higher fee rate estimate
|
|
218
|
-
*/
|
|
219
|
-
export type FeeEstimateMode = 'UNSET' | 'ECONOMICAL' | 'CONSERVATIVE';
|
|
220
|
-
|
|
221
|
-
export type TxStats = {
|
|
222
|
-
time: number;
|
|
223
|
-
txcount: number;
|
|
224
|
-
window_final_block_hash?: string;
|
|
225
|
-
window_block_count?: number;
|
|
226
|
-
window_tx_count?: number;
|
|
227
|
-
window_interval?: number;
|
|
228
|
-
txrate: number;
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
export type AddedNodeInfo = {
|
|
232
|
-
addednode: string;
|
|
233
|
-
connected: boolean;
|
|
234
|
-
addresses: {
|
|
235
|
-
address: string;
|
|
236
|
-
connected: 'inbound' | 'outbound';
|
|
237
|
-
}[];
|
|
133
|
+
};
|
|
134
|
+
txinwitness?: string[];
|
|
135
|
+
sequence: number;
|
|
238
136
|
};
|
|
239
137
|
|
|
240
|
-
export type
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
138
|
+
export type TxInPrevout = {
|
|
139
|
+
generated: boolean;
|
|
140
|
+
height: number;
|
|
141
|
+
value: number;
|
|
142
|
+
scriptPubKey?: {
|
|
143
|
+
asm: string;
|
|
144
|
+
desc: string;
|
|
145
|
+
hex: string;
|
|
146
|
+
address?: string;
|
|
147
|
+
type: string;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
250
150
|
|
|
251
|
-
export
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
protocolversion: number;
|
|
255
|
-
localservices: string;
|
|
256
|
-
localrelay: boolean;
|
|
257
|
-
timeoffset: number;
|
|
258
|
-
connections: number;
|
|
259
|
-
networkactive: boolean;
|
|
260
|
-
networks: {
|
|
261
|
-
name: string;
|
|
262
|
-
limited: boolean;
|
|
263
|
-
reachable: boolean;
|
|
264
|
-
proxy: string;
|
|
265
|
-
proxy_randomize_credentials: boolean;
|
|
266
|
-
}[];
|
|
267
|
-
relayfee: number;
|
|
268
|
-
incrementalfee: number;
|
|
269
|
-
localaddresses: {
|
|
270
|
-
address: string;
|
|
271
|
-
port: number;
|
|
272
|
-
score: number;
|
|
273
|
-
}[];
|
|
274
|
-
warnings?: string;
|
|
275
|
-
};
|
|
151
|
+
export interface TxInExt extends TxIn {
|
|
152
|
+
prevout: TxInPrevout;
|
|
153
|
+
}
|
|
276
154
|
|
|
277
|
-
export type
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
lastsend: number;
|
|
285
|
-
lastrecv: number;
|
|
286
|
-
bytessent: number;
|
|
287
|
-
bytesrecv: number;
|
|
288
|
-
conntime: number;
|
|
289
|
-
timeoffset: number;
|
|
290
|
-
pingtime: number;
|
|
291
|
-
minping: number;
|
|
292
|
-
version: number;
|
|
293
|
-
subver: string;
|
|
294
|
-
inbound: boolean;
|
|
295
|
-
addnode: boolean;
|
|
296
|
-
startinheight: number;
|
|
297
|
-
banscore: number;
|
|
298
|
-
synced_headers: number;
|
|
299
|
-
synced_blocks: number;
|
|
300
|
-
inflight: number[];
|
|
301
|
-
whitelisted: boolean;
|
|
302
|
-
bytessent_per_msg: {
|
|
303
|
-
[key: string]: number;
|
|
304
|
-
};
|
|
305
|
-
byterecv_per_msg: {
|
|
306
|
-
[key: string]: number;
|
|
307
|
-
};
|
|
155
|
+
export type ScriptPubKey = {
|
|
156
|
+
asm: string;
|
|
157
|
+
hex: string;
|
|
158
|
+
reqSigs: number;
|
|
159
|
+
type: string;
|
|
160
|
+
address?: string;
|
|
161
|
+
desc: string;
|
|
308
162
|
};
|
|
309
163
|
|
|
310
|
-
export type
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
uploadtarget: {
|
|
315
|
-
timeframe: number;
|
|
316
|
-
target: number;
|
|
317
|
-
target_reached: boolean;
|
|
318
|
-
save_historical_blocks: boolean;
|
|
319
|
-
bytes_left_in_cycle: number;
|
|
320
|
-
time_lef_in_cycle: number;
|
|
321
|
-
};
|
|
164
|
+
export type TxOut = {
|
|
165
|
+
value: number;
|
|
166
|
+
n: number;
|
|
167
|
+
scriptPubKey: ScriptPubKey;
|
|
322
168
|
};
|
|
323
169
|
|
|
324
170
|
export type ChainInfo = {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
};
|
|
345
|
-
}[];
|
|
346
|
-
bip9_softforks: {
|
|
347
|
-
[key: string]: {
|
|
348
|
-
status: 'defined' | 'started' | 'locked_in' | 'active' | 'failed';
|
|
349
|
-
};
|
|
350
|
-
}[];
|
|
351
|
-
warnings?: string;
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
export type ChainTip = {
|
|
355
|
-
height: number;
|
|
356
|
-
hash: string;
|
|
357
|
-
branchlen: number;
|
|
358
|
-
status: 'active' | 'valid-fork' | 'valid-headers' | 'headers-only' | 'invalid';
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
export type Outpoint = { id: string; index: number };
|
|
362
|
-
|
|
363
|
-
export type UTXO = {
|
|
364
|
-
height: number;
|
|
365
|
-
value: number;
|
|
366
|
-
scriptPubkey: {
|
|
367
|
-
asm: string;
|
|
368
|
-
hex: string;
|
|
369
|
-
reqSigs: number;
|
|
370
|
-
type: string;
|
|
371
|
-
addresses: string[];
|
|
171
|
+
chain: string;
|
|
172
|
+
blocks: number;
|
|
173
|
+
headers: number;
|
|
174
|
+
bestblockhash: string;
|
|
175
|
+
difficulty: number;
|
|
176
|
+
mediantime: number;
|
|
177
|
+
verificationprogress: number;
|
|
178
|
+
initialblockdownload: boolean;
|
|
179
|
+
chainwork: string;
|
|
180
|
+
size_on_disk: number;
|
|
181
|
+
pruned: boolean;
|
|
182
|
+
pruneheight: number;
|
|
183
|
+
automatic_pruning: boolean;
|
|
184
|
+
prune_target_size: number;
|
|
185
|
+
softforks: {
|
|
186
|
+
id: string;
|
|
187
|
+
version: number;
|
|
188
|
+
reject: {
|
|
189
|
+
status: boolean;
|
|
372
190
|
};
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
export type UnspentTxInfo = {
|
|
376
|
-
txid: string;
|
|
377
|
-
vout: number;
|
|
378
|
-
address: string;
|
|
379
|
-
acount: string;
|
|
380
|
-
scriptPubKey: string;
|
|
381
|
-
amount: number;
|
|
382
|
-
confirmations: number;
|
|
383
|
-
redeemScript: string;
|
|
384
|
-
spendable: boolean;
|
|
385
|
-
solvable: boolean;
|
|
386
|
-
safe: boolean;
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
export type PrevOut = {
|
|
390
|
-
txid: string;
|
|
391
|
-
vout: number;
|
|
392
|
-
scriptPubKey: string;
|
|
393
|
-
redeemScript?: string;
|
|
394
|
-
amount: number;
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
export type UTXOStats = {
|
|
398
|
-
height: number;
|
|
399
|
-
bestblock: string;
|
|
400
|
-
transactions: number;
|
|
401
|
-
txouts: number;
|
|
402
|
-
bogosize: number;
|
|
403
|
-
hash_serialized_2: string;
|
|
404
|
-
disk_size: number;
|
|
405
|
-
total_amount: number;
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
export type MempoolContent = {
|
|
191
|
+
}[];
|
|
192
|
+
bip9_softforks: {
|
|
409
193
|
[key: string]: {
|
|
410
|
-
|
|
411
|
-
fee: number;
|
|
412
|
-
modifiedfee: number;
|
|
413
|
-
time: number;
|
|
414
|
-
height: number;
|
|
415
|
-
descendantcount: number;
|
|
416
|
-
descendantsize: number;
|
|
417
|
-
descendantfees: number;
|
|
418
|
-
ancestorcount: number;
|
|
419
|
-
ancestorsize: number;
|
|
420
|
-
ancestorfees: number;
|
|
421
|
-
wtxid: string;
|
|
422
|
-
depends: string[];
|
|
194
|
+
status: 'defined' | 'started' | 'locked_in' | 'active' | 'failed';
|
|
423
195
|
};
|
|
196
|
+
}[];
|
|
197
|
+
warnings?: string;
|
|
424
198
|
};
|
|
425
199
|
|
|
426
|
-
|
|
427
|
-
txid: string;
|
|
428
|
-
hash: string;
|
|
429
|
-
size: number;
|
|
430
|
-
vsize: number;
|
|
431
|
-
version: number;
|
|
432
|
-
locktime: number;
|
|
433
|
-
vin: TxIn[];
|
|
434
|
-
vout: TxOut[];
|
|
435
|
-
};
|
|
436
|
-
|
|
437
|
-
export interface FetchedRawTransaction extends DecodedRawTransaction {
|
|
438
|
-
hex: string;
|
|
439
|
-
blockhash: string;
|
|
440
|
-
confirmations: number;
|
|
441
|
-
time: number;
|
|
442
|
-
blocktime: number;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
export type MiningInfo = {
|
|
446
|
-
blocks: number;
|
|
447
|
-
currentblockweight: number;
|
|
448
|
-
currentblocktx: number;
|
|
449
|
-
difficulty: number;
|
|
450
|
-
networkhashps: number;
|
|
451
|
-
pooledtx: number;
|
|
452
|
-
chain: 'main' | 'test' | 'regtest';
|
|
453
|
-
warnings?: string;
|
|
454
|
-
};
|
|
200
|
+
// ── Block types ─────────────────────────────────────────────────────
|
|
455
201
|
|
|
456
|
-
export type MempoolInfo = {
|
|
457
|
-
size: number;
|
|
458
|
-
bytes: number;
|
|
459
|
-
usage: number;
|
|
460
|
-
maxmempol: number;
|
|
461
|
-
mempoolminfee: number;
|
|
462
|
-
minrelaytxfee: number;
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
export type BlockHeader = {
|
|
466
|
-
hash: string;
|
|
467
|
-
confirmations: number;
|
|
468
|
-
height: number;
|
|
469
|
-
version: number;
|
|
470
|
-
versionHex: string;
|
|
471
|
-
merkleroot: string;
|
|
472
|
-
time: number;
|
|
473
|
-
mediantime: number;
|
|
474
|
-
nonce: number;
|
|
475
|
-
bits: string;
|
|
476
|
-
difficulty: number;
|
|
477
|
-
chainwork: string;
|
|
478
|
-
previoutsblockchash: string;
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
/** Block and GetBlock */
|
|
482
202
|
export type Block = {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
203
|
+
hash: string;
|
|
204
|
+
confirmations: number;
|
|
205
|
+
height: number;
|
|
206
|
+
version: number;
|
|
207
|
+
versionHex: string;
|
|
208
|
+
merkleroot: string;
|
|
209
|
+
time: number;
|
|
210
|
+
mediantime: number;
|
|
211
|
+
nonce: number;
|
|
212
|
+
bits: string;
|
|
213
|
+
difficulty: number;
|
|
214
|
+
chainwork: string;
|
|
215
|
+
nTx: number;
|
|
216
|
+
previousblockhash: string;
|
|
217
|
+
nextblockhash?: string;
|
|
218
|
+
strippedsize: number;
|
|
219
|
+
size: number;
|
|
220
|
+
weight: number;
|
|
501
221
|
};
|
|
502
222
|
|
|
503
223
|
export type BlockV0 = string;
|
|
504
224
|
export interface BlockV1 extends Block {
|
|
505
|
-
|
|
225
|
+
tx: Array<string>;
|
|
506
226
|
}
|
|
507
227
|
export interface BlockV2 extends Block {
|
|
508
|
-
|
|
228
|
+
tx: Array<RawTransactionV1>;
|
|
509
229
|
}
|
|
510
230
|
export interface BlockV3 extends Block {
|
|
511
|
-
|
|
231
|
+
tx: Array<RawTransactionV2>;
|
|
512
232
|
}
|
|
513
233
|
|
|
514
234
|
export type BlockResponse = BlockV0 | BlockV1 | BlockV2 | BlockV3;
|
|
515
235
|
|
|
516
|
-
|
|
236
|
+
// ── Transaction types ───────────────────────────────────────────────
|
|
237
|
+
|
|
517
238
|
export type Transaction = {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
};
|
|
527
|
-
export type TxIn = {
|
|
528
|
-
coinbase?: string;
|
|
529
|
-
txid?: string;
|
|
530
|
-
vout?: number;
|
|
531
|
-
scriptSig?: {
|
|
532
|
-
asm: string;
|
|
533
|
-
hex: string;
|
|
534
|
-
};
|
|
535
|
-
txinwitness?: string[];
|
|
536
|
-
sequence: number;
|
|
537
|
-
};
|
|
538
|
-
export type TxInPrevout = {
|
|
539
|
-
generated: boolean;
|
|
540
|
-
height: number;
|
|
541
|
-
value: number;
|
|
542
|
-
scriptPubKey?: {
|
|
543
|
-
asm: string;
|
|
544
|
-
desc: string;
|
|
545
|
-
hex: string;
|
|
546
|
-
address?: string;
|
|
547
|
-
type: string;
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
export interface TxInExt extends TxIn {
|
|
551
|
-
prevout: TxInPrevout;
|
|
552
|
-
}
|
|
553
|
-
export type TxOut = {
|
|
554
|
-
value: number;
|
|
555
|
-
n: number;
|
|
556
|
-
scriptPubKey: {
|
|
557
|
-
asm: string;
|
|
558
|
-
hex: string;
|
|
559
|
-
reqSigs: number;
|
|
560
|
-
type: scriptPubkeyType;
|
|
561
|
-
address?: string;
|
|
562
|
-
desc: string;
|
|
563
|
-
};
|
|
239
|
+
hex: string;
|
|
240
|
+
txid: string;
|
|
241
|
+
hash: string;
|
|
242
|
+
size: number;
|
|
243
|
+
vsize: number;
|
|
244
|
+
weight: number;
|
|
245
|
+
version: number;
|
|
246
|
+
locktime: number;
|
|
564
247
|
};
|
|
248
|
+
|
|
565
249
|
export type RawTransactionV0 = string;
|
|
566
250
|
export interface RawTransactionV1 extends Transaction {
|
|
567
|
-
|
|
568
|
-
|
|
251
|
+
vin: TxIn[];
|
|
252
|
+
vout: TxOut[];
|
|
569
253
|
};
|
|
570
254
|
export interface RawTransactionV2 extends Transaction {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
255
|
+
fee?: number;
|
|
256
|
+
vin: TxInExt[];
|
|
257
|
+
vout: TxOut[];
|
|
574
258
|
};
|
|
575
259
|
export type RawTransactionResponse = RawTransactionV0 | RawTransactionV1 | RawTransactionV2;
|
|
576
260
|
|
|
577
261
|
export type CreateRawTxInputs = {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
};
|
|
582
|
-
|
|
583
|
-
export type TxOutForCreateRaw = {
|
|
584
|
-
address: string;
|
|
585
|
-
data: string;
|
|
586
|
-
};
|
|
587
|
-
|
|
588
|
-
export type TxOutInBlock = {
|
|
589
|
-
bestblock: string;
|
|
590
|
-
confirmations: number;
|
|
591
|
-
value: number;
|
|
592
|
-
scriptPubKey: {
|
|
593
|
-
asm: string;
|
|
594
|
-
hex: string;
|
|
595
|
-
reqSigs: number;
|
|
596
|
-
type: scriptPubkeyType;
|
|
597
|
-
addresses: string[];
|
|
598
|
-
};
|
|
599
|
-
coinbase: boolean;
|
|
600
|
-
};
|
|
601
|
-
|
|
602
|
-
export type DecodedScript = {
|
|
603
|
-
asm: string;
|
|
604
|
-
hex: string;
|
|
605
|
-
type: string;
|
|
606
|
-
reqSigs: number;
|
|
607
|
-
addresses: string[];
|
|
608
|
-
p2sh: string;
|
|
609
|
-
};
|
|
610
|
-
|
|
611
|
-
export type WalletTransaction = {
|
|
612
|
-
amount: number;
|
|
613
|
-
fee: number;
|
|
614
|
-
confirmations: number;
|
|
615
|
-
blockhash: string;
|
|
616
|
-
blockindex: number;
|
|
617
|
-
blocktime: number;
|
|
618
|
-
txid: string;
|
|
619
|
-
time: number;
|
|
620
|
-
timereceived: number;
|
|
621
|
-
'bip125-replaceable': 'yes' | 'no' | 'unknown';
|
|
622
|
-
details: {
|
|
623
|
-
account: string;
|
|
624
|
-
address: string;
|
|
625
|
-
category: 'send' | 'receive';
|
|
626
|
-
amount: number;
|
|
627
|
-
label?: string;
|
|
628
|
-
vout: number;
|
|
629
|
-
fee: number;
|
|
630
|
-
abandoned: number;
|
|
631
|
-
}[];
|
|
632
|
-
hex: string;
|
|
633
|
-
};
|
|
634
|
-
|
|
635
|
-
export type WalletInfo = {
|
|
636
|
-
walletname: string;
|
|
637
|
-
walletversion: number;
|
|
638
|
-
balance: number;
|
|
639
|
-
unconfirmed_balance: number;
|
|
640
|
-
immature_balance: number;
|
|
641
|
-
txcount: number;
|
|
642
|
-
keypoololdest: number;
|
|
643
|
-
keypoolsize: number;
|
|
644
|
-
paytxfee: number;
|
|
645
|
-
hdmasterkeyid: string;
|
|
262
|
+
txid: string;
|
|
263
|
+
vout: number;
|
|
264
|
+
sequence?: number;
|
|
646
265
|
};
|
|
647
266
|
|
|
648
|
-
export type
|
|
649
|
-
|
|
650
|
-
export type SigHashType =
|
|
651
|
-
| 'ALL'
|
|
652
|
-
| 'NONE'
|
|
653
|
-
| 'SINGLE'
|
|
654
|
-
| 'ALL|ANYONECANPAY'
|
|
655
|
-
| 'NONE|ANYONECANPAY'
|
|
656
|
-
| 'SINGLE|ANYONECANPAY';
|
|
267
|
+
export type CreateRawTxOutputs = { [address: string]: number } | { data: string };
|
|
657
268
|
|
|
658
269
|
export type SignedRawTx = {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
};
|
|
669
|
-
|
|
670
|
-
export type ValidateAddressResult = {
|
|
671
|
-
isvalid: boolean;
|
|
672
|
-
address?: string;
|
|
673
|
-
scriptPubKey?: string;
|
|
674
|
-
ismine?: boolean;
|
|
675
|
-
iswatchonly?: boolean;
|
|
676
|
-
isscript?: boolean;
|
|
677
|
-
script?: string;
|
|
678
|
-
hex?: string;
|
|
679
|
-
addresses?: string[];
|
|
680
|
-
sigsrequired?: number;
|
|
681
|
-
pubkey?: string;
|
|
682
|
-
iscompressed?: boolean;
|
|
683
|
-
account?: string;
|
|
684
|
-
timestamp?: number;
|
|
685
|
-
hdkeypath?: string;
|
|
686
|
-
hdmasterkeyid?: string;
|
|
687
|
-
};
|
|
688
|
-
|
|
689
|
-
export type ImportMultiRequest = {
|
|
690
|
-
scriptPubKey: string | { address: string };
|
|
691
|
-
timestamp: number | 'now';
|
|
692
|
-
redeemScript?: string;
|
|
693
|
-
pubkeys?: string[];
|
|
694
|
-
keys?: string[];
|
|
695
|
-
internal?: boolean;
|
|
696
|
-
watchonly?: boolean;
|
|
697
|
-
label?: string;
|
|
698
|
-
};
|
|
699
|
-
|
|
700
|
-
export type ImportMultiResult = {
|
|
701
|
-
success: boolean;
|
|
702
|
-
error?: {
|
|
703
|
-
code: string;
|
|
704
|
-
message: string;
|
|
705
|
-
};
|
|
706
|
-
};
|
|
707
|
-
|
|
708
|
-
export type ImportMultiOptions = { rescan?: boolean; };
|
|
709
|
-
|
|
710
|
-
export type ImportDescriptorRequest = {
|
|
711
|
-
/** (string, required) Descriptor to import. */
|
|
712
|
-
desc: string;
|
|
713
|
-
/**
|
|
714
|
-
* (integer / string, required) Time from which to start rescanning the blockchain for this descriptor, in UNIX epoch time
|
|
715
|
-
* Use the string "now" to substitute the current synced blockchain time.
|
|
716
|
-
* "now" can be specified to bypass scanning, for outputs which are known to never have been used, and
|
|
717
|
-
* 0 can be specified to scan the entire blockchain. Blocks up to 2 hours before the earliest timestamp
|
|
718
|
-
* of all descriptors being imported will be scanned as well as the mempool.
|
|
719
|
-
*/
|
|
720
|
-
timestamp: number | string;
|
|
721
|
-
/** (boolean, optional, default=false) Make descriptor "active" for corresponding output type/externality */
|
|
722
|
-
active?: boolean;
|
|
723
|
-
/** (numeric or array, optional) If a ranged descriptor is used, this specifies the end or the range (in the form [begin,end]) to import */
|
|
724
|
-
range?: number | Array<number>;
|
|
725
|
-
/** (numeric, optional) If a ranged descriptor is set to active, this specifies the next index to generate addresses from */
|
|
726
|
-
next_index?: number;
|
|
727
|
-
/** (boolean, optional, default=false) Whether matching outputs should be treated as not incoming payments (e.g. change) */
|
|
728
|
-
internal?: boolean;
|
|
729
|
-
/** (string, optional, default="") Label to assign to the address, only allowed with internal=false. Disabled for ranged descriptors */
|
|
730
|
-
label?: string;
|
|
731
|
-
};
|
|
732
|
-
|
|
733
|
-
export type JsonRPCError = {
|
|
734
|
-
code: number;
|
|
735
|
-
message: string;
|
|
736
|
-
};
|
|
737
|
-
|
|
738
|
-
export type ImportDescriptorResult = {
|
|
739
|
-
success: boolean;
|
|
740
|
-
warnings?: string;
|
|
741
|
-
error: JsonRPCError;
|
|
742
|
-
};
|
|
743
|
-
|
|
744
|
-
export type Received = {
|
|
745
|
-
involvesWatchonly?: boolean;
|
|
746
|
-
account: string;
|
|
747
|
-
amount: number;
|
|
748
|
-
confirmations: number;
|
|
749
|
-
label: string;
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
export type ListUnspentOptions = {
|
|
753
|
-
minimumAmount: number | string;
|
|
754
|
-
maximumAmount: number | string;
|
|
755
|
-
maximumCount: number | string;
|
|
756
|
-
minimumSumAmount: number | string;
|
|
757
|
-
};
|
|
758
|
-
|
|
759
|
-
export type ReceivedByAccount = Received;
|
|
760
|
-
|
|
761
|
-
export type ReceivedByAddress = {
|
|
762
|
-
address: string;
|
|
763
|
-
txids: string[];
|
|
764
|
-
} & Received;
|
|
765
|
-
|
|
766
|
-
export type RestExtension = 'json' | 'bin' | 'hex';
|
|
767
|
-
|
|
768
|
-
export type MethodNameInLowerCase =
|
|
769
|
-
| 'getbestblockhash'
|
|
770
|
-
| 'getblock'
|
|
771
|
-
| 'getblockchaininfo'
|
|
772
|
-
| 'getblockcount'
|
|
773
|
-
| 'getblockhash'
|
|
774
|
-
| 'getblockheader'
|
|
775
|
-
| 'getchaintips'
|
|
776
|
-
| 'getchaintxstats'
|
|
777
|
-
| 'getdifficulty'
|
|
778
|
-
| 'getmempoolancestors'
|
|
779
|
-
| 'getmempooldescendants'
|
|
780
|
-
| 'getmempoolentry'
|
|
781
|
-
| 'getmempoolinfo'
|
|
782
|
-
| 'getrawmempool'
|
|
783
|
-
| 'gettxout'
|
|
784
|
-
| 'gettxoutproof'
|
|
785
|
-
| 'gettxoutsetinfo'
|
|
786
|
-
| 'preciousblock'
|
|
787
|
-
| 'pruneblockchain'
|
|
788
|
-
| 'verifychain'
|
|
789
|
-
| 'verifytxoutproof'
|
|
790
|
-
| 'getinfo'
|
|
791
|
-
| 'getmemoryinfo'
|
|
792
|
-
| 'help'
|
|
793
|
-
| 'stop'
|
|
794
|
-
| 'uptime'
|
|
795
|
-
| 'generate'
|
|
796
|
-
| 'generatetoaddress'
|
|
797
|
-
| 'getblocktemplate'
|
|
798
|
-
| 'getmininginfo'
|
|
799
|
-
| 'getnetworkhashps'
|
|
800
|
-
| 'prioritisetransaction'
|
|
801
|
-
| 'submitblock'
|
|
802
|
-
| 'addnode'
|
|
803
|
-
| 'clearbanned'
|
|
804
|
-
| 'disconnectnode'
|
|
805
|
-
| 'getaddednodeinfo'
|
|
806
|
-
| 'getconnectioncount'
|
|
807
|
-
| 'getnettotals'
|
|
808
|
-
| 'getnetworkinfo'
|
|
809
|
-
| 'getpeerinfo'
|
|
810
|
-
| 'istbanned'
|
|
811
|
-
| 'ping'
|
|
812
|
-
| 'setban'
|
|
813
|
-
| 'setnetworkactive'
|
|
814
|
-
| 'combinerawtransaction'
|
|
815
|
-
| 'createrawtransaction'
|
|
816
|
-
| 'createwallet'
|
|
817
|
-
| 'decoderawtransaction'
|
|
818
|
-
| 'decodescript'
|
|
819
|
-
| 'fundrawtransaction'
|
|
820
|
-
| 'getrawtransaction'
|
|
821
|
-
| 'sendrawtransaction'
|
|
822
|
-
| 'signrawtransaction'
|
|
823
|
-
| 'createmultisig'
|
|
824
|
-
| 'estimatefee'
|
|
825
|
-
| 'estimatesmartfee'
|
|
826
|
-
| 'signmessagewithprivkey'
|
|
827
|
-
| 'validateaddress'
|
|
828
|
-
| 'verifymessage'
|
|
829
|
-
| 'abandontransaction'
|
|
830
|
-
| 'abortrescan'
|
|
831
|
-
| 'addmultisigaddress'
|
|
832
|
-
| 'addwitnessaddress'
|
|
833
|
-
| 'backupwallet'
|
|
834
|
-
| 'bumpfee'
|
|
835
|
-
| 'dumpprivkey'
|
|
836
|
-
| 'dumpwallet'
|
|
837
|
-
| 'encryptwallet'
|
|
838
|
-
| 'getaccount'
|
|
839
|
-
| 'getaccountaddress'
|
|
840
|
-
| 'getaddressesbyaccount'
|
|
841
|
-
| 'getbalance'
|
|
842
|
-
| 'getnewaddress'
|
|
843
|
-
| 'getrawchangeaddress'
|
|
844
|
-
| 'getreceivedbyaccount'
|
|
845
|
-
| 'getreceivedbyaddress'
|
|
846
|
-
| 'gettransaction'
|
|
847
|
-
| 'getunconfirmedbalance'
|
|
848
|
-
| 'getwalletinfo'
|
|
849
|
-
| 'importaddress'
|
|
850
|
-
| 'importmulti'
|
|
851
|
-
| 'importprivkey'
|
|
852
|
-
| 'importprunedfunds'
|
|
853
|
-
| 'importpubkey'
|
|
854
|
-
| 'importwallet'
|
|
855
|
-
| 'keypoolrefill'
|
|
856
|
-
| 'listaccounts'
|
|
857
|
-
| 'listaddressgroupings'
|
|
858
|
-
| 'listlockunspent'
|
|
859
|
-
| 'listreceivedbyaccount'
|
|
860
|
-
| 'listreceivedbyaddress'
|
|
861
|
-
| 'listsinceblock'
|
|
862
|
-
| 'listtransactions'
|
|
863
|
-
| 'listunspent'
|
|
864
|
-
| 'listwallets'
|
|
865
|
-
| 'lockunspent'
|
|
866
|
-
| 'move'
|
|
867
|
-
| 'removeprunedfunds'
|
|
868
|
-
| 'sendfrom'
|
|
869
|
-
| 'sendmany'
|
|
870
|
-
| 'sendtoaddress'
|
|
871
|
-
| 'setaccount'
|
|
872
|
-
| 'settxfee'
|
|
873
|
-
| 'signmessage'
|
|
874
|
-
| 'scanblocks'
|
|
875
|
-
| 'getdescriptorinfo'
|
|
876
|
-
| 'deriveaddresses'
|
|
877
|
-
| 'importdescriptors'
|
|
878
|
-
| 'createwalletdescriptor'
|
|
879
|
-
| 'signrawtransactionwithwallet'
|
|
880
|
-
| 'send'
|
|
881
|
-
| 'sendmany'
|
|
882
|
-
| 'sendall';
|
|
883
|
-
|
|
884
|
-
export type BatchOption = {
|
|
885
|
-
method: MethodNameInLowerCase;
|
|
886
|
-
parameters?: Array<any>;
|
|
270
|
+
hex: string;
|
|
271
|
+
complete: boolean;
|
|
272
|
+
errors?: {
|
|
273
|
+
txid: string;
|
|
274
|
+
vout: number;
|
|
275
|
+
scriptSig: string;
|
|
276
|
+
sequence: number;
|
|
277
|
+
error: string;
|
|
278
|
+
}[];
|
|
887
279
|
};
|
|
888
280
|
|
|
889
|
-
export type
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
281
|
+
export type UnspentTxInfo = {
|
|
282
|
+
txid: string;
|
|
283
|
+
vout: number;
|
|
284
|
+
address: string;
|
|
285
|
+
account: string;
|
|
286
|
+
scriptPubKey: string;
|
|
287
|
+
amount: number;
|
|
288
|
+
confirmations: number;
|
|
289
|
+
redeemScript: string;
|
|
290
|
+
spendable: boolean;
|
|
291
|
+
solvable: boolean;
|
|
292
|
+
safe: boolean;
|
|
896
293
|
};
|
|
897
294
|
|
|
898
|
-
|
|
899
|
-
|
|
295
|
+
export type WalletTransaction = {
|
|
296
|
+
amount: number;
|
|
297
|
+
fee: number;
|
|
298
|
+
confirmations: number;
|
|
299
|
+
blockhash: string;
|
|
300
|
+
blockindex: number;
|
|
301
|
+
blocktime: number;
|
|
302
|
+
txid: string;
|
|
303
|
+
time: number;
|
|
304
|
+
timereceived: number;
|
|
305
|
+
'bip125-replaceable': 'yes' | 'no' | 'unknown';
|
|
306
|
+
details: {
|
|
900
307
|
account: string;
|
|
901
308
|
address: string;
|
|
902
309
|
category: 'send' | 'receive';
|
|
903
310
|
amount: number;
|
|
311
|
+
label?: string;
|
|
904
312
|
vout: number;
|
|
905
313
|
fee: number;
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
blocktime: number;
|
|
910
|
-
txid: string;
|
|
911
|
-
time: number;
|
|
912
|
-
timereceived: number;
|
|
913
|
-
walletconflicts: string[];
|
|
914
|
-
'bip125-replaceable': 'yes' | 'no' | 'unknown';
|
|
915
|
-
abandoned?: boolean;
|
|
916
|
-
comment?: string;
|
|
917
|
-
label: string;
|
|
918
|
-
to?: string;
|
|
919
|
-
};
|
|
920
|
-
|
|
921
|
-
export type TransactionInListSinceBlock = WalletTxBase;
|
|
922
|
-
|
|
923
|
-
export type ListSinceBlockResult = {
|
|
924
|
-
transactions: TransactionInListSinceBlock[];
|
|
925
|
-
removed?: TransactionInListSinceBlock[];
|
|
926
|
-
lastblock: string;
|
|
314
|
+
abandoned: number;
|
|
315
|
+
}[];
|
|
316
|
+
hex: string;
|
|
927
317
|
};
|
|
928
318
|
|
|
929
|
-
export type ListTransactionsResult = {
|
|
930
|
-
trusted: boolean;
|
|
931
|
-
otheraccount?: string;
|
|
932
|
-
abandoned?: boolean;
|
|
933
|
-
} & WalletTxBase;
|
|
934
|
-
|
|
935
|
-
export type AddressGrouping = [string, number] | [string, number, string];
|
|
936
|
-
|
|
937
|
-
export type RawOutputAddr = { [address: string]: number; };
|
|
938
|
-
export type RawOutputData = { data: string; };
|
|
939
|
-
export type CreateRawTxOutputs = RawOutputAddr | RawOutputData;
|
|
940
|
-
|
|
941
|
-
export type GetUTXOsResult = {
|
|
942
|
-
chainHeight: number;
|
|
943
|
-
chaintipHash: string;
|
|
944
|
-
bipmap: string;
|
|
945
|
-
utxos: UTXO[];
|
|
946
|
-
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
export type BumpFeeOptions = {
|
|
950
|
-
confTarget?: number;
|
|
951
|
-
totalFee?: number;
|
|
952
|
-
replaceable?: boolean;
|
|
953
|
-
estimate_mode?: FeeEstimateMode;
|
|
954
|
-
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
export type BumpFeeResult = {
|
|
958
|
-
txid: string;
|
|
959
|
-
origfee: number;
|
|
960
|
-
fee: number;
|
|
961
|
-
error?: string[];
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
export type AddMultiSigAddressParams = {
|
|
965
|
-
nrequired: number,
|
|
966
|
-
keys: string[],
|
|
967
|
-
account?: string,
|
|
968
|
-
}
|
|
969
|
-
export type SignRawTxParams = {
|
|
970
|
-
hexstring: string,
|
|
971
|
-
prevtxs?: PrevOut[],
|
|
972
|
-
privkeys?: string[],
|
|
973
|
-
sighashtype?: SigHashType
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
export type BitcoinSignature = { signature: string }
|
|
977
|
-
|
|
978
|
-
export type CreateMultiSigResult = { address: string; redeemScript: string }
|
|
979
|
-
|
|
980
|
-
export type CreateRawTxParams = {
|
|
981
|
-
inputs: CreateRawTxInputs[];
|
|
982
|
-
outputs: CreateRawTxOutputs[];
|
|
983
|
-
locktime?: number;
|
|
984
|
-
replacable?: boolean
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
export type CreateWalletParams = {
|
|
988
|
-
wallet_name: string;
|
|
989
|
-
disable_private_keys?: boolean;
|
|
990
|
-
blank?: boolean;
|
|
991
|
-
passphrase?: string;
|
|
992
|
-
avoid_reuse?: boolean;
|
|
993
|
-
descriptors?: boolean;
|
|
994
|
-
load_on_startup?: boolean
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
export type CreateWalletResult = {
|
|
998
|
-
name: string;
|
|
999
|
-
warning: string;
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
export type ScanBlocksParams = {
|
|
1003
|
-
action: 'start' | 'abort' | 'status';
|
|
1004
|
-
start_height?: number;
|
|
1005
|
-
stop_height?: number;
|
|
1006
|
-
filtertype?: string;
|
|
1007
|
-
options?: { filter_false_positives: boolean }
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
export type ListTransactionsParams = {
|
|
1011
|
-
account?: string;
|
|
1012
|
-
count?: number;
|
|
1013
|
-
skip?: number;
|
|
1014
|
-
include_watchonly?: boolean
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
export type FundRawTxResult = { hex: string; fee: number; changepos: number; }
|
|
1018
319
|
export type DerivedAddresses = Array<string>;
|
|
1019
|
-
export type CreateWalletDescriptorOptions = { internal: boolean; hdkey: string }
|
|
1020
|
-
export type WalletDescriptor = string;
|
|
1021
|
-
export type CreateWalletDescriptorsResult = { descs: Array<WalletDescriptor>; }
|
|
1022
|
-
|
|
1023
|
-
export type SendManyParams = {
|
|
1024
|
-
fromaccount: string;
|
|
1025
|
-
amounts: { address: string; };
|
|
1026
|
-
minconf?: number;
|
|
1027
|
-
comment?: string;
|
|
1028
|
-
subtractfeefrom?: string[];
|
|
1029
|
-
replaeable?: boolean;
|
|
1030
|
-
conf_target?: number;
|
|
1031
|
-
estimate_mode?: FeeEstimateMode
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
export type ListUnspentParams = {
|
|
1035
|
-
minconf?: number;
|
|
1036
|
-
maxconf?: number;
|
|
1037
|
-
address?: string[];
|
|
1038
|
-
include_unsafe?: boolean;
|
|
1039
|
-
query_options?: ListUnspentOptions;
|
|
1040
|
-
}
|
|
1041
320
|
|
|
1042
|
-
export type
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
}
|
|
1048
|
-
export type SolvingData = {
|
|
1049
|
-
pubkeys: string[];
|
|
1050
|
-
scripts: string[];
|
|
1051
|
-
descriptors: string[];
|
|
1052
|
-
}
|
|
1053
|
-
export type Recipients = Array<BitcoinRecipient>;
|
|
1054
|
-
export type SendAllOptions = {
|
|
1055
|
-
add_to_wallet?: boolean;
|
|
1056
|
-
fee_rate?: number | string;
|
|
1057
|
-
include_watching?: boolean;
|
|
1058
|
-
inputs?: Input[];
|
|
1059
|
-
locktime?: number;
|
|
1060
|
-
lock_unspents?: boolean;
|
|
1061
|
-
psbt?: boolean;
|
|
1062
|
-
send_max?: boolean;
|
|
1063
|
-
minconf?: number;
|
|
1064
|
-
maxconf?: number;
|
|
1065
|
-
conf_target?: number
|
|
1066
|
-
estimate_mode?: FeeEstimateMode;
|
|
1067
|
-
replaceable?: boolean;
|
|
1068
|
-
solving_data?: SolvingData
|
|
1069
|
-
}
|
|
1070
|
-
export type SendAllParams = {
|
|
1071
|
-
recipients: Recipients;
|
|
1072
|
-
options?: SendAllOptions;
|
|
1073
|
-
}
|
|
1074
|
-
export type SendAllResult = {
|
|
1075
|
-
txid: Hex;
|
|
1076
|
-
hex: Hex;
|
|
1077
|
-
psbt: string;
|
|
1078
|
-
complete: boolean;
|
|
1079
|
-
}
|
|
1080
|
-
export type SendToAddressResult = {
|
|
1081
|
-
txid: string;
|
|
1082
|
-
fee_reason?: string;
|
|
1083
|
-
}
|
|
1084
|
-
export type CreateMultisigParams = {
|
|
1085
|
-
nrequired: number;
|
|
1086
|
-
keys: string[];
|
|
1087
|
-
address_type?: string;
|
|
1088
|
-
}
|
|
1089
|
-
export type CreateMultisigResult = {
|
|
1090
|
-
address: string;
|
|
1091
|
-
redeemScript: Hex;
|
|
1092
|
-
descriptor: string;
|
|
1093
|
-
warnings?: string[]
|
|
321
|
+
export type ListTransactionsParams = {
|
|
322
|
+
account?: string;
|
|
323
|
+
count?: number;
|
|
324
|
+
skip?: number;
|
|
325
|
+
include_watchonly?: boolean
|
|
1094
326
|
}
|
|
1095
327
|
|
|
328
|
+
export type ListTransactionsResult = {
|
|
329
|
+
trusted: boolean;
|
|
330
|
+
otheraccount?: string;
|
|
331
|
+
abandoned?: boolean;
|
|
332
|
+
account: string;
|
|
333
|
+
address: string;
|
|
334
|
+
category: 'send' | 'receive';
|
|
335
|
+
amount: number;
|
|
336
|
+
vout: number;
|
|
337
|
+
fee: number;
|
|
338
|
+
confirmations: number;
|
|
339
|
+
blockhash: string;
|
|
340
|
+
blockindex: number;
|
|
341
|
+
blocktime: number;
|
|
342
|
+
txid: string;
|
|
343
|
+
time: number;
|
|
344
|
+
timereceived: number;
|
|
345
|
+
walletconflicts: string[];
|
|
346
|
+
'bip125-replaceable': 'yes' | 'no' | 'unknown';
|
|
347
|
+
label: string;
|
|
348
|
+
};
|
|
1096
349
|
|
|
1097
350
|
/**
|
|
1098
351
|
* Defines verbosity levels for block and transaction outputs.
|
|
1099
|
-
*
|
|
1100
|
-
* @enum {number} VerbosityLevel for block and transaction outputs.
|
|
352
|
+
* @enum {number}
|
|
1101
353
|
*/
|
|
1102
354
|
export enum VerbosityLevel {
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
*/
|
|
1112
|
-
jsonext = 2,
|
|
1113
|
-
/**
|
|
1114
|
-
* Return block data in JSON object format with additional information.
|
|
1115
|
-
* Returns block data with information about each transaction, including prevout information for inputs.
|
|
1116
|
-
*/
|
|
1117
|
-
jsonextprev = 3
|
|
355
|
+
/** Return data in raw hex-encoded format */
|
|
356
|
+
hex = 0,
|
|
357
|
+
/** Return data in JSON object format */
|
|
358
|
+
json = 1,
|
|
359
|
+
/** Return data in JSON format with additional information */
|
|
360
|
+
jsonext = 2,
|
|
361
|
+
/** Return block data in JSON format with prevout information for inputs */
|
|
362
|
+
jsonextprev = 3
|
|
1118
363
|
}
|
|
1119
364
|
|
|
1120
|
-
export type BlockHeight = number;
|
|
1121
|
-
|
|
1122
365
|
export interface GetBlockParams {
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
}
|
|
366
|
+
blockhash?: string;
|
|
367
|
+
height?: number;
|
|
368
|
+
verbosity?: VerbosityLevel
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export type MethodNameInLowerCase =
|
|
372
|
+
| 'getbestblockhash'
|
|
373
|
+
| 'getblock'
|
|
374
|
+
| 'getblockchaininfo'
|
|
375
|
+
| 'getblockcount'
|
|
376
|
+
| 'getblockhash'
|
|
377
|
+
| 'getblockheader'
|
|
378
|
+
| 'getchaintips'
|
|
379
|
+
| 'getchaintxstats'
|
|
380
|
+
| 'getdifficulty'
|
|
381
|
+
| 'getmempoolancestors'
|
|
382
|
+
| 'getmempooldescendants'
|
|
383
|
+
| 'getmempoolentry'
|
|
384
|
+
| 'getmempoolinfo'
|
|
385
|
+
| 'getrawmempool'
|
|
386
|
+
| 'gettxout'
|
|
387
|
+
| 'gettxoutproof'
|
|
388
|
+
| 'gettxoutsetinfo'
|
|
389
|
+
| 'preciousblock'
|
|
390
|
+
| 'pruneblockchain'
|
|
391
|
+
| 'verifychain'
|
|
392
|
+
| 'verifytxoutproof'
|
|
393
|
+
| 'getinfo'
|
|
394
|
+
| 'getmemoryinfo'
|
|
395
|
+
| 'help'
|
|
396
|
+
| 'stop'
|
|
397
|
+
| 'uptime'
|
|
398
|
+
| 'generate'
|
|
399
|
+
| 'generatetoaddress'
|
|
400
|
+
| 'getblocktemplate'
|
|
401
|
+
| 'getmininginfo'
|
|
402
|
+
| 'getnetworkhashps'
|
|
403
|
+
| 'prioritisetransaction'
|
|
404
|
+
| 'submitblock'
|
|
405
|
+
| 'addnode'
|
|
406
|
+
| 'clearbanned'
|
|
407
|
+
| 'disconnectnode'
|
|
408
|
+
| 'getaddednodeinfo'
|
|
409
|
+
| 'getconnectioncount'
|
|
410
|
+
| 'getnettotals'
|
|
411
|
+
| 'getnetworkinfo'
|
|
412
|
+
| 'getpeerinfo'
|
|
413
|
+
| 'istbanned'
|
|
414
|
+
| 'ping'
|
|
415
|
+
| 'setban'
|
|
416
|
+
| 'setnetworkactive'
|
|
417
|
+
| 'combinerawtransaction'
|
|
418
|
+
| 'createrawtransaction'
|
|
419
|
+
| 'createwallet'
|
|
420
|
+
| 'decoderawtransaction'
|
|
421
|
+
| 'decodescript'
|
|
422
|
+
| 'fundrawtransaction'
|
|
423
|
+
| 'getrawtransaction'
|
|
424
|
+
| 'sendrawtransaction'
|
|
425
|
+
| 'signrawtransaction'
|
|
426
|
+
| 'createmultisig'
|
|
427
|
+
| 'estimatefee'
|
|
428
|
+
| 'estimatesmartfee'
|
|
429
|
+
| 'signmessagewithprivkey'
|
|
430
|
+
| 'validateaddress'
|
|
431
|
+
| 'verifymessage'
|
|
432
|
+
| 'abandontransaction'
|
|
433
|
+
| 'abortrescan'
|
|
434
|
+
| 'addmultisigaddress'
|
|
435
|
+
| 'addwitnessaddress'
|
|
436
|
+
| 'backupwallet'
|
|
437
|
+
| 'bumpfee'
|
|
438
|
+
| 'dumpprivkey'
|
|
439
|
+
| 'dumpwallet'
|
|
440
|
+
| 'encryptwallet'
|
|
441
|
+
| 'getaccount'
|
|
442
|
+
| 'getaccountaddress'
|
|
443
|
+
| 'getaddressesbyaccount'
|
|
444
|
+
| 'getbalance'
|
|
445
|
+
| 'getnewaddress'
|
|
446
|
+
| 'getrawchangeaddress'
|
|
447
|
+
| 'getreceivedbyaccount'
|
|
448
|
+
| 'getreceivedbyaddress'
|
|
449
|
+
| 'gettransaction'
|
|
450
|
+
| 'getunconfirmedbalance'
|
|
451
|
+
| 'getwalletinfo'
|
|
452
|
+
| 'importaddress'
|
|
453
|
+
| 'importmulti'
|
|
454
|
+
| 'importprivkey'
|
|
455
|
+
| 'importprunedfunds'
|
|
456
|
+
| 'importpubkey'
|
|
457
|
+
| 'importwallet'
|
|
458
|
+
| 'keypoolrefill'
|
|
459
|
+
| 'listaccounts'
|
|
460
|
+
| 'listaddressgroupings'
|
|
461
|
+
| 'listlockunspent'
|
|
462
|
+
| 'listreceivedbyaccount'
|
|
463
|
+
| 'listreceivedbyaddress'
|
|
464
|
+
| 'listsinceblock'
|
|
465
|
+
| 'listtransactions'
|
|
466
|
+
| 'listunspent'
|
|
467
|
+
| 'listwallets'
|
|
468
|
+
| 'lockunspent'
|
|
469
|
+
| 'move'
|
|
470
|
+
| 'removeprunedfunds'
|
|
471
|
+
| 'sendfrom'
|
|
472
|
+
| 'sendmany'
|
|
473
|
+
| 'sendtoaddress'
|
|
474
|
+
| 'setaccount'
|
|
475
|
+
| 'settxfee'
|
|
476
|
+
| 'signmessage'
|
|
477
|
+
| 'scanblocks'
|
|
478
|
+
| 'getdescriptorinfo'
|
|
479
|
+
| 'deriveaddresses'
|
|
480
|
+
| 'importdescriptors'
|
|
481
|
+
| 'createwalletdescriptor'
|
|
482
|
+
| 'signrawtransactionwithwallet'
|
|
483
|
+
| 'send'
|
|
484
|
+
| 'sendall';
|
|
485
|
+
|