@breeztech/breez-sdk-spark-react-native 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/cpp/generated/breez_sdk_spark.cpp +710 -48
  2. package/cpp/generated/breez_sdk_spark.hpp +51 -7
  3. package/lib/commonjs/generated/breez_sdk_common.js +115 -274
  4. package/lib/commonjs/generated/breez_sdk_common.js.map +1 -1
  5. package/lib/commonjs/generated/breez_sdk_spark-ffi.js.map +1 -1
  6. package/lib/commonjs/generated/breez_sdk_spark.js +1165 -67
  7. package/lib/commonjs/generated/breez_sdk_spark.js.map +1 -1
  8. package/lib/module/generated/breez_sdk_common.js +114 -273
  9. package/lib/module/generated/breez_sdk_common.js.map +1 -1
  10. package/lib/module/generated/breez_sdk_spark-ffi.js.map +1 -1
  11. package/lib/module/generated/breez_sdk_spark.js +1163 -65
  12. package/lib/module/generated/breez_sdk_spark.js.map +1 -1
  13. package/lib/typescript/commonjs/src/generated/breez_sdk_common.d.ts +123 -183
  14. package/lib/typescript/commonjs/src/generated/breez_sdk_common.d.ts.map +1 -1
  15. package/lib/typescript/commonjs/src/generated/breez_sdk_spark-ffi.d.ts +21 -2
  16. package/lib/typescript/commonjs/src/generated/breez_sdk_spark-ffi.d.ts.map +1 -1
  17. package/lib/typescript/commonjs/src/generated/breez_sdk_spark.d.ts +1082 -77
  18. package/lib/typescript/commonjs/src/generated/breez_sdk_spark.d.ts.map +1 -1
  19. package/lib/typescript/module/src/generated/breez_sdk_common.d.ts +123 -183
  20. package/lib/typescript/module/src/generated/breez_sdk_common.d.ts.map +1 -1
  21. package/lib/typescript/module/src/generated/breez_sdk_spark-ffi.d.ts +21 -2
  22. package/lib/typescript/module/src/generated/breez_sdk_spark-ffi.d.ts.map +1 -1
  23. package/lib/typescript/module/src/generated/breez_sdk_spark.d.ts +1082 -77
  24. package/lib/typescript/module/src/generated/breez_sdk_spark.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/src/generated/breez_sdk_common.ts +194 -373
  27. package/src/generated/breez_sdk_spark-ffi.ts +55 -2
  28. package/src/generated/breez_sdk_spark.ts +2090 -218
@@ -123,6 +123,10 @@ typedef void (*UniffiCallbackInterfaceBitcoinChainServiceMethod3)(
123
123
  uint64_t uniffi_handle, RustBuffer tx,
124
124
  UniffiForeignFutureCompleteVoid uniffi_future_callback,
125
125
  uint64_t uniffi_callback_data, UniffiForeignFuture *uniffi_out_return);
126
+ typedef void (*UniffiCallbackInterfacePaymentObserverMethod0)(
127
+ uint64_t uniffi_handle, RustBuffer payments,
128
+ UniffiForeignFutureCompleteVoid uniffi_future_callback,
129
+ uint64_t uniffi_callback_data, UniffiForeignFuture *uniffi_out_return);
126
130
  typedef void (*UniffiCallbackInterfaceStorageMethod0)(
127
131
  uint64_t uniffi_handle, RustBuffer key,
128
132
  UniffiForeignFutureCompleteVoid uniffi_future_callback,
@@ -187,6 +191,10 @@ typedef struct UniffiVTableCallbackInterfaceBitcoinChainService {
187
191
  UniffiCallbackInterfaceBitcoinChainServiceMethod3 broadcast_transaction;
188
192
  UniffiCallbackInterfaceFree uniffi_free;
189
193
  } UniffiVTableCallbackInterfaceBitcoinChainService;
194
+ typedef struct UniffiVTableCallbackInterfacePaymentObserver {
195
+ UniffiCallbackInterfacePaymentObserverMethod0 before_send;
196
+ UniffiCallbackInterfaceFree uniffi_free;
197
+ } UniffiVTableCallbackInterfacePaymentObserver;
190
198
  typedef struct UniffiVTableCallbackInterfaceStorage {
191
199
  UniffiCallbackInterfaceStorageMethod0 delete_cached_item;
192
200
  UniffiCallbackInterfaceStorageMethod1 get_cached_item;
@@ -231,6 +239,9 @@ uniffi_breez_sdk_spark_fn_method_breezsdk_add_event_listener(void *ptr,
231
239
  uniffi_breez_sdk_spark_fn_method_breezsdk_check_lightning_address_available(
232
240
  void *ptr, RustBuffer req);
233
241
  /*handle*/ uint64_t
242
+ uniffi_breez_sdk_spark_fn_method_breezsdk_check_message(void *ptr,
243
+ RustBuffer request);
244
+ /*handle*/ uint64_t
234
245
  uniffi_breez_sdk_spark_fn_method_breezsdk_claim_deposit(void *ptr,
235
246
  RustBuffer request);
236
247
  /*handle*/ uint64_t
@@ -262,6 +273,11 @@ uniffi_breez_sdk_spark_fn_method_breezsdk_list_unclaimed_deposits(
262
273
  uniffi_breez_sdk_spark_fn_method_breezsdk_lnurl_pay(void *ptr,
263
274
  RustBuffer request);
264
275
  /*handle*/ uint64_t
276
+ uniffi_breez_sdk_spark_fn_method_breezsdk_lnurl_withdraw(void *ptr,
277
+ RustBuffer request);
278
+ /*handle*/ uint64_t
279
+ uniffi_breez_sdk_spark_fn_method_breezsdk_parse(void *ptr, RustBuffer input);
280
+ /*handle*/ uint64_t
265
281
  uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_lnurl_pay(void *ptr,
266
282
  RustBuffer request);
267
283
  /*handle*/ uint64_t
@@ -283,12 +299,25 @@ uniffi_breez_sdk_spark_fn_method_breezsdk_remove_event_listener(void *ptr,
283
299
  uniffi_breez_sdk_spark_fn_method_breezsdk_send_payment(void *ptr,
284
300
  RustBuffer request);
285
301
  /*handle*/ uint64_t
302
+ uniffi_breez_sdk_spark_fn_method_breezsdk_sign_message(void *ptr,
303
+ RustBuffer request);
304
+ /*handle*/ uint64_t
286
305
  uniffi_breez_sdk_spark_fn_method_breezsdk_sync_wallet(void *ptr,
287
306
  RustBuffer request);
288
307
  /*handle*/ uint64_t
289
308
  uniffi_breez_sdk_spark_fn_method_breezsdk_wait_for_payment(void *ptr,
290
309
  RustBuffer request);
291
310
  void *
311
+ uniffi_breez_sdk_spark_fn_clone_paymentobserver(void *ptr,
312
+ RustCallStatus *uniffi_out_err);
313
+ void uniffi_breez_sdk_spark_fn_free_paymentobserver(
314
+ void *ptr, RustCallStatus *uniffi_out_err);
315
+ void uniffi_breez_sdk_spark_fn_init_callback_vtable_paymentobserver(
316
+ UniffiVTableCallbackInterfacePaymentObserver *vtable);
317
+ /*handle*/ uint64_t
318
+ uniffi_breez_sdk_spark_fn_method_paymentobserver_before_send(
319
+ void *ptr, RustBuffer payments);
320
+ void *
292
321
  uniffi_breez_sdk_spark_fn_clone_sdkbuilder(void *ptr,
293
322
  RustCallStatus *uniffi_out_err);
294
323
  void uniffi_breez_sdk_spark_fn_free_sdkbuilder(void *ptr,
@@ -311,6 +340,9 @@ uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_fiat_service(
311
340
  uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_lnurl_client(
312
341
  void *ptr, void *lnurl_client);
313
342
  /*handle*/ uint64_t
343
+ uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_payment_observer(
344
+ void *ptr, void *payment_observer);
345
+ /*handle*/ uint64_t
314
346
  uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_rest_chain_service(
315
347
  void *ptr, RustBuffer url, RustBuffer credentials);
316
348
  void *uniffi_breez_sdk_spark_fn_clone_storage(void *ptr,
@@ -364,7 +396,6 @@ uniffi_breez_sdk_spark_fn_func_default_storage(RustBuffer data_dir,
364
396
  void uniffi_breez_sdk_spark_fn_func_init_logging(
365
397
  RustBuffer log_dir, RustBuffer app_logger, RustBuffer log_filter,
366
398
  RustCallStatus *uniffi_out_err);
367
- /*handle*/ uint64_t uniffi_breez_sdk_spark_fn_func_parse(RustBuffer input);
368
399
  RustBuffer ffi_breez_sdk_spark_rustbuffer_alloc(uint64_t size,
369
400
  RustCallStatus *uniffi_out_err);
370
401
  RustBuffer
@@ -496,7 +527,6 @@ uint16_t uniffi_breez_sdk_spark_checksum_func_connect();
496
527
  uint16_t uniffi_breez_sdk_spark_checksum_func_default_config();
497
528
  uint16_t uniffi_breez_sdk_spark_checksum_func_default_storage();
498
529
  uint16_t uniffi_breez_sdk_spark_checksum_func_init_logging();
499
- uint16_t uniffi_breez_sdk_spark_checksum_func_parse();
500
530
  uint16_t
501
531
  uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_address_utxos();
502
532
  uint16_t
@@ -508,6 +538,7 @@ uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_broadcast_transaction
508
538
  uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_add_event_listener();
509
539
  uint16_t
510
540
  uniffi_breez_sdk_spark_checksum_method_breezsdk_check_lightning_address_available();
541
+ uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_check_message();
511
542
  uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_claim_deposit();
512
543
  uint16_t
513
544
  uniffi_breez_sdk_spark_checksum_method_breezsdk_delete_lightning_address();
@@ -523,6 +554,8 @@ uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_list_payments();
523
554
  uint16_t
524
555
  uniffi_breez_sdk_spark_checksum_method_breezsdk_list_unclaimed_deposits();
525
556
  uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_pay();
557
+ uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_withdraw();
558
+ uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_parse();
526
559
  uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_lnurl_pay();
527
560
  uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_payment();
528
561
  uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_receive_payment();
@@ -532,14 +565,18 @@ uniffi_breez_sdk_spark_checksum_method_breezsdk_register_lightning_address();
532
565
  uint16_t
533
566
  uniffi_breez_sdk_spark_checksum_method_breezsdk_remove_event_listener();
534
567
  uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment();
568
+ uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_sign_message();
535
569
  uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_sync_wallet();
536
570
  uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_wait_for_payment();
571
+ uint16_t uniffi_breez_sdk_spark_checksum_method_paymentobserver_before_send();
537
572
  uint16_t uniffi_breez_sdk_spark_checksum_method_sdkbuilder_build();
538
573
  uint16_t uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_chain_service();
539
574
  uint16_t uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_fiat_service();
540
575
  uint16_t uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_key_set();
541
576
  uint16_t uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_lnurl_client();
542
577
  uint16_t
578
+ uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_payment_observer();
579
+ uint16_t
543
580
  uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_rest_chain_service();
544
581
  uint16_t uniffi_breez_sdk_spark_checksum_method_storage_delete_cached_item();
545
582
  uint16_t uniffi_breez_sdk_spark_checksum_method_storage_get_cached_item();
@@ -1362,6 +1399,118 @@ static void cleanup() {
1362
1399
  } // namespace
1363
1400
  // uniffi::breez_sdk_spark::st::vtablecallbackinterfacebitcoinchainservice::vtablecallbackinterfacebitcoinchainservice::free
1364
1401
 
1402
+ // Callback function:
1403
+ // uniffi::breez_sdk_spark::st::vtablecallbackinterfacepaymentobserver::vtablecallbackinterfacepaymentobserver::free::UniffiCallbackInterfaceFree
1404
+ //
1405
+ // We have the following constraints:
1406
+ // - we need to pass a function pointer to Rust.
1407
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
1408
+ // - function pointers can't store state, so we can't use a lamda.
1409
+ //
1410
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback`
1411
+ // function calls the lambda, which itself calls the `body` which then calls
1412
+ // into JS.
1413
+ //
1414
+ // We then give the `callback` function pointer to Rust which will call the
1415
+ // lambda sometime in the future.
1416
+ namespace uniffi::breez_sdk_spark::st::vtablecallbackinterfacepaymentobserver::
1417
+ vtablecallbackinterfacepaymentobserver::free {
1418
+ using namespace facebook;
1419
+
1420
+ // We need to store a lambda in a global so we can call it from
1421
+ // a function pointer. The function pointer is passed to Rust.
1422
+ static std::function<void(uint64_t)> rsLambda = nullptr;
1423
+
1424
+ // This is the main body of the callback. It's called from the lambda,
1425
+ // which itself is called from the callback function which is passed to Rust.
1426
+ static void body(jsi::Runtime &rt,
1427
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
1428
+ std::shared_ptr<jsi::Value> callbackValue,
1429
+ uint64_t rs_handle) {
1430
+
1431
+ // Convert the arguments from Rust, into jsi::Values.
1432
+ // We'll use the Bridging class to do this…
1433
+ auto js_handle =
1434
+ uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_handle);
1435
+
1436
+ // Now we are ready to call the callback.
1437
+ // We are already on the JS thread, because this `body` function was
1438
+ // invoked from the CallInvoker.
1439
+ try {
1440
+ // Getting the callback function
1441
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
1442
+ auto uniffiResult = cb.call(rt, js_handle);
1443
+
1444
+ } catch (const jsi::JSError &error) {
1445
+ std::cout << "Error in callback UniffiCallbackInterfaceFree: "
1446
+ << error.what() << std::endl;
1447
+ throw error;
1448
+ }
1449
+ }
1450
+
1451
+ static void callback(uint64_t rs_handle) {
1452
+ // If the runtime has shutdown, then there is no point in trying to
1453
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
1454
+ //
1455
+ // Answer: the module destructor calls into callback `cleanup` method,
1456
+ // which nulls out the rsLamda.
1457
+ //
1458
+ // If rsLamda is null, then there is no runtime to call into.
1459
+ if (rsLambda == nullptr) {
1460
+ // This only occurs when destructors are calling into Rust free/drop,
1461
+ // which causes the JS callback to be dropped.
1462
+ return;
1463
+ }
1464
+
1465
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
1466
+ // are all in the lambda.
1467
+ rsLambda(rs_handle);
1468
+ }
1469
+
1470
+ static UniffiCallbackInterfaceFree
1471
+ makeCallbackFunction( // uniffi::breez_sdk_spark::st::vtablecallbackinterfacepaymentobserver::vtablecallbackinterfacepaymentobserver::free
1472
+ jsi::Runtime &rt,
1473
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
1474
+ const jsi::Value &value) {
1475
+ if (rsLambda != nullptr) {
1476
+ // `makeCallbackFunction` is called in two circumstances:
1477
+ //
1478
+ // 1. at startup, when initializing callback interface vtables.
1479
+ // 2. when polling futures. This happens at least once per future that is
1480
+ // exposed to Javascript. We know that this is always the same function,
1481
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
1482
+ //
1483
+ // We can therefore return the callback function without making anything
1484
+ // new if we've been initialized already.
1485
+ return callback;
1486
+ }
1487
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
1488
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
1489
+ rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_handle) {
1490
+ // We immediately make a lambda which will do the work of transforming the
1491
+ // arguments into JSI values and calling the callback.
1492
+ uniffi_runtime::UniffiCallFunc jsLambda =
1493
+ [callInvoker, callbackValue, rs_handle](jsi::Runtime &rt) mutable {
1494
+ body(rt, callInvoker, callbackValue, rs_handle);
1495
+ };
1496
+ // We'll then call that lambda from the callInvoker which will
1497
+ // look after calling it on the correct thread.
1498
+
1499
+ callInvoker->invokeNonBlocking(rt, jsLambda);
1500
+ };
1501
+ return callback;
1502
+ }
1503
+
1504
+ // This method is called from the destructor of NativeBreezSdkSpark, which only
1505
+ // happens when the jsi::Runtime is being destroyed.
1506
+ static void cleanup() {
1507
+ // The lambda holds a reference to the the Runtime, so when this is nulled
1508
+ // out, then the pointer will no longer be left dangling.
1509
+ rsLambda = nullptr;
1510
+ }
1511
+ } // namespace
1512
+ // uniffi::breez_sdk_spark::st::vtablecallbackinterfacepaymentobserver::vtablecallbackinterfacepaymentobserver::free
1513
+
1365
1514
  // Callback function:
1366
1515
  // uniffi::breez_sdk_spark::st::vtablecallbackinterfacestorage::vtablecallbackinterfacestorage::free::UniffiCallbackInterfaceFree
1367
1516
  //
@@ -3235,6 +3384,148 @@ static void cleanup() {
3235
3384
  } // namespace
3236
3385
  // uniffi::breez_sdk_spark::cb::callbackinterfacebitcoinchainservicemethod3
3237
3386
  // Implementation of callback function calling from Rust to JS
3387
+ // CallbackInterfacePaymentObserverMethod0
3388
+
3389
+ // Callback function:
3390
+ // uniffi::breez_sdk_spark::cb::callbackinterfacepaymentobservermethod0::UniffiCallbackInterfacePaymentObserverMethod0
3391
+ //
3392
+ // We have the following constraints:
3393
+ // - we need to pass a function pointer to Rust.
3394
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
3395
+ // - function pointers can't store state, so we can't use a lamda.
3396
+ //
3397
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback`
3398
+ // function calls the lambda, which itself calls the `body` which then calls
3399
+ // into JS.
3400
+ //
3401
+ // We then give the `callback` function pointer to Rust which will call the
3402
+ // lambda sometime in the future.
3403
+ namespace uniffi::breez_sdk_spark::cb::callbackinterfacepaymentobservermethod0 {
3404
+ using namespace facebook;
3405
+
3406
+ // We need to store a lambda in a global so we can call it from
3407
+ // a function pointer. The function pointer is passed to Rust.
3408
+ static std::function<void(uint64_t, RustBuffer, UniffiForeignFutureCompleteVoid,
3409
+ uint64_t, UniffiForeignFuture *)>
3410
+ rsLambda = nullptr;
3411
+
3412
+ // This is the main body of the callback. It's called from the lambda,
3413
+ // which itself is called from the callback function which is passed to Rust.
3414
+ static void body(jsi::Runtime &rt,
3415
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
3416
+ std::shared_ptr<jsi::Value> callbackValue,
3417
+ uint64_t rs_uniffiHandle, RustBuffer rs_payments,
3418
+ UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
3419
+ uint64_t rs_uniffiCallbackData,
3420
+ UniffiForeignFuture *rs_uniffiOutReturn) {
3421
+
3422
+ // Convert the arguments from Rust, into jsi::Values.
3423
+ // We'll use the Bridging class to do this…
3424
+ auto js_uniffiHandle =
3425
+ uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_uniffiHandle);
3426
+ auto js_payments = uniffi::breez_sdk_spark::Bridging<RustBuffer>::toJs(
3427
+ rt, callInvoker, rs_payments);
3428
+ auto js_uniffiFutureCallback =
3429
+ uniffi::breez_sdk_spark::Bridging<UniffiForeignFutureCompleteVoid>::toJs(
3430
+ rt, callInvoker, rs_uniffiFutureCallback);
3431
+ auto js_uniffiCallbackData = uniffi_jsi::Bridging<uint64_t>::toJs(
3432
+ rt, callInvoker, rs_uniffiCallbackData);
3433
+
3434
+ // Now we are ready to call the callback.
3435
+ // We are already on the JS thread, because this `body` function was
3436
+ // invoked from the CallInvoker.
3437
+ try {
3438
+ // Getting the callback function
3439
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
3440
+ auto uniffiResult = cb.call(rt, js_uniffiHandle, js_payments,
3441
+ js_uniffiFutureCallback, js_uniffiCallbackData);
3442
+
3443
+ // Finally, we need to copy the return value back into the Rust pointer.
3444
+ *rs_uniffiOutReturn = uniffi::breez_sdk_spark::Bridging<
3445
+ ReferenceHolder<UniffiForeignFuture>>::fromJs(rt, callInvoker,
3446
+ uniffiResult);
3447
+ } catch (const jsi::JSError &error) {
3448
+ std::cout
3449
+ << "Error in callback UniffiCallbackInterfacePaymentObserverMethod0: "
3450
+ << error.what() << std::endl;
3451
+ throw error;
3452
+ }
3453
+ }
3454
+
3455
+ static void callback(uint64_t rs_uniffiHandle, RustBuffer rs_payments,
3456
+ UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
3457
+ uint64_t rs_uniffiCallbackData,
3458
+ UniffiForeignFuture *rs_uniffiOutReturn) {
3459
+ // If the runtime has shutdown, then there is no point in trying to
3460
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
3461
+ //
3462
+ // Answer: the module destructor calls into callback `cleanup` method,
3463
+ // which nulls out the rsLamda.
3464
+ //
3465
+ // If rsLamda is null, then there is no runtime to call into.
3466
+ if (rsLambda == nullptr) {
3467
+ // This only occurs when destructors are calling into Rust free/drop,
3468
+ // which causes the JS callback to be dropped.
3469
+ return;
3470
+ }
3471
+
3472
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
3473
+ // are all in the lambda.
3474
+ rsLambda(rs_uniffiHandle, rs_payments, rs_uniffiFutureCallback,
3475
+ rs_uniffiCallbackData, rs_uniffiOutReturn);
3476
+ }
3477
+
3478
+ static UniffiCallbackInterfacePaymentObserverMethod0
3479
+ makeCallbackFunction( // uniffi::breez_sdk_spark::cb::callbackinterfacepaymentobservermethod0
3480
+ jsi::Runtime &rt,
3481
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
3482
+ const jsi::Value &value) {
3483
+ if (rsLambda != nullptr) {
3484
+ // `makeCallbackFunction` is called in two circumstances:
3485
+ //
3486
+ // 1. at startup, when initializing callback interface vtables.
3487
+ // 2. when polling futures. This happens at least once per future that is
3488
+ // exposed to Javascript. We know that this is always the same function,
3489
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
3490
+ //
3491
+ // We can therefore return the callback function without making anything
3492
+ // new if we've been initialized already.
3493
+ return callback;
3494
+ }
3495
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
3496
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
3497
+ rsLambda = [&rt, callInvoker, callbackValue](
3498
+ uint64_t rs_uniffiHandle, RustBuffer rs_payments,
3499
+ UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
3500
+ uint64_t rs_uniffiCallbackData,
3501
+ UniffiForeignFuture *rs_uniffiOutReturn) {
3502
+ // We immediately make a lambda which will do the work of transforming the
3503
+ // arguments into JSI values and calling the callback.
3504
+ uniffi_runtime::UniffiCallFunc jsLambda =
3505
+ [callInvoker, callbackValue, rs_uniffiHandle, rs_payments,
3506
+ rs_uniffiFutureCallback, rs_uniffiCallbackData,
3507
+ rs_uniffiOutReturn](jsi::Runtime &rt) mutable {
3508
+ body(rt, callInvoker, callbackValue, rs_uniffiHandle, rs_payments,
3509
+ rs_uniffiFutureCallback, rs_uniffiCallbackData,
3510
+ rs_uniffiOutReturn);
3511
+ };
3512
+ // We'll then call that lambda from the callInvoker which will
3513
+ // look after calling it on the correct thread.
3514
+ callInvoker->invokeBlocking(rt, jsLambda);
3515
+ };
3516
+ return callback;
3517
+ }
3518
+
3519
+ // This method is called from the destructor of NativeBreezSdkSpark, which only
3520
+ // happens when the jsi::Runtime is being destroyed.
3521
+ static void cleanup() {
3522
+ // The lambda holds a reference to the the Runtime, so when this is nulled
3523
+ // out, then the pointer will no longer be left dangling.
3524
+ rsLambda = nullptr;
3525
+ }
3526
+ } // namespace
3527
+ // uniffi::breez_sdk_spark::cb::callbackinterfacepaymentobservermethod0
3528
+ // Implementation of callback function calling from Rust to JS
3238
3529
  // CallbackInterfaceStorageMethod0
3239
3530
 
3240
3531
  // Callback function:
@@ -5068,25 +5359,59 @@ namespace uniffi::breez_sdk_spark {
5068
5359
  using namespace facebook;
5069
5360
  using CallInvoker = uniffi_runtime::UniffiCallInvoker;
5070
5361
 
5071
- template <> struct Bridging<UniffiVTableCallbackInterfaceStorage> {
5072
- static UniffiVTableCallbackInterfaceStorage
5362
+ template <> struct Bridging<UniffiVTableCallbackInterfacePaymentObserver> {
5363
+ static UniffiVTableCallbackInterfacePaymentObserver
5073
5364
  fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
5074
5365
  const jsi::Value &jsValue) {
5075
5366
  // Check if the input is an object
5076
5367
  if (!jsValue.isObject()) {
5077
- throw jsi::JSError(
5078
- rt, "Expected an object for UniffiVTableCallbackInterfaceStorage");
5368
+ throw jsi::JSError(rt, "Expected an object for "
5369
+ "UniffiVTableCallbackInterfacePaymentObserver");
5079
5370
  }
5080
5371
 
5081
5372
  // Get the object from the jsi::Value
5082
5373
  auto jsObject = jsValue.getObject(rt);
5083
5374
 
5084
5375
  // Create the vtable struct
5085
- UniffiVTableCallbackInterfaceStorage rsObject;
5376
+ UniffiVTableCallbackInterfacePaymentObserver rsObject;
5086
5377
 
5087
5378
  // Create the vtable from the js callbacks.
5088
- rsObject.delete_cached_item = uniffi::breez_sdk_spark::cb::
5089
- callbackinterfacestoragemethod0::makeCallbackFunction(
5379
+ rsObject.before_send = uniffi::breez_sdk_spark::cb::
5380
+ callbackinterfacepaymentobservermethod0::makeCallbackFunction(
5381
+ rt, callInvoker, jsObject.getProperty(rt, "beforeSend"));
5382
+ rsObject.uniffi_free =
5383
+ uniffi::breez_sdk_spark::st::vtablecallbackinterfacepaymentobserver::
5384
+ vtablecallbackinterfacepaymentobserver::free::makeCallbackFunction(
5385
+ rt, callInvoker, jsObject.getProperty(rt, "uniffiFree"));
5386
+
5387
+ return rsObject;
5388
+ }
5389
+ };
5390
+
5391
+ } // namespace uniffi::breez_sdk_spark
5392
+ namespace uniffi::breez_sdk_spark {
5393
+ using namespace facebook;
5394
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
5395
+
5396
+ template <> struct Bridging<UniffiVTableCallbackInterfaceStorage> {
5397
+ static UniffiVTableCallbackInterfaceStorage
5398
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
5399
+ const jsi::Value &jsValue) {
5400
+ // Check if the input is an object
5401
+ if (!jsValue.isObject()) {
5402
+ throw jsi::JSError(
5403
+ rt, "Expected an object for UniffiVTableCallbackInterfaceStorage");
5404
+ }
5405
+
5406
+ // Get the object from the jsi::Value
5407
+ auto jsObject = jsValue.getObject(rt);
5408
+
5409
+ // Create the vtable struct
5410
+ UniffiVTableCallbackInterfaceStorage rsObject;
5411
+
5412
+ // Create the vtable from the js callbacks.
5413
+ rsObject.delete_cached_item = uniffi::breez_sdk_spark::cb::
5414
+ callbackinterfacestoragemethod0::makeCallbackFunction(
5090
5415
  rt, callInvoker, jsObject.getProperty(rt, "deleteCachedItem"));
5091
5416
  rsObject.get_cached_item = uniffi::breez_sdk_spark::cb::
5092
5417
  callbackinterfacestoragemethod1::makeCallbackFunction(
@@ -5309,6 +5634,19 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
5309
5634
  ->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_check_lightning_address_available(
5310
5635
  rt, thisVal, args, count);
5311
5636
  });
5637
+ props["ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_check_message"] =
5638
+ jsi::Function::createFromHostFunction(
5639
+ rt,
5640
+ jsi::PropNameID::forAscii(
5641
+ rt,
5642
+ "ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_check_message"),
5643
+ 2,
5644
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
5645
+ const jsi::Value *args, size_t count) -> jsi::Value {
5646
+ return this
5647
+ ->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_check_message(
5648
+ rt, thisVal, args, count);
5649
+ });
5312
5650
  props["ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_claim_deposit"] =
5313
5651
  jsi::Function::createFromHostFunction(
5314
5652
  rt,
@@ -5455,6 +5793,30 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
5455
5793
  ->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_lnurl_pay(
5456
5794
  rt, thisVal, args, count);
5457
5795
  });
5796
+ props["ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_lnurl_withdraw"] =
5797
+ jsi::Function::createFromHostFunction(
5798
+ rt,
5799
+ jsi::PropNameID::forAscii(
5800
+ rt,
5801
+ "ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_lnurl_withdraw"),
5802
+ 2,
5803
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
5804
+ const jsi::Value *args, size_t count) -> jsi::Value {
5805
+ return this
5806
+ ->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_lnurl_withdraw(
5807
+ rt, thisVal, args, count);
5808
+ });
5809
+ props["ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_parse"] =
5810
+ jsi::Function::createFromHostFunction(
5811
+ rt,
5812
+ jsi::PropNameID::forAscii(
5813
+ rt, "ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_parse"),
5814
+ 2,
5815
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
5816
+ const jsi::Value *args, size_t count) -> jsi::Value {
5817
+ return this->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_parse(
5818
+ rt, thisVal, args, count);
5819
+ });
5458
5820
  props["ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_lnurl_pay"] =
5459
5821
  jsi::Function::createFromHostFunction(
5460
5822
  rt,
@@ -5542,6 +5904,19 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
5542
5904
  ->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_send_payment(
5543
5905
  rt, thisVal, args, count);
5544
5906
  });
5907
+ props["ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_sign_message"] =
5908
+ jsi::Function::createFromHostFunction(
5909
+ rt,
5910
+ jsi::PropNameID::forAscii(
5911
+ rt,
5912
+ "ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_sign_message"),
5913
+ 2,
5914
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
5915
+ const jsi::Value *args, size_t count) -> jsi::Value {
5916
+ return this
5917
+ ->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_sign_message(
5918
+ rt, thisVal, args, count);
5919
+ });
5545
5920
  props["ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_sync_wallet"] =
5546
5921
  jsi::Function::createFromHostFunction(
5547
5922
  rt,
@@ -5566,6 +5941,40 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
5566
5941
  ->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_wait_for_payment(
5567
5942
  rt, thisVal, args, count);
5568
5943
  });
5944
+ props["ubrn_uniffi_breez_sdk_spark_fn_clone_paymentobserver"] =
5945
+ jsi::Function::createFromHostFunction(
5946
+ rt,
5947
+ jsi::PropNameID::forAscii(
5948
+ rt, "ubrn_uniffi_breez_sdk_spark_fn_clone_paymentobserver"),
5949
+ 1,
5950
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
5951
+ const jsi::Value *args, size_t count) -> jsi::Value {
5952
+ return this->cpp_uniffi_breez_sdk_spark_fn_clone_paymentobserver(
5953
+ rt, thisVal, args, count);
5954
+ });
5955
+ props["ubrn_uniffi_breez_sdk_spark_fn_free_paymentobserver"] =
5956
+ jsi::Function::createFromHostFunction(
5957
+ rt,
5958
+ jsi::PropNameID::forAscii(
5959
+ rt, "ubrn_uniffi_breez_sdk_spark_fn_free_paymentobserver"),
5960
+ 1,
5961
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
5962
+ const jsi::Value *args, size_t count) -> jsi::Value {
5963
+ return this->cpp_uniffi_breez_sdk_spark_fn_free_paymentobserver(
5964
+ rt, thisVal, args, count);
5965
+ });
5966
+ props["ubrn_uniffi_breez_sdk_spark_fn_method_paymentobserver_before_send"] =
5967
+ jsi::Function::createFromHostFunction(
5968
+ rt,
5969
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_fn_method_"
5970
+ "paymentobserver_before_send"),
5971
+ 2,
5972
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
5973
+ const jsi::Value *args, size_t count) -> jsi::Value {
5974
+ return this
5975
+ ->cpp_uniffi_breez_sdk_spark_fn_method_paymentobserver_before_send(
5976
+ rt, thisVal, args, count);
5977
+ });
5569
5978
  props["ubrn_uniffi_breez_sdk_spark_fn_clone_sdkbuilder"] =
5570
5979
  jsi::Function::createFromHostFunction(
5571
5980
  rt,
@@ -5660,6 +6069,18 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
5660
6069
  ->cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_lnurl_client(
5661
6070
  rt, thisVal, args, count);
5662
6071
  });
6072
+ props["ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_payment_"
6073
+ "observer"] = jsi::Function::createFromHostFunction(
6074
+ rt,
6075
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_fn_method_"
6076
+ "sdkbuilder_with_payment_observer"),
6077
+ 2,
6078
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
6079
+ const jsi::Value *args, size_t count) -> jsi::Value {
6080
+ return this
6081
+ ->cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_payment_observer(
6082
+ rt, thisVal, args, count);
6083
+ });
5663
6084
  props["ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_rest_chain_"
5664
6085
  "service"] = jsi::Function::createFromHostFunction(
5665
6086
  rt,
@@ -5889,17 +6310,6 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
5889
6310
  return this->cpp_uniffi_breez_sdk_spark_fn_func_init_logging(
5890
6311
  rt, thisVal, args, count);
5891
6312
  });
5892
- props["ubrn_uniffi_breez_sdk_spark_fn_func_parse"] =
5893
- jsi::Function::createFromHostFunction(
5894
- rt,
5895
- jsi::PropNameID::forAscii(
5896
- rt, "ubrn_uniffi_breez_sdk_spark_fn_func_parse"),
5897
- 1,
5898
- [this](jsi::Runtime &rt, const jsi::Value &thisVal,
5899
- const jsi::Value *args, size_t count) -> jsi::Value {
5900
- return this->cpp_uniffi_breez_sdk_spark_fn_func_parse(rt, thisVal,
5901
- args, count);
5902
- });
5903
6313
  props["ubrn_ffi_breez_sdk_spark_rust_future_poll_u8"] =
5904
6314
  jsi::Function::createFromHostFunction(
5905
6315
  rt,
@@ -6519,17 +6929,6 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
6519
6929
  return this->cpp_uniffi_breez_sdk_spark_checksum_func_init_logging(
6520
6930
  rt, thisVal, args, count);
6521
6931
  });
6522
- props["ubrn_uniffi_breez_sdk_spark_checksum_func_parse"] =
6523
- jsi::Function::createFromHostFunction(
6524
- rt,
6525
- jsi::PropNameID::forAscii(
6526
- rt, "ubrn_uniffi_breez_sdk_spark_checksum_func_parse"),
6527
- 0,
6528
- [this](jsi::Runtime &rt, const jsi::Value &thisVal,
6529
- const jsi::Value *args, size_t count) -> jsi::Value {
6530
- return this->cpp_uniffi_breez_sdk_spark_checksum_func_parse(
6531
- rt, thisVal, args, count);
6532
- });
6533
6932
  props["ubrn_uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_"
6534
6933
  "address_utxos"] = jsi::Function::createFromHostFunction(
6535
6934
  rt,
@@ -6607,6 +7006,18 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
6607
7006
  ->cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_check_lightning_address_available(
6608
7007
  rt, thisVal, args, count);
6609
7008
  });
7009
+ props["ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_check_message"] =
7010
+ jsi::Function::createFromHostFunction(
7011
+ rt,
7012
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_checksum_"
7013
+ "method_breezsdk_check_message"),
7014
+ 0,
7015
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
7016
+ const jsi::Value *args, size_t count) -> jsi::Value {
7017
+ return this
7018
+ ->cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_check_message(
7019
+ rt, thisVal, args, count);
7020
+ });
6610
7021
  props["ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_claim_deposit"] =
6611
7022
  jsi::Function::createFromHostFunction(
6612
7023
  rt,
@@ -6753,6 +7164,30 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
6753
7164
  ->cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_pay(
6754
7165
  rt, thisVal, args, count);
6755
7166
  });
7167
+ props["ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_withdraw"] =
7168
+ jsi::Function::createFromHostFunction(
7169
+ rt,
7170
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_checksum_"
7171
+ "method_breezsdk_lnurl_withdraw"),
7172
+ 0,
7173
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
7174
+ const jsi::Value *args, size_t count) -> jsi::Value {
7175
+ return this
7176
+ ->cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_withdraw(
7177
+ rt, thisVal, args, count);
7178
+ });
7179
+ props["ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_parse"] =
7180
+ jsi::Function::createFromHostFunction(
7181
+ rt,
7182
+ jsi::PropNameID::forAscii(
7183
+ rt, "ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_parse"),
7184
+ 0,
7185
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
7186
+ const jsi::Value *args, size_t count) -> jsi::Value {
7187
+ return this
7188
+ ->cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_parse(
7189
+ rt, thisVal, args, count);
7190
+ });
6756
7191
  props["ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_lnurl_"
6757
7192
  "pay"] = jsi::Function::createFromHostFunction(
6758
7193
  rt,
@@ -6838,6 +7273,18 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
6838
7273
  ->cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment(
6839
7274
  rt, thisVal, args, count);
6840
7275
  });
7276
+ props["ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_sign_message"] =
7277
+ jsi::Function::createFromHostFunction(
7278
+ rt,
7279
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_checksum_"
7280
+ "method_breezsdk_sign_message"),
7281
+ 0,
7282
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
7283
+ const jsi::Value *args, size_t count) -> jsi::Value {
7284
+ return this
7285
+ ->cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_sign_message(
7286
+ rt, thisVal, args, count);
7287
+ });
6841
7288
  props["ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_sync_wallet"] =
6842
7289
  jsi::Function::createFromHostFunction(
6843
7290
  rt,
@@ -6862,6 +7309,18 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
6862
7309
  ->cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_wait_for_payment(
6863
7310
  rt, thisVal, args, count);
6864
7311
  });
7312
+ props["ubrn_uniffi_breez_sdk_spark_checksum_method_paymentobserver_before_"
7313
+ "send"] = jsi::Function::createFromHostFunction(
7314
+ rt,
7315
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_checksum_"
7316
+ "method_paymentobserver_before_send"),
7317
+ 0,
7318
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
7319
+ const jsi::Value *args, size_t count) -> jsi::Value {
7320
+ return this
7321
+ ->cpp_uniffi_breez_sdk_spark_checksum_method_paymentobserver_before_send(
7322
+ rt, thisVal, args, count);
7323
+ });
6865
7324
  props["ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_build"] =
6866
7325
  jsi::Function::createFromHostFunction(
6867
7326
  rt,
@@ -6923,6 +7382,18 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
6923
7382
  ->cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_lnurl_client(
6924
7383
  rt, thisVal, args, count);
6925
7384
  });
7385
+ props["ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_payment_"
7386
+ "observer"] = jsi::Function::createFromHostFunction(
7387
+ rt,
7388
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_checksum_"
7389
+ "method_sdkbuilder_with_payment_observer"),
7390
+ 0,
7391
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
7392
+ const jsi::Value *args, size_t count) -> jsi::Value {
7393
+ return this
7394
+ ->cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_payment_observer(
7395
+ rt, thisVal, args, count);
7396
+ });
6926
7397
  props["ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_rest_"
6927
7398
  "chain_service"] = jsi::Function::createFromHostFunction(
6928
7399
  rt,
@@ -7162,6 +7633,18 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
7162
7633
  ->cpp_uniffi_breez_sdk_spark_fn_init_callback_vtable_bitcoinchainservice(
7163
7634
  rt, thisVal, args, count);
7164
7635
  });
7636
+ props["ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_paymentobserver"] =
7637
+ jsi::Function::createFromHostFunction(
7638
+ rt,
7639
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_fn_init_"
7640
+ "callback_vtable_paymentobserver"),
7641
+ 1,
7642
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
7643
+ const jsi::Value *args, size_t count) -> jsi::Value {
7644
+ return this
7645
+ ->cpp_uniffi_breez_sdk_spark_fn_init_callback_vtable_paymentobserver(
7646
+ rt, thisVal, args, count);
7647
+ });
7165
7648
  props["ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_storage"] =
7166
7649
  jsi::Function::createFromHostFunction(
7167
7650
  rt,
@@ -7199,6 +7682,18 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
7199
7682
  ->cpp_uniffi_internal_fn_method_breezsdk_ffi__bless_pointer(
7200
7683
  rt, thisVal, args, count);
7201
7684
  });
7685
+ props["ubrn_uniffi_internal_fn_method_paymentobserver_ffi__bless_pointer"] =
7686
+ jsi::Function::createFromHostFunction(
7687
+ rt,
7688
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_method_"
7689
+ "paymentobserver_ffi__bless_pointer"),
7690
+ 1,
7691
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
7692
+ const jsi::Value *args, size_t count) -> jsi::Value {
7693
+ return this
7694
+ ->cpp_uniffi_internal_fn_method_paymentobserver_ffi__bless_pointer(
7695
+ rt, thisVal, args, count);
7696
+ });
7202
7697
  props["ubrn_uniffi_internal_fn_method_sdkbuilder_ffi__bless_pointer"] =
7203
7698
  jsi::Function::createFromHostFunction(
7204
7699
  rt,
@@ -7273,6 +7768,8 @@ NativeBreezSdkSpark::~NativeBreezSdkSpark() {
7273
7768
  vtablecallbackinterfacelogger::free::cleanup();
7274
7769
  uniffi::breez_sdk_spark::st::vtablecallbackinterfacebitcoinchainservice::
7275
7770
  vtablecallbackinterfacebitcoinchainservice::free::cleanup();
7771
+ uniffi::breez_sdk_spark::st::vtablecallbackinterfacepaymentobserver::
7772
+ vtablecallbackinterfacepaymentobserver::free::cleanup();
7276
7773
  uniffi::breez_sdk_spark::st::vtablecallbackinterfacestorage::
7277
7774
  vtablecallbackinterfacestorage::free::cleanup();
7278
7775
  // Cleanup for callback function CallbackInterfaceEventListenerMethod0
@@ -7291,6 +7788,9 @@ NativeBreezSdkSpark::~NativeBreezSdkSpark() {
7291
7788
  // Cleanup for callback function CallbackInterfaceBitcoinChainServiceMethod3
7292
7789
  uniffi::breez_sdk_spark::cb::callbackinterfacebitcoinchainservicemethod3::
7293
7790
  cleanup();
7791
+ // Cleanup for callback function CallbackInterfacePaymentObserverMethod0
7792
+ uniffi::breez_sdk_spark::cb::callbackinterfacepaymentobservermethod0::
7793
+ cleanup();
7294
7794
  // Cleanup for callback function CallbackInterfaceStorageMethod0
7295
7795
  uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod0::cleanup();
7296
7796
  // Cleanup for callback function CallbackInterfaceStorageMethod1
@@ -7370,6 +7870,22 @@ NativeBreezSdkSpark::cpp_uniffi_internal_fn_method_breezsdk_ffi__bless_pointer(
7370
7870
  auto obj = jsi::Object::createFromHostObject(rt, ptrObj);
7371
7871
  return jsi::Value(rt, obj);
7372
7872
  }
7873
+ jsi::Value NativeBreezSdkSpark::
7874
+ cpp_uniffi_internal_fn_method_paymentobserver_ffi__bless_pointer(
7875
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
7876
+ size_t count) {
7877
+ auto pointer =
7878
+ uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]);
7879
+ auto static destructor = [](uint64_t p) {
7880
+ auto pointer = reinterpret_cast<void *>(static_cast<uintptr_t>(p));
7881
+ RustCallStatus status = {0};
7882
+ uniffi_breez_sdk_spark_fn_free_paymentobserver(pointer, &status);
7883
+ };
7884
+ auto ptrObj =
7885
+ std::make_shared<uniffi_jsi::DestructibleObject>(pointer, destructor);
7886
+ auto obj = jsi::Object::createFromHostObject(rt, ptrObj);
7887
+ return jsi::Value(rt, obj);
7888
+ }
7373
7889
  jsi::Value NativeBreezSdkSpark::
7374
7890
  cpp_uniffi_internal_fn_method_sdkbuilder_ffi__bless_pointer(
7375
7891
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -7530,6 +8046,18 @@ jsi::Value NativeBreezSdkSpark::
7530
8046
  return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
7531
8047
  value);
7532
8048
  }
8049
+ jsi::Value NativeBreezSdkSpark::
8050
+ cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_check_message(
8051
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
8052
+ size_t count) {
8053
+ auto value = uniffi_breez_sdk_spark_fn_method_breezsdk_check_message(
8054
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
8055
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
8056
+ args[1]));
8057
+
8058
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
8059
+ value);
8060
+ }
7533
8061
  jsi::Value NativeBreezSdkSpark::
7534
8062
  cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_claim_deposit(
7535
8063
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -7666,6 +8194,30 @@ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_lnurl_pay(
7666
8194
  return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
7667
8195
  value);
7668
8196
  }
8197
+ jsi::Value NativeBreezSdkSpark::
8198
+ cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_lnurl_withdraw(
8199
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
8200
+ size_t count) {
8201
+ auto value = uniffi_breez_sdk_spark_fn_method_breezsdk_lnurl_withdraw(
8202
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
8203
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
8204
+ args[1]));
8205
+
8206
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
8207
+ value);
8208
+ }
8209
+ jsi::Value
8210
+ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_parse(
8211
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
8212
+ size_t count) {
8213
+ auto value = uniffi_breez_sdk_spark_fn_method_breezsdk_parse(
8214
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
8215
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
8216
+ args[1]));
8217
+
8218
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
8219
+ value);
8220
+ }
7669
8221
  jsi::Value NativeBreezSdkSpark::
7670
8222
  cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_lnurl_pay(
7671
8223
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -7752,6 +8304,18 @@ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_send_payment(
7752
8304
  value);
7753
8305
  }
7754
8306
  jsi::Value
8307
+ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_sign_message(
8308
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
8309
+ size_t count) {
8310
+ auto value = uniffi_breez_sdk_spark_fn_method_breezsdk_sign_message(
8311
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
8312
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
8313
+ args[1]));
8314
+
8315
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
8316
+ value);
8317
+ }
8318
+ jsi::Value
7755
8319
  NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_sync_wallet(
7756
8320
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
7757
8321
  size_t count) {
@@ -7775,6 +8339,44 @@ jsi::Value NativeBreezSdkSpark::
7775
8339
  return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
7776
8340
  value);
7777
8341
  }
8342
+ jsi::Value
8343
+ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_clone_paymentobserver(
8344
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
8345
+ size_t count) {
8346
+ RustCallStatus status =
8347
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::rustSuccess(rt);
8348
+ auto value = uniffi_breez_sdk_spark_fn_clone_paymentobserver(
8349
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]), &status);
8350
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::copyIntoJs(
8351
+ rt, callInvoker, status, args[count - 1]);
8352
+
8353
+ return uniffi_jsi::Bridging<void *>::toJs(rt, callInvoker, value);
8354
+ }
8355
+ jsi::Value
8356
+ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_free_paymentobserver(
8357
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
8358
+ size_t count) {
8359
+ RustCallStatus status =
8360
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::rustSuccess(rt);
8361
+ uniffi_breez_sdk_spark_fn_free_paymentobserver(
8362
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]), &status);
8363
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::copyIntoJs(
8364
+ rt, callInvoker, status, args[count - 1]);
8365
+
8366
+ return jsi::Value::undefined();
8367
+ }
8368
+ jsi::Value NativeBreezSdkSpark::
8369
+ cpp_uniffi_breez_sdk_spark_fn_method_paymentobserver_before_send(
8370
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
8371
+ size_t count) {
8372
+ auto value = uniffi_breez_sdk_spark_fn_method_paymentobserver_before_send(
8373
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
8374
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
8375
+ args[1]));
8376
+
8377
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
8378
+ value);
8379
+ }
7778
8380
  jsi::Value NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_clone_sdkbuilder(
7779
8381
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
7780
8382
  size_t count) {
@@ -7874,6 +8476,18 @@ jsi::Value NativeBreezSdkSpark::
7874
8476
  return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
7875
8477
  value);
7876
8478
  }
8479
+ jsi::Value NativeBreezSdkSpark::
8480
+ cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_payment_observer(
8481
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
8482
+ size_t count) {
8483
+ auto value =
8484
+ uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_payment_observer(
8485
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
8486
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[1]));
8487
+
8488
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
8489
+ value);
8490
+ }
7877
8491
  jsi::Value NativeBreezSdkSpark::
7878
8492
  cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_rest_chain_service(
7879
8493
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -8124,16 +8738,6 @@ jsi::Value NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_func_init_logging(
8124
8738
 
8125
8739
  return jsi::Value::undefined();
8126
8740
  }
8127
- jsi::Value NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_func_parse(
8128
- jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
8129
- size_t count) {
8130
- auto value = uniffi_breez_sdk_spark_fn_func_parse(
8131
- uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
8132
- args[0]));
8133
-
8134
- return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
8135
- value);
8136
- }
8137
8741
  jsi::Value NativeBreezSdkSpark::cpp_ffi_breez_sdk_spark_rust_future_poll_u8(
8138
8742
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
8139
8743
  size_t count) {
@@ -8782,13 +9386,6 @@ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_checksum_func_init_logging(
8782
9386
 
8783
9387
  return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
8784
9388
  }
8785
- jsi::Value NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_checksum_func_parse(
8786
- jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
8787
- size_t count) {
8788
- auto value = uniffi_breez_sdk_spark_checksum_func_parse();
8789
-
8790
- return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
8791
- }
8792
9389
  jsi::Value NativeBreezSdkSpark::
8793
9390
  cpp_uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_address_utxos(
8794
9391
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -8843,6 +9440,14 @@ jsi::Value NativeBreezSdkSpark::
8843
9440
 
8844
9441
  return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
8845
9442
  }
9443
+ jsi::Value NativeBreezSdkSpark::
9444
+ cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_check_message(
9445
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
9446
+ size_t count) {
9447
+ auto value = uniffi_breez_sdk_spark_checksum_method_breezsdk_check_message();
9448
+
9449
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
9450
+ }
8846
9451
  jsi::Value NativeBreezSdkSpark::
8847
9452
  cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_claim_deposit(
8848
9453
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -8945,6 +9550,22 @@ jsi::Value NativeBreezSdkSpark::
8945
9550
 
8946
9551
  return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
8947
9552
  }
9553
+ jsi::Value NativeBreezSdkSpark::
9554
+ cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_withdraw(
9555
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
9556
+ size_t count) {
9557
+ auto value = uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_withdraw();
9558
+
9559
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
9560
+ }
9561
+ jsi::Value
9562
+ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_parse(
9563
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
9564
+ size_t count) {
9565
+ auto value = uniffi_breez_sdk_spark_checksum_method_breezsdk_parse();
9566
+
9567
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
9568
+ }
8948
9569
  jsi::Value NativeBreezSdkSpark::
8949
9570
  cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_lnurl_pay(
8950
9571
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -9006,6 +9627,14 @@ jsi::Value NativeBreezSdkSpark::
9006
9627
 
9007
9628
  return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
9008
9629
  }
9630
+ jsi::Value NativeBreezSdkSpark::
9631
+ cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_sign_message(
9632
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
9633
+ size_t count) {
9634
+ auto value = uniffi_breez_sdk_spark_checksum_method_breezsdk_sign_message();
9635
+
9636
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
9637
+ }
9009
9638
  jsi::Value NativeBreezSdkSpark::
9010
9639
  cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_sync_wallet(
9011
9640
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -9023,6 +9652,15 @@ jsi::Value NativeBreezSdkSpark::
9023
9652
 
9024
9653
  return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
9025
9654
  }
9655
+ jsi::Value NativeBreezSdkSpark::
9656
+ cpp_uniffi_breez_sdk_spark_checksum_method_paymentobserver_before_send(
9657
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
9658
+ size_t count) {
9659
+ auto value =
9660
+ uniffi_breez_sdk_spark_checksum_method_paymentobserver_before_send();
9661
+
9662
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
9663
+ }
9026
9664
  jsi::Value NativeBreezSdkSpark::
9027
9665
  cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_build(
9028
9666
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -9066,6 +9704,15 @@ jsi::Value NativeBreezSdkSpark::
9066
9704
 
9067
9705
  return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
9068
9706
  }
9707
+ jsi::Value NativeBreezSdkSpark::
9708
+ cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_payment_observer(
9709
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
9710
+ size_t count) {
9711
+ auto value =
9712
+ uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_payment_observer();
9713
+
9714
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
9715
+ }
9069
9716
  jsi::Value NativeBreezSdkSpark::
9070
9717
  cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_rest_chain_service(
9071
9718
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -9250,6 +9897,21 @@ jsi::Value NativeBreezSdkSpark::
9250
9897
  "UniffiVTableCallbackInterfaceBitcoinChainService", vtableInstance));
9251
9898
  return jsi::Value::undefined();
9252
9899
  }
9900
+ jsi::Value NativeBreezSdkSpark::
9901
+ cpp_uniffi_breez_sdk_spark_fn_init_callback_vtable_paymentobserver(
9902
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
9903
+ size_t count) {
9904
+ auto vtableInstance = uniffi::breez_sdk_spark::Bridging<
9905
+ UniffiVTableCallbackInterfacePaymentObserver>::fromJs(rt, callInvoker,
9906
+ args[0]);
9907
+
9908
+ std::lock_guard<std::mutex> lock(
9909
+ uniffi::breez_sdk_spark::registry::vtableMutex);
9910
+ uniffi_breez_sdk_spark_fn_init_callback_vtable_paymentobserver(
9911
+ uniffi::breez_sdk_spark::registry::putTable(
9912
+ "UniffiVTableCallbackInterfacePaymentObserver", vtableInstance));
9913
+ return jsi::Value::undefined();
9914
+ }
9253
9915
  jsi::Value
9254
9916
  NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_init_callback_vtable_storage(
9255
9917
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,