@secondts/bark-react-native 0.4.1 → 0.5.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.
- package/README.md +1 -1
- package/cpp/generated/bark.cpp +632 -5
- package/cpp/generated/bark.hpp +10 -0
- package/lib/commonjs/Logger.js +48 -0
- package/lib/commonjs/Logger.js.map +1 -0
- package/lib/commonjs/generated/bark-ffi.js.map +1 -1
- package/lib/commonjs/generated/bark.js +187 -4
- package/lib/commonjs/generated/bark.js.map +1 -1
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/Logger.js +43 -0
- package/lib/module/Logger.js.map +1 -0
- package/lib/module/generated/bark-ffi.js.map +1 -1
- package/lib/module/generated/bark.js +186 -4
- package/lib/module/generated/bark.js.map +1 -1
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/Logger.d.ts +18 -0
- package/lib/typescript/commonjs/src/Logger.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts +17 -1
- package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/generated/bark.d.ts +79 -2
- package/lib/typescript/commonjs/src/generated/bark.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/Logger.d.ts +18 -0
- package/lib/typescript/module/src/Logger.d.ts.map +1 -0
- package/lib/typescript/module/src/generated/bark-ffi.d.ts +17 -1
- package/lib/typescript/module/src/generated/bark-ffi.d.ts.map +1 -1
- package/lib/typescript/module/src/generated/bark.d.ts +79 -2
- package/lib/typescript/module/src/generated/bark.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +1 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/Logger.ts +42 -0
- package/src/generated/bark-ffi.ts +37 -1
- package/src/generated/bark.ts +333 -2
- package/src/index.tsx +3 -0
package/cpp/generated/bark.cpp
CHANGED
|
@@ -130,6 +130,14 @@ extern "C" {
|
|
|
130
130
|
UniffiForeignFutureResultVoid result
|
|
131
131
|
);
|
|
132
132
|
typedef void
|
|
133
|
+
(*UniffiCallbackInterfaceBarkLoggerMethod0)(
|
|
134
|
+
uint64_t uniffi_handle,
|
|
135
|
+
RustBuffer level,
|
|
136
|
+
RustBuffer target,
|
|
137
|
+
RustBuffer message,
|
|
138
|
+
void * uniffi_out_return, RustCallStatus* rust_call_status
|
|
139
|
+
);
|
|
140
|
+
typedef void
|
|
133
141
|
(*UniffiCallbackInterfaceCustomOnchainWalletCallbacksMethod0)(
|
|
134
142
|
uint64_t uniffi_handle,
|
|
135
143
|
uint64_t * uniffi_out_return, RustCallStatus* rust_call_status
|
|
@@ -183,7 +191,11 @@ extern "C" {
|
|
|
183
191
|
uint64_t uniffi_handle,
|
|
184
192
|
RustBuffer tx_hex,
|
|
185
193
|
void * uniffi_out_return, RustCallStatus* rust_call_status
|
|
186
|
-
);typedef struct
|
|
194
|
+
);typedef struct UniffiVTableCallbackInterfaceBarkLogger {
|
|
195
|
+
UniffiCallbackInterfaceFree uniffi_free;
|
|
196
|
+
UniffiCallbackInterfaceClone uniffi_clone;
|
|
197
|
+
UniffiCallbackInterfaceBarkLoggerMethod0 log;
|
|
198
|
+
} UniffiVTableCallbackInterfaceBarkLogger;typedef struct UniffiVTableCallbackInterfaceCustomOnchainWalletCallbacks {
|
|
187
199
|
UniffiCallbackInterfaceFree uniffi_free;
|
|
188
200
|
UniffiCallbackInterfaceClone uniffi_clone;
|
|
189
201
|
UniffiCallbackInterfaceCustomOnchainWalletCallbacksMethod0 get_balance;
|
|
@@ -269,6 +281,12 @@ extern "C" {
|
|
|
269
281
|
RustBuffer config,
|
|
270
282
|
RustBuffer datadir
|
|
271
283
|
);
|
|
284
|
+
/*handle*/ uint64_t uniffi_bark_ffi_fn_constructor_wallet_open_with_daemon(
|
|
285
|
+
RustBuffer mnemonic,
|
|
286
|
+
RustBuffer config,
|
|
287
|
+
RustBuffer datadir,
|
|
288
|
+
RustBuffer onchain_wallet
|
|
289
|
+
);
|
|
272
290
|
/*handle*/ uint64_t uniffi_bark_ffi_fn_constructor_wallet_open_with_onchain(
|
|
273
291
|
RustBuffer mnemonic,
|
|
274
292
|
RustBuffer config,
|
|
@@ -298,7 +316,8 @@ extern "C" {
|
|
|
298
316
|
);
|
|
299
317
|
/*handle*/ uint64_t uniffi_bark_ffi_fn_method_wallet_bolt11_invoice(
|
|
300
318
|
/*handle*/ uint64_t ptr,
|
|
301
|
-
uint64_t amount_sats
|
|
319
|
+
uint64_t amount_sats,
|
|
320
|
+
RustBuffer description
|
|
302
321
|
);
|
|
303
322
|
/*handle*/ uint64_t uniffi_bark_ffi_fn_method_wallet_broadcast_tx(
|
|
304
323
|
/*handle*/ uint64_t ptr,
|
|
@@ -541,6 +560,10 @@ extern "C" {
|
|
|
541
560
|
/*handle*/ uint64_t ptr,
|
|
542
561
|
RustBuffer vtxo_ids
|
|
543
562
|
);
|
|
563
|
+
/*handle*/ uint64_t uniffi_bark_ffi_fn_method_wallet_run_daemon(
|
|
564
|
+
/*handle*/ uint64_t ptr,
|
|
565
|
+
RustBuffer onchain_wallet
|
|
566
|
+
);
|
|
544
567
|
/*handle*/ uint64_t uniffi_bark_ffi_fn_method_wallet_send_arkoor_payment(
|
|
545
568
|
/*handle*/ uint64_t ptr,
|
|
546
569
|
RustBuffer ark_address,
|
|
@@ -565,6 +588,9 @@ extern "C" {
|
|
|
565
588
|
/*handle*/ uint64_t ptr,
|
|
566
589
|
RustBuffer vtxo_ids
|
|
567
590
|
);
|
|
591
|
+
/*handle*/ uint64_t uniffi_bark_ffi_fn_method_wallet_stop_daemon(
|
|
592
|
+
/*handle*/ uint64_t ptr
|
|
593
|
+
);
|
|
568
594
|
/*handle*/ uint64_t uniffi_bark_ffi_fn_method_wallet_sync(
|
|
569
595
|
/*handle*/ uint64_t ptr
|
|
570
596
|
);
|
|
@@ -591,6 +617,9 @@ extern "C" {
|
|
|
591
617
|
/*handle*/ uint64_t uniffi_bark_ffi_fn_method_wallet_vtxos(
|
|
592
618
|
/*handle*/ uint64_t ptr
|
|
593
619
|
);
|
|
620
|
+
void uniffi_bark_ffi_fn_init_callback_vtable_barklogger(
|
|
621
|
+
UniffiVTableCallbackInterfaceBarkLogger * vtable
|
|
622
|
+
);
|
|
594
623
|
void uniffi_bark_ffi_fn_init_callback_vtable_customonchainwalletcallbacks(
|
|
595
624
|
UniffiVTableCallbackInterfaceCustomOnchainWalletCallbacks * vtable
|
|
596
625
|
);
|
|
@@ -600,6 +629,11 @@ extern "C" {
|
|
|
600
629
|
);
|
|
601
630
|
RustBuffer uniffi_bark_ffi_fn_func_generate_mnemonic(RustCallStatus *uniffi_out_err
|
|
602
631
|
);
|
|
632
|
+
void uniffi_bark_ffi_fn_func_set_logger(
|
|
633
|
+
uint64_t logger,
|
|
634
|
+
RustBuffer max_level,
|
|
635
|
+
RustCallStatus *uniffi_out_err
|
|
636
|
+
);
|
|
603
637
|
int8_t uniffi_bark_ffi_fn_func_validate_ark_address(
|
|
604
638
|
RustBuffer address,
|
|
605
639
|
RustCallStatus *uniffi_out_err
|
|
@@ -809,6 +843,8 @@ extern "C" {
|
|
|
809
843
|
);
|
|
810
844
|
uint16_t uniffi_bark_ffi_checksum_func_generate_mnemonic(
|
|
811
845
|
);
|
|
846
|
+
uint16_t uniffi_bark_ffi_checksum_func_set_logger(
|
|
847
|
+
);
|
|
812
848
|
uint16_t uniffi_bark_ffi_checksum_func_validate_ark_address(
|
|
813
849
|
);
|
|
814
850
|
uint16_t uniffi_bark_ffi_checksum_func_validate_mnemonic(
|
|
@@ -967,6 +1003,8 @@ extern "C" {
|
|
|
967
1003
|
);
|
|
968
1004
|
uint16_t uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_delegated(
|
|
969
1005
|
);
|
|
1006
|
+
uint16_t uniffi_bark_ffi_checksum_method_wallet_run_daemon(
|
|
1007
|
+
);
|
|
970
1008
|
uint16_t uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment(
|
|
971
1009
|
);
|
|
972
1010
|
uint16_t uniffi_bark_ffi_checksum_method_wallet_send_onchain(
|
|
@@ -979,6 +1017,8 @@ extern "C" {
|
|
|
979
1017
|
);
|
|
980
1018
|
uint16_t uniffi_bark_ffi_checksum_method_wallet_start_exit_for_vtxos(
|
|
981
1019
|
);
|
|
1020
|
+
uint16_t uniffi_bark_ffi_checksum_method_wallet_stop_daemon(
|
|
1021
|
+
);
|
|
982
1022
|
uint16_t uniffi_bark_ffi_checksum_method_wallet_sync(
|
|
983
1023
|
);
|
|
984
1024
|
uint16_t uniffi_bark_ffi_checksum_method_wallet_sync_exits(
|
|
@@ -1003,8 +1043,12 @@ extern "C" {
|
|
|
1003
1043
|
);
|
|
1004
1044
|
uint16_t uniffi_bark_ffi_checksum_constructor_wallet_open(
|
|
1005
1045
|
);
|
|
1046
|
+
uint16_t uniffi_bark_ffi_checksum_constructor_wallet_open_with_daemon(
|
|
1047
|
+
);
|
|
1006
1048
|
uint16_t uniffi_bark_ffi_checksum_constructor_wallet_open_with_onchain(
|
|
1007
1049
|
);
|
|
1050
|
+
uint16_t uniffi_bark_ffi_checksum_method_barklogger_log(
|
|
1051
|
+
);
|
|
1008
1052
|
uint16_t uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_get_balance(
|
|
1009
1053
|
);
|
|
1010
1054
|
uint16_t uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_prepare_tx(
|
|
@@ -1483,6 +1527,121 @@ namespace uniffi::bark::cb::foreignfuturedroppedcallback {
|
|
|
1483
1527
|
// Implementation of free callback function CallbackInterfaceFree
|
|
1484
1528
|
|
|
1485
1529
|
|
|
1530
|
+
// Callback function: uniffi::bark::st::vtablecallbackinterfacebarklogger::vtablecallbackinterfacebarklogger::free::UniffiCallbackInterfaceFree
|
|
1531
|
+
//
|
|
1532
|
+
// We have the following constraints:
|
|
1533
|
+
// - we need to pass a function pointer to Rust.
|
|
1534
|
+
// - we need a jsi::Runtime and jsi::Function to call into JS.
|
|
1535
|
+
// - function pointers can't store state, so we can't use a lamda.
|
|
1536
|
+
//
|
|
1537
|
+
// For this, we store a lambda as a global, as `rsLambda`. The `callback` function calls
|
|
1538
|
+
// the lambda, which itself calls the `body` which then calls into JS.
|
|
1539
|
+
//
|
|
1540
|
+
// We then give the `callback` function pointer to Rust which will call the lambda sometime in the
|
|
1541
|
+
// future.
|
|
1542
|
+
namespace uniffi::bark::st::vtablecallbackinterfacebarklogger::vtablecallbackinterfacebarklogger::free {
|
|
1543
|
+
using namespace facebook;
|
|
1544
|
+
|
|
1545
|
+
// We need to store a lambda in a global so we can call it from
|
|
1546
|
+
// a function pointer. The function pointer is passed to Rust.
|
|
1547
|
+
static std::function<void(uint64_t)> rsLambda = nullptr;
|
|
1548
|
+
|
|
1549
|
+
// This is the main body of the callback. It's called from the lambda,
|
|
1550
|
+
// which itself is called from the callback function which is passed to Rust.
|
|
1551
|
+
static void body(jsi::Runtime &rt,
|
|
1552
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
1553
|
+
std::shared_ptr<jsi::Value> callbackValue
|
|
1554
|
+
,uint64_t rs_handle) {
|
|
1555
|
+
|
|
1556
|
+
// Convert the arguments from Rust, into jsi::Values.
|
|
1557
|
+
// We'll use the Bridging class to do this…
|
|
1558
|
+
auto js_handle = uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_handle);
|
|
1559
|
+
|
|
1560
|
+
// Now we are ready to call the callback.
|
|
1561
|
+
// We are already on the JS thread, because this `body` function was
|
|
1562
|
+
// invoked from the CallInvoker.
|
|
1563
|
+
try {
|
|
1564
|
+
// Getting the callback function
|
|
1565
|
+
auto cb = callbackValue->asObject(rt).asFunction(rt);
|
|
1566
|
+
auto uniffiResult = cb.call(rt, js_handle
|
|
1567
|
+
);
|
|
1568
|
+
|
|
1569
|
+
|
|
1570
|
+
|
|
1571
|
+
|
|
1572
|
+
} catch (const jsi::JSError &error) {
|
|
1573
|
+
std::cout << "Error in callback UniffiCallbackInterfaceFree: "
|
|
1574
|
+
<< error.what() << std::endl;
|
|
1575
|
+
throw error;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
static void callback(uint64_t rs_handle) {
|
|
1580
|
+
// If the runtime has shutdown, then there is no point in trying to
|
|
1581
|
+
// call into Javascript. BUT how do we tell if the runtime has shutdown?
|
|
1582
|
+
//
|
|
1583
|
+
// Answer: the module destructor calls into callback `cleanup` method,
|
|
1584
|
+
// which nulls out the rsLamda.
|
|
1585
|
+
//
|
|
1586
|
+
// If rsLamda is null, then there is no runtime to call into.
|
|
1587
|
+
if (rsLambda == nullptr) {
|
|
1588
|
+
// This only occurs when destructors are calling into Rust free/drop,
|
|
1589
|
+
// which causes the JS callback to be dropped.
|
|
1590
|
+
return;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
// The runtime, the actual callback jsi::funtion, and the callInvoker
|
|
1594
|
+
// are all in the lambda.
|
|
1595
|
+
rsLambda(
|
|
1596
|
+
rs_handle);
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
[[maybe_unused]] static UniffiCallbackInterfaceFree
|
|
1600
|
+
makeCallbackFunction( // uniffi::bark::st::vtablecallbackinterfacebarklogger::vtablecallbackinterfacebarklogger::free
|
|
1601
|
+
jsi::Runtime &rt,
|
|
1602
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
1603
|
+
const jsi::Value &value) {
|
|
1604
|
+
if (rsLambda != nullptr) {
|
|
1605
|
+
// `makeCallbackFunction` is called in two circumstances:
|
|
1606
|
+
//
|
|
1607
|
+
// 1. at startup, when initializing callback interface vtables.
|
|
1608
|
+
// 2. when polling futures. This happens at least once per future that is
|
|
1609
|
+
// exposed to Javascript. We know that this is always the same function,
|
|
1610
|
+
// `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
|
|
1611
|
+
//
|
|
1612
|
+
// We can therefore return the callback function without making anything
|
|
1613
|
+
// new if we've been initialized already.
|
|
1614
|
+
return callback;
|
|
1615
|
+
}
|
|
1616
|
+
auto callbackFunction = value.asObject(rt).asFunction(rt);
|
|
1617
|
+
auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
|
|
1618
|
+
rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_handle) {
|
|
1619
|
+
// We immediately make a lambda which will do the work of transforming the
|
|
1620
|
+
// arguments into JSI values and calling the callback.
|
|
1621
|
+
uniffi_runtime::UniffiCallFunc jsLambda = [
|
|
1622
|
+
callInvoker,
|
|
1623
|
+
callbackValue
|
|
1624
|
+
, rs_handle](jsi::Runtime &rt) mutable {
|
|
1625
|
+
body(rt, callInvoker, callbackValue
|
|
1626
|
+
, rs_handle);
|
|
1627
|
+
};
|
|
1628
|
+
// We'll then call that lambda from the callInvoker which will
|
|
1629
|
+
// look after calling it on the correct thread.
|
|
1630
|
+
|
|
1631
|
+
callInvoker->invokeNonBlocking(rt, jsLambda);
|
|
1632
|
+
};
|
|
1633
|
+
return callback;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
// This method is called from the destructor of NativeBark, which only happens
|
|
1637
|
+
// when the jsi::Runtime is being destroyed.
|
|
1638
|
+
static void cleanup() {
|
|
1639
|
+
// The lambda holds a reference to the the Runtime, so when this is nulled out,
|
|
1640
|
+
// then the pointer will no longer be left dangling.
|
|
1641
|
+
rsLambda = nullptr;
|
|
1642
|
+
}
|
|
1643
|
+
} // namespace uniffi::bark::st::vtablecallbackinterfacebarklogger::vtablecallbackinterfacebarklogger::free
|
|
1644
|
+
|
|
1486
1645
|
// Callback function: uniffi::bark::st::vtablecallbackinterfacecustomonchainwalletcallbacks::vtablecallbackinterfacecustomonchainwalletcallbacks::free::UniffiCallbackInterfaceFree
|
|
1487
1646
|
//
|
|
1488
1647
|
// We have the following constraints:
|
|
@@ -2514,6 +2673,309 @@ template <> struct Bridging<UniffiForeignFutureCompleteVoid> {
|
|
|
2514
2673
|
return jsi::Value::undefined();
|
|
2515
2674
|
}
|
|
2516
2675
|
};
|
|
2676
|
+
} // namespace uniffi::bark
|
|
2677
|
+
// Implementation of CallbackInterfaceClone for vtable field uniffi_clone in VTableCallbackInterfaceBarkLogger
|
|
2678
|
+
|
|
2679
|
+
|
|
2680
|
+
// Callback function: uniffi::bark::cb::callbackinterfaceclone::vtablecallbackinterfacebarklogger::UniffiCallbackInterfaceClone
|
|
2681
|
+
//
|
|
2682
|
+
// We have the following constraints:
|
|
2683
|
+
// - we need to pass a function pointer to Rust.
|
|
2684
|
+
// - we need a jsi::Runtime and jsi::Function to call into JS.
|
|
2685
|
+
// - function pointers can't store state, so we can't use a lamda.
|
|
2686
|
+
//
|
|
2687
|
+
// For this, we store a lambda as a global, as `rsLambda`. The `callback` function calls
|
|
2688
|
+
// the lambda, which itself calls the `body` which then calls into JS.
|
|
2689
|
+
//
|
|
2690
|
+
// We then give the `callback` function pointer to Rust which will call the lambda sometime in the
|
|
2691
|
+
// future.
|
|
2692
|
+
namespace uniffi::bark::cb::callbackinterfaceclone::vtablecallbackinterfacebarklogger {
|
|
2693
|
+
using namespace facebook;
|
|
2694
|
+
|
|
2695
|
+
// We need to store a lambda in a global so we can call it from
|
|
2696
|
+
// a function pointer. The function pointer is passed to Rust.
|
|
2697
|
+
static std::function<void(uint64_t, uint64_t*)> rsLambda = nullptr;
|
|
2698
|
+
|
|
2699
|
+
// This is the main body of the callback. It's called from the lambda,
|
|
2700
|
+
// which itself is called from the callback function which is passed to Rust.
|
|
2701
|
+
static void body(jsi::Runtime &rt,
|
|
2702
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
2703
|
+
std::shared_ptr<jsi::Value> callbackValue
|
|
2704
|
+
,uint64_t rs_handle
|
|
2705
|
+
, uint64_t* uniffi_direct_return) {
|
|
2706
|
+
|
|
2707
|
+
// Convert the arguments from Rust, into jsi::Values.
|
|
2708
|
+
// We'll use the Bridging class to do this…
|
|
2709
|
+
auto js_handle = uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_handle);
|
|
2710
|
+
|
|
2711
|
+
// Now we are ready to call the callback.
|
|
2712
|
+
// We are already on the JS thread, because this `body` function was
|
|
2713
|
+
// invoked from the CallInvoker.
|
|
2714
|
+
try {
|
|
2715
|
+
// Getting the callback function
|
|
2716
|
+
auto cb = callbackValue->asObject(rt).asFunction(rt);
|
|
2717
|
+
auto uniffiResult = cb.call(rt, js_handle
|
|
2718
|
+
);
|
|
2719
|
+
|
|
2720
|
+
|
|
2721
|
+
|
|
2722
|
+
|
|
2723
|
+
// Write the direct return value back to the caller.
|
|
2724
|
+
if (uniffi_direct_return != nullptr) {
|
|
2725
|
+
*uniffi_direct_return = uniffi_jsi::Bridging<uint64_t>::fromJs(
|
|
2726
|
+
rt, callInvoker, uniffiResult
|
|
2727
|
+
);
|
|
2728
|
+
}
|
|
2729
|
+
} catch (const jsi::JSError &error) {
|
|
2730
|
+
std::cout << "Error in callback UniffiCallbackInterfaceClone: "
|
|
2731
|
+
<< error.what() << std::endl;
|
|
2732
|
+
throw error;
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
static uint64_t callback(uint64_t rs_handle) {
|
|
2737
|
+
// If the runtime has shutdown, then there is no point in trying to
|
|
2738
|
+
// call into Javascript. BUT how do we tell if the runtime has shutdown?
|
|
2739
|
+
//
|
|
2740
|
+
// Answer: the module destructor calls into callback `cleanup` method,
|
|
2741
|
+
// which nulls out the rsLamda.
|
|
2742
|
+
//
|
|
2743
|
+
// If rsLamda is null, then there is no runtime to call into.
|
|
2744
|
+
if (rsLambda == nullptr) {
|
|
2745
|
+
// This only occurs when destructors are calling into Rust free/drop,
|
|
2746
|
+
// which causes the JS callback to be dropped.
|
|
2747
|
+
return 0;
|
|
2748
|
+
}
|
|
2749
|
+
uint64_t uniffi_result = 0;
|
|
2750
|
+
|
|
2751
|
+
// The runtime, the actual callback jsi::funtion, and the callInvoker
|
|
2752
|
+
// are all in the lambda.
|
|
2753
|
+
rsLambda(
|
|
2754
|
+
rs_handle,
|
|
2755
|
+
&uniffi_result);
|
|
2756
|
+
return uniffi_result;
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2759
|
+
[[maybe_unused]] static UniffiCallbackInterfaceClone
|
|
2760
|
+
makeCallbackFunction( // uniffi::bark::cb::callbackinterfaceclone::vtablecallbackinterfacebarklogger
|
|
2761
|
+
jsi::Runtime &rt,
|
|
2762
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
2763
|
+
const jsi::Value &value) {
|
|
2764
|
+
if (rsLambda != nullptr) {
|
|
2765
|
+
// `makeCallbackFunction` is called in two circumstances:
|
|
2766
|
+
//
|
|
2767
|
+
// 1. at startup, when initializing callback interface vtables.
|
|
2768
|
+
// 2. when polling futures. This happens at least once per future that is
|
|
2769
|
+
// exposed to Javascript. We know that this is always the same function,
|
|
2770
|
+
// `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
|
|
2771
|
+
//
|
|
2772
|
+
// We can therefore return the callback function without making anything
|
|
2773
|
+
// new if we've been initialized already.
|
|
2774
|
+
return callback;
|
|
2775
|
+
}
|
|
2776
|
+
auto callbackFunction = value.asObject(rt).asFunction(rt);
|
|
2777
|
+
auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
|
|
2778
|
+
rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_handle, uint64_t* uniffi_direct_return) {
|
|
2779
|
+
// We immediately make a lambda which will do the work of transforming the
|
|
2780
|
+
// arguments into JSI values and calling the callback.
|
|
2781
|
+
uniffi_runtime::UniffiCallFunc jsLambda = [
|
|
2782
|
+
callInvoker,
|
|
2783
|
+
callbackValue
|
|
2784
|
+
, rs_handle, uniffi_direct_return](jsi::Runtime &rt) mutable {
|
|
2785
|
+
body(rt, callInvoker, callbackValue
|
|
2786
|
+
, rs_handle, uniffi_direct_return);
|
|
2787
|
+
};
|
|
2788
|
+
// We'll then call that lambda from the callInvoker which will
|
|
2789
|
+
// look after calling it on the correct thread.
|
|
2790
|
+
callInvoker->invokeBlocking(rt, jsLambda);
|
|
2791
|
+
};
|
|
2792
|
+
return callback;
|
|
2793
|
+
}
|
|
2794
|
+
|
|
2795
|
+
// This method is called from the destructor of NativeBark, which only happens
|
|
2796
|
+
// when the jsi::Runtime is being destroyed.
|
|
2797
|
+
static void cleanup() {
|
|
2798
|
+
// The lambda holds a reference to the the Runtime, so when this is nulled out,
|
|
2799
|
+
// then the pointer will no longer be left dangling.
|
|
2800
|
+
rsLambda = nullptr;
|
|
2801
|
+
}
|
|
2802
|
+
} // namespace uniffi::bark::cb::callbackinterfaceclone::vtablecallbackinterfacebarklogger
|
|
2803
|
+
// Implementation of CallbackInterfaceBarkLoggerMethod0 for vtable field log in VTableCallbackInterfaceBarkLogger
|
|
2804
|
+
|
|
2805
|
+
|
|
2806
|
+
// Callback function: uniffi::bark::cb::callbackinterfacebarkloggermethod0::vtablecallbackinterfacebarklogger::UniffiCallbackInterfaceBarkLoggerMethod0
|
|
2807
|
+
//
|
|
2808
|
+
// We have the following constraints:
|
|
2809
|
+
// - we need to pass a function pointer to Rust.
|
|
2810
|
+
// - we need a jsi::Runtime and jsi::Function to call into JS.
|
|
2811
|
+
// - function pointers can't store state, so we can't use a lamda.
|
|
2812
|
+
//
|
|
2813
|
+
// For this, we store a lambda as a global, as `rsLambda`. The `callback` function calls
|
|
2814
|
+
// the lambda, which itself calls the `body` which then calls into JS.
|
|
2815
|
+
//
|
|
2816
|
+
// We then give the `callback` function pointer to Rust which will call the lambda sometime in the
|
|
2817
|
+
// future.
|
|
2818
|
+
namespace uniffi::bark::cb::callbackinterfacebarkloggermethod0::vtablecallbackinterfacebarklogger {
|
|
2819
|
+
using namespace facebook;
|
|
2820
|
+
|
|
2821
|
+
// We need to store a lambda in a global so we can call it from
|
|
2822
|
+
// a function pointer. The function pointer is passed to Rust.
|
|
2823
|
+
static std::function<void(uint64_t, RustBuffer, RustBuffer, RustBuffer, void *, RustCallStatus*)> rsLambda = nullptr;
|
|
2824
|
+
|
|
2825
|
+
// This is the main body of the callback. It's called from the lambda,
|
|
2826
|
+
// which itself is called from the callback function which is passed to Rust.
|
|
2827
|
+
static void body(jsi::Runtime &rt,
|
|
2828
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
2829
|
+
std::shared_ptr<jsi::Value> callbackValue
|
|
2830
|
+
,uint64_t rs_uniffiHandle
|
|
2831
|
+
,RustBuffer rs_level
|
|
2832
|
+
,RustBuffer rs_target
|
|
2833
|
+
,RustBuffer rs_message
|
|
2834
|
+
,void * rs_uniffiOutReturn, RustCallStatus* uniffi_call_status) {
|
|
2835
|
+
|
|
2836
|
+
// Convert the arguments from Rust, into jsi::Values.
|
|
2837
|
+
// We'll use the Bridging class to do this…
|
|
2838
|
+
auto js_uniffiHandle = uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_uniffiHandle);
|
|
2839
|
+
auto js_level = uniffi::bark::Bridging<RustBuffer>::toJs(rt, callInvoker, rs_level);
|
|
2840
|
+
auto js_target = uniffi::bark::Bridging<RustBuffer>::toJs(rt, callInvoker, rs_target);
|
|
2841
|
+
auto js_message = uniffi::bark::Bridging<RustBuffer>::toJs(rt, callInvoker, rs_message);
|
|
2842
|
+
|
|
2843
|
+
// Now we are ready to call the callback.
|
|
2844
|
+
// We are already on the JS thread, because this `body` function was
|
|
2845
|
+
// invoked from the CallInvoker.
|
|
2846
|
+
try {
|
|
2847
|
+
// Getting the callback function
|
|
2848
|
+
auto cb = callbackValue->asObject(rt).asFunction(rt);
|
|
2849
|
+
auto uniffiResult = cb.call(rt, js_uniffiHandle, js_level, js_target, js_message
|
|
2850
|
+
);
|
|
2851
|
+
|
|
2852
|
+
// Now copy the result back from JS into the RustCallStatus object.
|
|
2853
|
+
uniffi::bark::Bridging<RustCallStatus>::copyFromJs(rt, callInvoker, uniffiResult, uniffi_call_status);
|
|
2854
|
+
|
|
2855
|
+
if (uniffi_call_status->code != UNIFFI_CALL_STATUS_OK) {
|
|
2856
|
+
// The JS callback finished abnormally, so we cannot retrieve the return value.
|
|
2857
|
+
return;
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
|
|
2861
|
+
} catch (const jsi::JSError &error) {
|
|
2862
|
+
std::cout << "Error in callback UniffiCallbackInterfaceBarkLoggerMethod0: "
|
|
2863
|
+
<< error.what() << std::endl;
|
|
2864
|
+
throw error;
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
|
|
2868
|
+
static void callback(uint64_t rs_uniffiHandle, RustBuffer rs_level, RustBuffer rs_target, RustBuffer rs_message, void * rs_uniffiOutReturn, RustCallStatus* uniffi_call_status) {
|
|
2869
|
+
// If the runtime has shutdown, then there is no point in trying to
|
|
2870
|
+
// call into Javascript. BUT how do we tell if the runtime has shutdown?
|
|
2871
|
+
//
|
|
2872
|
+
// Answer: the module destructor calls into callback `cleanup` method,
|
|
2873
|
+
// which nulls out the rsLamda.
|
|
2874
|
+
//
|
|
2875
|
+
// If rsLamda is null, then there is no runtime to call into.
|
|
2876
|
+
if (rsLambda == nullptr) {
|
|
2877
|
+
// This only occurs when destructors are calling into Rust free/drop,
|
|
2878
|
+
// which causes the JS callback to be dropped.
|
|
2879
|
+
return;
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2882
|
+
// The runtime, the actual callback jsi::funtion, and the callInvoker
|
|
2883
|
+
// are all in the lambda.
|
|
2884
|
+
rsLambda(
|
|
2885
|
+
rs_uniffiHandle,
|
|
2886
|
+
rs_level,
|
|
2887
|
+
rs_target,
|
|
2888
|
+
rs_message,
|
|
2889
|
+
rs_uniffiOutReturn, uniffi_call_status);
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2892
|
+
[[maybe_unused]] static UniffiCallbackInterfaceBarkLoggerMethod0
|
|
2893
|
+
makeCallbackFunction( // uniffi::bark::cb::callbackinterfacebarkloggermethod0::vtablecallbackinterfacebarklogger
|
|
2894
|
+
jsi::Runtime &rt,
|
|
2895
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
2896
|
+
const jsi::Value &value) {
|
|
2897
|
+
if (rsLambda != nullptr) {
|
|
2898
|
+
// `makeCallbackFunction` is called in two circumstances:
|
|
2899
|
+
//
|
|
2900
|
+
// 1. at startup, when initializing callback interface vtables.
|
|
2901
|
+
// 2. when polling futures. This happens at least once per future that is
|
|
2902
|
+
// exposed to Javascript. We know that this is always the same function,
|
|
2903
|
+
// `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
|
|
2904
|
+
//
|
|
2905
|
+
// We can therefore return the callback function without making anything
|
|
2906
|
+
// new if we've been initialized already.
|
|
2907
|
+
return callback;
|
|
2908
|
+
}
|
|
2909
|
+
auto callbackFunction = value.asObject(rt).asFunction(rt);
|
|
2910
|
+
auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
|
|
2911
|
+
rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_uniffiHandle, RustBuffer rs_level, RustBuffer rs_target, RustBuffer rs_message, void * rs_uniffiOutReturn, RustCallStatus* uniffi_call_status) {
|
|
2912
|
+
// We immediately make a lambda which will do the work of transforming the
|
|
2913
|
+
// arguments into JSI values and calling the callback.
|
|
2914
|
+
uniffi_runtime::UniffiCallFunc jsLambda = [
|
|
2915
|
+
callInvoker,
|
|
2916
|
+
callbackValue
|
|
2917
|
+
, rs_uniffiHandle
|
|
2918
|
+
, rs_level
|
|
2919
|
+
, rs_target
|
|
2920
|
+
, rs_message
|
|
2921
|
+
, rs_uniffiOutReturn, uniffi_call_status](jsi::Runtime &rt) mutable {
|
|
2922
|
+
body(rt, callInvoker, callbackValue
|
|
2923
|
+
, rs_uniffiHandle
|
|
2924
|
+
, rs_level
|
|
2925
|
+
, rs_target
|
|
2926
|
+
, rs_message
|
|
2927
|
+
, rs_uniffiOutReturn, uniffi_call_status);
|
|
2928
|
+
};
|
|
2929
|
+
// We'll then call that lambda from the callInvoker which will
|
|
2930
|
+
// look after calling it on the correct thread.
|
|
2931
|
+
callInvoker->invokeBlocking(rt, jsLambda);
|
|
2932
|
+
};
|
|
2933
|
+
return callback;
|
|
2934
|
+
}
|
|
2935
|
+
|
|
2936
|
+
// This method is called from the destructor of NativeBark, which only happens
|
|
2937
|
+
// when the jsi::Runtime is being destroyed.
|
|
2938
|
+
static void cleanup() {
|
|
2939
|
+
// The lambda holds a reference to the the Runtime, so when this is nulled out,
|
|
2940
|
+
// then the pointer will no longer be left dangling.
|
|
2941
|
+
rsLambda = nullptr;
|
|
2942
|
+
}
|
|
2943
|
+
} // namespace uniffi::bark::cb::callbackinterfacebarkloggermethod0::vtablecallbackinterfacebarklogger
|
|
2944
|
+
namespace uniffi::bark {
|
|
2945
|
+
using namespace facebook;
|
|
2946
|
+
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
2947
|
+
|
|
2948
|
+
template <> struct Bridging<UniffiVTableCallbackInterfaceBarkLogger> {
|
|
2949
|
+
static UniffiVTableCallbackInterfaceBarkLogger fromJs(jsi::Runtime &rt,
|
|
2950
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
2951
|
+
const jsi::Value &jsValue
|
|
2952
|
+
) {
|
|
2953
|
+
// Check if the input is an object
|
|
2954
|
+
if (!jsValue.isObject()) {
|
|
2955
|
+
throw jsi::JSError(rt, "Expected an object for UniffiVTableCallbackInterfaceBarkLogger");
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2958
|
+
// Get the object from the jsi::Value
|
|
2959
|
+
auto jsObject = jsValue.getObject(rt);
|
|
2960
|
+
|
|
2961
|
+
// Create the vtable struct
|
|
2962
|
+
UniffiVTableCallbackInterfaceBarkLogger rsObject;
|
|
2963
|
+
|
|
2964
|
+
// Create the vtable from the js callbacks.
|
|
2965
|
+
rsObject.uniffi_free = uniffi::bark::st::vtablecallbackinterfacebarklogger::vtablecallbackinterfacebarklogger::free::makeCallbackFunction(
|
|
2966
|
+
rt, callInvoker, jsObject.getProperty(rt, "uniffiFree")
|
|
2967
|
+
);
|
|
2968
|
+
rsObject.uniffi_clone = uniffi::bark::cb::callbackinterfaceclone::vtablecallbackinterfacebarklogger::makeCallbackFunction(
|
|
2969
|
+
rt, callInvoker, jsObject.getProperty(rt, "uniffiClone")
|
|
2970
|
+
);
|
|
2971
|
+
rsObject.log = uniffi::bark::cb::callbackinterfacebarkloggermethod0::vtablecallbackinterfacebarklogger::makeCallbackFunction(
|
|
2972
|
+
rt, callInvoker, jsObject.getProperty(rt, "log")
|
|
2973
|
+
);
|
|
2974
|
+
|
|
2975
|
+
return rsObject;
|
|
2976
|
+
}
|
|
2977
|
+
};
|
|
2978
|
+
|
|
2517
2979
|
} // namespace uniffi::bark
|
|
2518
2980
|
// Implementation of CallbackInterfaceClone for vtable field uniffi_clone in VTableCallbackInterfaceCustomOnchainWalletCallbacks
|
|
2519
2981
|
|
|
@@ -4140,6 +4602,14 @@ NativeBark::NativeBark(
|
|
|
4140
4602
|
return this->cpp_uniffi_bark_ffi_fn_constructor_wallet_open(rt, thisVal, args, count);
|
|
4141
4603
|
}
|
|
4142
4604
|
);
|
|
4605
|
+
props["ubrn_uniffi_bark_ffi_fn_constructor_wallet_open_with_daemon"] = jsi::Function::createFromHostFunction(
|
|
4606
|
+
rt,
|
|
4607
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_constructor_wallet_open_with_daemon"),
|
|
4608
|
+
4,
|
|
4609
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
4610
|
+
return this->cpp_uniffi_bark_ffi_fn_constructor_wallet_open_with_daemon(rt, thisVal, args, count);
|
|
4611
|
+
}
|
|
4612
|
+
);
|
|
4143
4613
|
props["ubrn_uniffi_bark_ffi_fn_constructor_wallet_open_with_onchain"] = jsi::Function::createFromHostFunction(
|
|
4144
4614
|
rt,
|
|
4145
4615
|
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_constructor_wallet_open_with_onchain"),
|
|
@@ -4199,7 +4669,7 @@ NativeBark::NativeBark(
|
|
|
4199
4669
|
props["ubrn_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice"] = jsi::Function::createFromHostFunction(
|
|
4200
4670
|
rt,
|
|
4201
4671
|
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice"),
|
|
4202
|
-
|
|
4672
|
+
3,
|
|
4203
4673
|
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
4204
4674
|
return this->cpp_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice(rt, thisVal, args, count);
|
|
4205
4675
|
}
|
|
@@ -4716,6 +5186,14 @@ NativeBark::NativeBark(
|
|
|
4716
5186
|
return this->cpp_uniffi_bark_ffi_fn_method_wallet_refresh_vtxos_delegated(rt, thisVal, args, count);
|
|
4717
5187
|
}
|
|
4718
5188
|
);
|
|
5189
|
+
props["ubrn_uniffi_bark_ffi_fn_method_wallet_run_daemon"] = jsi::Function::createFromHostFunction(
|
|
5190
|
+
rt,
|
|
5191
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_method_wallet_run_daemon"),
|
|
5192
|
+
2,
|
|
5193
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
5194
|
+
return this->cpp_uniffi_bark_ffi_fn_method_wallet_run_daemon(rt, thisVal, args, count);
|
|
5195
|
+
}
|
|
5196
|
+
);
|
|
4719
5197
|
props["ubrn_uniffi_bark_ffi_fn_method_wallet_send_arkoor_payment"] = jsi::Function::createFromHostFunction(
|
|
4720
5198
|
rt,
|
|
4721
5199
|
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_method_wallet_send_arkoor_payment"),
|
|
@@ -4764,6 +5242,14 @@ NativeBark::NativeBark(
|
|
|
4764
5242
|
return this->cpp_uniffi_bark_ffi_fn_method_wallet_start_exit_for_vtxos(rt, thisVal, args, count);
|
|
4765
5243
|
}
|
|
4766
5244
|
);
|
|
5245
|
+
props["ubrn_uniffi_bark_ffi_fn_method_wallet_stop_daemon"] = jsi::Function::createFromHostFunction(
|
|
5246
|
+
rt,
|
|
5247
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_method_wallet_stop_daemon"),
|
|
5248
|
+
1,
|
|
5249
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
5250
|
+
return this->cpp_uniffi_bark_ffi_fn_method_wallet_stop_daemon(rt, thisVal, args, count);
|
|
5251
|
+
}
|
|
5252
|
+
);
|
|
4767
5253
|
props["ubrn_uniffi_bark_ffi_fn_method_wallet_sync"] = jsi::Function::createFromHostFunction(
|
|
4768
5254
|
rt,
|
|
4769
5255
|
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_method_wallet_sync"),
|
|
@@ -4820,6 +5306,14 @@ NativeBark::NativeBark(
|
|
|
4820
5306
|
return this->cpp_uniffi_bark_ffi_fn_method_wallet_vtxos(rt, thisVal, args, count);
|
|
4821
5307
|
}
|
|
4822
5308
|
);
|
|
5309
|
+
props["ubrn_uniffi_bark_ffi_fn_init_callback_vtable_barklogger"] = jsi::Function::createFromHostFunction(
|
|
5310
|
+
rt,
|
|
5311
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_init_callback_vtable_barklogger"),
|
|
5312
|
+
1,
|
|
5313
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
5314
|
+
return this->cpp_uniffi_bark_ffi_fn_init_callback_vtable_barklogger(rt, thisVal, args, count);
|
|
5315
|
+
}
|
|
5316
|
+
);
|
|
4823
5317
|
props["ubrn_uniffi_bark_ffi_fn_init_callback_vtable_customonchainwalletcallbacks"] = jsi::Function::createFromHostFunction(
|
|
4824
5318
|
rt,
|
|
4825
5319
|
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_init_callback_vtable_customonchainwalletcallbacks"),
|
|
@@ -4844,6 +5338,14 @@ NativeBark::NativeBark(
|
|
|
4844
5338
|
return this->cpp_uniffi_bark_ffi_fn_func_generate_mnemonic(rt, thisVal, args, count);
|
|
4845
5339
|
}
|
|
4846
5340
|
);
|
|
5341
|
+
props["ubrn_uniffi_bark_ffi_fn_func_set_logger"] = jsi::Function::createFromHostFunction(
|
|
5342
|
+
rt,
|
|
5343
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_func_set_logger"),
|
|
5344
|
+
2,
|
|
5345
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
5346
|
+
return this->cpp_uniffi_bark_ffi_fn_func_set_logger(rt, thisVal, args, count);
|
|
5347
|
+
}
|
|
5348
|
+
);
|
|
4847
5349
|
props["ubrn_uniffi_bark_ffi_fn_func_validate_ark_address"] = jsi::Function::createFromHostFunction(
|
|
4848
5350
|
rt,
|
|
4849
5351
|
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_func_validate_ark_address"),
|
|
@@ -5260,6 +5762,14 @@ NativeBark::NativeBark(
|
|
|
5260
5762
|
return this->cpp_uniffi_bark_ffi_checksum_func_generate_mnemonic(rt, thisVal, args, count);
|
|
5261
5763
|
}
|
|
5262
5764
|
);
|
|
5765
|
+
props["ubrn_uniffi_bark_ffi_checksum_func_set_logger"] = jsi::Function::createFromHostFunction(
|
|
5766
|
+
rt,
|
|
5767
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_checksum_func_set_logger"),
|
|
5768
|
+
0,
|
|
5769
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
5770
|
+
return this->cpp_uniffi_bark_ffi_checksum_func_set_logger(rt, thisVal, args, count);
|
|
5771
|
+
}
|
|
5772
|
+
);
|
|
5263
5773
|
props["ubrn_uniffi_bark_ffi_checksum_func_validate_ark_address"] = jsi::Function::createFromHostFunction(
|
|
5264
5774
|
rt,
|
|
5265
5775
|
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_checksum_func_validate_ark_address"),
|
|
@@ -5892,6 +6402,14 @@ NativeBark::NativeBark(
|
|
|
5892
6402
|
return this->cpp_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_delegated(rt, thisVal, args, count);
|
|
5893
6403
|
}
|
|
5894
6404
|
);
|
|
6405
|
+
props["ubrn_uniffi_bark_ffi_checksum_method_wallet_run_daemon"] = jsi::Function::createFromHostFunction(
|
|
6406
|
+
rt,
|
|
6407
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_checksum_method_wallet_run_daemon"),
|
|
6408
|
+
0,
|
|
6409
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
6410
|
+
return this->cpp_uniffi_bark_ffi_checksum_method_wallet_run_daemon(rt, thisVal, args, count);
|
|
6411
|
+
}
|
|
6412
|
+
);
|
|
5895
6413
|
props["ubrn_uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment"] = jsi::Function::createFromHostFunction(
|
|
5896
6414
|
rt,
|
|
5897
6415
|
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment"),
|
|
@@ -5940,6 +6458,14 @@ NativeBark::NativeBark(
|
|
|
5940
6458
|
return this->cpp_uniffi_bark_ffi_checksum_method_wallet_start_exit_for_vtxos(rt, thisVal, args, count);
|
|
5941
6459
|
}
|
|
5942
6460
|
);
|
|
6461
|
+
props["ubrn_uniffi_bark_ffi_checksum_method_wallet_stop_daemon"] = jsi::Function::createFromHostFunction(
|
|
6462
|
+
rt,
|
|
6463
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_checksum_method_wallet_stop_daemon"),
|
|
6464
|
+
0,
|
|
6465
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
6466
|
+
return this->cpp_uniffi_bark_ffi_checksum_method_wallet_stop_daemon(rt, thisVal, args, count);
|
|
6467
|
+
}
|
|
6468
|
+
);
|
|
5943
6469
|
props["ubrn_uniffi_bark_ffi_checksum_method_wallet_sync"] = jsi::Function::createFromHostFunction(
|
|
5944
6470
|
rt,
|
|
5945
6471
|
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_checksum_method_wallet_sync"),
|
|
@@ -6036,6 +6562,14 @@ NativeBark::NativeBark(
|
|
|
6036
6562
|
return this->cpp_uniffi_bark_ffi_checksum_constructor_wallet_open(rt, thisVal, args, count);
|
|
6037
6563
|
}
|
|
6038
6564
|
);
|
|
6565
|
+
props["ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open_with_daemon"] = jsi::Function::createFromHostFunction(
|
|
6566
|
+
rt,
|
|
6567
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open_with_daemon"),
|
|
6568
|
+
0,
|
|
6569
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
6570
|
+
return this->cpp_uniffi_bark_ffi_checksum_constructor_wallet_open_with_daemon(rt, thisVal, args, count);
|
|
6571
|
+
}
|
|
6572
|
+
);
|
|
6039
6573
|
props["ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open_with_onchain"] = jsi::Function::createFromHostFunction(
|
|
6040
6574
|
rt,
|
|
6041
6575
|
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open_with_onchain"),
|
|
@@ -6044,6 +6578,14 @@ NativeBark::NativeBark(
|
|
|
6044
6578
|
return this->cpp_uniffi_bark_ffi_checksum_constructor_wallet_open_with_onchain(rt, thisVal, args, count);
|
|
6045
6579
|
}
|
|
6046
6580
|
);
|
|
6581
|
+
props["ubrn_uniffi_bark_ffi_checksum_method_barklogger_log"] = jsi::Function::createFromHostFunction(
|
|
6582
|
+
rt,
|
|
6583
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_checksum_method_barklogger_log"),
|
|
6584
|
+
0,
|
|
6585
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
6586
|
+
return this->cpp_uniffi_bark_ffi_checksum_method_barklogger_log(rt, thisVal, args, count);
|
|
6587
|
+
}
|
|
6588
|
+
);
|
|
6047
6589
|
props["ubrn_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_get_balance"] = jsi::Function::createFromHostFunction(
|
|
6048
6590
|
rt,
|
|
6049
6591
|
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_get_balance"),
|
|
@@ -6188,7 +6730,9 @@ uniffi::bark::cb::rustfuturecontinuationcallback::cleanup();
|
|
|
6188
6730
|
// Cleanup for callback function ForeignFutureDroppedCallback
|
|
6189
6731
|
uniffi::bark::cb::foreignfuturedroppedcallback::cleanup();
|
|
6190
6732
|
// Cleanup for "free" callback function CallbackInterfaceFree
|
|
6191
|
-
uniffi::bark::st::vtablecallbackinterfacecustomonchainwalletcallbacks::vtablecallbackinterfacecustomonchainwalletcallbacks::free::cleanup();
|
|
6733
|
+
uniffi::bark::st::vtablecallbackinterfacebarklogger::vtablecallbackinterfacebarklogger::free::cleanup();uniffi::bark::st::vtablecallbackinterfacecustomonchainwalletcallbacks::vtablecallbackinterfacecustomonchainwalletcallbacks::free::cleanup();
|
|
6734
|
+
uniffi::bark::cb::callbackinterfaceclone::vtablecallbackinterfacebarklogger::cleanup();
|
|
6735
|
+
uniffi::bark::cb::callbackinterfacebarkloggermethod0::vtablecallbackinterfacebarklogger::cleanup();
|
|
6192
6736
|
uniffi::bark::cb::callbackinterfaceclone::vtablecallbackinterfacecustomonchainwalletcallbacks::cleanup();
|
|
6193
6737
|
uniffi::bark::cb::callbackinterfacecustomonchainwalletcallbacksmethod0::vtablecallbackinterfacecustomonchainwalletcallbacks::cleanup();
|
|
6194
6738
|
uniffi::bark::cb::callbackinterfacecustomonchainwalletcallbacksmethod1::vtablecallbackinterfacecustomonchainwalletcallbacks::cleanup();
|
|
@@ -6383,6 +6927,13 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_constructor_wallet_open(jsi::Runti
|
|
|
6383
6927
|
);
|
|
6384
6928
|
|
|
6385
6929
|
|
|
6930
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
|
|
6931
|
+
}
|
|
6932
|
+
jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_constructor_wallet_open_with_daemon(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
6933
|
+
auto value = uniffi_bark_ffi_fn_constructor_wallet_open_with_daemon(uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[3])
|
|
6934
|
+
);
|
|
6935
|
+
|
|
6936
|
+
|
|
6386
6937
|
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
|
|
6387
6938
|
}
|
|
6388
6939
|
jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_constructor_wallet_open_with_onchain(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
@@ -6435,7 +6986,7 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_board_amount(jsi::Ru
|
|
|
6435
6986
|
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
|
|
6436
6987
|
}
|
|
6437
6988
|
jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
6438
|
-
auto value = uniffi_bark_ffi_fn_method_wallet_bolt11_invoice(uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[1])
|
|
6989
|
+
auto value = uniffi_bark_ffi_fn_method_wallet_bolt11_invoice(uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[1]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2])
|
|
6439
6990
|
);
|
|
6440
6991
|
|
|
6441
6992
|
|
|
@@ -6899,6 +7450,13 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_refresh_vtxos_delega
|
|
|
6899
7450
|
);
|
|
6900
7451
|
|
|
6901
7452
|
|
|
7453
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
|
|
7454
|
+
}
|
|
7455
|
+
jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_run_daemon(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
7456
|
+
auto value = uniffi_bark_ffi_fn_method_wallet_run_daemon(uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1])
|
|
7457
|
+
);
|
|
7458
|
+
|
|
7459
|
+
|
|
6902
7460
|
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
|
|
6903
7461
|
}
|
|
6904
7462
|
jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_send_arkoor_payment(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
@@ -6941,6 +7499,13 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_start_exit_for_vtxos
|
|
|
6941
7499
|
);
|
|
6942
7500
|
|
|
6943
7501
|
|
|
7502
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
|
|
7503
|
+
}
|
|
7504
|
+
jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_stop_daemon(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
7505
|
+
auto value = uniffi_bark_ffi_fn_method_wallet_stop_daemon(uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[0])
|
|
7506
|
+
);
|
|
7507
|
+
|
|
7508
|
+
|
|
6944
7509
|
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
|
|
6945
7510
|
}
|
|
6946
7511
|
jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_sync(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
@@ -6992,6 +7557,23 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_vtxos(jsi::Runtime&
|
|
|
6992
7557
|
|
|
6993
7558
|
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
|
|
6994
7559
|
}
|
|
7560
|
+
jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_init_callback_vtable_barklogger(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
7561
|
+
auto vtableInstance =
|
|
7562
|
+
uniffi::bark::Bridging<UniffiVTableCallbackInterfaceBarkLogger>::fromJs(
|
|
7563
|
+
rt,
|
|
7564
|
+
callInvoker,
|
|
7565
|
+
args[0]
|
|
7566
|
+
);
|
|
7567
|
+
|
|
7568
|
+
std::lock_guard<std::mutex> lock(uniffi::bark::registry::vtableMutex);
|
|
7569
|
+
uniffi_bark_ffi_fn_init_callback_vtable_barklogger(
|
|
7570
|
+
uniffi::bark::registry::putTable(
|
|
7571
|
+
"UniffiVTableCallbackInterfaceBarkLogger",
|
|
7572
|
+
vtableInstance
|
|
7573
|
+
)
|
|
7574
|
+
);
|
|
7575
|
+
return jsi::Value::undefined();
|
|
7576
|
+
}
|
|
6995
7577
|
jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_init_callback_vtable_customonchainwalletcallbacks(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
6996
7578
|
auto vtableInstance =
|
|
6997
7579
|
uniffi::bark::Bridging<UniffiVTableCallbackInterfaceCustomOnchainWalletCallbacks>::fromJs(
|
|
@@ -7028,6 +7610,16 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_func_generate_mnemonic(jsi::Runtim
|
|
|
7028
7610
|
|
|
7029
7611
|
return uniffi::bark::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
|
|
7030
7612
|
}
|
|
7613
|
+
jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_func_set_logger(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
7614
|
+
RustCallStatus status = uniffi::bark::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
7615
|
+
uniffi_bark_ffi_fn_func_set_logger(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]),
|
|
7616
|
+
&status
|
|
7617
|
+
);
|
|
7618
|
+
uniffi::bark::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
|
|
7619
|
+
|
|
7620
|
+
|
|
7621
|
+
return jsi::Value::undefined();
|
|
7622
|
+
}
|
|
7031
7623
|
jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_func_validate_ark_address(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
7032
7624
|
RustCallStatus status = uniffi::bark::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
7033
7625
|
auto value = uniffi_bark_ffi_fn_func_validate_ark_address(uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]),
|
|
@@ -7432,6 +8024,13 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_func_generate_mnemonic(jsi::
|
|
|
7432
8024
|
);
|
|
7433
8025
|
|
|
7434
8026
|
|
|
8027
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
8028
|
+
}
|
|
8029
|
+
jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_func_set_logger(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
8030
|
+
auto value = uniffi_bark_ffi_checksum_func_set_logger(
|
|
8031
|
+
);
|
|
8032
|
+
|
|
8033
|
+
|
|
7435
8034
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
7436
8035
|
}
|
|
7437
8036
|
jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_func_validate_ark_address(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
@@ -7985,6 +8584,13 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_
|
|
|
7985
8584
|
);
|
|
7986
8585
|
|
|
7987
8586
|
|
|
8587
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
8588
|
+
}
|
|
8589
|
+
jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_method_wallet_run_daemon(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
8590
|
+
auto value = uniffi_bark_ffi_checksum_method_wallet_run_daemon(
|
|
8591
|
+
);
|
|
8592
|
+
|
|
8593
|
+
|
|
7988
8594
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
7989
8595
|
}
|
|
7990
8596
|
jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
@@ -8027,6 +8633,13 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_method_wallet_start_exit_for
|
|
|
8027
8633
|
);
|
|
8028
8634
|
|
|
8029
8635
|
|
|
8636
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
8637
|
+
}
|
|
8638
|
+
jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_method_wallet_stop_daemon(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
8639
|
+
auto value = uniffi_bark_ffi_checksum_method_wallet_stop_daemon(
|
|
8640
|
+
);
|
|
8641
|
+
|
|
8642
|
+
|
|
8030
8643
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
8031
8644
|
}
|
|
8032
8645
|
jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_method_wallet_sync(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
@@ -8111,6 +8724,13 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_constructor_wallet_open(jsi:
|
|
|
8111
8724
|
);
|
|
8112
8725
|
|
|
8113
8726
|
|
|
8727
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
8728
|
+
}
|
|
8729
|
+
jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_constructor_wallet_open_with_daemon(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
8730
|
+
auto value = uniffi_bark_ffi_checksum_constructor_wallet_open_with_daemon(
|
|
8731
|
+
);
|
|
8732
|
+
|
|
8733
|
+
|
|
8114
8734
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
8115
8735
|
}
|
|
8116
8736
|
jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_constructor_wallet_open_with_onchain(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
@@ -8118,6 +8738,13 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_constructor_wallet_open_with
|
|
|
8118
8738
|
);
|
|
8119
8739
|
|
|
8120
8740
|
|
|
8741
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
8742
|
+
}
|
|
8743
|
+
jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_method_barklogger_log(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
8744
|
+
auto value = uniffi_bark_ffi_checksum_method_barklogger_log(
|
|
8745
|
+
);
|
|
8746
|
+
|
|
8747
|
+
|
|
8121
8748
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
8122
8749
|
}
|
|
8123
8750
|
jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_get_balance(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|