react-native-nitro-ark 0.0.15 → 0.0.17
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/NitroArk.hpp +105 -105
- package/cpp/bark-cpp.h +30 -227
- package/lib/module/index.js +89 -110
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NitroArk.nitro.d.ts +22 -19
- package/lib/typescript/src/NitroArk.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +59 -86
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.cpp +4 -1
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.hpp +23 -20
- package/package.json +1 -1
- package/src/NitroArk.nitro.ts +18 -65
- package/src/index.tsx +79 -203
package/cpp/NitroArk.hpp
CHANGED
|
@@ -53,15 +53,17 @@ namespace margelo::nitro::nitroark
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
std::shared_ptr<Promise<void>>
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
loadWallet(const std::string &datadir,
|
|
57
|
+
const BarkCreateOpts &opts) override
|
|
58
58
|
{
|
|
59
59
|
return Promise<void>::async([datadir, opts]()
|
|
60
60
|
{
|
|
61
61
|
// Keep fee rate value alive for the C call
|
|
62
62
|
std::optional<uint64_t> fallback_fee_rate_val;
|
|
63
|
-
if (opts.config.has_value() &&
|
|
64
|
-
|
|
63
|
+
if (opts.config.has_value() &&
|
|
64
|
+
opts.config->fallback_fee_rate.has_value()) {
|
|
65
|
+
fallback_fee_rate_val =
|
|
66
|
+
static_cast<uint64_t>(opts.config->fallback_fee_rate.value());
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
bark::bark_BarkConfigOpts config = {
|
|
@@ -89,8 +91,7 @@ namespace margelo::nitro::nitroark
|
|
|
89
91
|
opts.config->vtxo_refresh_expiry_threshold.value())
|
|
90
92
|
: 0,
|
|
91
93
|
fallback_fee_rate_val.has_value() ? &fallback_fee_rate_val.value()
|
|
92
|
-
: nullptr
|
|
93
|
-
};
|
|
94
|
+
: nullptr};
|
|
94
95
|
|
|
95
96
|
bark::bark_BarkCreateOpts barkOpts = {
|
|
96
97
|
opts.force.value_or(false),
|
|
@@ -104,21 +105,27 @@ namespace margelo::nitro::nitroark
|
|
|
104
105
|
config};
|
|
105
106
|
|
|
106
107
|
bark::bark_BarkError *error =
|
|
107
|
-
bark::
|
|
108
|
+
bark::bark_load_wallet(datadir.c_str(), barkOpts);
|
|
109
|
+
check_bark_error(error); });
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
std::shared_ptr<Promise<void>> closeWallet() override
|
|
113
|
+
{
|
|
114
|
+
return Promise<void>::async([]()
|
|
115
|
+
{
|
|
116
|
+
bark::bark_BarkError *error = bark::bark_close_wallet();
|
|
108
117
|
check_bark_error(error); });
|
|
109
118
|
}
|
|
110
119
|
|
|
111
120
|
// --- Wallet Info ---
|
|
112
121
|
|
|
113
122
|
std::shared_ptr<Promise<BarkBalance>>
|
|
114
|
-
getBalance(
|
|
115
|
-
const std::string &mnemonic) override
|
|
123
|
+
getBalance(bool no_sync) override
|
|
116
124
|
{
|
|
117
|
-
return Promise<BarkBalance>::async([
|
|
125
|
+
return Promise<BarkBalance>::async([no_sync]()
|
|
118
126
|
{
|
|
119
127
|
bark::bark_BarkBalance c_balance;
|
|
120
|
-
bark::bark_BarkError *error = bark::bark_get_balance(
|
|
121
|
-
datadir.c_str(), no_sync, mnemonic.c_str(), &c_balance);
|
|
128
|
+
bark::bark_BarkError *error = bark::bark_get_balance(no_sync, &c_balance);
|
|
122
129
|
check_bark_error(error);
|
|
123
130
|
|
|
124
131
|
return BarkBalance(static_cast<double>(c_balance.onchain),
|
|
@@ -127,14 +134,12 @@ namespace margelo::nitro::nitroark
|
|
|
127
134
|
}
|
|
128
135
|
|
|
129
136
|
std::shared_ptr<Promise<std::string>>
|
|
130
|
-
getOnchainAddress(
|
|
131
|
-
const std::string &mnemonic) override
|
|
137
|
+
getOnchainAddress() override
|
|
132
138
|
{
|
|
133
|
-
return Promise<std::string>::async([
|
|
139
|
+
return Promise<std::string>::async([]()
|
|
134
140
|
{
|
|
135
141
|
char *address_c = nullptr;
|
|
136
|
-
bark::bark_BarkError *error = bark::bark_get_onchain_address(
|
|
137
|
-
datadir.c_str(), mnemonic.c_str(), &address_c);
|
|
142
|
+
bark::bark_BarkError *error = bark::bark_get_onchain_address(&address_c);
|
|
138
143
|
check_bark_error(error);
|
|
139
144
|
if (address_c == nullptr) {
|
|
140
145
|
throw std::runtime_error("Bark-cpp error: getOnchainAddress returned "
|
|
@@ -146,14 +151,12 @@ namespace margelo::nitro::nitroark
|
|
|
146
151
|
}
|
|
147
152
|
|
|
148
153
|
std::shared_ptr<Promise<std::string>>
|
|
149
|
-
getOnchainUtxos(
|
|
150
|
-
bool no_sync) override
|
|
154
|
+
getOnchainUtxos(bool no_sync) override
|
|
151
155
|
{
|
|
152
|
-
return Promise<std::string>::async([
|
|
156
|
+
return Promise<std::string>::async([no_sync]()
|
|
153
157
|
{
|
|
154
158
|
char *json_c = nullptr;
|
|
155
|
-
bark::bark_BarkError *error = bark::bark_get_onchain_utxos(
|
|
156
|
-
datadir.c_str(), mnemonic.c_str(), no_sync, &json_c);
|
|
159
|
+
bark::bark_BarkError *error = bark::bark_get_onchain_utxos(no_sync, &json_c);
|
|
157
160
|
check_bark_error(error);
|
|
158
161
|
if (json_c == nullptr) {
|
|
159
162
|
throw std::runtime_error("Bark-cpp error: getOnchainUtxos returned "
|
|
@@ -165,14 +168,18 @@ namespace margelo::nitro::nitroark
|
|
|
165
168
|
}
|
|
166
169
|
|
|
167
170
|
std::shared_ptr<Promise<std::string>>
|
|
168
|
-
getVtxoPubkey(
|
|
169
|
-
const std::string &mnemonic) override
|
|
171
|
+
getVtxoPubkey(std::optional<double> index) override
|
|
170
172
|
{
|
|
171
|
-
return Promise<std::string>::async([
|
|
173
|
+
return Promise<std::string>::async([index]()
|
|
172
174
|
{
|
|
173
175
|
char *pubkey_c = nullptr;
|
|
176
|
+
std::optional<uint32_t> index_val;
|
|
177
|
+
if (index.has_value()) {
|
|
178
|
+
index_val = static_cast<uint32_t>(index.value());
|
|
179
|
+
}
|
|
180
|
+
|
|
174
181
|
bark::bark_BarkError *error = bark::bark_get_vtxo_pubkey(
|
|
175
|
-
|
|
182
|
+
index_val.has_value() ? &index_val.value() : nullptr, &pubkey_c);
|
|
176
183
|
check_bark_error(error);
|
|
177
184
|
if (pubkey_c == nullptr) {
|
|
178
185
|
throw std::runtime_error("Bark-cpp error: getVtxoPubkey returned "
|
|
@@ -183,15 +190,12 @@ namespace margelo::nitro::nitroark
|
|
|
183
190
|
return pubkey_str; });
|
|
184
191
|
}
|
|
185
192
|
|
|
186
|
-
std::shared_ptr<Promise<std::string>> getVtxos(
|
|
187
|
-
const std::string &mnemonic,
|
|
188
|
-
bool no_sync) override
|
|
193
|
+
std::shared_ptr<Promise<std::string>> getVtxos(bool no_sync) override
|
|
189
194
|
{
|
|
190
|
-
return Promise<std::string>::async([
|
|
195
|
+
return Promise<std::string>::async([no_sync]()
|
|
191
196
|
{
|
|
192
197
|
char *json_c = nullptr;
|
|
193
|
-
bark::bark_BarkError *error = bark::bark_get_vtxos(
|
|
194
|
-
datadir.c_str(), mnemonic.c_str(), no_sync, &json_c);
|
|
198
|
+
bark::bark_BarkError *error = bark::bark_get_vtxos(no_sync, &json_c);
|
|
195
199
|
check_bark_error(error);
|
|
196
200
|
if (json_c == nullptr) {
|
|
197
201
|
throw std::runtime_error(
|
|
@@ -205,17 +209,14 @@ namespace margelo::nitro::nitroark
|
|
|
205
209
|
// --- Onchain Operations ---
|
|
206
210
|
|
|
207
211
|
std::shared_ptr<Promise<std::string>>
|
|
208
|
-
sendOnchain(const std::string &
|
|
209
|
-
const std::string &destination, double amountSat,
|
|
212
|
+
sendOnchain(const std::string &destination, double amountSat,
|
|
210
213
|
bool no_sync) override
|
|
211
214
|
{
|
|
212
|
-
return Promise<std::string>::async([
|
|
213
|
-
amountSat, no_sync]()
|
|
215
|
+
return Promise<std::string>::async([destination, amountSat, no_sync]()
|
|
214
216
|
{
|
|
215
217
|
char *txid_c = nullptr;
|
|
216
218
|
bark::bark_BarkError *error = bark::bark_send_onchain(
|
|
217
|
-
|
|
218
|
-
static_cast<uint64_t>(amountSat), no_sync, &txid_c);
|
|
219
|
+
destination.c_str(), static_cast<uint64_t>(amountSat), no_sync, &txid_c);
|
|
219
220
|
check_bark_error(error);
|
|
220
221
|
if (txid_c == nullptr) {
|
|
221
222
|
throw std::runtime_error(
|
|
@@ -227,16 +228,14 @@ namespace margelo::nitro::nitroark
|
|
|
227
228
|
}
|
|
228
229
|
|
|
229
230
|
std::shared_ptr<Promise<std::string>>
|
|
230
|
-
drainOnchain(const std::string &
|
|
231
|
-
const std::string &destination, bool no_sync) override
|
|
231
|
+
drainOnchain(const std::string &destination, bool no_sync) override
|
|
232
232
|
{
|
|
233
233
|
return Promise<std::string>::async(
|
|
234
|
-
[
|
|
234
|
+
[destination, no_sync]()
|
|
235
235
|
{
|
|
236
236
|
char *txid_c = nullptr;
|
|
237
237
|
bark::bark_BarkError *error =
|
|
238
|
-
bark::bark_drain_onchain(
|
|
239
|
-
destination.c_str(), no_sync, &txid_c);
|
|
238
|
+
bark::bark_drain_onchain(destination.c_str(), no_sync, &txid_c);
|
|
240
239
|
check_bark_error(error);
|
|
241
240
|
if (txid_c == nullptr)
|
|
242
241
|
{
|
|
@@ -250,11 +249,10 @@ namespace margelo::nitro::nitroark
|
|
|
250
249
|
}
|
|
251
250
|
|
|
252
251
|
std::shared_ptr<Promise<std::string>>
|
|
253
|
-
sendManyOnchain(const std::
|
|
254
|
-
const std::vector<BarkSendManyOutput> &outputs,
|
|
252
|
+
sendManyOnchain(const std::vector<BarkSendManyOutput> &outputs,
|
|
255
253
|
bool no_sync) override
|
|
256
254
|
{
|
|
257
|
-
return Promise<std::string>::async([
|
|
255
|
+
return Promise<std::string>::async([outputs, no_sync]()
|
|
258
256
|
{
|
|
259
257
|
size_t num_outputs = outputs.size();
|
|
260
258
|
if (num_outputs == 0) {
|
|
@@ -268,16 +266,13 @@ namespace margelo::nitro::nitroark
|
|
|
268
266
|
amounts_c.reserve(num_outputs);
|
|
269
267
|
|
|
270
268
|
for (const auto &output : outputs) {
|
|
271
|
-
// --- FIX: Access directly, no .value() ---
|
|
272
269
|
destinations_c.push_back(output.destination.c_str());
|
|
273
270
|
amounts_c.push_back(static_cast<uint64_t>(output.amountSat));
|
|
274
|
-
// --- End FIX ---
|
|
275
271
|
}
|
|
276
272
|
|
|
277
273
|
char *txid_c = nullptr;
|
|
278
274
|
bark::bark_BarkError *error = bark::bark_send_many_onchain(
|
|
279
|
-
|
|
280
|
-
amounts_c.data(), num_outputs, no_sync, &txid_c);
|
|
275
|
+
destinations_c.data(), amounts_c.data(), num_outputs, no_sync, &txid_c);
|
|
281
276
|
check_bark_error(error);
|
|
282
277
|
if (txid_c == nullptr) {
|
|
283
278
|
throw std::runtime_error("Bark-cpp error: sendManyOnchain returned "
|
|
@@ -291,10 +286,9 @@ namespace margelo::nitro::nitroark
|
|
|
291
286
|
// --- Ark Operations ---
|
|
292
287
|
|
|
293
288
|
std::shared_ptr<Promise<std::string>>
|
|
294
|
-
refreshVtxos(const
|
|
295
|
-
const BarkRefreshOpts &refreshOpts, bool no_sync) override
|
|
289
|
+
refreshVtxos(const BarkRefreshOpts &refreshOpts, bool no_sync) override
|
|
296
290
|
{
|
|
297
|
-
return Promise<std::string>::async([
|
|
291
|
+
return Promise<std::string>::async([refreshOpts,
|
|
298
292
|
no_sync]()
|
|
299
293
|
{
|
|
300
294
|
bark::bark_BarkRefreshOpts c_opts;
|
|
@@ -355,8 +349,7 @@ namespace margelo::nitro::nitroark
|
|
|
355
349
|
|
|
356
350
|
// Make the C FFI call
|
|
357
351
|
char *status_c = nullptr;
|
|
358
|
-
bark::bark_BarkError *error = bark::bark_refresh_vtxos(
|
|
359
|
-
datadir.c_str(), mnemonic.c_str(), c_opts, no_sync, &status_c);
|
|
352
|
+
bark::bark_BarkError *error = bark::bark_refresh_vtxos(c_opts, no_sync, &status_c);
|
|
360
353
|
|
|
361
354
|
check_bark_error(error);
|
|
362
355
|
if (status_c == nullptr) {
|
|
@@ -370,17 +363,15 @@ namespace margelo::nitro::nitroark
|
|
|
370
363
|
return status_str; });
|
|
371
364
|
}
|
|
372
365
|
|
|
373
|
-
std::shared_ptr<Promise<std::string>> boardAmount(
|
|
374
|
-
const std::string &mnemonic,
|
|
375
|
-
double amountSat,
|
|
366
|
+
std::shared_ptr<Promise<std::string>> boardAmount(double amountSat,
|
|
376
367
|
bool no_sync) override
|
|
377
368
|
{
|
|
378
|
-
return Promise<std::string>::async([
|
|
369
|
+
return Promise<std::string>::async([amountSat,
|
|
379
370
|
no_sync]()
|
|
380
371
|
{
|
|
381
372
|
char *status_c = nullptr;
|
|
382
373
|
bark::bark_BarkError *error = bark::bark_board_amount(
|
|
383
|
-
|
|
374
|
+
static_cast<uint64_t>(amountSat),
|
|
384
375
|
no_sync, &status_c);
|
|
385
376
|
check_bark_error(error);
|
|
386
377
|
if (status_c == nullptr) {
|
|
@@ -392,15 +383,12 @@ namespace margelo::nitro::nitroark
|
|
|
392
383
|
return status_str; });
|
|
393
384
|
}
|
|
394
385
|
|
|
395
|
-
std::shared_ptr<Promise<std::string>> boardAll(
|
|
396
|
-
const std::string &mnemonic,
|
|
397
|
-
bool no_sync) override
|
|
386
|
+
std::shared_ptr<Promise<std::string>> boardAll(bool no_sync) override
|
|
398
387
|
{
|
|
399
|
-
return Promise<std::string>::async([
|
|
388
|
+
return Promise<std::string>::async([no_sync]()
|
|
400
389
|
{
|
|
401
390
|
char *status_c = nullptr;
|
|
402
|
-
bark::bark_BarkError *error = bark::bark_board_all(
|
|
403
|
-
datadir.c_str(), mnemonic.c_str(), no_sync, &status_c);
|
|
391
|
+
bark::bark_BarkError *error = bark::bark_board_all(no_sync, &status_c);
|
|
404
392
|
check_bark_error(error);
|
|
405
393
|
if (status_c == nullptr) {
|
|
406
394
|
throw std::runtime_error(
|
|
@@ -412,22 +400,16 @@ namespace margelo::nitro::nitroark
|
|
|
412
400
|
}
|
|
413
401
|
|
|
414
402
|
std::shared_ptr<Promise<std::string>>
|
|
415
|
-
send(const std::string &
|
|
416
|
-
const std::string &destination, double amountSat,
|
|
403
|
+
send(const std::string &destination, double amountSat,
|
|
417
404
|
const std::optional<std::string> &comment, bool no_sync) override
|
|
418
405
|
{
|
|
419
|
-
return Promise<std::string>::async([
|
|
406
|
+
return Promise<std::string>::async([destination,
|
|
420
407
|
amountSat, comment, no_sync]()
|
|
421
408
|
{
|
|
422
409
|
char *status_c = nullptr;
|
|
423
410
|
const char *comment_c = comment.has_value() ? comment->c_str() : nullptr;
|
|
424
|
-
// NOTE: bark_send in ffi.rs expects u64::MAX if amount is not provided.
|
|
425
|
-
// Here, amountSat (double) is always passed from TS. If you want to
|
|
426
|
-
// support sending MAX, the TS/Nitro interface needs adjustment (e.g.,
|
|
427
|
-
// optional amount). Assuming amountSat passed from TS is always the
|
|
428
|
-
// intended amount.
|
|
429
411
|
bark::bark_BarkError *error = bark::bark_send(
|
|
430
|
-
|
|
412
|
+
destination.c_str(),
|
|
431
413
|
static_cast<uint64_t>(amountSat), comment_c, no_sync, &status_c);
|
|
432
414
|
check_bark_error(error);
|
|
433
415
|
if (status_c == nullptr) {
|
|
@@ -440,16 +422,15 @@ namespace margelo::nitro::nitroark
|
|
|
440
422
|
}
|
|
441
423
|
|
|
442
424
|
std::shared_ptr<Promise<std::string>>
|
|
443
|
-
sendRoundOnchain(const std::string &
|
|
444
|
-
const std::string &destination, double amountSat,
|
|
425
|
+
sendRoundOnchain(const std::string &destination, double amountSat,
|
|
445
426
|
bool no_sync) override
|
|
446
427
|
{
|
|
447
428
|
return Promise<std::string>::async(
|
|
448
|
-
[
|
|
429
|
+
[destination, amountSat, no_sync]()
|
|
449
430
|
{
|
|
450
431
|
char *status_c = nullptr;
|
|
451
432
|
bark::bark_BarkError *error = bark::bark_send_round_onchain(
|
|
452
|
-
|
|
433
|
+
destination.c_str(),
|
|
453
434
|
static_cast<uint64_t>(amountSat), no_sync, &status_c);
|
|
454
435
|
check_bark_error(error);
|
|
455
436
|
if (status_c == nullptr)
|
|
@@ -463,16 +444,45 @@ namespace margelo::nitro::nitroark
|
|
|
463
444
|
});
|
|
464
445
|
}
|
|
465
446
|
|
|
447
|
+
// --- Lightning Operations ---
|
|
448
|
+
|
|
449
|
+
std::shared_ptr<Promise<std::string>>
|
|
450
|
+
bolt11Invoice(double amountMsat) override
|
|
451
|
+
{
|
|
452
|
+
return Promise<std::string>::async([amountMsat]()
|
|
453
|
+
{
|
|
454
|
+
char *invoice_c = nullptr;
|
|
455
|
+
bark::bark_BarkError *error = bark::bark_bolt11_invoice(
|
|
456
|
+
static_cast<uint64_t>(amountMsat),
|
|
457
|
+
&invoice_c);
|
|
458
|
+
check_bark_error(error);
|
|
459
|
+
if (invoice_c == nullptr) {
|
|
460
|
+
throw std::runtime_error("Bark-cpp error: bolt11Invoice returned "
|
|
461
|
+
"success but invoice is null");
|
|
462
|
+
}
|
|
463
|
+
std::string invoice_str(invoice_c);
|
|
464
|
+
bark::bark_free_string(invoice_c);
|
|
465
|
+
return invoice_str; });
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
std::shared_ptr<Promise<void>>
|
|
469
|
+
claimBolt11Payment(const std::string &bolt11) override
|
|
470
|
+
{
|
|
471
|
+
return Promise<void>::async([bolt11]()
|
|
472
|
+
{
|
|
473
|
+
bark::bark_BarkError *error = bark::bark_claim_bolt11_payment(bolt11.c_str());
|
|
474
|
+
check_bark_error(error); });
|
|
475
|
+
}
|
|
476
|
+
|
|
466
477
|
// --- Offboarding / Exiting ---
|
|
467
478
|
|
|
468
479
|
std::shared_ptr<Promise<std::string>>
|
|
469
|
-
offboardSpecific(const std::
|
|
470
|
-
const std::vector<std::string> &vtxoIds,
|
|
480
|
+
offboardSpecific(const std::vector<std::string> &vtxoIds,
|
|
471
481
|
const std::optional<std::string> &optionalAddress,
|
|
472
482
|
bool no_sync) override
|
|
473
483
|
{
|
|
474
484
|
return Promise<std::string>::async(
|
|
475
|
-
[
|
|
485
|
+
[vtxoIds, optionalAddress, no_sync]()
|
|
476
486
|
{
|
|
477
487
|
if (vtxoIds.empty())
|
|
478
488
|
{
|
|
@@ -490,7 +500,7 @@ namespace margelo::nitro::nitroark
|
|
|
490
500
|
char *status_c = nullptr;
|
|
491
501
|
|
|
492
502
|
bark::bark_BarkError *error = bark::bark_offboard_specific(
|
|
493
|
-
|
|
503
|
+
ids_c.data(), ids_c.size(),
|
|
494
504
|
addr_c, no_sync, &status_c);
|
|
495
505
|
check_bark_error(error);
|
|
496
506
|
if (status_c == nullptr)
|
|
@@ -505,18 +515,17 @@ namespace margelo::nitro::nitroark
|
|
|
505
515
|
}
|
|
506
516
|
|
|
507
517
|
std::shared_ptr<Promise<std::string>>
|
|
508
|
-
offboardAll(const std::
|
|
509
|
-
const std::optional<std::string> &optionalAddress,
|
|
518
|
+
offboardAll(const std::optional<std::string> &optionalAddress,
|
|
510
519
|
bool no_sync) override
|
|
511
520
|
{
|
|
512
|
-
return Promise<std::string>::async([
|
|
521
|
+
return Promise<std::string>::async([optionalAddress,
|
|
513
522
|
no_sync]()
|
|
514
523
|
{
|
|
515
524
|
const char *addr_c =
|
|
516
525
|
optionalAddress.has_value() ? optionalAddress->c_str() : nullptr;
|
|
517
526
|
char *status_c = nullptr;
|
|
518
527
|
bark::bark_BarkError *error = bark::bark_offboard_all(
|
|
519
|
-
|
|
528
|
+
addr_c, no_sync, &status_c);
|
|
520
529
|
check_bark_error(error);
|
|
521
530
|
if (status_c == nullptr) {
|
|
522
531
|
throw std::runtime_error(
|
|
@@ -528,11 +537,9 @@ namespace margelo::nitro::nitroark
|
|
|
528
537
|
}
|
|
529
538
|
|
|
530
539
|
std::shared_ptr<Promise<std::string>> exitStartSpecific(
|
|
531
|
-
const std::
|
|
532
|
-
const std::vector<std::string> &vtxoIds,
|
|
533
|
-
bool no_sync /* Potential C header mismatch noted */) override
|
|
540
|
+
const std::vector<std::string> &vtxoIds) override
|
|
534
541
|
{
|
|
535
|
-
return Promise<std::string>::async([
|
|
542
|
+
return Promise<std::string>::async([vtxoIds]()
|
|
536
543
|
{
|
|
537
544
|
if (vtxoIds.empty()) {
|
|
538
545
|
throw std::runtime_error(
|
|
@@ -545,10 +552,8 @@ namespace margelo::nitro::nitroark
|
|
|
545
552
|
}
|
|
546
553
|
char *status_c = nullptr;
|
|
547
554
|
|
|
548
|
-
// Call reflects C header (which might be missing no_sync)
|
|
549
555
|
bark::bark_BarkError *error =
|
|
550
|
-
bark::bark_exit_start_specific(
|
|
551
|
-
ids_c.data(), ids_c.size(), &status_c);
|
|
556
|
+
bark::bark_exit_start_specific(ids_c.data(), ids_c.size(), &status_c);
|
|
552
557
|
check_bark_error(error);
|
|
553
558
|
if (status_c == nullptr) {
|
|
554
559
|
throw std::runtime_error("Bark-cpp error: exitStartSpecific returned "
|
|
@@ -560,15 +565,12 @@ namespace margelo::nitro::nitroark
|
|
|
560
565
|
}
|
|
561
566
|
|
|
562
567
|
std::shared_ptr<Promise<std::string>>
|
|
563
|
-
exitStartAll(
|
|
564
|
-
bool no_sync /* Potential C header mismatch noted */) override
|
|
568
|
+
exitStartAll() override
|
|
565
569
|
{
|
|
566
|
-
return Promise<std::string>::async([
|
|
570
|
+
return Promise<std::string>::async([]()
|
|
567
571
|
{
|
|
568
572
|
char *status_c = nullptr;
|
|
569
|
-
|
|
570
|
-
bark::bark_BarkError *error = bark::bark_exit_start_all(
|
|
571
|
-
datadir.c_str(), mnemonic.c_str(), &status_c);
|
|
573
|
+
bark::bark_BarkError *error = bark::bark_exit_start_all(&status_c);
|
|
572
574
|
check_bark_error(error);
|
|
573
575
|
if (status_c == nullptr) {
|
|
574
576
|
throw std::runtime_error(
|
|
@@ -580,14 +582,12 @@ namespace margelo::nitro::nitroark
|
|
|
580
582
|
}
|
|
581
583
|
|
|
582
584
|
std::shared_ptr<Promise<std::string>>
|
|
583
|
-
exitProgressOnce(
|
|
584
|
-
const std::string &mnemonic) override
|
|
585
|
+
exitProgressOnce() override
|
|
585
586
|
{
|
|
586
|
-
return Promise<std::string>::async([
|
|
587
|
+
return Promise<std::string>::async([]()
|
|
587
588
|
{
|
|
588
589
|
char *status_c = nullptr;
|
|
589
|
-
bark::bark_BarkError *error = bark::bark_exit_progress_once(
|
|
590
|
-
datadir.c_str(), mnemonic.c_str(), &status_c);
|
|
590
|
+
bark::bark_BarkError *error = bark::bark_exit_progress_once(&status_c);
|
|
591
591
|
check_bark_error(error);
|
|
592
592
|
if (status_c == nullptr) {
|
|
593
593
|
throw std::runtime_error("Bark-cpp error: exitProgressOnce returned "
|