@did-btcr2/bitcoin 0.3.4 → 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 +83 -84
- 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 +31 -84
- 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 +75 -337
- 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 +83 -84
- 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 +31 -84
- 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 +75 -337
- 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 +105 -118
- 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 +38 -94
- package/src/client/rest/protocol.ts +153 -0
- package/src/client/rest/transaction.ts +23 -23
- package/src/client/rpc/index.ts +140 -379
- 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 -972
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,1063 +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 ScriptPubKey = {
|
|
554
|
-
asm: string;
|
|
555
|
-
hex: string;
|
|
556
|
-
reqSigs: number;
|
|
557
|
-
type: string;
|
|
558
|
-
address?: string;
|
|
559
|
-
desc: string;
|
|
560
|
-
};
|
|
561
|
-
export type TxOut = {
|
|
562
|
-
value: number;
|
|
563
|
-
n: number;
|
|
564
|
-
scriptPubKey: ScriptPubKey;
|
|
239
|
+
hex: string;
|
|
240
|
+
txid: string;
|
|
241
|
+
hash: string;
|
|
242
|
+
size: number;
|
|
243
|
+
vsize: number;
|
|
244
|
+
weight: number;
|
|
245
|
+
version: number;
|
|
246
|
+
locktime: number;
|
|
565
247
|
};
|
|
248
|
+
|
|
566
249
|
export type RawTransactionV0 = string;
|
|
567
250
|
export interface RawTransactionV1 extends Transaction {
|
|
568
|
-
|
|
569
|
-
|
|
251
|
+
vin: TxIn[];
|
|
252
|
+
vout: TxOut[];
|
|
570
253
|
};
|
|
571
254
|
export interface RawTransactionV2 extends Transaction {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
255
|
+
fee?: number;
|
|
256
|
+
vin: TxInExt[];
|
|
257
|
+
vout: TxOut[];
|
|
575
258
|
};
|
|
576
259
|
export type RawTransactionResponse = RawTransactionV0 | RawTransactionV1 | RawTransactionV2;
|
|
577
260
|
|
|
578
261
|
export type CreateRawTxInputs = {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
export type TxOutForCreateRaw = {
|
|
585
|
-
address: string;
|
|
586
|
-
data: string;
|
|
587
|
-
};
|
|
588
|
-
|
|
589
|
-
export type TxOutInBlock = {
|
|
590
|
-
bestblock: string;
|
|
591
|
-
confirmations: number;
|
|
592
|
-
value: number;
|
|
593
|
-
scriptPubKey: {
|
|
594
|
-
asm: string;
|
|
595
|
-
hex: string;
|
|
596
|
-
reqSigs: number;
|
|
597
|
-
type: string;
|
|
598
|
-
addresses: string[];
|
|
599
|
-
};
|
|
600
|
-
coinbase: boolean;
|
|
601
|
-
};
|
|
602
|
-
|
|
603
|
-
export type DecodedScript = {
|
|
604
|
-
asm: string;
|
|
605
|
-
hex: string;
|
|
606
|
-
type: string;
|
|
607
|
-
reqSigs: number;
|
|
608
|
-
addresses: string[];
|
|
609
|
-
p2sh: string;
|
|
610
|
-
};
|
|
611
|
-
|
|
612
|
-
export type WalletTransaction = {
|
|
613
|
-
amount: number;
|
|
614
|
-
fee: number;
|
|
615
|
-
confirmations: number;
|
|
616
|
-
blockhash: string;
|
|
617
|
-
blockindex: number;
|
|
618
|
-
blocktime: number;
|
|
619
|
-
txid: string;
|
|
620
|
-
time: number;
|
|
621
|
-
timereceived: number;
|
|
622
|
-
'bip125-replaceable': 'yes' | 'no' | 'unknown';
|
|
623
|
-
details: {
|
|
624
|
-
account: string;
|
|
625
|
-
address: string;
|
|
626
|
-
category: 'send' | 'receive';
|
|
627
|
-
amount: number;
|
|
628
|
-
label?: string;
|
|
629
|
-
vout: number;
|
|
630
|
-
fee: number;
|
|
631
|
-
abandoned: number;
|
|
632
|
-
}[];
|
|
633
|
-
hex: string;
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
export type WalletInfo = {
|
|
637
|
-
walletname: string;
|
|
638
|
-
walletversion: number;
|
|
639
|
-
balance: number;
|
|
640
|
-
unconfirmed_balance: number;
|
|
641
|
-
immature_balance: number;
|
|
642
|
-
txcount: number;
|
|
643
|
-
keypoololdest: number;
|
|
644
|
-
keypoolsize: number;
|
|
645
|
-
paytxfee: number;
|
|
646
|
-
hdmasterkeyid: string;
|
|
262
|
+
txid: string;
|
|
263
|
+
vout: number;
|
|
264
|
+
sequence?: number;
|
|
647
265
|
};
|
|
648
266
|
|
|
649
|
-
export type
|
|
650
|
-
| 'ALL'
|
|
651
|
-
| 'NONE'
|
|
652
|
-
| 'SINGLE'
|
|
653
|
-
| 'ALL|ANYONECANPAY'
|
|
654
|
-
| 'NONE|ANYONECANPAY'
|
|
655
|
-
| 'SINGLE|ANYONECANPAY';
|
|
267
|
+
export type CreateRawTxOutputs = { [address: string]: number } | { data: string };
|
|
656
268
|
|
|
657
269
|
export type SignedRawTx = {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
};
|
|
668
|
-
|
|
669
|
-
export type ValidateAddressResult = {
|
|
670
|
-
isvalid: boolean;
|
|
671
|
-
address?: string;
|
|
672
|
-
scriptPubKey?: string;
|
|
673
|
-
ismine?: boolean;
|
|
674
|
-
iswatchonly?: boolean;
|
|
675
|
-
isscript?: boolean;
|
|
676
|
-
script?: string;
|
|
677
|
-
hex?: string;
|
|
678
|
-
addresses?: string[];
|
|
679
|
-
sigsrequired?: number;
|
|
680
|
-
pubkey?: string;
|
|
681
|
-
iscompressed?: boolean;
|
|
682
|
-
account?: string;
|
|
683
|
-
timestamp?: number;
|
|
684
|
-
hdkeypath?: string;
|
|
685
|
-
hdmasterkeyid?: string;
|
|
686
|
-
};
|
|
687
|
-
|
|
688
|
-
export type ImportMultiRequest = {
|
|
689
|
-
scriptPubKey: string | { address: string };
|
|
690
|
-
timestamp: number | 'now';
|
|
691
|
-
redeemScript?: string;
|
|
692
|
-
pubkeys?: string[];
|
|
693
|
-
keys?: string[];
|
|
694
|
-
internal?: boolean;
|
|
695
|
-
watchonly?: boolean;
|
|
696
|
-
label?: string;
|
|
697
|
-
};
|
|
698
|
-
|
|
699
|
-
export type ImportMultiResult = {
|
|
700
|
-
success: boolean;
|
|
701
|
-
error?: {
|
|
702
|
-
code: string;
|
|
703
|
-
message: string;
|
|
704
|
-
};
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
export type ImportMultiOptions = { rescan?: boolean; };
|
|
708
|
-
|
|
709
|
-
export type ImportDescriptorRequest = {
|
|
710
|
-
/** (string, required) Descriptor to import. */
|
|
711
|
-
desc: string;
|
|
712
|
-
/**
|
|
713
|
-
* (integer / string, required) Time from which to start rescanning the blockchain for this descriptor, in UNIX epoch time
|
|
714
|
-
* Use the string "now" to substitute the current synced blockchain time.
|
|
715
|
-
* "now" can be specified to bypass scanning, for outputs which are known to never have been used, and
|
|
716
|
-
* 0 can be specified to scan the entire blockchain. Blocks up to 2 hours before the earliest timestamp
|
|
717
|
-
* of all descriptors being imported will be scanned as well as the mempool.
|
|
718
|
-
*/
|
|
719
|
-
timestamp: number | string;
|
|
720
|
-
/** (boolean, optional, default=false) Make descriptor "active" for corresponding output type/externality */
|
|
721
|
-
active?: boolean;
|
|
722
|
-
/** (numeric or array, optional) If a ranged descriptor is used, this specifies the end or the range (in the form [begin,end]) to import */
|
|
723
|
-
range?: number | Array<number>;
|
|
724
|
-
/** (numeric, optional) If a ranged descriptor is set to active, this specifies the next index to generate addresses from */
|
|
725
|
-
next_index?: number;
|
|
726
|
-
/** (boolean, optional, default=false) Whether matching outputs should be treated as not incoming payments (e.g. change) */
|
|
727
|
-
internal?: boolean;
|
|
728
|
-
/** (string, optional, default="") Label to assign to the address, only allowed with internal=false. Disabled for ranged descriptors */
|
|
729
|
-
label?: string;
|
|
730
|
-
};
|
|
731
|
-
|
|
732
|
-
export type JsonRPCError = {
|
|
733
|
-
code: number;
|
|
734
|
-
message: string;
|
|
735
|
-
};
|
|
736
|
-
|
|
737
|
-
export type ImportDescriptorResult = {
|
|
738
|
-
success: boolean;
|
|
739
|
-
warnings?: string;
|
|
740
|
-
error: JsonRPCError;
|
|
741
|
-
};
|
|
742
|
-
|
|
743
|
-
export type Received = {
|
|
744
|
-
involvesWatchonly?: boolean;
|
|
745
|
-
account: string;
|
|
746
|
-
amount: number;
|
|
747
|
-
confirmations: number;
|
|
748
|
-
label: string;
|
|
749
|
-
};
|
|
750
|
-
|
|
751
|
-
export type ListUnspentOptions = {
|
|
752
|
-
minimumAmount: number | string;
|
|
753
|
-
maximumAmount: number | string;
|
|
754
|
-
maximumCount: number | string;
|
|
755
|
-
minimumSumAmount: number | string;
|
|
756
|
-
};
|
|
757
|
-
|
|
758
|
-
export type ReceivedByAccount = Received;
|
|
759
|
-
|
|
760
|
-
export type ReceivedByAddress = {
|
|
761
|
-
address: string;
|
|
762
|
-
txids: string[];
|
|
763
|
-
} & Received;
|
|
764
|
-
|
|
765
|
-
export type RestExtension = 'json' | 'bin' | 'hex';
|
|
766
|
-
|
|
767
|
-
export type MethodNameInLowerCase =
|
|
768
|
-
| 'getbestblockhash'
|
|
769
|
-
| 'getblock'
|
|
770
|
-
| 'getblockchaininfo'
|
|
771
|
-
| 'getblockcount'
|
|
772
|
-
| 'getblockhash'
|
|
773
|
-
| 'getblockheader'
|
|
774
|
-
| 'getchaintips'
|
|
775
|
-
| 'getchaintxstats'
|
|
776
|
-
| 'getdifficulty'
|
|
777
|
-
| 'getmempoolancestors'
|
|
778
|
-
| 'getmempooldescendants'
|
|
779
|
-
| 'getmempoolentry'
|
|
780
|
-
| 'getmempoolinfo'
|
|
781
|
-
| 'getrawmempool'
|
|
782
|
-
| 'gettxout'
|
|
783
|
-
| 'gettxoutproof'
|
|
784
|
-
| 'gettxoutsetinfo'
|
|
785
|
-
| 'preciousblock'
|
|
786
|
-
| 'pruneblockchain'
|
|
787
|
-
| 'verifychain'
|
|
788
|
-
| 'verifytxoutproof'
|
|
789
|
-
| 'getinfo'
|
|
790
|
-
| 'getmemoryinfo'
|
|
791
|
-
| 'help'
|
|
792
|
-
| 'stop'
|
|
793
|
-
| 'uptime'
|
|
794
|
-
| 'generate'
|
|
795
|
-
| 'generatetoaddress'
|
|
796
|
-
| 'getblocktemplate'
|
|
797
|
-
| 'getmininginfo'
|
|
798
|
-
| 'getnetworkhashps'
|
|
799
|
-
| 'prioritisetransaction'
|
|
800
|
-
| 'submitblock'
|
|
801
|
-
| 'addnode'
|
|
802
|
-
| 'clearbanned'
|
|
803
|
-
| 'disconnectnode'
|
|
804
|
-
| 'getaddednodeinfo'
|
|
805
|
-
| 'getconnectioncount'
|
|
806
|
-
| 'getnettotals'
|
|
807
|
-
| 'getnetworkinfo'
|
|
808
|
-
| 'getpeerinfo'
|
|
809
|
-
| 'istbanned'
|
|
810
|
-
| 'ping'
|
|
811
|
-
| 'setban'
|
|
812
|
-
| 'setnetworkactive'
|
|
813
|
-
| 'combinerawtransaction'
|
|
814
|
-
| 'createrawtransaction'
|
|
815
|
-
| 'createwallet'
|
|
816
|
-
| 'decoderawtransaction'
|
|
817
|
-
| 'decodescript'
|
|
818
|
-
| 'fundrawtransaction'
|
|
819
|
-
| 'getrawtransaction'
|
|
820
|
-
| 'sendrawtransaction'
|
|
821
|
-
| 'signrawtransaction'
|
|
822
|
-
| 'createmultisig'
|
|
823
|
-
| 'estimatefee'
|
|
824
|
-
| 'estimatesmartfee'
|
|
825
|
-
| 'signmessagewithprivkey'
|
|
826
|
-
| 'validateaddress'
|
|
827
|
-
| 'verifymessage'
|
|
828
|
-
| 'abandontransaction'
|
|
829
|
-
| 'abortrescan'
|
|
830
|
-
| 'addmultisigaddress'
|
|
831
|
-
| 'addwitnessaddress'
|
|
832
|
-
| 'backupwallet'
|
|
833
|
-
| 'bumpfee'
|
|
834
|
-
| 'dumpprivkey'
|
|
835
|
-
| 'dumpwallet'
|
|
836
|
-
| 'encryptwallet'
|
|
837
|
-
| 'getaccount'
|
|
838
|
-
| 'getaccountaddress'
|
|
839
|
-
| 'getaddressesbyaccount'
|
|
840
|
-
| 'getbalance'
|
|
841
|
-
| 'getnewaddress'
|
|
842
|
-
| 'getrawchangeaddress'
|
|
843
|
-
| 'getreceivedbyaccount'
|
|
844
|
-
| 'getreceivedbyaddress'
|
|
845
|
-
| 'gettransaction'
|
|
846
|
-
| 'getunconfirmedbalance'
|
|
847
|
-
| 'getwalletinfo'
|
|
848
|
-
| 'importaddress'
|
|
849
|
-
| 'importmulti'
|
|
850
|
-
| 'importprivkey'
|
|
851
|
-
| 'importprunedfunds'
|
|
852
|
-
| 'importpubkey'
|
|
853
|
-
| 'importwallet'
|
|
854
|
-
| 'keypoolrefill'
|
|
855
|
-
| 'listaccounts'
|
|
856
|
-
| 'listaddressgroupings'
|
|
857
|
-
| 'listlockunspent'
|
|
858
|
-
| 'listreceivedbyaccount'
|
|
859
|
-
| 'listreceivedbyaddress'
|
|
860
|
-
| 'listsinceblock'
|
|
861
|
-
| 'listtransactions'
|
|
862
|
-
| 'listunspent'
|
|
863
|
-
| 'listwallets'
|
|
864
|
-
| 'lockunspent'
|
|
865
|
-
| 'move'
|
|
866
|
-
| 'removeprunedfunds'
|
|
867
|
-
| 'sendfrom'
|
|
868
|
-
| 'sendmany'
|
|
869
|
-
| 'sendtoaddress'
|
|
870
|
-
| 'setaccount'
|
|
871
|
-
| 'settxfee'
|
|
872
|
-
| 'signmessage'
|
|
873
|
-
| 'scanblocks'
|
|
874
|
-
| 'getdescriptorinfo'
|
|
875
|
-
| 'deriveaddresses'
|
|
876
|
-
| 'importdescriptors'
|
|
877
|
-
| 'createwalletdescriptor'
|
|
878
|
-
| 'signrawtransactionwithwallet'
|
|
879
|
-
| 'send'
|
|
880
|
-
| 'sendmany'
|
|
881
|
-
| 'sendall';
|
|
882
|
-
|
|
883
|
-
export type BatchOption = {
|
|
884
|
-
method: MethodNameInLowerCase;
|
|
885
|
-
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
|
+
}[];
|
|
886
279
|
};
|
|
887
280
|
|
|
888
|
-
export type
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
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;
|
|
895
293
|
};
|
|
896
294
|
|
|
897
|
-
|
|
898
|
-
|
|
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: {
|
|
899
307
|
account: string;
|
|
900
308
|
address: string;
|
|
901
309
|
category: 'send' | 'receive';
|
|
902
310
|
amount: number;
|
|
311
|
+
label?: string;
|
|
903
312
|
vout: number;
|
|
904
313
|
fee: number;
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
blocktime: number;
|
|
909
|
-
txid: string;
|
|
910
|
-
time: number;
|
|
911
|
-
timereceived: number;
|
|
912
|
-
walletconflicts: string[];
|
|
913
|
-
'bip125-replaceable': 'yes' | 'no' | 'unknown';
|
|
914
|
-
abandoned?: boolean;
|
|
915
|
-
comment?: string;
|
|
916
|
-
label: string;
|
|
917
|
-
to?: string;
|
|
314
|
+
abandoned: number;
|
|
315
|
+
}[];
|
|
316
|
+
hex: string;
|
|
918
317
|
};
|
|
919
318
|
|
|
920
|
-
export type TransactionInListSinceBlock = WalletTxBase;
|
|
921
|
-
|
|
922
|
-
export type ListSinceBlockResult = {
|
|
923
|
-
transactions: TransactionInListSinceBlock[];
|
|
924
|
-
removed?: TransactionInListSinceBlock[];
|
|
925
|
-
lastblock: string;
|
|
926
|
-
};
|
|
927
|
-
|
|
928
|
-
export type ListTransactionsResult = {
|
|
929
|
-
trusted: boolean;
|
|
930
|
-
otheraccount?: string;
|
|
931
|
-
abandoned?: boolean;
|
|
932
|
-
} & WalletTxBase;
|
|
933
|
-
|
|
934
|
-
export type AddressGrouping = [string, number] | [string, number, string];
|
|
935
|
-
|
|
936
|
-
export type RawOutputAddr = { [address: string]: number; };
|
|
937
|
-
export type RawOutputData = { data: string; };
|
|
938
|
-
export type CreateRawTxOutputs = RawOutputAddr | RawOutputData;
|
|
939
|
-
|
|
940
|
-
export type GetUTXOsResult = {
|
|
941
|
-
chainHeight: number;
|
|
942
|
-
chaintipHash: string;
|
|
943
|
-
bipmap: string;
|
|
944
|
-
utxos: UTXO[];
|
|
945
|
-
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
export type BumpFeeOptions = {
|
|
949
|
-
confTarget?: number;
|
|
950
|
-
totalFee?: number;
|
|
951
|
-
replaceable?: boolean;
|
|
952
|
-
estimate_mode?: FeeEstimateMode;
|
|
953
|
-
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
export type BumpFeeResult = {
|
|
957
|
-
txid: string;
|
|
958
|
-
origfee: number;
|
|
959
|
-
fee: number;
|
|
960
|
-
error?: string[];
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
export type AddMultiSigAddressParams = {
|
|
964
|
-
nrequired: number,
|
|
965
|
-
keys: string[],
|
|
966
|
-
account?: string,
|
|
967
|
-
}
|
|
968
|
-
export type SignRawTxParams = {
|
|
969
|
-
hexstring: string,
|
|
970
|
-
prevtxs?: PrevOut[],
|
|
971
|
-
privkeys?: string[],
|
|
972
|
-
sighashtype?: SigHashType
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
export type BitcoinSignature = { signature: string }
|
|
976
|
-
|
|
977
|
-
export type CreateMultiSigResult = { address: string; redeemScript: string }
|
|
978
|
-
|
|
979
|
-
export type CreateRawTxParams = {
|
|
980
|
-
inputs: CreateRawTxInputs[];
|
|
981
|
-
outputs: CreateRawTxOutputs[];
|
|
982
|
-
locktime?: number;
|
|
983
|
-
replacable?: boolean
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
export type CreateWalletParams = {
|
|
987
|
-
wallet_name: string;
|
|
988
|
-
disable_private_keys?: boolean;
|
|
989
|
-
blank?: boolean;
|
|
990
|
-
passphrase?: string;
|
|
991
|
-
avoid_reuse?: boolean;
|
|
992
|
-
descriptors?: boolean;
|
|
993
|
-
load_on_startup?: boolean
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
export type CreateWalletResult = {
|
|
997
|
-
name: string;
|
|
998
|
-
warning: string;
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
export type ScanBlocksParams = {
|
|
1002
|
-
action: 'start' | 'abort' | 'status';
|
|
1003
|
-
start_height?: number;
|
|
1004
|
-
stop_height?: number;
|
|
1005
|
-
filtertype?: string;
|
|
1006
|
-
options?: { filter_false_positives: boolean }
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
export type ListTransactionsParams = {
|
|
1010
|
-
account?: string;
|
|
1011
|
-
count?: number;
|
|
1012
|
-
skip?: number;
|
|
1013
|
-
include_watchonly?: boolean
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
export type FundRawTxResult = { hex: string; fee: number; changepos: number; }
|
|
1017
319
|
export type DerivedAddresses = Array<string>;
|
|
1018
|
-
export type CreateWalletDescriptorOptions = { internal: boolean; hdkey: string }
|
|
1019
|
-
export type WalletDescriptor = string;
|
|
1020
|
-
export type CreateWalletDescriptorsResult = { descs: Array<WalletDescriptor>; }
|
|
1021
|
-
|
|
1022
|
-
export type SendManyParams = {
|
|
1023
|
-
fromaccount: string;
|
|
1024
|
-
amounts: { address: string; };
|
|
1025
|
-
minconf?: number;
|
|
1026
|
-
comment?: string;
|
|
1027
|
-
subtractfeefrom?: string[];
|
|
1028
|
-
replaeable?: boolean;
|
|
1029
|
-
conf_target?: number;
|
|
1030
|
-
estimate_mode?: FeeEstimateMode
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
export type ListUnspentParams = {
|
|
1034
|
-
minconf?: number;
|
|
1035
|
-
maxconf?: number;
|
|
1036
|
-
address?: string[];
|
|
1037
|
-
include_unsafe?: boolean;
|
|
1038
|
-
query_options?: ListUnspentOptions;
|
|
1039
|
-
}
|
|
1040
320
|
|
|
1041
|
-
export type
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
}
|
|
1047
|
-
export type SolvingData = {
|
|
1048
|
-
pubkeys: string[];
|
|
1049
|
-
scripts: string[];
|
|
1050
|
-
descriptors: string[];
|
|
1051
|
-
}
|
|
1052
|
-
export type Recipients = Array<BitcoinRecipient>;
|
|
1053
|
-
export type SendAllOptions = {
|
|
1054
|
-
add_to_wallet?: boolean;
|
|
1055
|
-
fee_rate?: number | string;
|
|
1056
|
-
include_watching?: boolean;
|
|
1057
|
-
inputs?: Input[];
|
|
1058
|
-
locktime?: number;
|
|
1059
|
-
lock_unspents?: boolean;
|
|
1060
|
-
psbt?: boolean;
|
|
1061
|
-
send_max?: boolean;
|
|
1062
|
-
minconf?: number;
|
|
1063
|
-
maxconf?: number;
|
|
1064
|
-
conf_target?: number
|
|
1065
|
-
estimate_mode?: FeeEstimateMode;
|
|
1066
|
-
replaceable?: boolean;
|
|
1067
|
-
solving_data?: SolvingData
|
|
1068
|
-
}
|
|
1069
|
-
export type SendAllParams = {
|
|
1070
|
-
recipients: Recipients;
|
|
1071
|
-
options?: SendAllOptions;
|
|
1072
|
-
}
|
|
1073
|
-
export type SendAllResult = {
|
|
1074
|
-
txid: Hex;
|
|
1075
|
-
hex: Hex;
|
|
1076
|
-
psbt: string;
|
|
1077
|
-
complete: boolean;
|
|
1078
|
-
}
|
|
1079
|
-
export type SendToAddressResult = {
|
|
1080
|
-
txid: string;
|
|
1081
|
-
fee_reason?: string;
|
|
1082
|
-
}
|
|
1083
|
-
export type CreateMultisigParams = {
|
|
1084
|
-
nrequired: number;
|
|
1085
|
-
keys: string[];
|
|
1086
|
-
address_type?: string;
|
|
1087
|
-
}
|
|
1088
|
-
export type CreateMultisigResult = {
|
|
1089
|
-
address: string;
|
|
1090
|
-
redeemScript: Hex;
|
|
1091
|
-
descriptor: string;
|
|
1092
|
-
warnings?: string[]
|
|
321
|
+
export type ListTransactionsParams = {
|
|
322
|
+
account?: string;
|
|
323
|
+
count?: number;
|
|
324
|
+
skip?: number;
|
|
325
|
+
include_watchonly?: boolean
|
|
1093
326
|
}
|
|
1094
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
|
+
};
|
|
1095
349
|
|
|
1096
350
|
/**
|
|
1097
351
|
* Defines verbosity levels for block and transaction outputs.
|
|
1098
|
-
*
|
|
1099
|
-
* @enum {number} VerbosityLevel for block and transaction outputs.
|
|
352
|
+
* @enum {number}
|
|
1100
353
|
*/
|
|
1101
354
|
export enum VerbosityLevel {
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
*/
|
|
1111
|
-
jsonext = 2,
|
|
1112
|
-
/**
|
|
1113
|
-
* Return block data in JSON object format with additional information.
|
|
1114
|
-
* Returns block data with information about each transaction, including prevout information for inputs.
|
|
1115
|
-
*/
|
|
1116
|
-
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
|
|
1117
363
|
}
|
|
1118
364
|
|
|
1119
|
-
export type BlockHeight = number;
|
|
1120
|
-
|
|
1121
365
|
export interface GetBlockParams {
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
}
|
|
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
|
+
|