react-native-nitro-ark 0.0.10 → 0.0.11

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/cpp/bark-cpp.h CHANGED
@@ -8,374 +8,370 @@
8
8
  #include <cstdarg>
9
9
  #include <cstdint>
10
10
  #include <cstdlib>
11
- #include <new>
12
11
  #include <ostream>
12
+ #include <new>
13
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,
14
+ namespace bark
15
+ {
16
+
17
+ enum class bark_BarkRefreshModeType
18
+ {
19
+ DefaultThreshold,
20
+ ThresholdBlocks,
21
+ ThresholdHours,
22
+ Counterparty,
23
+ All,
24
+ Specific,
25
+ };
26
+
27
+ struct bark_BarkError
28
+ {
29
+ char *message;
30
+ };
31
+
32
+ struct bark_BarkConfigOpts
33
+ {
34
+ const char *asp;
35
+ const char *esplora;
36
+ const char *bitcoind;
37
+ const char *bitcoind_cookie;
38
+ const char *bitcoind_user;
39
+ const char *bitcoind_pass;
40
+ uint32_t vtxo_refresh_expiry_threshold;
41
+ const uint64_t *fallback_fee_rate;
42
+ };
43
+
44
+ struct bark_BarkCreateOpts
45
+ {
46
+ bool force;
47
+ bool regtest;
48
+ bool signet;
49
+ bool bitcoin;
50
+ const char *mnemonic;
51
+ uint32_t birthday_height;
52
+ bark_BarkConfigOpts config;
53
+ };
54
+
55
+ struct bark_BarkBalance
56
+ {
57
+ uint64_t onchain;
58
+ uint64_t offchain;
59
+ uint64_t pending_exit;
60
+ };
61
+
62
+ struct bark_BarkRefreshOpts
63
+ {
64
+ bark_BarkRefreshModeType mode_type;
65
+ uint32_t threshold_value;
66
+ const char *const *specific_vtxo_ids;
67
+ uintptr_t num_specific_vtxo_ids;
68
+ };
69
+
70
+ extern "C"
71
+ {
72
+
73
+ /// Initializes the logger for the library.
74
+ /// This should be called once when the library is loaded by the C/C++ application,
75
+ /// before any other library functions are used.
76
+ void bark_init_logger();
77
+
78
+ void bark_free_error(bark_BarkError *error);
79
+
80
+ const char *bark_error_message(const bark_BarkError *error);
81
+
82
+ /// Frees a C string allocated by a bark-cpp function.
83
+ ///
84
+ /// This function should be called by the C/C++ side on any `char*`
85
+ /// that was returned by functions like `bark_create_mnemonic`,
86
+ /// `bark_get_onchain_address`, `bark_send_onchain`, etc.
87
+ ///
88
+ /// # Safety
89
+ ///
90
+ /// The pointer `s` must have been previously allocated by Rust using
91
+ /// `CString::into_raw` or a similar mechanism within this library.
92
+ /// Calling this with a null pointer is safe (it does nothing).
93
+ /// Calling this with a pointer not allocated by this library, or calling
94
+ /// it more than once on the same pointer, results in undefined behavior.
95
+ void bark_free_string(char *s);
96
+
97
+ /// Create a new mnemonic
98
+ ///
99
+ /// @return The mnemonic string as a C string, or NULL on error
100
+ char *bark_create_mnemonic();
101
+
102
+ /// Create a new wallet at the specified directory
103
+ ///
104
+ /// @param datadir Path to the data directory
105
+ /// @param opts Creation options
106
+ /// @return Error pointer or NULL on success
107
+ bark_BarkError *bark_create_wallet(const char *datadir, bark_BarkCreateOpts opts);
108
+
109
+ /// Get offchain and onchain balances
110
+ ///
111
+ /// @param datadir Path to the data directory
112
+ /// @param no_sync Whether to skip syncing the wallet
113
+ /// @param balance_out Pointer to a BarkBalance struct where the result will be stored
114
+ /// @return Error pointer or NULL on success
115
+ bark_BarkError *bark_get_balance(const char *datadir,
116
+ bool no_sync,
117
+ const char *mnemonic,
118
+ bark_BarkBalance *balance_out);
119
+
120
+ /// Get an onchain address.
121
+ ///
122
+ /// The returned address string must be freed by the caller using `bark_free_string`.
123
+ ///
124
+ /// @param datadir Path to the data directory
125
+ /// @param mnemonic The wallet mnemonic phrase
126
+ /// @param address_out Pointer to a `*mut c_char` where the address string pointer will be written.
127
+ /// @return Error pointer or NULL on success.
128
+ bark_BarkError *bark_get_onchain_address(const char *datadir,
129
+ const char *mnemonic,
130
+ char **address_out);
131
+
132
+ /// Send funds using the onchain wallet.
133
+ ///
134
+ /// The returned transaction ID string must be freed by the caller using `bark_free_string`.
135
+ ///
136
+ /// @param datadir Path to the data directory
137
+ /// @param mnemonic The wallet mnemonic phrase
138
+ /// @param destination The destination Bitcoin address as a string
139
+ /// @param amount_sat The amount to send in satoshis
140
+ /// @param no_sync Whether to skip syncing the wallet before sending
141
+ /// @param txid_out Pointer to a `*mut c_char` where the transaction ID string pointer will be written.
142
+ /// @return Error pointer or NULL on success.
143
+ bark_BarkError *bark_send_onchain(const char *datadir,
144
+ const char *mnemonic,
145
+ const char *destination,
146
+ uint64_t amount_sat,
147
+ bool no_sync,
148
+ char **txid_out);
149
+
150
+ /// Send all funds from the onchain wallet to a destination address.
151
+ ///
152
+ /// The returned transaction ID string must be freed by the caller using `bark_free_string`.
153
+ ///
154
+ /// @param datadir Path to the data directory
155
+ /// @param mnemonic The wallet mnemonic phrase
156
+ /// @param destination The destination Bitcoin address as a string
157
+ /// @param no_sync Whether to skip syncing the wallet before sending
158
+ /// @param txid_out Pointer to a `*mut c_char` where the transaction ID string pointer will be written.
159
+ /// @return Error pointer or NULL on success.
160
+ bark_BarkError *bark_drain_onchain(const char *datadir,
176
161
  const char *mnemonic,
177
- const char *const *destinations,
178
- const uint64_t *amounts_sat,
179
- uintptr_t num_outputs, bool no_sync,
162
+ const char *destination,
163
+ bool no_sync,
180
164
  char **txid_out);
181
165
 
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,
166
+ /// Send funds to multiple recipients using the onchain wallet.
167
+ ///
168
+ /// The returned transaction ID string must be freed by the caller using `bark_free_string`.
169
+ ///
170
+ /// @param datadir Path to the data directory
171
+ /// @param mnemonic The wallet mnemonic phrase
172
+ /// @param destinations Array of C strings representing destination Bitcoin addresses
173
+ /// @param amounts_sat Array of u64 representing amounts in satoshis (must match destinations array length)
174
+ /// @param num_outputs The number of outputs (length of the destinations and amounts_sat arrays)
175
+ /// @param no_sync Whether to skip syncing the wallet before sending
176
+ /// @param txid_out Pointer to a `*mut c_char` where the transaction ID string pointer will be written.
177
+ /// @return Error pointer or NULL on success.
178
+ bark_BarkError *bark_send_many_onchain(const char *datadir,
179
+ const char *mnemonic,
180
+ const char *const *destinations,
181
+ const uint64_t *amounts_sat,
182
+ uintptr_t num_outputs,
183
+ bool no_sync,
184
+ char **txid_out);
185
+
186
+ /// Get the list of onchain UTXOs as a JSON string.
187
+ ///
188
+ /// The returned JSON string must be freed by the caller using `bark_free_string`.
189
+ ///
190
+ /// @param datadir Path to the data directory
191
+ /// @param mnemonic The wallet mnemonic phrase
192
+ /// @param no_sync Whether to skip syncing the wallet before fetching
193
+ /// @param utxos_json_out Pointer to a `*mut c_char` where the JSON string pointer will be written.
194
+ /// @return Error pointer or NULL on success.
195
+ bark_BarkError *bark_get_onchain_utxos(const char *datadir,
196
+ const char *mnemonic,
197
+ bool no_sync,
198
+ char **utxos_json_out);
199
+
200
+ /// Get the wallet's VTXO public key (hex string).
201
+ ///
202
+ /// The returned public key string must be freed by the caller using `bark_free_string`.
203
+ ///
204
+ /// @param datadir Path to the data directory
205
+ /// @param mnemonic The wallet mnemonic phrase
206
+ /// @param pubkey_hex_out Pointer to a `*mut c_char` where the hex string pointer will be written.
207
+ /// @return Error pointer or NULL on success.
208
+ bark_BarkError *bark_get_vtxo_pubkey(const char *datadir,
346
209
  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,
210
+ char **pubkey_hex_out);
211
+
212
+ /// Get the list of VTXOs as a JSON string.
213
+ ///
214
+ /// The returned JSON string must be freed by the caller using `bark_free_string`.
215
+ ///
216
+ /// @param datadir Path to the data directory
217
+ /// @param mnemonic The wallet mnemonic phrase
218
+ /// @param no_sync Whether to skip syncing the wallet before fetching
219
+ /// @param vtxos_json_out Pointer to a `*mut c_char` where the JSON string pointer will be written.
220
+ /// @return Error pointer or NULL on success.
221
+ bark_BarkError *bark_get_vtxos(const char *datadir,
222
+ const char *mnemonic,
223
+ bool no_sync,
224
+ char **vtxos_json_out);
225
+
226
+ /// Refresh VTXOs based on specified criteria.
227
+ ///
228
+ /// The returned JSON status string must be freed by the caller using `bark_free_string`.
229
+ ///
230
+ /// @param datadir Path to the data directory
231
+ /// @param mnemonic The wallet mnemonic phrase
232
+ /// @param refresh_opts Options specifying which VTXOs to refresh
233
+ /// @param no_sync Whether to skip syncing the wallet before refreshing
234
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON status string will be written.
235
+ /// @return Error pointer or NULL on success.
236
+ bark_BarkError *bark_refresh_vtxos(const char *datadir,
237
+ const char *mnemonic,
238
+ bark_BarkRefreshOpts refresh_opts,
239
+ bool no_sync,
240
+ char **status_json_out);
241
+
242
+ /// Board a specific amount from the onchain wallet into Ark.
243
+ ///
244
+ /// The returned JSON status string must be freed by the caller using `bark_free_string`.
245
+ ///
246
+ /// @param datadir Path to the data directory
247
+ /// @param mnemonic The wallet mnemonic phrase
248
+ /// @param amount_sat The amount in satoshis to board
249
+ /// @param no_sync Whether to skip syncing the onchain wallet before boarding
250
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON status string will be written.
251
+ /// @return Error pointer or NULL on success.
252
+ bark_BarkError *bark_board_amount(const char *datadir,
253
+ const char *mnemonic,
254
+ uint64_t amount_sat,
255
+ bool no_sync,
256
+ char **status_json_out);
257
+
258
+ /// Board all available funds from the onchain wallet into Ark.
259
+ ///
260
+ /// The returned JSON status string must be freed by the caller using `bark_free_string`.
261
+ ///
262
+ /// @param datadir Path to the data directory
263
+ /// @param mnemonic The wallet mnemonic phrase
264
+ /// @param no_sync Whether to skip syncing the onchain wallet before boarding
265
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON status string will be written.
266
+ /// @return Error pointer or NULL on success.
267
+ bark_BarkError *bark_board_all(const char *datadir,
268
+ const char *mnemonic,
269
+ bool no_sync,
270
+ char **status_json_out);
271
+
272
+ bark_BarkError *bark_send(const char *datadir,
273
+ const char *mnemonic,
274
+ const char *destination,
275
+ uint64_t amount_sat,
276
+ const char *comment,
277
+ bool no_sync,
278
+ char **status_json_out);
279
+
280
+ /// Send an onchain payment via an Ark round.
281
+ ///
282
+ /// The returned JSON status string must be freed by the caller using `bark_free_string`.
283
+ ///
284
+ /// @param datadir Path to the data directory
285
+ /// @param mnemonic The wallet mnemonic phrase
286
+ /// @param destination The destination Bitcoin address as a string
287
+ /// @param amount_sat The amount in satoshis to send
288
+ /// @param no_sync Whether to skip syncing the wallet before sending
289
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON status string will be written.
290
+ /// @return Error pointer or NULL on success.
291
+ bark_BarkError *bark_send_round_onchain(const char *datadir,
292
+ const char *mnemonic,
293
+ const char *destination,
294
+ uint64_t amount_sat,
295
+ bool no_sync,
296
+ char **status_json_out);
297
+
298
+ /// Offboard specific VTXOs to an optional onchain address.
299
+ ///
300
+ /// The returned JSON result string must be freed by the caller using `bark_free_string`.
301
+ ///
302
+ /// @param datadir Path to the data directory
303
+ /// @param mnemonic The wallet mnemonic phrase
304
+ /// @param specific_vtxo_ids Array of VtxoId strings (cannot be empty)
305
+ /// @param num_specific_vtxo_ids Number of VtxoIds in the array
306
+ /// @param optional_address Optional destination Bitcoin address (pass NULL if not provided)
307
+ /// @param no_sync Whether to skip syncing the wallet
308
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON result string will be written.
309
+ /// @return Error pointer or NULL on success.
310
+ bark_BarkError *bark_offboard_specific(const char *datadir,
311
+ const char *mnemonic,
312
+ const char *const *specific_vtxo_ids,
313
+ uintptr_t num_specific_vtxo_ids,
314
+ const char *optional_address,
315
+ bool no_sync,
316
+ char **status_json_out);
317
+
318
+ /// Offboard all VTXOs to an optional onchain address.
319
+ ///
320
+ /// The returned JSON result string must be freed by the caller using `bark_free_string`.
321
+ ///
322
+ /// @param datadir Path to the data directory
323
+ /// @param mnemonic The wallet mnemonic phrase
324
+ /// @param optional_address Optional destination Bitcoin address (pass NULL if 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 string will be written.
327
+ /// @return Error pointer or NULL on success.
328
+ bark_BarkError *bark_offboard_all(const char *datadir,
329
+ const char *mnemonic,
330
+ const char *optional_address,
331
+ bool no_sync,
332
+ char **status_json_out);
333
+
334
+ /// Start the exit process for specific VTXOs.
335
+ ///
336
+ /// The returned JSON success string must be freed by the caller using `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 string will be written.
343
+ /// @return Error pointer or NULL on success.
344
+ bark_BarkError *bark_exit_start_specific(const char *datadir,
345
+ const char *mnemonic,
346
+ const char *const *specific_vtxo_ids,
347
+ uintptr_t num_specific_vtxo_ids,
348
+ char **status_json_out);
349
+
350
+ /// Start the exit process for all VTXOs in the wallet.
351
+ ///
352
+ /// The returned JSON success string must be freed by the caller using `bark_free_string`.
353
+ ///
354
+ /// @param datadir Path to the data directory
355
+ /// @param mnemonic The wallet mnemonic phrase
356
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON success string will be written.
357
+ /// @return Error pointer or NULL on success.
358
+ bark_BarkError *bark_exit_start_all(const char *datadir,
375
359
  const char *mnemonic,
376
360
  char **status_json_out);
377
361
 
378
- } // extern "C"
362
+ /// Progress the exit process once and return the current status.
363
+ ///
364
+ /// The returned JSON status string must be freed by the caller using `bark_free_string`.
365
+ ///
366
+ /// @param datadir Path to the data directory
367
+ /// @param mnemonic The wallet mnemonic phrase
368
+ /// @param status_json_out Pointer to a `*mut c_char` where the JSON status string will be written.
369
+ /// @return Error pointer or NULL on success.
370
+ bark_BarkError *bark_exit_progress_once(const char *datadir,
371
+ const char *mnemonic,
372
+ char **status_json_out);
373
+
374
+ } // extern "C"
379
375
 
380
376
  } // namespace bark
381
377