@spirobel/monero-wallet-api 0.1.2 → 0.3.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.
Files changed (67) hide show
  1. package/README.md +13 -1
  2. package/dist/api.d.ts +25 -53
  3. package/dist/api.js +23 -101
  4. package/dist/io/BunFileInterface.d.ts +32 -0
  5. package/dist/io/BunFileInterface.js +1 -0
  6. package/dist/io/atomicWrite.d.ts +2 -0
  7. package/dist/io/atomicWrite.js +10 -0
  8. package/dist/io/extension.d.ts +18 -0
  9. package/dist/io/extension.js +11 -0
  10. package/dist/io/indexedDB.d.ts +45 -0
  11. package/dist/io/indexedDB.js +221 -0
  12. package/dist/io/readDir.d.ts +1 -0
  13. package/dist/io/readDir.js +7 -0
  14. package/dist/io/sleep.d.ts +1 -0
  15. package/dist/io/sleep.js +1 -0
  16. package/dist/keypairs-seeds/keypairs.d.ts +29 -0
  17. package/dist/keypairs-seeds/keypairs.js +207 -0
  18. package/dist/keypairs-seeds/writeKeypairs.d.ts +11 -0
  19. package/dist/keypairs-seeds/writeKeypairs.js +75 -0
  20. package/dist/node-interaction/binaryEndpoints.d.ts +67 -10
  21. package/dist/node-interaction/binaryEndpoints.js +127 -53
  22. package/dist/node-interaction/jsonEndpoints.d.ts +249 -187
  23. package/dist/node-interaction/jsonEndpoints.js +287 -0
  24. package/dist/node-interaction/nodeUrl.d.ts +129 -0
  25. package/dist/node-interaction/nodeUrl.js +113 -0
  26. package/dist/scanning-syncing/backgroundWorker.d.ts +6 -0
  27. package/dist/scanning-syncing/backgroundWorker.js +56 -0
  28. package/dist/scanning-syncing/connectionStatus.d.ts +15 -0
  29. package/dist/scanning-syncing/connectionStatus.js +35 -0
  30. package/dist/scanning-syncing/openWallet.d.ts +28 -0
  31. package/dist/scanning-syncing/openWallet.js +57 -0
  32. package/dist/scanning-syncing/scanSettings.d.ts +96 -0
  33. package/dist/scanning-syncing/scanSettings.js +243 -0
  34. package/dist/scanning-syncing/scanresult/computeKeyImage.d.ts +3 -0
  35. package/dist/scanning-syncing/scanresult/computeKeyImage.js +21 -0
  36. package/dist/scanning-syncing/scanresult/getBlocksbinBuffer.d.ts +28 -0
  37. package/dist/scanning-syncing/scanresult/getBlocksbinBuffer.js +52 -0
  38. package/dist/scanning-syncing/scanresult/reorg.d.ts +14 -0
  39. package/dist/scanning-syncing/scanresult/reorg.js +78 -0
  40. package/dist/scanning-syncing/scanresult/scanCache.d.ts +84 -0
  41. package/dist/scanning-syncing/scanresult/scanCache.js +134 -0
  42. package/dist/scanning-syncing/scanresult/scanCacheOpened.d.ts +149 -0
  43. package/dist/scanning-syncing/scanresult/scanCacheOpened.js +648 -0
  44. package/dist/scanning-syncing/scanresult/scanResult.d.ts +64 -0
  45. package/dist/scanning-syncing/scanresult/scanResult.js +213 -0
  46. package/dist/scanning-syncing/scanresult/scanStats.d.ts +60 -0
  47. package/dist/scanning-syncing/scanresult/scanStats.js +273 -0
  48. package/dist/scanning-syncing/worker-entrypoints/worker.d.ts +1 -0
  49. package/dist/scanning-syncing/worker-entrypoints/worker.js +8 -0
  50. package/dist/scanning-syncing/worker-mains/worker.d.ts +1 -0
  51. package/dist/scanning-syncing/worker-mains/worker.js +7 -0
  52. package/dist/send-functionality/conversion.d.ts +4 -0
  53. package/dist/send-functionality/conversion.js +75 -0
  54. package/dist/send-functionality/inputSelection.d.ts +13 -0
  55. package/dist/send-functionality/inputSelection.js +8 -0
  56. package/dist/send-functionality/transactionBuilding.d.ts +51 -0
  57. package/dist/send-functionality/transactionBuilding.js +111 -0
  58. package/dist/tools/monero-tools.d.ts +46 -0
  59. package/dist/tools/monero-tools.js +165 -0
  60. package/dist/viewpair/ViewPair.d.ts +157 -0
  61. package/dist/viewpair/ViewPair.js +346 -0
  62. package/dist/wasm-processing/wasi.js +1 -2
  63. package/dist/wasm-processing/wasmFile.d.ts +1 -1
  64. package/dist/wasm-processing/wasmFile.js +2 -2
  65. package/dist/wasm-processing/wasmProcessor.d.ts +16 -4
  66. package/dist/wasm-processing/wasmProcessor.js +23 -7
  67. package/package.json +29 -6
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import type { SignedTransaction } from "../send-functionality/transactionBuilding";
2
3
  export declare const GetInfoResponseSchema: z.ZodObject<{
3
4
  id: z.ZodString;
4
5
  jsonrpc: z.ZodLiteral<"2.0">;
@@ -46,196 +47,39 @@ export declare const GetInfoResponseSchema: z.ZodObject<{
46
47
  white_peerlist_size: z.ZodNumber;
47
48
  wide_cumulative_difficulty: z.ZodString;
48
49
  wide_difficulty: z.ZodString;
49
- }, "strip", z.ZodTypeAny, {
50
- status: string;
51
- adjusted_time: number;
52
- alt_blocks_count: number;
53
- block_size_limit: number;
54
- block_size_median: number;
55
- block_weight_limit: number;
56
- block_weight_median: number;
57
- bootstrap_daemon_address: string;
58
- busy_syncing: boolean;
59
- credits: number;
60
- cumulative_difficulty: number;
61
- cumulative_difficulty_top64: number;
62
- database_size: number;
63
- difficulty: number;
64
- difficulty_top64: number;
65
- free_space: number;
66
- grey_peerlist_size: number;
67
- height: number;
68
- height_without_bootstrap: number;
69
- incoming_connections_count: number;
70
- mainnet: boolean;
71
- nettype: string;
72
- offline: boolean;
73
- outgoing_connections_count: number;
74
- restricted: boolean;
75
- rpc_connections_count: number;
76
- stagenet: boolean;
77
- start_time: number;
78
- synchronized: boolean;
79
- target: number;
80
- target_height: number;
81
- testnet: boolean;
82
- top_block_hash: string;
83
- top_hash: string;
84
- tx_count: number;
85
- tx_pool_size: number;
86
- untrusted: boolean;
87
- update_available: boolean;
88
- version: string;
89
- was_bootstrap_ever_used: boolean;
90
- white_peerlist_size: number;
91
- wide_cumulative_difficulty: string;
92
- wide_difficulty: string;
93
- }, {
94
- status: string;
95
- adjusted_time: number;
96
- alt_blocks_count: number;
97
- block_size_limit: number;
98
- block_size_median: number;
99
- block_weight_limit: number;
100
- block_weight_median: number;
101
- bootstrap_daemon_address: string;
102
- busy_syncing: boolean;
103
- credits: number;
104
- cumulative_difficulty: number;
105
- cumulative_difficulty_top64: number;
106
- database_size: number;
107
- difficulty: number;
108
- difficulty_top64: number;
109
- free_space: number;
110
- grey_peerlist_size: number;
111
- height: number;
112
- height_without_bootstrap: number;
113
- incoming_connections_count: number;
114
- mainnet: boolean;
115
- nettype: string;
116
- offline: boolean;
117
- outgoing_connections_count: number;
118
- restricted: boolean;
119
- rpc_connections_count: number;
120
- stagenet: boolean;
121
- start_time: number;
122
- synchronized: boolean;
123
- target: number;
124
- target_height: number;
125
- testnet: boolean;
126
- top_block_hash: string;
127
- top_hash: string;
128
- tx_count: number;
129
- tx_pool_size: number;
130
- untrusted: boolean;
131
- update_available: boolean;
132
- version: string;
133
- was_bootstrap_ever_used: boolean;
134
- white_peerlist_size: number;
135
- wide_cumulative_difficulty: string;
136
- wide_difficulty: string;
137
- }>;
138
- }, "strip", z.ZodTypeAny, {
139
- id: string;
140
- jsonrpc: "2.0";
141
- result: {
142
- status: string;
143
- adjusted_time: number;
144
- alt_blocks_count: number;
145
- block_size_limit: number;
146
- block_size_median: number;
147
- block_weight_limit: number;
148
- block_weight_median: number;
149
- bootstrap_daemon_address: string;
150
- busy_syncing: boolean;
151
- credits: number;
152
- cumulative_difficulty: number;
153
- cumulative_difficulty_top64: number;
154
- database_size: number;
155
- difficulty: number;
156
- difficulty_top64: number;
157
- free_space: number;
158
- grey_peerlist_size: number;
159
- height: number;
160
- height_without_bootstrap: number;
161
- incoming_connections_count: number;
162
- mainnet: boolean;
163
- nettype: string;
164
- offline: boolean;
165
- outgoing_connections_count: number;
166
- restricted: boolean;
167
- rpc_connections_count: number;
168
- stagenet: boolean;
169
- start_time: number;
170
- synchronized: boolean;
171
- target: number;
172
- target_height: number;
173
- testnet: boolean;
174
- top_block_hash: string;
175
- top_hash: string;
176
- tx_count: number;
177
- tx_pool_size: number;
178
- untrusted: boolean;
179
- update_available: boolean;
180
- version: string;
181
- was_bootstrap_ever_used: boolean;
182
- white_peerlist_size: number;
183
- wide_cumulative_difficulty: string;
184
- wide_difficulty: string;
185
- };
186
- }, {
187
- id: string;
188
- jsonrpc: "2.0";
189
- result: {
190
- status: string;
191
- adjusted_time: number;
192
- alt_blocks_count: number;
193
- block_size_limit: number;
194
- block_size_median: number;
195
- block_weight_limit: number;
196
- block_weight_median: number;
197
- bootstrap_daemon_address: string;
198
- busy_syncing: boolean;
199
- credits: number;
200
- cumulative_difficulty: number;
201
- cumulative_difficulty_top64: number;
202
- database_size: number;
203
- difficulty: number;
204
- difficulty_top64: number;
205
- free_space: number;
206
- grey_peerlist_size: number;
207
- height: number;
208
- height_without_bootstrap: number;
209
- incoming_connections_count: number;
210
- mainnet: boolean;
211
- nettype: string;
212
- offline: boolean;
213
- outgoing_connections_count: number;
214
- restricted: boolean;
215
- rpc_connections_count: number;
216
- stagenet: boolean;
217
- start_time: number;
218
- synchronized: boolean;
219
- target: number;
220
- target_height: number;
221
- testnet: boolean;
222
- top_block_hash: string;
223
- top_hash: string;
224
- tx_count: number;
225
- tx_pool_size: number;
226
- untrusted: boolean;
227
- update_available: boolean;
228
- version: string;
229
- was_bootstrap_ever_used: boolean;
230
- white_peerlist_size: number;
231
- wide_cumulative_difficulty: string;
232
- wide_difficulty: string;
233
- };
234
- }>;
50
+ }, z.core.$strip>;
51
+ }, z.core.$strip>;
235
52
  export type GetInfoResponse = z.infer<typeof GetInfoResponseSchema>;
53
+ /**
54
+ * Response schema for the get_output_distribution method.
55
+ *
56
+ * @property id - The request ID.
57
+ * @property jsonrpc - The JSON-RPC version.
58
+ * @property result - The result object containing:
59
+ * - distributions: An array of distribution objects, each with:
60
+ * - amount: unsigned int Same as in the request. Use 0 to get all RingCT outputs.
61
+ * - base: unsigned int; The total number of outputs of amount in the chain before, not including, the block at start_height.
62
+ * - distribution: array of unsigned int
63
+ * - 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
+ * - status: string; General RPC error code. "OK" means everything looks good.
65
+ */
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>;
80
+ export declare function parseGetOutputDistributionResponse(data: unknown): GetOutputDistributionResponse | null;
236
81
  export declare function parseGetInfoResponse(data: unknown): GetInfoResponse | null;
237
82
  export declare function get_info(NODE_URL: string): Promise<{
238
- status: string;
239
83
  adjusted_time: number;
240
84
  alt_blocks_count: number;
241
85
  block_size_limit: number;
@@ -263,6 +107,7 @@ export declare function get_info(NODE_URL: string): Promise<{
263
107
  rpc_connections_count: number;
264
108
  stagenet: boolean;
265
109
  start_time: number;
110
+ status: string;
266
111
  synchronized: boolean;
267
112
  target: number;
268
113
  target_height: number;
@@ -279,3 +124,220 @@ export declare function get_info(NODE_URL: string): Promise<{
279
124
  wide_cumulative_difficulty: string;
280
125
  wide_difficulty: string;
281
126
  }>;
127
+ /**
128
+ * Parameters for retrieving output distribution information.
129
+ *
130
+ * @property amounts - Array of unsigned integers representing cleartext amounts to look for.
131
+ * Use 0 to get all RingCT outputs. defaults to [0].
132
+ * @property cumulative - (Optional) If true, the result will be cumulative. Defaults to false.
133
+ * @property from_height - (Optional) Starting block height (inclusive) to check from. Defaults to 0.
134
+ * @property to_height - (Optional) Ending block height (inclusive) to check up to. Set to 0 to get the entire chain after from_height. Defaults to 0.
135
+ * @property binary - boolean; for disabling epee encoding, defaults to false.
136
+ * @property compress - (Optional) If true, enables compression. Ignored if binary is set to false.
137
+ */
138
+ export type GetOutputDistributionParams = {
139
+ amounts?: number[];
140
+ cumulative?: boolean;
141
+ from_height?: number;
142
+ to_height?: number;
143
+ binary?: boolean;
144
+ compress?: boolean;
145
+ };
146
+ export declare function get_output_distribution(NODE_URL: string, params?: GetOutputDistributionParams): Promise<{
147
+ distributions: {
148
+ amount: number;
149
+ base: number;
150
+ distribution: number[];
151
+ start_height: number;
152
+ }[];
153
+ status: string;
154
+ }>;
155
+ /**
156
+ * Response schema for the get_fee_estimate method.
157
+ *
158
+ * @property id - The request ID.
159
+ * @property jsonrpc - The JSON-RPC version.
160
+ * @property result - The result object containing:
161
+ * - status: string; General RPC error code. "OK" means everything looks good.
162
+ * - fee: unsigned int; Base fee per byte.
163
+ * - fees: (Optional) Array of unsigned int; Fee estimates for priorities 1–4.
164
+ * - quantization_mask: unsigned int; Mask used for fee rounding.
165
+ */
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>;
177
+ export declare function parseGetFeeEstimateResponse(data: unknown): GetFeeEstimateResponse | null;
178
+ export type GetFeeEstimateResult = {
179
+ status: string;
180
+ fee: number;
181
+ fees?: number[];
182
+ quantization_mask: number;
183
+ };
184
+ export type FeeEstimateResponse = {
185
+ status: string;
186
+ fee: number;
187
+ quantization_mask: number;
188
+ fees?: number[] | undefined;
189
+ };
190
+ 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>;
206
+ export declare function parseSendRawTransactionResponse(data: unknown): SendRawTransactionResponse | null;
207
+ export type SendRawTransactionResult = {
208
+ double_spend: boolean;
209
+ fee_too_low: boolean;
210
+ invalid_input: boolean;
211
+ invalid_output: boolean;
212
+ low_mixin: boolean;
213
+ not_relayed: boolean;
214
+ overspend: boolean;
215
+ reason: string;
216
+ status: string;
217
+ too_big: boolean;
218
+ untrusted: boolean;
219
+ not_rct?: boolean | undefined;
220
+ };
221
+ export declare function send_raw_transaction(NODE_URL: string, tx_as_hex: SignedTransaction, // tx_as_hex - string; Full transaction information as hexadecimal string.
222
+ do_not_relay?: boolean): Promise<SendRawTransactionResult>;
223
+ /**
224
+ * Response schema for the get_block_headers_range method.
225
+ *
226
+ * @property id - The request ID.
227
+ * @property jsonrpc - The JSON-RPC version.
228
+ * @property result - The result object containing:
229
+ * - credits: unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0.
230
+ * - headers: array of block_header objects, each with:
231
+ * - block_size: unsigned int
232
+ * - block_weight: unsigned int
233
+ * - cumulative_difficulty: unsigned int
234
+ * - cumulative_difficulty_top64: unsigned int
235
+ * - depth: unsigned int
236
+ * - difficulty: unsigned int
237
+ * - difficulty_top64: unsigned int
238
+ * - hash: string
239
+ * - height: unsigned int
240
+ * - long_term_weight: unsigned int
241
+ * - major_version: unsigned int
242
+ * - miner_tx_hash: string
243
+ * - minor_version: unsigned int
244
+ * - nonce: unsigned int
245
+ * - num_txes: unsigned int
246
+ * - orphan_status: boolean
247
+ * - pow_hash: string (if fill_pow_hash is true)
248
+ * - prev_hash: string
249
+ * - reward: unsigned int
250
+ * - timestamp: unsigned int
251
+ * - wide_cumulative_difficulty: string
252
+ * - wide_difficulty: string
253
+ * - status: string; General RPC error code. "OK" means everything looks good.
254
+ * - top_hash: string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty.
255
+ * - untrusted: boolean; States if the result is obtained using the bootstrap mode (true) or not (false).
256
+ * @property error - Optional error object if the request failed:
257
+ * - code: int; Error code.
258
+ * - message: string; Error message.
259
+ */
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>;
299
+ export type GetBlockHeadersRange = {
300
+ status: string;
301
+ credits: number;
302
+ headers: {
303
+ block_size: number;
304
+ block_weight: number;
305
+ cumulative_difficulty: number;
306
+ cumulative_difficulty_top64: number;
307
+ depth: number;
308
+ difficulty: number;
309
+ difficulty_top64: number;
310
+ hash: string;
311
+ height: number;
312
+ long_term_weight: number;
313
+ major_version: number;
314
+ miner_tx_hash: string;
315
+ minor_version: number;
316
+ nonce: number;
317
+ num_txes: number;
318
+ orphan_status: boolean;
319
+ pow_hash: string;
320
+ prev_hash: string;
321
+ reward: number;
322
+ timestamp: number;
323
+ wide_cumulative_difficulty: string;
324
+ wide_difficulty: string;
325
+ }[];
326
+ top_hash: string;
327
+ untrusted: boolean;
328
+ };
329
+ export declare function parseGetBlockHeadersRangeResponse(data: unknown): GetBlockHeadersRangeResponse | null;
330
+ /**
331
+ * Parameters for retrieving block headers in a range.
332
+ *
333
+ * @property start_height - unsigned int; The starting block's height.
334
+ * @property end_height - unsigned int; The ending block's height.
335
+ * @property fill_pow_hash - (Optional) boolean; Add PoW hash to block_header response. Defaults to false.
336
+ */
337
+ export type GetBlockHeadersRangeParams = {
338
+ start_height: number;
339
+ end_height: number;
340
+ fill_pow_hash?: boolean;
341
+ };
342
+ export declare const RESTRICTED_BLOCK_HEADER_RANGE = 1000;
343
+ export declare function get_block_headers_range(NODE_URL: string, params: GetBlockHeadersRangeParams): Promise<GetBlockHeadersRange>;