@mr-zwets/bchn-api-wrapper 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +129 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/interfaces/interfaces.d.ts +70 -0
- package/dist/interfaces/interfaces.js +1 -0
- package/dist/interfaces/restInterfaces/interfaces.d.ts +109 -0
- package/dist/interfaces/restInterfaces/interfaces.js +1 -0
- package/dist/interfaces/rpcInterfaces/blockchain.d.ts +692 -0
- package/dist/interfaces/rpcInterfaces/blockchain.js +3 -0
- package/dist/interfaces/rpcInterfaces/control.d.ts +54 -0
- package/dist/interfaces/rpcInterfaces/control.js +3 -0
- package/dist/interfaces/rpcInterfaces/generating.d.ts +17 -0
- package/dist/interfaces/rpcInterfaces/generating.js +3 -0
- package/dist/interfaces/rpcInterfaces/index.d.ts +9 -0
- package/dist/interfaces/rpcInterfaces/index.js +12 -0
- package/dist/interfaces/rpcInterfaces/mining.d.ts +131 -0
- package/dist/interfaces/rpcInterfaces/mining.js +3 -0
- package/dist/interfaces/rpcInterfaces/network.d.ts +179 -0
- package/dist/interfaces/rpcInterfaces/network.js +3 -0
- package/dist/interfaces/rpcInterfaces/rawtransactions.d.ts +283 -0
- package/dist/interfaces/rpcInterfaces/rawtransactions.js +3 -0
- package/dist/interfaces/rpcInterfaces/util.d.ts +44 -0
- package/dist/interfaces/rpcInterfaces/util.js +3 -0
- package/dist/interfaces/rpcInterfaces/wallet.d.ts +620 -0
- package/dist/interfaces/rpcInterfaces/wallet.js +3 -0
- package/dist/interfaces/rpcInterfaces/zmq.d.ts +8 -0
- package/dist/interfaces/rpcInterfaces/zmq.js +3 -0
- package/dist/restClient.d.ts +17 -0
- package/dist/restClient.js +100 -0
- package/dist/rpcClient.d.ts +12 -0
- package/dist/rpcClient.js +85 -0
- package/dist/utils/errors.d.ts +3 -0
- package/dist/utils/errors.js +6 -0
- package/dist/utils/utils.d.ts +11 -0
- package/dist/utils/utils.js +49 -0
- package/package.json +40 -0
- package/src/index.ts +4 -0
- package/src/interfaces/interfaces.ts +87 -0
- package/src/interfaces/restInterfaces/interfaces.ts +117 -0
- package/src/interfaces/rpcInterfaces/blockchain.ts +759 -0
- package/src/interfaces/rpcInterfaces/control.ts +62 -0
- package/src/interfaces/rpcInterfaces/generating.ts +21 -0
- package/src/interfaces/rpcInterfaces/index.ts +14 -0
- package/src/interfaces/rpcInterfaces/mining.ts +143 -0
- package/src/interfaces/rpcInterfaces/network.ts +195 -0
- package/src/interfaces/rpcInterfaces/rawtransactions.ts +314 -0
- package/src/interfaces/rpcInterfaces/util.ts +52 -0
- package/src/interfaces/rpcInterfaces/wallet.ts +674 -0
- package/src/interfaces/rpcInterfaces/zmq.ts +11 -0
- package/src/restClient.ts +119 -0
- package/src/rpcClient.ts +93 -0
- package/src/utils/errors.ts +6 -0
- package/src/utils/utils.ts +55 -0
- package/test/restClient.test.ts +32 -0
- package/test/rpcClient.test.ts +115 -0
- package/test/setupTests.ts +54 -0
- package/test/tsconfig.json +4 -0
- package/tsconfig.json +13 -0
- package/vitest.config.ts +9 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface CreateMultisig {
|
|
2
|
+
method: 'createmultisig';
|
|
3
|
+
params: [
|
|
4
|
+
nrequired: number,
|
|
5
|
+
keys: string[]
|
|
6
|
+
];
|
|
7
|
+
response: {
|
|
8
|
+
address: string;
|
|
9
|
+
redeemScript: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface EstimateFee {
|
|
13
|
+
method: 'estimatefee';
|
|
14
|
+
params: [];
|
|
15
|
+
response: number;
|
|
16
|
+
}
|
|
17
|
+
export interface SignMessageWithPrivKey {
|
|
18
|
+
method: 'signmessagewithprivkey';
|
|
19
|
+
params: [
|
|
20
|
+
privkey: string,
|
|
21
|
+
message: string
|
|
22
|
+
];
|
|
23
|
+
response: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ValidateAddress {
|
|
26
|
+
method: 'validateaddress';
|
|
27
|
+
params: [string];
|
|
28
|
+
response: {
|
|
29
|
+
isvalid: boolean;
|
|
30
|
+
address: string;
|
|
31
|
+
scriptPubKey?: string;
|
|
32
|
+
isscript: boolean;
|
|
33
|
+
istokenaware: boolean;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface VerifyMessage {
|
|
37
|
+
method: 'verifymessage';
|
|
38
|
+
params: [
|
|
39
|
+
address: string,
|
|
40
|
+
signature: string,
|
|
41
|
+
message: string
|
|
42
|
+
];
|
|
43
|
+
response: boolean;
|
|
44
|
+
}
|
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
import type { TokenData } from "../interfaces.js";
|
|
2
|
+
export interface AbandonTransaction {
|
|
3
|
+
method: 'abandontransaction';
|
|
4
|
+
params: [
|
|
5
|
+
txid: string
|
|
6
|
+
];
|
|
7
|
+
response: null;
|
|
8
|
+
}
|
|
9
|
+
export interface AbortRescan {
|
|
10
|
+
method: 'abortrescan';
|
|
11
|
+
params: [];
|
|
12
|
+
response: null;
|
|
13
|
+
}
|
|
14
|
+
export interface AddMultisigAddress {
|
|
15
|
+
method: 'addmultisigaddress';
|
|
16
|
+
params: [
|
|
17
|
+
nrequired: number,
|
|
18
|
+
keys: string[],
|
|
19
|
+
label?: string
|
|
20
|
+
];
|
|
21
|
+
response: {
|
|
22
|
+
address: string;
|
|
23
|
+
redeemScript: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface BackupWallet {
|
|
27
|
+
method: 'backupwallet';
|
|
28
|
+
params: [
|
|
29
|
+
destination: string
|
|
30
|
+
];
|
|
31
|
+
response: null;
|
|
32
|
+
}
|
|
33
|
+
export interface CreateWallet {
|
|
34
|
+
method: 'createwallet';
|
|
35
|
+
params: [
|
|
36
|
+
wallet_name: string,
|
|
37
|
+
disable_private_keys?: boolean,
|
|
38
|
+
blank?: boolean
|
|
39
|
+
];
|
|
40
|
+
response: {
|
|
41
|
+
name: string;
|
|
42
|
+
warning?: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface DumpWallet {
|
|
46
|
+
method: 'dumpwallet';
|
|
47
|
+
params: [
|
|
48
|
+
filename: string
|
|
49
|
+
];
|
|
50
|
+
response: {
|
|
51
|
+
filename: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface DumpPrivKey {
|
|
55
|
+
method: 'dumpprivkey';
|
|
56
|
+
params: [
|
|
57
|
+
address: string
|
|
58
|
+
];
|
|
59
|
+
response: string;
|
|
60
|
+
}
|
|
61
|
+
export interface EncryptWallet {
|
|
62
|
+
method: 'encryptwallet';
|
|
63
|
+
params: [
|
|
64
|
+
passphrase: string
|
|
65
|
+
];
|
|
66
|
+
response: string;
|
|
67
|
+
}
|
|
68
|
+
export interface GetAddressesByLabel {
|
|
69
|
+
method: 'getaddressesbylabel';
|
|
70
|
+
params: [
|
|
71
|
+
label: string
|
|
72
|
+
];
|
|
73
|
+
response: {
|
|
74
|
+
[address: string]: {
|
|
75
|
+
purpose: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export interface GetAddressInfo {
|
|
80
|
+
method: 'getaddressinfo';
|
|
81
|
+
params: [string];
|
|
82
|
+
response: {
|
|
83
|
+
address: string;
|
|
84
|
+
scriptPubKey: string;
|
|
85
|
+
ismine: boolean;
|
|
86
|
+
iswatchonly: boolean;
|
|
87
|
+
isscript: boolean;
|
|
88
|
+
ischange: boolean;
|
|
89
|
+
script?: 'nonstandard' | 'pubkey' | 'pubkeyhash' | 'scripthash' | 'multisig' | 'nulldata';
|
|
90
|
+
hex?: string;
|
|
91
|
+
pubkeys?: string[];
|
|
92
|
+
sigsrequired?: number;
|
|
93
|
+
pubkey?: string;
|
|
94
|
+
embedded?: object;
|
|
95
|
+
iscompressed: boolean;
|
|
96
|
+
label: string;
|
|
97
|
+
timestamp?: number;
|
|
98
|
+
hdkeypath?: string;
|
|
99
|
+
hdseedid?: string;
|
|
100
|
+
hdmasterkeyid?: string;
|
|
101
|
+
labels: {
|
|
102
|
+
name: string;
|
|
103
|
+
purpose: 'send' | 'receive';
|
|
104
|
+
}[];
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export interface GetBalance {
|
|
108
|
+
method: 'getbalance';
|
|
109
|
+
params: [
|
|
110
|
+
dummy?: string,
|
|
111
|
+
minconf?: number,
|
|
112
|
+
include_watchonly?: boolean
|
|
113
|
+
];
|
|
114
|
+
response: number;
|
|
115
|
+
}
|
|
116
|
+
export interface GetNewAddress {
|
|
117
|
+
method: 'getnewaddress';
|
|
118
|
+
params: [
|
|
119
|
+
label?: string
|
|
120
|
+
];
|
|
121
|
+
response: string;
|
|
122
|
+
}
|
|
123
|
+
export interface GetRawChangeAddress {
|
|
124
|
+
method: 'getrawchangeaddress';
|
|
125
|
+
params: [];
|
|
126
|
+
response: string;
|
|
127
|
+
}
|
|
128
|
+
export interface GetReceivedByAddress {
|
|
129
|
+
method: 'getreceivedbyaddress';
|
|
130
|
+
params: [
|
|
131
|
+
address: string,
|
|
132
|
+
minconf?: number
|
|
133
|
+
];
|
|
134
|
+
response: number;
|
|
135
|
+
}
|
|
136
|
+
export interface GetReceivedByLabel {
|
|
137
|
+
method: 'getreceivedbylabel';
|
|
138
|
+
params: [
|
|
139
|
+
label: string,
|
|
140
|
+
minconf?: number
|
|
141
|
+
];
|
|
142
|
+
response: number;
|
|
143
|
+
}
|
|
144
|
+
export interface GetTransaction {
|
|
145
|
+
method: 'gettransaction';
|
|
146
|
+
params: [
|
|
147
|
+
txid: string,
|
|
148
|
+
include_watchonly?: boolean
|
|
149
|
+
];
|
|
150
|
+
response: {
|
|
151
|
+
amount: number;
|
|
152
|
+
fee?: number;
|
|
153
|
+
confirmations: number;
|
|
154
|
+
blockhash?: string;
|
|
155
|
+
blockindex?: number;
|
|
156
|
+
blocktime?: number;
|
|
157
|
+
txid: string;
|
|
158
|
+
time: number;
|
|
159
|
+
timereceived: number;
|
|
160
|
+
'bip125-replaceable': 'yes' | 'no' | 'unknown';
|
|
161
|
+
details: {
|
|
162
|
+
address: string;
|
|
163
|
+
category: 'send' | 'receive';
|
|
164
|
+
amount: number;
|
|
165
|
+
label?: string;
|
|
166
|
+
vout: number;
|
|
167
|
+
fee?: number;
|
|
168
|
+
abandoned?: boolean;
|
|
169
|
+
}[];
|
|
170
|
+
hex: string;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
export interface GetUnconfirmedBalance {
|
|
174
|
+
method: 'getunconfirmedbalance';
|
|
175
|
+
params: [];
|
|
176
|
+
response: number;
|
|
177
|
+
}
|
|
178
|
+
export interface GetWalletInfo {
|
|
179
|
+
method: 'getwalletinfo';
|
|
180
|
+
params: [];
|
|
181
|
+
response: {
|
|
182
|
+
walletname: string;
|
|
183
|
+
walletversion: number;
|
|
184
|
+
balance: number;
|
|
185
|
+
unconfirmed_balance: number;
|
|
186
|
+
immature_balance: number;
|
|
187
|
+
txcount: number;
|
|
188
|
+
keypoololdest: number;
|
|
189
|
+
keypoolsize: number;
|
|
190
|
+
keypoolsize_hd_internal: number;
|
|
191
|
+
unlocked_until: number;
|
|
192
|
+
paytxfee: number;
|
|
193
|
+
hdseedid?: string;
|
|
194
|
+
hdmasterkeyid?: string;
|
|
195
|
+
private_keys_enabled: boolean;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
export interface ImportAddress {
|
|
199
|
+
method: 'importaddress';
|
|
200
|
+
params: [
|
|
201
|
+
address: string,
|
|
202
|
+
label?: string,
|
|
203
|
+
rescan?: boolean,
|
|
204
|
+
p2sh?: boolean
|
|
205
|
+
];
|
|
206
|
+
response: number;
|
|
207
|
+
}
|
|
208
|
+
export interface ImportMulti {
|
|
209
|
+
method: 'importmulti';
|
|
210
|
+
params: [
|
|
211
|
+
requests: {
|
|
212
|
+
scriptPubKey: string | {
|
|
213
|
+
address: string;
|
|
214
|
+
};
|
|
215
|
+
timestamp: number | 'now';
|
|
216
|
+
redeemscript?: string;
|
|
217
|
+
pubkeys?: string[];
|
|
218
|
+
keys?: string[];
|
|
219
|
+
internal?: boolean;
|
|
220
|
+
watchonly?: boolean;
|
|
221
|
+
label?: string;
|
|
222
|
+
}[],
|
|
223
|
+
options?: {
|
|
224
|
+
rescan?: boolean;
|
|
225
|
+
}
|
|
226
|
+
];
|
|
227
|
+
response: {
|
|
228
|
+
success: boolean;
|
|
229
|
+
error?: {
|
|
230
|
+
code: number;
|
|
231
|
+
message: string;
|
|
232
|
+
};
|
|
233
|
+
}[];
|
|
234
|
+
}
|
|
235
|
+
export interface ImportPrivKey {
|
|
236
|
+
method: 'importprivkey';
|
|
237
|
+
params: [
|
|
238
|
+
privkey: string,
|
|
239
|
+
label?: string,
|
|
240
|
+
rescan?: boolean
|
|
241
|
+
];
|
|
242
|
+
response: null;
|
|
243
|
+
}
|
|
244
|
+
export interface ImportPrunedFunds {
|
|
245
|
+
method: 'importprunedfunds';
|
|
246
|
+
params: [
|
|
247
|
+
rawtransaction: string,
|
|
248
|
+
txoutproof: string
|
|
249
|
+
];
|
|
250
|
+
response: null;
|
|
251
|
+
}
|
|
252
|
+
export interface ImportPubKey {
|
|
253
|
+
method: 'importpubkey';
|
|
254
|
+
params: [
|
|
255
|
+
pubkey: string,
|
|
256
|
+
label?: string,
|
|
257
|
+
rescan?: boolean
|
|
258
|
+
];
|
|
259
|
+
response: null;
|
|
260
|
+
}
|
|
261
|
+
export interface ImportWallet {
|
|
262
|
+
method: 'importwallet';
|
|
263
|
+
params: [
|
|
264
|
+
filename: string
|
|
265
|
+
];
|
|
266
|
+
response: null;
|
|
267
|
+
}
|
|
268
|
+
export interface KeyPoolRefill {
|
|
269
|
+
method: 'keypoolrefill';
|
|
270
|
+
params: [
|
|
271
|
+
newsize?: number
|
|
272
|
+
];
|
|
273
|
+
response: null;
|
|
274
|
+
}
|
|
275
|
+
export interface ListAddressGroupings {
|
|
276
|
+
method: 'listaddressgroupings';
|
|
277
|
+
params: [];
|
|
278
|
+
response: [
|
|
279
|
+
[
|
|
280
|
+
{
|
|
281
|
+
address: string;
|
|
282
|
+
amount: number;
|
|
283
|
+
label?: string;
|
|
284
|
+
}[]
|
|
285
|
+
][]
|
|
286
|
+
];
|
|
287
|
+
}
|
|
288
|
+
export interface ListLabels {
|
|
289
|
+
method: 'listlabels';
|
|
290
|
+
params: [
|
|
291
|
+
purpose?: string
|
|
292
|
+
];
|
|
293
|
+
response: string[];
|
|
294
|
+
}
|
|
295
|
+
export interface ListLockUnspent {
|
|
296
|
+
method: 'listlockunspent';
|
|
297
|
+
params: [];
|
|
298
|
+
response: {
|
|
299
|
+
txid: string;
|
|
300
|
+
vout: number;
|
|
301
|
+
}[];
|
|
302
|
+
}
|
|
303
|
+
export interface ListReceivedByAddress {
|
|
304
|
+
method: 'listreceivedbyaddress';
|
|
305
|
+
params: [
|
|
306
|
+
minconf?: number,
|
|
307
|
+
include_empty?: boolean,
|
|
308
|
+
include_watchonly?: boolean,
|
|
309
|
+
address_filter?: string
|
|
310
|
+
];
|
|
311
|
+
response: {
|
|
312
|
+
involvesWatchonly?: boolean;
|
|
313
|
+
address: string;
|
|
314
|
+
amount: number;
|
|
315
|
+
confirmations: number;
|
|
316
|
+
label: string;
|
|
317
|
+
txids: string[];
|
|
318
|
+
}[];
|
|
319
|
+
}
|
|
320
|
+
export interface ListReceivedByLabel {
|
|
321
|
+
method: 'listreceivedbylabel';
|
|
322
|
+
params: [
|
|
323
|
+
minconf?: number,
|
|
324
|
+
include_empty?: boolean,
|
|
325
|
+
include_watchonly?: boolean
|
|
326
|
+
];
|
|
327
|
+
response: {
|
|
328
|
+
involvesWatchonly?: boolean;
|
|
329
|
+
amount: number;
|
|
330
|
+
confirmations: number;
|
|
331
|
+
label: string;
|
|
332
|
+
}[];
|
|
333
|
+
}
|
|
334
|
+
interface TransactionWallet {
|
|
335
|
+
address?: string;
|
|
336
|
+
category: 'send' | 'receive';
|
|
337
|
+
amount: number;
|
|
338
|
+
vout: number;
|
|
339
|
+
fee?: number;
|
|
340
|
+
confirmations: number;
|
|
341
|
+
blockhash?: string;
|
|
342
|
+
blockindex?: number;
|
|
343
|
+
blocktime?: number;
|
|
344
|
+
txid: string;
|
|
345
|
+
time: number;
|
|
346
|
+
timereceived: number;
|
|
347
|
+
abandoned?: boolean;
|
|
348
|
+
comment?: string;
|
|
349
|
+
label?: string;
|
|
350
|
+
to?: string;
|
|
351
|
+
}
|
|
352
|
+
export interface ListSinceBlock {
|
|
353
|
+
method: 'listsinceblock';
|
|
354
|
+
params: [
|
|
355
|
+
blockhash?: string,
|
|
356
|
+
target_confirmations?: number,
|
|
357
|
+
include_watchonly?: boolean,
|
|
358
|
+
include_removed?: boolean
|
|
359
|
+
];
|
|
360
|
+
response: {
|
|
361
|
+
transactions: TransactionWallet[];
|
|
362
|
+
removed?: TransactionWallet[];
|
|
363
|
+
lastblock: string;
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
export interface ListTransactions {
|
|
367
|
+
method: 'listtransactions';
|
|
368
|
+
params: [
|
|
369
|
+
label?: string,
|
|
370
|
+
count?: number,
|
|
371
|
+
skip?: number,
|
|
372
|
+
include_watchonly?: boolean
|
|
373
|
+
];
|
|
374
|
+
response: TransactionWallet[];
|
|
375
|
+
}
|
|
376
|
+
export interface ListUnspent {
|
|
377
|
+
method: 'listunspent';
|
|
378
|
+
params: [
|
|
379
|
+
minconf?: number,
|
|
380
|
+
maxconf?: number,
|
|
381
|
+
addresses?: string[],
|
|
382
|
+
include_unsafe?: boolean,
|
|
383
|
+
query_options?: {
|
|
384
|
+
minimumAmount?: number | string;
|
|
385
|
+
maximumAmount?: number | string;
|
|
386
|
+
maximumCount?: number;
|
|
387
|
+
minimumSumAmount?: number | string;
|
|
388
|
+
includeTokens?: boolean;
|
|
389
|
+
tokensOnly?: boolean;
|
|
390
|
+
}
|
|
391
|
+
];
|
|
392
|
+
response: ListUnspentItem[];
|
|
393
|
+
}
|
|
394
|
+
export interface ListUnspentItem {
|
|
395
|
+
txid: string;
|
|
396
|
+
vout: number;
|
|
397
|
+
address: string;
|
|
398
|
+
label: string;
|
|
399
|
+
scriptPubKey: string;
|
|
400
|
+
amount: number;
|
|
401
|
+
tokenData?: TokenData;
|
|
402
|
+
confirmations: number;
|
|
403
|
+
redeemScript: string;
|
|
404
|
+
spendable: boolean;
|
|
405
|
+
solvable: boolean;
|
|
406
|
+
safe: boolean;
|
|
407
|
+
}
|
|
408
|
+
export interface ListWalletDir {
|
|
409
|
+
method: 'listwalletdir';
|
|
410
|
+
params: [];
|
|
411
|
+
response: {
|
|
412
|
+
wallets: {
|
|
413
|
+
name: string;
|
|
414
|
+
}[];
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
export interface ListWallets {
|
|
418
|
+
method: 'importaddress';
|
|
419
|
+
params: [];
|
|
420
|
+
response: string[];
|
|
421
|
+
}
|
|
422
|
+
export interface LoadWallet {
|
|
423
|
+
method: 'loadwallet';
|
|
424
|
+
params: [
|
|
425
|
+
filename: string
|
|
426
|
+
];
|
|
427
|
+
response: {
|
|
428
|
+
name: string;
|
|
429
|
+
warning?: string;
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
export interface LockUnspent {
|
|
433
|
+
method: 'lockunspent';
|
|
434
|
+
params: [
|
|
435
|
+
unlock: boolean,
|
|
436
|
+
transactions?: {
|
|
437
|
+
txid: string;
|
|
438
|
+
vout: number;
|
|
439
|
+
}[]
|
|
440
|
+
];
|
|
441
|
+
response: boolean;
|
|
442
|
+
}
|
|
443
|
+
export interface RemovePrunedFunds {
|
|
444
|
+
method: 'removeprunedfunds';
|
|
445
|
+
params: [
|
|
446
|
+
txid: string
|
|
447
|
+
];
|
|
448
|
+
response: null;
|
|
449
|
+
}
|
|
450
|
+
export interface RescanBlockchain {
|
|
451
|
+
method: 'rescanblockchain';
|
|
452
|
+
params: [
|
|
453
|
+
start_height?: number,
|
|
454
|
+
stop_height?: number
|
|
455
|
+
];
|
|
456
|
+
response: {
|
|
457
|
+
start_height: number;
|
|
458
|
+
stop_height: number;
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
export interface SendMany {
|
|
462
|
+
method: 'sendmany';
|
|
463
|
+
params: [
|
|
464
|
+
dummy: string,
|
|
465
|
+
amounts: {
|
|
466
|
+
[address: string]: number | string;
|
|
467
|
+
},
|
|
468
|
+
minconf?: number,
|
|
469
|
+
comment?: string,
|
|
470
|
+
subtractfeefrom?: string[],
|
|
471
|
+
coinsel?: number,
|
|
472
|
+
include_unsafe?: boolean
|
|
473
|
+
];
|
|
474
|
+
response: string;
|
|
475
|
+
}
|
|
476
|
+
export interface SendToAddress {
|
|
477
|
+
method: 'sendtoaddress';
|
|
478
|
+
params: [
|
|
479
|
+
address: string,
|
|
480
|
+
amount: number | string,
|
|
481
|
+
comment?: string,
|
|
482
|
+
comment_to?: string,
|
|
483
|
+
subtractfeefromamount?: boolean,
|
|
484
|
+
coinsel?: number,
|
|
485
|
+
include_unsafe?: boolean
|
|
486
|
+
];
|
|
487
|
+
response: string;
|
|
488
|
+
}
|
|
489
|
+
export interface SetHdSeed {
|
|
490
|
+
method: 'sethdseed';
|
|
491
|
+
params: [
|
|
492
|
+
newkeypool?: boolean,
|
|
493
|
+
seed?: string
|
|
494
|
+
];
|
|
495
|
+
response: null;
|
|
496
|
+
}
|
|
497
|
+
export interface SetLabel {
|
|
498
|
+
method: 'setlabel';
|
|
499
|
+
params: [
|
|
500
|
+
address: string,
|
|
501
|
+
label: string
|
|
502
|
+
];
|
|
503
|
+
response: null;
|
|
504
|
+
}
|
|
505
|
+
export interface SetTxFee {
|
|
506
|
+
method: 'settxfee';
|
|
507
|
+
params: [
|
|
508
|
+
amount: number | string
|
|
509
|
+
];
|
|
510
|
+
response: boolean;
|
|
511
|
+
}
|
|
512
|
+
export interface SignMessage {
|
|
513
|
+
method: 'signmessage';
|
|
514
|
+
params: [
|
|
515
|
+
address: string,
|
|
516
|
+
message: string
|
|
517
|
+
];
|
|
518
|
+
response: string;
|
|
519
|
+
}
|
|
520
|
+
export interface SignRawTransactionWithWallet {
|
|
521
|
+
method: 'signrawtransactionwithwallet';
|
|
522
|
+
params: [
|
|
523
|
+
hexstring: string,
|
|
524
|
+
prevtxs?: {
|
|
525
|
+
txid: string;
|
|
526
|
+
vout: number;
|
|
527
|
+
scriptPubKey: string;
|
|
528
|
+
redeemScript?: string;
|
|
529
|
+
amount: number | string;
|
|
530
|
+
tokenData?: TokenData;
|
|
531
|
+
}[],
|
|
532
|
+
sighashtype?: string
|
|
533
|
+
];
|
|
534
|
+
response: {
|
|
535
|
+
hex: string;
|
|
536
|
+
complete: boolean;
|
|
537
|
+
errors?: {
|
|
538
|
+
txid: string;
|
|
539
|
+
vout: number;
|
|
540
|
+
scriptSig: string;
|
|
541
|
+
sequence: number;
|
|
542
|
+
error: string;
|
|
543
|
+
}[];
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
export interface UnloadWallet {
|
|
547
|
+
method: 'unloadwallet';
|
|
548
|
+
params: [
|
|
549
|
+
wallet_name?: string
|
|
550
|
+
];
|
|
551
|
+
response: null;
|
|
552
|
+
}
|
|
553
|
+
export interface WalletCreateFundedPsbt {
|
|
554
|
+
method: 'walletcreatefundedpsbt';
|
|
555
|
+
params: [
|
|
556
|
+
inputs: {
|
|
557
|
+
txid: string;
|
|
558
|
+
vout: number;
|
|
559
|
+
sequence: number;
|
|
560
|
+
}[],
|
|
561
|
+
outputs: {
|
|
562
|
+
address?: number | string | {
|
|
563
|
+
amount: number | string;
|
|
564
|
+
tokenData?: TokenData;
|
|
565
|
+
};
|
|
566
|
+
data?: string | string[];
|
|
567
|
+
}[],
|
|
568
|
+
locktime?: number,
|
|
569
|
+
options?: {
|
|
570
|
+
include_unsafe?: boolean;
|
|
571
|
+
changeAddress?: string;
|
|
572
|
+
changePosition?: number;
|
|
573
|
+
includeWatching?: boolean;
|
|
574
|
+
lockUnspents?: boolean;
|
|
575
|
+
feeRate?: number | string;
|
|
576
|
+
subtractFeeFromOutputs?: number[];
|
|
577
|
+
},
|
|
578
|
+
bip32derivs?: boolean
|
|
579
|
+
];
|
|
580
|
+
response: {
|
|
581
|
+
psbt: string;
|
|
582
|
+
fee: number;
|
|
583
|
+
changepos: number;
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
export interface WalletLock {
|
|
587
|
+
method: 'walletlock';
|
|
588
|
+
params: [];
|
|
589
|
+
response: null;
|
|
590
|
+
}
|
|
591
|
+
export interface WalletPassphrase {
|
|
592
|
+
method: 'walletpassphrase';
|
|
593
|
+
params: [
|
|
594
|
+
passphrase: string,
|
|
595
|
+
timeout: number
|
|
596
|
+
];
|
|
597
|
+
response: null;
|
|
598
|
+
}
|
|
599
|
+
export interface WalletPassphraseChange {
|
|
600
|
+
method: 'walletpassphrasechange';
|
|
601
|
+
params: [
|
|
602
|
+
oldpassphrase: string,
|
|
603
|
+
newpassphrase: string
|
|
604
|
+
];
|
|
605
|
+
response: null;
|
|
606
|
+
}
|
|
607
|
+
export interface WalletProcessPsbt {
|
|
608
|
+
method: 'walletprocesspsbt';
|
|
609
|
+
params: [
|
|
610
|
+
psbt: string,
|
|
611
|
+
sign?: boolean,
|
|
612
|
+
sighashtype?: string,
|
|
613
|
+
bip32derivs?: boolean
|
|
614
|
+
];
|
|
615
|
+
response: {
|
|
616
|
+
psbt: string;
|
|
617
|
+
complete: boolean;
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RestClientConfig, formatOptions, ResponseType } from "./interfaces/interfaces.js";
|
|
2
|
+
import type { BlockInfoNoTxDetails, BlockInfoTxDetails, ChainInfo, HeaderInfo, MempoolContent, MempoolInfo, TxDetails, UtxosInfo } from "./interfaces/restInterfaces/interfaces.js";
|
|
3
|
+
export declare class BchnRestClient {
|
|
4
|
+
private baseUrl;
|
|
5
|
+
private timeoutMs;
|
|
6
|
+
private logger;
|
|
7
|
+
constructor(config: RestClientConfig);
|
|
8
|
+
private fetchFromNode;
|
|
9
|
+
getTransaction<TFormat extends formatOptions = 'json'>(txid: string, format?: TFormat): Promise<ResponseType<TFormat, TxDetails>>;
|
|
10
|
+
getBlock<TFormat extends formatOptions = 'json'>(blockhash: string, includeTxDetails: true, format?: TFormat): Promise<TFormat extends 'json' ? BlockInfoTxDetails : string>;
|
|
11
|
+
getBlock<TFormat extends formatOptions = 'json'>(blockhash: string, includeTxDetails: false, format?: TFormat): Promise<TFormat extends 'json' ? BlockInfoNoTxDetails : string>;
|
|
12
|
+
getBlockHeaders<TFormat extends formatOptions = 'json'>(count: number, blockhash: string, format?: TFormat): Promise<ResponseType<TFormat, HeaderInfo>>;
|
|
13
|
+
getChainInfo(): Promise<ChainInfo>;
|
|
14
|
+
getUTXOs<TFormat extends formatOptions = 'json'>(checkmempool: boolean, outpoints: string[], format?: TFormat): Promise<ResponseType<TFormat, UtxosInfo>>;
|
|
15
|
+
getMempoolInfo(): Promise<MempoolInfo>;
|
|
16
|
+
getMempoolContents(): Promise<MempoolContent>;
|
|
17
|
+
}
|