@spirobel/monero-wallet-api 0.3.18 → 0.4.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.
Files changed (51) hide show
  1. package/dist/api.d.ts +5 -2
  2. package/dist/api.js +5 -1
  3. package/dist/io/atomicWrite.js +3 -1
  4. package/dist/io/indexedDB.js +7 -2
  5. package/dist/io/logging.d.ts +40 -0
  6. package/dist/io/logging.js +172 -0
  7. package/dist/keypairs-seeds/keypairs.d.ts +21 -0
  8. package/dist/keypairs-seeds/keypairs.js +21 -0
  9. package/dist/node-interaction/binaryEndpoints.d.ts +31 -2
  10. package/dist/node-interaction/binaryEndpoints.js +61 -43
  11. package/dist/node-interaction/jsonEndpoints.d.ts +257 -130
  12. package/dist/node-interaction/jsonEndpoints.js +159 -119
  13. package/dist/node-interaction/nodeUrl.d.ts +21 -6
  14. package/dist/node-interaction/nodeUrl.js +50 -8
  15. package/dist/scanning-syncing/backgroundWorker.d.ts +10 -6
  16. package/dist/scanning-syncing/backgroundWorker.js +88 -39
  17. package/dist/scanning-syncing/blocksbuffer/blocksBufferFetchLoop.d.ts +44 -0
  18. package/dist/scanning-syncing/blocksbuffer/blocksBufferFetchLoop.js +355 -0
  19. package/dist/scanning-syncing/blocksbuffer/blocksbufferCoordination.d.ts +15 -0
  20. package/dist/scanning-syncing/blocksbuffer/blocksbufferCoordination.js +28 -0
  21. package/dist/scanning-syncing/{scanresult → blocksbuffer}/getBlocksbinBuffer.d.ts +5 -5
  22. package/dist/scanning-syncing/{scanresult → blocksbuffer}/getBlocksbinBuffer.js +7 -5
  23. package/dist/scanning-syncing/connectionStatus.d.ts +33 -9
  24. package/dist/scanning-syncing/connectionStatus.js +89 -19
  25. package/dist/scanning-syncing/scanSettings.d.ts +21 -0
  26. package/dist/scanning-syncing/scanSettings.js +29 -0
  27. package/dist/scanning-syncing/scanresult/reorg.d.ts +0 -11
  28. package/dist/scanning-syncing/scanresult/reorg.js +39 -16
  29. package/dist/scanning-syncing/scanresult/scanCache.d.ts +16 -2
  30. package/dist/scanning-syncing/scanresult/scanCache.js +65 -5
  31. package/dist/scanning-syncing/scanresult/scanCacheOpened.d.ts +18 -0
  32. package/dist/scanning-syncing/scanresult/scanCacheOpened.js +56 -11
  33. package/dist/scanning-syncing/scanresult/scanCoordination.d.ts +127 -0
  34. package/dist/scanning-syncing/scanresult/scanCoordination.js +602 -0
  35. package/dist/scanning-syncing/scanresult/scanLoop.d.ts +20 -0
  36. package/dist/scanning-syncing/scanresult/scanLoop.js +116 -0
  37. package/dist/scanning-syncing/scanresult/scanResult.d.ts +24 -3
  38. package/dist/scanning-syncing/scanresult/scanResult.js +159 -97
  39. package/dist/scanning-syncing/worker-entrypoints/worker.js +1 -1
  40. package/dist/scanning-syncing/worker-mains/coordinator-main.d.ts +1 -0
  41. package/dist/scanning-syncing/worker-mains/coordinator-main.js +24 -0
  42. package/dist/scanning-syncing/worker-mains/cpubound-main.d.ts +5 -0
  43. package/dist/scanning-syncing/worker-mains/cpubound-main.js +122 -0
  44. package/dist/scanning-syncing/worker-mains/worker.d.ts +1 -1
  45. package/dist/scanning-syncing/worker-mains/worker.js +62 -6
  46. package/dist/viewpair/ViewPair.d.ts +30 -7
  47. package/dist/viewpair/ViewPair.js +56 -118
  48. package/dist/wasm-processing/wasmFile.js +1 -1
  49. package/package.json +22 -24
  50. package/dist/io/extension.d.ts +0 -18
  51. package/dist/io/extension.js +0 -11
@@ -1,55 +1,112 @@
1
- import { z } from "zod";
2
1
  import type { SignedTransaction } from "../send-functionality/transactionBuilding";
3
- export declare const GetInfoResponseSchema: z.ZodObject<{
4
- id: z.ZodString;
5
- jsonrpc: z.ZodLiteral<"2.0">;
6
- result: z.ZodObject<{
7
- adjusted_time: z.ZodNumber;
8
- alt_blocks_count: z.ZodNumber;
9
- block_size_limit: z.ZodNumber;
10
- block_size_median: z.ZodNumber;
11
- block_weight_limit: z.ZodNumber;
12
- block_weight_median: z.ZodNumber;
13
- bootstrap_daemon_address: z.ZodString;
14
- busy_syncing: z.ZodBoolean;
15
- credits: z.ZodNumber;
16
- cumulative_difficulty: z.ZodNumber;
17
- cumulative_difficulty_top64: z.ZodNumber;
18
- database_size: z.ZodNumber;
19
- difficulty: z.ZodNumber;
20
- difficulty_top64: z.ZodNumber;
21
- free_space: z.ZodNumber;
22
- grey_peerlist_size: z.ZodNumber;
23
- height: z.ZodNumber;
24
- height_without_bootstrap: z.ZodNumber;
25
- incoming_connections_count: z.ZodNumber;
26
- mainnet: z.ZodBoolean;
27
- nettype: z.ZodString;
28
- offline: z.ZodBoolean;
29
- outgoing_connections_count: z.ZodNumber;
30
- restricted: z.ZodBoolean;
31
- rpc_connections_count: z.ZodNumber;
32
- stagenet: z.ZodBoolean;
33
- start_time: z.ZodNumber;
34
- status: z.ZodString;
35
- synchronized: z.ZodBoolean;
36
- target: z.ZodNumber;
37
- target_height: z.ZodNumber;
38
- testnet: z.ZodBoolean;
39
- top_block_hash: z.ZodString;
40
- top_hash: z.ZodString;
41
- tx_count: z.ZodNumber;
42
- tx_pool_size: z.ZodNumber;
43
- untrusted: z.ZodBoolean;
44
- update_available: z.ZodBoolean;
45
- version: z.ZodString;
46
- was_bootstrap_ever_used: z.ZodBoolean;
47
- white_peerlist_size: z.ZodNumber;
48
- wide_cumulative_difficulty: z.ZodString;
49
- wide_difficulty: z.ZodString;
50
- }, z.core.$strip>;
51
- }, z.core.$strip>;
52
- export type GetInfoResponse = z.infer<typeof GetInfoResponseSchema>;
2
+ type R<T> = {
3
+ success: true;
4
+ data: T;
5
+ } | {
6
+ success: false;
7
+ error: Error;
8
+ };
9
+ type Infer<T> = T extends (x: unknown) => infer R ? R : never;
10
+ export declare const GetInfoResponseSchema: ((x: unknown) => {
11
+ id: string;
12
+ jsonrpc: "2.0";
13
+ result: {
14
+ adjusted_time: /*elided*/ any;
15
+ alt_blocks_count: /*elided*/ any;
16
+ block_size_limit: /*elided*/ any;
17
+ block_size_median: /*elided*/ any;
18
+ block_weight_limit: /*elided*/ any;
19
+ block_weight_median: /*elided*/ any;
20
+ bootstrap_daemon_address: /*elided*/ any;
21
+ busy_syncing: /*elided*/ any;
22
+ credits: /*elided*/ any;
23
+ cumulative_difficulty: /*elided*/ any;
24
+ cumulative_difficulty_top64: /*elided*/ any;
25
+ database_size: /*elided*/ any;
26
+ difficulty: /*elided*/ any;
27
+ difficulty_top64: /*elided*/ any;
28
+ free_space: /*elided*/ any;
29
+ grey_peerlist_size: /*elided*/ any;
30
+ height: /*elided*/ any;
31
+ height_without_bootstrap: /*elided*/ any;
32
+ incoming_connections_count: /*elided*/ any;
33
+ mainnet: /*elided*/ any;
34
+ nettype: /*elided*/ any;
35
+ offline: /*elided*/ any;
36
+ outgoing_connections_count: /*elided*/ any;
37
+ restricted: /*elided*/ any;
38
+ rpc_connections_count: /*elided*/ any;
39
+ stagenet: /*elided*/ any;
40
+ start_time: /*elided*/ any;
41
+ status: /*elided*/ any;
42
+ synchronized: /*elided*/ any;
43
+ target: /*elided*/ any;
44
+ target_height: /*elided*/ any;
45
+ testnet: /*elided*/ any;
46
+ top_block_hash: /*elided*/ any;
47
+ top_hash: /*elided*/ any;
48
+ tx_count: /*elided*/ any;
49
+ tx_pool_size: /*elided*/ any;
50
+ untrusted: /*elided*/ any;
51
+ update_available: /*elided*/ any;
52
+ version: /*elided*/ any;
53
+ was_bootstrap_ever_used: /*elided*/ any;
54
+ white_peerlist_size: /*elided*/ any;
55
+ wide_cumulative_difficulty: /*elided*/ any;
56
+ wide_difficulty: /*elided*/ any;
57
+ };
58
+ }) & {
59
+ safeParse(x: unknown): R<{
60
+ id: string;
61
+ jsonrpc: "2.0";
62
+ result: {
63
+ adjusted_time: /*elided*/ any;
64
+ alt_blocks_count: /*elided*/ any;
65
+ block_size_limit: /*elided*/ any;
66
+ block_size_median: /*elided*/ any;
67
+ block_weight_limit: /*elided*/ any;
68
+ block_weight_median: /*elided*/ any;
69
+ bootstrap_daemon_address: /*elided*/ any;
70
+ busy_syncing: /*elided*/ any;
71
+ credits: /*elided*/ any;
72
+ cumulative_difficulty: /*elided*/ any;
73
+ cumulative_difficulty_top64: /*elided*/ any;
74
+ database_size: /*elided*/ any;
75
+ difficulty: /*elided*/ any;
76
+ difficulty_top64: /*elided*/ any;
77
+ free_space: /*elided*/ any;
78
+ grey_peerlist_size: /*elided*/ any;
79
+ height: /*elided*/ any;
80
+ height_without_bootstrap: /*elided*/ any;
81
+ incoming_connections_count: /*elided*/ any;
82
+ mainnet: /*elided*/ any;
83
+ nettype: /*elided*/ any;
84
+ offline: /*elided*/ any;
85
+ outgoing_connections_count: /*elided*/ any;
86
+ restricted: /*elided*/ any;
87
+ rpc_connections_count: /*elided*/ any;
88
+ stagenet: /*elided*/ any;
89
+ start_time: /*elided*/ any;
90
+ status: /*elided*/ any;
91
+ synchronized: /*elided*/ any;
92
+ target: /*elided*/ any;
93
+ target_height: /*elided*/ any;
94
+ testnet: /*elided*/ any;
95
+ top_block_hash: /*elided*/ any;
96
+ top_hash: /*elided*/ any;
97
+ tx_count: /*elided*/ any;
98
+ tx_pool_size: /*elided*/ any;
99
+ untrusted: /*elided*/ any;
100
+ update_available: /*elided*/ any;
101
+ version: /*elided*/ any;
102
+ was_bootstrap_ever_used: /*elided*/ any;
103
+ white_peerlist_size: /*elided*/ any;
104
+ wide_cumulative_difficulty: /*elided*/ any;
105
+ wide_difficulty: /*elided*/ any;
106
+ };
107
+ }>;
108
+ };
109
+ export type GetInfoResponse = Infer<typeof GetInfoResponseSchema>;
53
110
  /**
54
111
  * Response schema for the get_output_distribution method.
55
112
  *
@@ -63,20 +120,24 @@ export type GetInfoResponse = z.infer<typeof GetInfoResponseSchema>;
63
120
  * - start_height: unsigned int; Note that this is not necessarily equal to from_height, especially for amount=0 where start_height will be no less than the height of the v4 hardfork.
64
121
  * - status: string; General RPC error code. "OK" means everything looks good.
65
122
  */
66
- export declare const GetOutputDistributionResponseSchema: z.ZodObject<{
67
- id: z.ZodString;
68
- jsonrpc: z.ZodLiteral<"2.0">;
69
- result: z.ZodObject<{
70
- distributions: z.ZodArray<z.ZodObject<{
71
- amount: z.ZodNumber;
72
- base: z.ZodNumber;
73
- distribution: z.ZodArray<z.ZodNumber>;
74
- start_height: z.ZodNumber;
75
- }, z.core.$strip>>;
76
- status: z.ZodString;
77
- }, z.core.$strip>;
78
- }, z.core.$strip>;
79
- export type GetOutputDistributionResponse = z.infer<typeof GetOutputDistributionResponseSchema>;
123
+ export declare const GetOutputDistributionResponseSchema: ((x: unknown) => {
124
+ id: string;
125
+ jsonrpc: "2.0";
126
+ result: {
127
+ distributions: /*elided*/ any;
128
+ status: /*elided*/ any;
129
+ };
130
+ }) & {
131
+ safeParse(x: unknown): R<{
132
+ id: string;
133
+ jsonrpc: "2.0";
134
+ result: {
135
+ distributions: /*elided*/ any;
136
+ status: /*elided*/ any;
137
+ };
138
+ }>;
139
+ };
140
+ export type GetOutputDistributionResponse = Infer<typeof GetOutputDistributionResponseSchema>;
80
141
  export declare function parseGetOutputDistributionResponse(data: unknown): GetOutputDistributionResponse | null;
81
142
  export declare function parseGetInfoResponse(data: unknown): GetInfoResponse | null;
82
143
  export declare function get_info(NODE_URL: string): Promise<{
@@ -163,17 +224,28 @@ export declare function get_output_distribution(NODE_URL: string, params?: GetOu
163
224
  * - fees: (Optional) Array of unsigned int; Fee estimates for priorities 1–4.
164
225
  * - quantization_mask: unsigned int; Mask used for fee rounding.
165
226
  */
166
- export declare const GetFeeEstimateResponseSchema: z.ZodObject<{
167
- id: z.ZodString;
168
- jsonrpc: z.ZodLiteral<"2.0">;
169
- result: z.ZodObject<{
170
- status: z.ZodString;
171
- fee: z.ZodNumber;
172
- fees: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
173
- quantization_mask: z.ZodNumber;
174
- }, z.core.$strip>;
175
- }, z.core.$strip>;
176
- export type GetFeeEstimateResponse = z.infer<typeof GetFeeEstimateResponseSchema>;
227
+ export declare const GetFeeEstimateResponseSchema: ((x: unknown) => {
228
+ id: string;
229
+ jsonrpc: "2.0";
230
+ result: {
231
+ status: /*elided*/ any;
232
+ fee: /*elided*/ any;
233
+ fees: /*elided*/ any;
234
+ quantization_mask: /*elided*/ any;
235
+ };
236
+ }) & {
237
+ safeParse(x: unknown): R<{
238
+ id: string;
239
+ jsonrpc: "2.0";
240
+ result: {
241
+ status: /*elided*/ any;
242
+ fee: /*elided*/ any;
243
+ fees: /*elided*/ any;
244
+ quantization_mask: /*elided*/ any;
245
+ };
246
+ }>;
247
+ };
248
+ export type GetFeeEstimateResponse = Infer<typeof GetFeeEstimateResponseSchema>;
177
249
  export declare function parseGetFeeEstimateResponse(data: unknown): GetFeeEstimateResponse | null;
178
250
  export type GetFeeEstimateResult = {
179
251
  status: string;
@@ -188,21 +260,36 @@ export type FeeEstimateResponse = {
188
260
  fees?: number[] | undefined;
189
261
  };
190
262
  export declare function get_fee_estimate(NODE_URL: string): Promise<FeeEstimateResponse>;
191
- export declare const SendRawTransactionResponseSchema: z.ZodObject<{
192
- double_spend: z.ZodBoolean;
193
- fee_too_low: z.ZodBoolean;
194
- invalid_input: z.ZodBoolean;
195
- invalid_output: z.ZodBoolean;
196
- low_mixin: z.ZodBoolean;
197
- not_rct: z.ZodOptional<z.ZodBoolean>;
198
- not_relayed: z.ZodBoolean;
199
- overspend: z.ZodBoolean;
200
- reason: z.ZodString;
201
- status: z.ZodString;
202
- too_big: z.ZodBoolean;
203
- untrusted: z.ZodBoolean;
204
- }, z.core.$strip>;
205
- export type SendRawTransactionResponse = z.infer<typeof SendRawTransactionResponseSchema>;
263
+ export declare const SendRawTransactionResponseSchema: ((x: unknown) => {
264
+ double_spend: boolean;
265
+ fee_too_low: boolean;
266
+ invalid_input: boolean;
267
+ invalid_output: boolean;
268
+ low_mixin: boolean;
269
+ not_rct: boolean | undefined;
270
+ not_relayed: boolean;
271
+ overspend: boolean;
272
+ reason: string;
273
+ status: string;
274
+ too_big: boolean;
275
+ untrusted: boolean;
276
+ }) & {
277
+ safeParse(x: unknown): R<{
278
+ double_spend: boolean;
279
+ fee_too_low: boolean;
280
+ invalid_input: boolean;
281
+ invalid_output: boolean;
282
+ low_mixin: boolean;
283
+ not_rct: boolean | undefined;
284
+ not_relayed: boolean;
285
+ overspend: boolean;
286
+ reason: string;
287
+ status: string;
288
+ too_big: boolean;
289
+ untrusted: boolean;
290
+ }>;
291
+ };
292
+ export type SendRawTransactionResponse = Infer<typeof SendRawTransactionResponseSchema>;
206
293
  export declare function parseSendRawTransactionResponse(data: unknown): SendRawTransactionResponse | null;
207
294
  export type SendRawTransactionResult = {
208
295
  double_spend: boolean;
@@ -257,45 +344,84 @@ do_not_relay?: boolean): Promise<SendRawTransactionResult>;
257
344
  * - code: int; Error code.
258
345
  * - message: string; Error message.
259
346
  */
260
- export declare const GetBlockHeadersRangeResponseSchema: z.ZodObject<{
261
- id: z.ZodString;
262
- jsonrpc: z.ZodLiteral<"2.0">;
263
- result: z.ZodOptional<z.ZodObject<{
264
- credits: z.ZodNumber;
265
- headers: z.ZodArray<z.ZodObject<{
266
- block_size: z.ZodNumber;
267
- block_weight: z.ZodNumber;
268
- cumulative_difficulty: z.ZodNumber;
269
- cumulative_difficulty_top64: z.ZodNumber;
270
- depth: z.ZodNumber;
271
- difficulty: z.ZodNumber;
272
- difficulty_top64: z.ZodNumber;
273
- hash: z.ZodString;
274
- height: z.ZodNumber;
275
- long_term_weight: z.ZodNumber;
276
- major_version: z.ZodNumber;
277
- miner_tx_hash: z.ZodString;
278
- minor_version: z.ZodNumber;
279
- nonce: z.ZodNumber;
280
- num_txes: z.ZodNumber;
281
- orphan_status: z.ZodBoolean;
282
- pow_hash: z.ZodString;
283
- prev_hash: z.ZodString;
284
- reward: z.ZodNumber;
285
- timestamp: z.ZodNumber;
286
- wide_cumulative_difficulty: z.ZodString;
287
- wide_difficulty: z.ZodString;
288
- }, z.core.$strip>>;
289
- status: z.ZodString;
290
- top_hash: z.ZodString;
291
- untrusted: z.ZodBoolean;
292
- }, z.core.$strip>>;
293
- error: z.ZodOptional<z.ZodObject<{
294
- code: z.ZodNumber;
295
- message: z.ZodString;
296
- }, z.core.$strip>>;
297
- }, z.core.$strip>;
298
- export type GetBlockHeadersRangeResponse = z.infer<typeof GetBlockHeadersRangeResponseSchema>;
347
+ export declare const GetBlockHeadersRangeResponseSchema: ((x: unknown) => {
348
+ id: string;
349
+ jsonrpc: "2.0";
350
+ result: {
351
+ credits: number;
352
+ headers: {
353
+ block_size: number;
354
+ block_weight: number;
355
+ cumulative_difficulty: number;
356
+ cumulative_difficulty_top64: number;
357
+ depth: number;
358
+ difficulty: number;
359
+ difficulty_top64: number;
360
+ hash: string;
361
+ height: number;
362
+ long_term_weight: number;
363
+ major_version: number;
364
+ miner_tx_hash: string;
365
+ minor_version: number;
366
+ nonce: number;
367
+ num_txes: number;
368
+ orphan_status: boolean;
369
+ pow_hash: string;
370
+ prev_hash: string;
371
+ reward: number;
372
+ timestamp: number;
373
+ wide_cumulative_difficulty: string;
374
+ wide_difficulty: string;
375
+ }[];
376
+ status: string;
377
+ top_hash: string;
378
+ untrusted: boolean;
379
+ } | undefined;
380
+ error: {
381
+ code: number;
382
+ message: string;
383
+ } | undefined;
384
+ }) & {
385
+ safeParse(x: unknown): R<{
386
+ id: string;
387
+ jsonrpc: "2.0";
388
+ result: {
389
+ credits: number;
390
+ headers: {
391
+ block_size: number;
392
+ block_weight: number;
393
+ cumulative_difficulty: number;
394
+ cumulative_difficulty_top64: number;
395
+ depth: number;
396
+ difficulty: number;
397
+ difficulty_top64: number;
398
+ hash: string;
399
+ height: number;
400
+ long_term_weight: number;
401
+ major_version: number;
402
+ miner_tx_hash: string;
403
+ minor_version: number;
404
+ nonce: number;
405
+ num_txes: number;
406
+ orphan_status: boolean;
407
+ pow_hash: string;
408
+ prev_hash: string;
409
+ reward: number;
410
+ timestamp: number;
411
+ wide_cumulative_difficulty: string;
412
+ wide_difficulty: string;
413
+ }[];
414
+ status: string;
415
+ top_hash: string;
416
+ untrusted: boolean;
417
+ } | undefined;
418
+ error: {
419
+ code: number;
420
+ message: string;
421
+ } | undefined;
422
+ }>;
423
+ };
424
+ export type GetBlockHeadersRangeResponse = Infer<typeof GetBlockHeadersRangeResponseSchema>;
299
425
  export type GetBlockHeadersRange = {
300
426
  status: string;
301
427
  credits: number;
@@ -341,3 +467,4 @@ export type GetBlockHeadersRangeParams = {
341
467
  };
342
468
  export declare const RESTRICTED_BLOCK_HEADER_RANGE = 1000;
343
469
  export declare function get_block_headers_range(NODE_URL: string, params: GetBlockHeadersRangeParams): Promise<GetBlockHeadersRange>;
470
+ export {};