react-native-nitro-ark 0.0.2

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 (55) hide show
  1. package/LICENSE +20 -0
  2. package/NitroArk.podspec +30 -0
  3. package/README.md +22 -0
  4. package/android/CMakeLists.txt +64 -0
  5. package/android/build.gradle +145 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +3 -0
  8. package/android/src/main/AndroidManifestNew.xml +2 -0
  9. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  10. package/android/src/main/java/com/nitroark/NitroArkPackage.kt +22 -0
  11. package/cpp/HybridArk.cpp +8 -0
  12. package/cpp/NitroArk.hpp +558 -0
  13. package/cpp/bark-cpp.h +382 -0
  14. package/lib/commonjs/NitroArk.nitro.js +6 -0
  15. package/lib/commonjs/NitroArk.nitro.js.map +1 -0
  16. package/lib/commonjs/index.js +292 -0
  17. package/lib/commonjs/index.js.map +1 -0
  18. package/lib/commonjs/package.json +1 -0
  19. package/lib/module/NitroArk.nitro.js +4 -0
  20. package/lib/module/NitroArk.nitro.js.map +1 -0
  21. package/lib/module/index.js +268 -0
  22. package/lib/module/index.js.map +1 -0
  23. package/lib/module/package.json +1 -0
  24. package/lib/typescript/commonjs/package.json +1 -0
  25. package/lib/typescript/commonjs/src/NitroArk.nitro.d.ts +59 -0
  26. package/lib/typescript/commonjs/src/NitroArk.nitro.d.ts.map +1 -0
  27. package/lib/typescript/commonjs/src/index.d.ts +180 -0
  28. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  29. package/lib/typescript/module/package.json +1 -0
  30. package/lib/typescript/module/src/NitroArk.nitro.d.ts +59 -0
  31. package/lib/typescript/module/src/NitroArk.nitro.d.ts.map +1 -0
  32. package/lib/typescript/module/src/index.d.ts +180 -0
  33. package/lib/typescript/module/src/index.d.ts.map +1 -0
  34. package/nitrogen/generated/android/NitroArk+autolinking.cmake +78 -0
  35. package/nitrogen/generated/android/NitroArk+autolinking.gradle +27 -0
  36. package/nitrogen/generated/android/NitroArkOnLoad.cpp +44 -0
  37. package/nitrogen/generated/android/NitroArkOnLoad.hpp +25 -0
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroark/NitroArkOnLoad.kt +35 -0
  39. package/nitrogen/generated/ios/NitroArk+autolinking.rb +60 -0
  40. package/nitrogen/generated/ios/NitroArk-Swift-Cxx-Bridge.cpp +17 -0
  41. package/nitrogen/generated/ios/NitroArk-Swift-Cxx-Bridge.hpp +27 -0
  42. package/nitrogen/generated/ios/NitroArk-Swift-Cxx-Umbrella.hpp +38 -0
  43. package/nitrogen/generated/ios/NitroArkAutolinking.mm +35 -0
  44. package/nitrogen/generated/ios/NitroArkAutolinking.swift +12 -0
  45. package/nitrogen/generated/shared/c++/BarkBalance.hpp +77 -0
  46. package/nitrogen/generated/shared/c++/BarkConfigOpts.hpp +90 -0
  47. package/nitrogen/generated/shared/c++/BarkCreateOpts.hpp +96 -0
  48. package/nitrogen/generated/shared/c++/BarkRefreshModeType.hpp +94 -0
  49. package/nitrogen/generated/shared/c++/BarkRefreshOpts.hpp +81 -0
  50. package/nitrogen/generated/shared/c++/BarkSendManyOutput.hpp +73 -0
  51. package/nitrogen/generated/shared/c++/HybridNitroArkSpec.cpp +40 -0
  52. package/nitrogen/generated/shared/c++/HybridNitroArkSpec.hpp +95 -0
  53. package/package.json +178 -0
  54. package/src/NitroArk.nitro.ts +159 -0
  55. package/src/index.tsx +443 -0
package/cpp/bark-cpp.h ADDED
@@ -0,0 +1,382 @@
1
+ // Auto-generated C/C++ bindings for bark-cpp
2
+
3
+ #ifndef BARK_CPP_H
4
+ #define BARK_CPP_H
5
+
6
+ /* Generated with cbindgen:0.28.0 */
7
+
8
+ #include <cstdarg>
9
+ #include <cstdint>
10
+ #include <cstdlib>
11
+ #include <new>
12
+ #include <ostream>
13
+
14
+ namespace bark {
15
+
16
+ enum class bark_BarkRefreshModeType {
17
+ DefaultThreshold,
18
+ ThresholdBlocks,
19
+ ThresholdHours,
20
+ Counterparty,
21
+ All,
22
+ Specific,
23
+ };
24
+
25
+ struct bark_BarkError {
26
+ char *message;
27
+ };
28
+
29
+ struct bark_BarkConfigOpts {
30
+ const char *asp;
31
+ const char *esplora;
32
+ const char *bitcoind;
33
+ const char *bitcoind_cookie;
34
+ const char *bitcoind_user;
35
+ const char *bitcoind_pass;
36
+ };
37
+
38
+ struct bark_BarkCreateOpts {
39
+ bool force;
40
+ bool regtest;
41
+ bool signet;
42
+ bool bitcoin;
43
+ const char *mnemonic;
44
+ uint32_t birthday_height;
45
+ bark_BarkConfigOpts config;
46
+ };
47
+
48
+ struct bark_BarkBalance {
49
+ uint64_t onchain;
50
+ uint64_t offchain;
51
+ uint64_t pending_exit;
52
+ };
53
+
54
+ struct bark_BarkRefreshOpts {
55
+ bark_BarkRefreshModeType mode_type;
56
+ uint32_t threshold_value;
57
+ const char *const *specific_vtxo_ids;
58
+ uintptr_t num_specific_vtxo_ids;
59
+ };
60
+
61
+ extern "C" {
62
+
63
+ /// Initializes the logger for the library.
64
+ /// This should be called once when the library is loaded by the C/C++
65
+ /// application, before any other library functions are used.
66
+ void bark_init_logger();
67
+
68
+ void bark_free_error(bark_BarkError *error);
69
+
70
+ const char *bark_error_message(const bark_BarkError *error);
71
+
72
+ /// Frees a C string allocated by a bark-cpp function.
73
+ ///
74
+ /// This function should be called by the C/C++ side on any `char*`
75
+ /// that was returned by functions like `bark_create_mnemonic`,
76
+ /// `bark_get_onchain_address`, `bark_send_onchain`, etc.
77
+ ///
78
+ /// # Safety
79
+ ///
80
+ /// The pointer `s` must have been previously allocated by Rust using
81
+ /// `CString::into_raw` or a similar mechanism within this library.
82
+ /// Calling this with a null pointer is safe (it does nothing).
83
+ /// Calling this with a pointer not allocated by this library, or calling
84
+ /// it more than once on the same pointer, results in undefined behavior.
85
+ void bark_free_string(char *s);
86
+
87
+ /// Create a new mnemonic
88
+ ///
89
+ /// @return The mnemonic string as a C string, or NULL on error
90
+ char *bark_create_mnemonic();
91
+
92
+ /// Create a new wallet at the specified directory
93
+ ///
94
+ /// @param datadir Path to the data directory
95
+ /// @param opts Creation options
96
+ /// @return Error pointer or NULL on success
97
+ bark_BarkError *bark_create_wallet(const char *datadir,
98
+ bark_BarkCreateOpts opts);
99
+
100
+ /// Get offchain and onchain balances
101
+ ///
102
+ /// @param datadir Path to the data directory
103
+ /// @param no_sync Whether to skip syncing the wallet
104
+ /// @param balance_out Pointer to a BarkBalance struct where the result will be
105
+ /// stored
106
+ /// @return Error pointer or NULL on success
107
+ bark_BarkError *bark_get_balance(const char *datadir, bool no_sync,
108
+ const char *mnemonic,
109
+ bark_BarkBalance *balance_out);
110
+
111
+ /// Get an onchain address.
112
+ ///
113
+ /// The returned address string must be freed by the caller using
114
+ /// `bark_free_string`.
115
+ ///
116
+ /// @param datadir Path to the data directory
117
+ /// @param mnemonic The wallet mnemonic phrase
118
+ /// @param address_out Pointer to a `*mut c_char` where the address string
119
+ /// pointer will be written.
120
+ /// @return Error pointer or NULL on success.
121
+ bark_BarkError *bark_get_onchain_address(const char *datadir,
122
+ const char *mnemonic,
123
+ char **address_out);
124
+
125
+ /// Send funds using the onchain wallet.
126
+ ///
127
+ /// The returned transaction ID string must be freed by the caller using
128
+ /// `bark_free_string`.
129
+ ///
130
+ /// @param datadir Path to the data directory
131
+ /// @param mnemonic The wallet mnemonic phrase
132
+ /// @param destination The destination Bitcoin address as a string
133
+ /// @param amount_sat The amount to send in satoshis
134
+ /// @param no_sync Whether to skip syncing the wallet before sending
135
+ /// @param txid_out Pointer to a `*mut c_char` where the transaction ID string
136
+ /// pointer will be written.
137
+ /// @return Error pointer or NULL on success.
138
+ bark_BarkError *bark_send_onchain(const char *datadir, const char *mnemonic,
139
+ const char *destination, uint64_t amount_sat,
140
+ bool no_sync, char **txid_out);
141
+
142
+ /// Send all funds from the onchain wallet to a destination address.
143
+ ///
144
+ /// The returned transaction ID string must be freed by the caller using
145
+ /// `bark_free_string`.
146
+ ///
147
+ /// @param datadir Path to the data directory
148
+ /// @param mnemonic The wallet mnemonic phrase
149
+ /// @param destination The destination Bitcoin address as a string
150
+ /// @param no_sync Whether to skip syncing the wallet before sending
151
+ /// @param txid_out Pointer to a `*mut c_char` where the transaction ID string
152
+ /// pointer will be written.
153
+ /// @return Error pointer or NULL on success.
154
+ bark_BarkError *bark_drain_onchain(const char *datadir, const char *mnemonic,
155
+ const char *destination, bool no_sync,
156
+ char **txid_out);
157
+
158
+ /// Send funds to multiple recipients using the onchain wallet.
159
+ ///
160
+ /// The returned transaction ID string must be freed by the caller using
161
+ /// `bark_free_string`.
162
+ ///
163
+ /// @param datadir Path to the data directory
164
+ /// @param mnemonic The wallet mnemonic phrase
165
+ /// @param destinations Array of C strings representing destination Bitcoin
166
+ /// addresses
167
+ /// @param amounts_sat Array of u64 representing amounts in satoshis (must match
168
+ /// destinations array length)
169
+ /// @param num_outputs The number of outputs (length of the destinations and
170
+ /// amounts_sat arrays)
171
+ /// @param no_sync Whether to skip syncing the wallet before sending
172
+ /// @param txid_out Pointer to a `*mut c_char` where the transaction ID string
173
+ /// pointer will be written.
174
+ /// @return Error pointer or NULL on success.
175
+ bark_BarkError *bark_send_many_onchain(const char *datadir,
176
+ const char *mnemonic,
177
+ const char *const *destinations,
178
+ const uint64_t *amounts_sat,
179
+ uintptr_t num_outputs, bool no_sync,
180
+ char **txid_out);
181
+
182
+ /// Get the list of onchain UTXOs as a JSON string.
183
+ ///
184
+ /// The returned JSON string must be freed by the caller using
185
+ /// `bark_free_string`.
186
+ ///
187
+ /// @param datadir Path to the data directory
188
+ /// @param mnemonic The wallet mnemonic phrase
189
+ /// @param no_sync Whether to skip syncing the wallet before fetching
190
+ /// @param utxos_json_out Pointer to a `*mut c_char` where the JSON string
191
+ /// pointer will be written.
192
+ /// @return Error pointer or NULL on success.
193
+ bark_BarkError *bark_get_onchain_utxos(const char *datadir,
194
+ const char *mnemonic, bool no_sync,
195
+ char **utxos_json_out);
196
+
197
+ /// Get the wallet's VTXO public key (hex string).
198
+ ///
199
+ /// The returned public key string must be freed by the caller using
200
+ /// `bark_free_string`.
201
+ ///
202
+ /// @param datadir Path to the data directory
203
+ /// @param mnemonic The wallet mnemonic phrase
204
+ /// @param pubkey_hex_out Pointer to a `*mut c_char` where the hex string
205
+ /// pointer will be written.
206
+ /// @return Error pointer or NULL on success.
207
+ bark_BarkError *bark_get_vtxo_pubkey(const char *datadir, const char *mnemonic,
208
+ char **pubkey_hex_out);
209
+
210
+ /// Get the list of VTXOs as a JSON string.
211
+ ///
212
+ /// The returned JSON string must be freed by the caller using
213
+ /// `bark_free_string`.
214
+ ///
215
+ /// @param datadir Path to the data directory
216
+ /// @param mnemonic The wallet mnemonic phrase
217
+ /// @param no_sync Whether to skip syncing the wallet before fetching
218
+ /// @param vtxos_json_out Pointer to a `*mut c_char` where the JSON string
219
+ /// pointer will be written.
220
+ /// @return Error pointer or NULL on success.
221
+ bark_BarkError *bark_get_vtxos(const char *datadir, const char *mnemonic,
222
+ bool no_sync, char **vtxos_json_out);
223
+
224
+ /// Refresh VTXOs based on specified criteria.
225
+ ///
226
+ /// The returned JSON status string must be freed by the caller using
227
+ /// `bark_free_string`.
228
+ ///
229
+ /// @param datadir Path to the data directory
230
+ /// @param mnemonic The wallet mnemonic phrase
231
+ /// @param refresh_opts Options specifying which VTXOs to refresh
232
+ /// @param no_sync Whether to skip syncing the wallet before refreshing
233
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON status
234
+ /// string will be written.
235
+ /// @return Error pointer or NULL on success.
236
+ bark_BarkError *bark_refresh_vtxos(const char *datadir, const char *mnemonic,
237
+ bark_BarkRefreshOpts refresh_opts,
238
+ bool no_sync, char **status_json_out);
239
+
240
+ /// Board a specific amount from the onchain wallet into Ark.
241
+ ///
242
+ /// The returned JSON status string must be freed by the caller using
243
+ /// `bark_free_string`.
244
+ ///
245
+ /// @param datadir Path to the data directory
246
+ /// @param mnemonic The wallet mnemonic phrase
247
+ /// @param amount_sat The amount in satoshis to board
248
+ /// @param no_sync Whether to skip syncing the onchain wallet before boarding
249
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON status
250
+ /// string will be written.
251
+ /// @return Error pointer or NULL on success.
252
+ bark_BarkError *bark_board_amount(const char *datadir, const char *mnemonic,
253
+ uint64_t amount_sat, bool no_sync,
254
+ char **status_json_out);
255
+
256
+ /// Board all available funds from the onchain wallet into Ark.
257
+ ///
258
+ /// The returned JSON status string must be freed by the caller using
259
+ /// `bark_free_string`.
260
+ ///
261
+ /// @param datadir Path to the data directory
262
+ /// @param mnemonic The wallet mnemonic phrase
263
+ /// @param no_sync Whether to skip syncing the onchain wallet before boarding
264
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON status
265
+ /// string will be written.
266
+ /// @return Error pointer or NULL on success.
267
+ bark_BarkError *bark_board_all(const char *datadir, const char *mnemonic,
268
+ bool no_sync, char **status_json_out);
269
+
270
+ bark_BarkError *bark_send(const char *datadir, const char *mnemonic,
271
+ const char *destination, uint64_t amount_sat,
272
+ const char *comment, bool no_sync,
273
+ char **status_json_out);
274
+
275
+ /// Send an onchain payment via an Ark round.
276
+ ///
277
+ /// The returned JSON status string must be freed by the caller using
278
+ /// `bark_free_string`.
279
+ ///
280
+ /// @param datadir Path to the data directory
281
+ /// @param mnemonic The wallet mnemonic phrase
282
+ /// @param destination The destination Bitcoin address as a string
283
+ /// @param amount_sat The amount in satoshis to send
284
+ /// @param no_sync Whether to skip syncing the wallet before sending
285
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON status
286
+ /// string will be written.
287
+ /// @return Error pointer or NULL on success.
288
+ bark_BarkError *bark_send_round_onchain(const char *datadir,
289
+ const char *mnemonic,
290
+ const char *destination,
291
+ uint64_t amount_sat, bool no_sync,
292
+ char **status_json_out);
293
+
294
+ /// Offboard specific VTXOs to an optional onchain address.
295
+ ///
296
+ /// The returned JSON result string must be freed by the caller using
297
+ /// `bark_free_string`.
298
+ ///
299
+ /// @param datadir Path to the data directory
300
+ /// @param mnemonic The wallet mnemonic phrase
301
+ /// @param specific_vtxo_ids Array of VtxoId strings (cannot be empty)
302
+ /// @param num_specific_vtxo_ids Number of VtxoIds in the array
303
+ /// @param optional_address Optional destination Bitcoin address (pass NULL if
304
+ /// not provided)
305
+ /// @param no_sync Whether to skip syncing the wallet
306
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON result
307
+ /// string will be written.
308
+ /// @return Error pointer or NULL on success.
309
+ bark_BarkError *bark_offboard_specific(const char *datadir,
310
+ const char *mnemonic,
311
+ const char *const *specific_vtxo_ids,
312
+ uintptr_t num_specific_vtxo_ids,
313
+ const char *optional_address,
314
+ bool no_sync, char **status_json_out);
315
+
316
+ /// Offboard all VTXOs to an optional onchain address.
317
+ ///
318
+ /// The returned JSON result string must be freed by the caller using
319
+ /// `bark_free_string`.
320
+ ///
321
+ /// @param datadir Path to the data directory
322
+ /// @param mnemonic The wallet mnemonic phrase
323
+ /// @param optional_address Optional destination Bitcoin address (pass NULL if
324
+ /// not provided)
325
+ /// @param no_sync Whether to skip syncing the wallet
326
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON result
327
+ /// string will be written.
328
+ /// @return Error pointer or NULL on success.
329
+ bark_BarkError *bark_offboard_all(const char *datadir, const char *mnemonic,
330
+ const char *optional_address, bool no_sync,
331
+ char **status_json_out);
332
+
333
+ /// Start the exit process for specific VTXOs.
334
+ ///
335
+ /// The returned JSON success string must be freed by the caller using
336
+ /// `bark_free_string`.
337
+ ///
338
+ /// @param datadir Path to the data directory
339
+ /// @param mnemonic The wallet mnemonic phrase
340
+ /// @param specific_vtxo_ids Array of VtxoId strings (cannot be empty)
341
+ /// @param num_specific_vtxo_ids Number of VtxoIds in the array
342
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON success
343
+ /// string will be written.
344
+ /// @return Error pointer or NULL on success.
345
+ bark_BarkError *bark_exit_start_specific(const char *datadir,
346
+ const char *mnemonic,
347
+ const char *const *specific_vtxo_ids,
348
+ uintptr_t num_specific_vtxo_ids,
349
+ char **status_json_out);
350
+
351
+ /// Start the exit process for all VTXOs in the wallet.
352
+ ///
353
+ /// The returned JSON success string must be freed by the caller using
354
+ /// `bark_free_string`.
355
+ ///
356
+ /// @param datadir Path to the data directory
357
+ /// @param mnemonic The wallet mnemonic phrase
358
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON success
359
+ /// string will be written.
360
+ /// @return Error pointer or NULL on success.
361
+ bark_BarkError *bark_exit_start_all(const char *datadir, const char *mnemonic,
362
+ char **status_json_out);
363
+
364
+ /// Progress the exit process once and return the current status.
365
+ ///
366
+ /// The returned JSON status string must be freed by the caller using
367
+ /// `bark_free_string`.
368
+ ///
369
+ /// @param datadir Path to the data directory
370
+ /// @param mnemonic The wallet mnemonic phrase
371
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON status
372
+ /// string will be written.
373
+ /// @return Error pointer or NULL on success.
374
+ bark_BarkError *bark_exit_progress_once(const char *datadir,
375
+ const char *mnemonic,
376
+ char **status_json_out);
377
+
378
+ } // extern "C"
379
+
380
+ } // namespace bark
381
+
382
+ #endif // BARK_CPP_H
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=NitroArk.nitro.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["NitroArk.nitro.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,292 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NitroArkHybridObject = void 0;
7
+ exports.boardAll = boardAll;
8
+ exports.boardAmount = boardAmount;
9
+ exports.createMnemonic = createMnemonic;
10
+ exports.createWallet = createWallet;
11
+ exports.drainOnchain = drainOnchain;
12
+ exports.exitProgressOnce = exitProgressOnce;
13
+ exports.exitStartAll = exitStartAll;
14
+ exports.exitStartSpecific = exitStartSpecific;
15
+ exports.getBalance = getBalance;
16
+ exports.getOnchainAddress = getOnchainAddress;
17
+ exports.getOnchainUtxos = getOnchainUtxos;
18
+ exports.getVtxoPubkey = getVtxoPubkey;
19
+ exports.getVtxos = getVtxos;
20
+ exports.offboardAll = offboardAll;
21
+ exports.offboardSpecific = offboardSpecific;
22
+ exports.refreshVtxos = refreshVtxos;
23
+ exports.send = send;
24
+ exports.sendManyOnchain = sendManyOnchain;
25
+ exports.sendOnchain = sendOnchain;
26
+ exports.sendRoundOnchain = sendRoundOnchain;
27
+ var _reactNativeNitroModules = require("react-native-nitro-modules");
28
+ // Create the hybrid object instance
29
+ const NitroArkHybridObject = exports.NitroArkHybridObject = _reactNativeNitroModules.NitroModules.createHybridObject('NitroArk');
30
+
31
+ // --- Management ---
32
+
33
+ /**
34
+ * Creates a new BIP39 mnemonic phrase.
35
+ * @returns A promise resolving to the mnemonic string.
36
+ */
37
+ function createMnemonic() {
38
+ return NitroArkHybridObject.createMnemonic();
39
+ }
40
+
41
+ /**
42
+ * Creates a new wallet at the specified directory.
43
+ * @param datadir Path to the data directory.
44
+ * @param opts Creation options.
45
+ * @returns A promise that resolves on success or rejects on error.
46
+ */
47
+ function createWallet(datadir, opts) {
48
+ return NitroArkHybridObject.createWallet(datadir, opts);
49
+ }
50
+
51
+ // --- Wallet Info ---
52
+
53
+ /**
54
+ * Gets the offchain and onchain balances.
55
+ * @param datadir Path to the data directory.
56
+ * @param no_sync Whether to skip syncing the wallet. Defaults to false.
57
+ * @param mnemonic The wallet mnemonic phrase.
58
+ * @returns A promise resolving to the BarkBalance object.
59
+ */
60
+ function getBalance(datadir, mnemonic, no_sync = false) {
61
+ // Pass mnemonic correctly, adjusted default position for optional no_sync
62
+ return NitroArkHybridObject.getBalance(datadir, no_sync, mnemonic);
63
+ }
64
+
65
+ /**
66
+ * Gets a fresh onchain address.
67
+ * @param datadir Path to the data directory.
68
+ * @param mnemonic The wallet mnemonic phrase.
69
+ * @returns A promise resolving to the Bitcoin address string.
70
+ */
71
+ function getOnchainAddress(datadir, mnemonic) {
72
+ return NitroArkHybridObject.getOnchainAddress(datadir, mnemonic);
73
+ }
74
+
75
+ /**
76
+ * Gets the list of onchain UTXOs as a JSON string.
77
+ * @param datadir Path to the data directory.
78
+ * @param mnemonic The wallet mnemonic phrase.
79
+ * @param no_sync Whether to skip syncing the wallet. Defaults to false.
80
+ * @returns A promise resolving to the JSON string of UTXOs.
81
+ */
82
+ function getOnchainUtxos(datadir, mnemonic, no_sync = false) {
83
+ return NitroArkHybridObject.getOnchainUtxos(datadir, mnemonic, no_sync);
84
+ }
85
+
86
+ /**
87
+ * Gets the wallet's VTXO public key (hex string).
88
+ * @param datadir Path to the data directory.
89
+ * @param mnemonic The wallet mnemonic phrase.
90
+ * @returns A promise resolving to the hex-encoded public key string.
91
+ */
92
+ function getVtxoPubkey(datadir, mnemonic) {
93
+ return NitroArkHybridObject.getVtxoPubkey(datadir, mnemonic);
94
+ }
95
+
96
+ /**
97
+ * Gets the list of VTXOs as a JSON string.
98
+ * @param datadir Path to the data directory.
99
+ * @param mnemonic The wallet mnemonic phrase.
100
+ * @param no_sync Whether to skip syncing the wallet. Defaults to false.
101
+ * @returns A promise resolving to the JSON string of VTXOs.
102
+ */
103
+ function getVtxos(datadir, mnemonic, no_sync = false) {
104
+ return NitroArkHybridObject.getVtxos(datadir, mnemonic, no_sync);
105
+ }
106
+
107
+ // --- Onchain Operations ---
108
+
109
+ /**
110
+ * Sends funds using the onchain wallet.
111
+ * @param datadir Path to the data directory.
112
+ * @param mnemonic The wallet mnemonic phrase.
113
+ * @param destination The destination Bitcoin address.
114
+ * @param amountSat The amount to send in satoshis.
115
+ * @param no_sync Whether to skip syncing the wallet. Defaults to false.
116
+ * @returns A promise resolving to the transaction ID string.
117
+ */
118
+ function sendOnchain(datadir, mnemonic, destination, amountSat, no_sync = false) {
119
+ return NitroArkHybridObject.sendOnchain(datadir, mnemonic, destination, amountSat, no_sync);
120
+ }
121
+
122
+ /**
123
+ * Sends all funds from the onchain wallet to a destination address.
124
+ * @param datadir Path to the data directory.
125
+ * @param mnemonic The wallet mnemonic phrase.
126
+ * @param destination The destination Bitcoin address.
127
+ * @param no_sync Whether to skip syncing the wallet. Defaults to false.
128
+ * @returns A promise resolving to the transaction ID string.
129
+ */
130
+ function drainOnchain(datadir, mnemonic, destination, no_sync = false) {
131
+ return NitroArkHybridObject.drainOnchain(datadir, mnemonic, destination, no_sync);
132
+ }
133
+
134
+ /**
135
+ * Sends funds to multiple recipients using the onchain wallet.
136
+ * @param datadir Path to the data directory.
137
+ * @param mnemonic The wallet mnemonic phrase.
138
+ * @param outputs An array of objects containing destination address and amountSat.
139
+ * @param no_sync Whether to skip syncing the wallet. Defaults to false.
140
+ * @returns A promise resolving to the transaction ID string.
141
+ */
142
+ function sendManyOnchain(datadir, mnemonic, outputs, no_sync = false) {
143
+ return NitroArkHybridObject.sendManyOnchain(datadir, mnemonic, outputs, no_sync);
144
+ }
145
+
146
+ // --- Ark Operations ---
147
+
148
+ /**
149
+ * Refreshes VTXOs based on specified criteria.
150
+ * @param datadir Path to the data directory.
151
+ * @param mnemonic The wallet mnemonic phrase.
152
+ * @param refreshOpts Options specifying which VTXOs to refresh.
153
+ * `mode_type` should be one of: 'DefaultThreshold', 'ThresholdBlocks', 'ThresholdHours', 'Counterparty', 'All', 'Specific'.
154
+ * @param no_sync Whether to skip syncing the wallet. Defaults to false.
155
+ * @returns A promise resolving to a JSON status string.
156
+ * @example
157
+ * // Refresh using default threshold
158
+ * refreshVtxos(datadir, mnemonic, { mode_type: 'DefaultThreshold' });
159
+ * // Refresh specific VTXOs
160
+ * refreshVtxos(datadir, mnemonic, { mode_type: 'Specific', specific_vtxo_ids: ['vtxo_id_1', 'vtxo_id_2'] });
161
+ * // Refresh if older than 10 blocks
162
+ * refreshVtxos(datadir, mnemonic, { mode_type: 'ThresholdBlocks', threshold_value: 10 });
163
+ */
164
+ function refreshVtxos(datadir, mnemonic, refreshOpts, no_sync = false) {
165
+ // Ensure mode_type is provided (should be handled by TS type system)
166
+ if (!refreshOpts.mode_type) {
167
+ return Promise.reject(new Error('refreshVtxos requires refreshOpts.mode_type'));
168
+ }
169
+ // Additional validation for specific modes could be added here if desired
170
+ if (refreshOpts.mode_type === 'Specific' && (!refreshOpts.specific_vtxo_ids || refreshOpts.specific_vtxo_ids.length === 0)) {
171
+ return Promise.reject(new Error("refreshVtxos with mode_type 'Specific' requires non-empty specific_vtxo_ids array"));
172
+ }
173
+ if ((refreshOpts.mode_type === 'ThresholdBlocks' || refreshOpts.mode_type === 'ThresholdHours') && (refreshOpts.threshold_value === undefined || refreshOpts.threshold_value <= 0)) {
174
+ return Promise.reject(new Error(`refreshVtxos with mode_type '${refreshOpts.mode_type}' requires a positive threshold_value`));
175
+ }
176
+ return NitroArkHybridObject.refreshVtxos(datadir, mnemonic, refreshOpts, no_sync);
177
+ }
178
+
179
+ /**
180
+ * Boards a specific amount from the onchain wallet into Ark.
181
+ * @param datadir Path to the data directory.
182
+ * @param mnemonic The wallet mnemonic phrase.
183
+ * @param amountSat The amount in satoshis to board.
184
+ * @param no_sync Whether to skip syncing the onchain wallet. Defaults to false.
185
+ * @returns A promise resolving to a JSON status string.
186
+ */
187
+ function boardAmount(datadir, mnemonic, amountSat, no_sync = false) {
188
+ return NitroArkHybridObject.boardAmount(datadir, mnemonic, amountSat, no_sync);
189
+ }
190
+
191
+ /**
192
+ * Boards all available funds from the onchain wallet into Ark.
193
+ * @param datadir Path to the data directory.
194
+ * @param mnemonic The wallet mnemonic phrase.
195
+ * @param no_sync Whether to skip syncing the onchain wallet. Defaults to false.
196
+ * @returns A promise resolving to a JSON status string.
197
+ */
198
+ function boardAll(datadir, mnemonic, no_sync = false) {
199
+ return NitroArkHybridObject.boardAll(datadir, mnemonic, no_sync);
200
+ }
201
+
202
+ /**
203
+ * Sends funds offchain using Ark VTXOs.
204
+ * @param datadir Path to the data directory.
205
+ * @param mnemonic The wallet mnemonic phrase.
206
+ * @param destination Ark address (VTXO pubkey) or onchain Bitcoin address.
207
+ * @param amountSat The amount in satoshis to send.
208
+ * @param comment Optional comment (can be null).
209
+ * @param no_sync Whether to skip syncing the wallet. Defaults to false.
210
+ * @returns A promise resolving to a JSON status string.
211
+ */
212
+ function send(datadir, mnemonic, destination, amountSat, comment = null, no_sync = false) {
213
+ return NitroArkHybridObject.send(datadir, mnemonic, destination, amountSat, comment, no_sync);
214
+ }
215
+
216
+ /**
217
+ * Sends an onchain payment via an Ark round.
218
+ * @param datadir Path to the data directory.
219
+ * @param mnemonic The wallet mnemonic phrase.
220
+ * @param destination The destination Bitcoin address.
221
+ * @param amountSat The amount in satoshis to send.
222
+ * @param no_sync Whether to skip syncing the wallet. Defaults to false.
223
+ * @returns A promise resolving to a JSON status string.
224
+ */
225
+ function sendRoundOnchain(datadir, mnemonic, destination, amountSat, no_sync = false) {
226
+ return NitroArkHybridObject.sendRoundOnchain(datadir, mnemonic, destination, amountSat, no_sync);
227
+ }
228
+
229
+ // --- Offboarding / Exiting ---
230
+
231
+ /**
232
+ * Offboards specific VTXOs to an optional onchain address.
233
+ * @param datadir Path to the data directory.
234
+ * @param mnemonic The wallet mnemonic phrase.
235
+ * @param vtxoIds Array of VtxoId strings to offboard.
236
+ * @param optionalAddress Optional destination Bitcoin address (null if sending to internal wallet).
237
+ * @param no_sync Whether to skip syncing the wallet. Defaults to false.
238
+ * @returns A promise resolving to a JSON result string.
239
+ */
240
+ function offboardSpecific(datadir, mnemonic, vtxoIds, optionalAddress = null, no_sync = false) {
241
+ return NitroArkHybridObject.offboardSpecific(datadir, mnemonic, vtxoIds, optionalAddress, no_sync);
242
+ }
243
+
244
+ /**
245
+ * Offboards all VTXOs to an optional onchain address.
246
+ * @param datadir Path to the data directory.
247
+ * @param mnemonic The wallet mnemonic phrase.
248
+ * @param optionalAddress Optional destination Bitcoin address (null if sending to internal wallet).
249
+ * @param no_sync Whether to skip syncing the wallet. Defaults to false.
250
+ * @returns A promise resolving to a JSON result string.
251
+ */
252
+ function offboardAll(datadir, mnemonic, optionalAddress = null, no_sync = false) {
253
+ return NitroArkHybridObject.offboardAll(datadir, mnemonic, optionalAddress, no_sync);
254
+ }
255
+
256
+ /**
257
+ * Starts the exit process for specific VTXOs.
258
+ * @param datadir Path to the data directory.
259
+ * @param mnemonic The wallet mnemonic phrase.
260
+ * @param vtxoIds Array of VtxoId strings to start exiting.
261
+ * @param no_sync Whether to skip syncing the wallet (Note: This might depend on potential C header updates). Defaults to false.
262
+ * @returns A promise resolving to a JSON status string.
263
+ */
264
+ function exitStartSpecific(datadir, mnemonic, vtxoIds, no_sync = false) {
265
+ // Passing no_sync, aligning with the TS/C++ interface definition, even if C header might differ
266
+ return NitroArkHybridObject.exitStartSpecific(datadir, mnemonic, vtxoIds, no_sync);
267
+ }
268
+
269
+ /**
270
+ * Starts the exit process for all VTXOs in the wallet.
271
+ * @param datadir Path to the data directory.
272
+ * @param mnemonic The wallet mnemonic phrase.
273
+ * @param no_sync Whether to skip syncing the wallet (Note: This might depend on potential C header updates). Defaults to false.
274
+ * @returns A promise resolving to a JSON status string.
275
+ */
276
+ function exitStartAll(datadir, mnemonic, no_sync = false) {
277
+ // Passing no_sync, aligning with the TS/C++ interface definition, even if C header might differ
278
+ return NitroArkHybridObject.exitStartAll(datadir, mnemonic, no_sync);
279
+ }
280
+
281
+ /**
282
+ * Progresses the exit process once and returns the current status.
283
+ * @param datadir Path to the data directory.
284
+ * @param mnemonic The wallet mnemonic phrase.
285
+ * @returns A promise resolving to a JSON status string.
286
+ */
287
+ function exitProgressOnce(datadir, mnemonic) {
288
+ return NitroArkHybridObject.exitProgressOnce(datadir, mnemonic);
289
+ }
290
+
291
+ // --- Re-export types and enums ---
292
+ //# sourceMappingURL=index.js.map