@secondts/bark-react-native 0.26.0 → 0.27.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.
Files changed (52) hide show
  1. package/README.md +84 -38
  2. package/android/CMakeLists.txt +1 -1
  3. package/android/build.gradle +1 -1
  4. package/android/proguard-rules.pro +16 -0
  5. package/app.plugin.js +5 -1
  6. package/cpp/generated/bark.cpp +81 -6
  7. package/cpp/generated/bark.hpp +4 -0
  8. package/lib/commonjs/WalletNotifications.js +7 -2
  9. package/lib/commonjs/WalletNotifications.js.map +1 -1
  10. package/lib/commonjs/generated/bark-ffi.js.map +1 -1
  11. package/lib/commonjs/generated/bark.js +854 -708
  12. package/lib/commonjs/generated/bark.js.map +1 -1
  13. package/lib/module/WalletNotifications.js +7 -2
  14. package/lib/module/WalletNotifications.js.map +1 -1
  15. package/lib/module/generated/bark-ffi.js.map +1 -1
  16. package/lib/module/generated/bark.js +853 -707
  17. package/lib/module/generated/bark.js.map +1 -1
  18. package/lib/typescript/commonjs/src/WalletNotifications.d.ts.map +1 -1
  19. package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts +7 -3
  20. package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts.map +1 -1
  21. package/lib/typescript/commonjs/src/generated/bark.d.ts +533 -20
  22. package/lib/typescript/commonjs/src/generated/bark.d.ts.map +1 -1
  23. package/lib/typescript/module/src/WalletNotifications.d.ts.map +1 -1
  24. package/lib/typescript/module/src/generated/bark-ffi.d.ts +7 -3
  25. package/lib/typescript/module/src/generated/bark-ffi.d.ts.map +1 -1
  26. package/lib/typescript/module/src/generated/bark.d.ts +533 -20
  27. package/lib/typescript/module/src/generated/bark.d.ts.map +1 -1
  28. package/package.json +5 -15
  29. package/scripts/postinstall.js +92 -31
  30. package/src/WalletNotifications.ts +7 -2
  31. package/src/generated/bark-ffi.ts +400 -1022
  32. package/src/generated/bark.ts +12904 -14919
  33. package/lib/typescript/commonjs/plugin/src/index.d.ts +0 -11
  34. package/lib/typescript/commonjs/plugin/src/index.d.ts.map +0 -1
  35. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +0 -6
  36. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +0 -1
  37. package/lib/typescript/commonjs/plugin/src/withIOS.d.ts +0 -7
  38. package/lib/typescript/commonjs/plugin/src/withIOS.d.ts.map +0 -1
  39. package/lib/typescript/module/plugin/src/index.d.ts +0 -11
  40. package/lib/typescript/module/plugin/src/index.d.ts.map +0 -1
  41. package/lib/typescript/module/plugin/src/withAndroid.d.ts +0 -6
  42. package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +0 -1
  43. package/lib/typescript/module/plugin/src/withIOS.d.ts +0 -7
  44. package/lib/typescript/module/plugin/src/withIOS.d.ts.map +0 -1
  45. package/plugin/build/index.d.ts +0 -10
  46. package/plugin/build/index.js +0 -16
  47. package/plugin/build/withAndroid.d.ts +0 -5
  48. package/plugin/build/withAndroid.js +0 -26
  49. package/plugin/build/withIOS.d.ts +0 -6
  50. package/plugin/build/withIOS.js +0 -13
  51. package/plugin/tsconfig.json +0 -9
  52. package/plugin/tsconfig.tsbuildinfo +0 -1
package/README.md CHANGED
@@ -11,66 +11,112 @@ Bark is an implementation of the Ark protocol on bitcoin, led by [Second](https:
11
11
 
12
12
  ## Installation
13
13
 
14
- Requires React Native 0.75+ (Expo SDK 52+) with the New Architecture enabled and Hermes, the default JavaScript engine.
14
+ ### Requirements
15
+
16
+ - React Native 0.75+, or Expo SDK 52+
17
+ - The New Architecture enabled
18
+ - Hermes, the default JavaScript engine
15
19
 
16
20
  ### Expo
17
21
 
18
22
  1. Install the package:
19
23
 
20
- ```bash
21
- npx expo install @secondts/bark-react-native
22
- ```
24
+ ```bash
25
+ npx expo install @secondts/bark-react-native
26
+ ```
23
27
 
24
- 2. Add the plugin to `app.json` or `app.config.js`:
28
+ 2. Generate the native projects and run a development build:
25
29
 
26
- ```json
27
- {
28
- "expo": {
29
- "plugins": ["@secondts/bark-react-native"]
30
- }
31
- }
32
- ```
30
+ ```bash
31
+ npx expo prebuild
32
+ npx expo run:ios # or: npx expo run:android
33
+ ```
33
34
 
34
- Warning: If you are using pnpm v10+, run `pnpm approve-builds` and select `@secondts/bark-react-native` to allow the postinstall script to download the prebuilt native binaries.
35
+ The package contains native code, so it doesn't work in Expo Go. No config plugin is needed.
35
36
 
36
- 3. Run prebuild
37
+ ### Bare React Native
38
+
39
+ 1. Install the package:
37
40
 
38
- ```bash
39
- npx expo prebuild
41
+ ```bash
42
+ npm install @secondts/bark-react-native
43
+ ```
44
+
45
+ 2. On iOS, install the pods:
46
+
47
+ ```bash
48
+ cd ios && pod install
49
+ ```
50
+
51
+ ## Quick start
52
+
53
+ ```ts
54
+ import {
55
+ generateMnemonic,
56
+ Network,
57
+ Wallet,
58
+ WalletOpenArgs,
59
+ type Config,
60
+ } from "@secondts/bark-react-native";
61
+
62
+ // datadir: a writable directory as a plain path (no file:// prefix),
63
+ // e.g. from expo-file-system or react-native-fs.
64
+ export async function quickStart(datadir: string) {
65
+ // Store the mnemonic securely: you need it to reopen the wallet.
66
+ const mnemonic = generateMnemonic();
67
+
68
+ const config: Config = {
69
+ serverAddress: "https://ark.signet.2nd.dev",
70
+ esploraAddress: "https://esplora.signet.2nd.dev",
71
+ };
72
+
73
+ // Opens the wallet in datadir, creating it on first launch.
74
+ const wallet = await Wallet.open(
75
+ Network.Signet,
76
+ mnemonic,
77
+ config,
78
+ WalletOpenArgs.create({ datadir }),
79
+ );
80
+
81
+ await wallet.sync();
82
+
83
+ const { spendableSats } = await wallet.balance();
84
+ console.log(`Spendable: ${spendableSats} sats`);
85
+
86
+ const address = await wallet.newAddress();
87
+ console.log(`Ark address: ${address}`);
88
+ }
40
89
  ```
41
90
 
42
- Note: `bark-react-native` contains native code and requires a development build. It will not work with Expo Go.
91
+ Amounts in sats are `bigint`.
43
92
 
44
- ### Bare React Native
93
+ ## Example app
45
94
 
46
- 1. Install the package
95
+ [bark-expo-example](https://gitlab.com/ark-bitcoin/labs/bark-expo-example) is an Expo wallet built on this package that sends and receives over Ark and Lightning, on signet or mainnet.
47
96
 
48
- ```bash
49
- npm install @secondts/bark-react-native
50
- ```
97
+ ## Troubleshooting
51
98
 
52
- Note: If you are running on iOS, navigate into the `ios` folder and run `pod install`.
99
+ ### Native binaries missing after install
53
100
 
54
- ### Beta/Pre-release Versions
101
+ A `postinstall` script downloads the prebuilt native libraries from the GitLab release. If it didn't run, the app fails on startup:
55
102
 
56
- To install a beta or pre-release version:
103
+ - **pnpm v10+:** run `pnpm approve-builds` and select `@secondts/bark-react-native`.
104
+ - **Bun:** add `@secondts/bark-react-native` to `trustedDependencies` in your `package.json`.
105
+ - Installing with `--ignore-scripts` skips the download.
106
+ - The download needs network access to `gitlab.com`.
57
107
 
58
- ```bash
59
- # Install latest beta
60
- npx expo install @secondts/bark-react-native@beta
61
- ```
108
+ ## Resources
62
109
 
63
- ```bash
64
- # Or install a specific beta version
65
- npx expo install @secondts/bark-react-native@0.26.0
66
- ```
110
+ - [React Native SDK guide](https://second.tech/docs/bark-sdk/react-native)
111
+ - [Bark SDK documentation](https://second.tech/docs/bark-sdk)
112
+ - [Learn about Ark](https://second.tech/docs/learn/intro)
113
+ - [bark source code](https://gitlab.com/ark-bitcoin/bark)
67
114
 
68
- For bare React Native projects, use:
115
+ ## Support
69
116
 
70
- ```bash
71
- npm install @secondts/bark-react-native@beta
72
- ```
117
+ - [Community forum](https://chat.second.tech)
118
+ - [GitLab issues](https://gitlab.com/ark-bitcoin/bark-ffi-bindings/-/issues)
73
119
 
74
120
  ## License
75
121
 
76
- Released under the **MIT** license.
122
+ Released under the [MIT](https://gitlab.com/ark-bitcoin/bark-ffi-bindings/-/blob/master/LICENSE) license.
@@ -1,5 +1,5 @@
1
1
  # Generated by uniffi-bindgen-react-native
2
- cmake_minimum_required(VERSION 3.9.0)
2
+ cmake_minimum_required(VERSION 3.13)
3
3
  project(BarkReactNative)
4
4
 
5
5
  set (CMAKE_VERBOSE_MAKEFILE ON)
@@ -2,7 +2,7 @@
2
2
 
3
3
  buildscript {
4
4
  // Buildscript is evaluated before everything else so we can't use getExtOrDefault
5
- def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["DummyLibForAndroid_kotlinVersion"]
5
+ def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["BarkReactNative_kotlinVersion"]
6
6
 
7
7
  repositories {
8
8
  google()
@@ -0,0 +1,16 @@
1
+ # Consumer ProGuard rules for @secondts/bark-react-native.
2
+ #
3
+ # build.gradle lists this file in `consumerProguardFiles`, so it must exist:
4
+ # AGP 9 (Expo SDK 58+, where R8 is on for release builds) fails the release
5
+ # build when a declared consumer rules file is missing. ubrn only generates
6
+ # this file for JNA bindings, which this package does not use.
7
+
8
+ # The TurboModule is instantiated reflectively by React Native's module
9
+ # registry, and its `nativeInstallRustCrate` / `nativeCleanupRustCrate`
10
+ # methods are resolved from JNI by name (cpp-adapter.cpp).
11
+ -keep class com.barkreactnative.** { *; }
12
+
13
+ # JNI entry points are looked up by their exact symbol names.
14
+ -keepclasseswithmembernames class * {
15
+ native <methods>;
16
+ }
package/app.plugin.js CHANGED
@@ -1 +1,5 @@
1
- module.exports = require('./plugin/build');
1
+ // No native configuration is needed: the module is autolinked, and the only
2
+ // setting the old plugin applied (`android.useAndroidX=true`) is already on in
3
+ // the Expo and React Native templates. Kept as a pass-through so app configs
4
+ // that still list "@secondts/bark-react-native" under `plugins` keep working.
5
+ module.exports = (config) => config;
@@ -422,14 +422,16 @@ extern "C" {
422
422
  /*handle*/ uint64_t ptr,
423
423
  uint64_t amount_sats,
424
424
  RustBuffer description,
425
- RustBuffer token
425
+ RustBuffer token,
426
+ RustBuffer expiry_secs
426
427
  );
427
428
  /*handle*/ uint64_t uniffi_bark_ffi_fn_method_wallet_bolt11_invoice_for_address(
428
429
  /*handle*/ uint64_t ptr,
429
430
  uint64_t amount_sats,
430
431
  RustBuffer claim_destination,
431
432
  RustBuffer description,
432
- RustBuffer token
433
+ RustBuffer token,
434
+ RustBuffer expiry_secs
433
435
  );
434
436
  /*handle*/ uint64_t uniffi_bark_ffi_fn_method_wallet_broadcast_tx(
435
437
  /*handle*/ uint64_t ptr,
@@ -708,6 +710,11 @@ extern "C" {
708
710
  /*handle*/ uint64_t uniffi_bark_ffi_fn_method_wallet_pending_round_states(
709
711
  /*handle*/ uint64_t ptr
710
712
  );
713
+ /*handle*/ uint64_t uniffi_bark_ffi_fn_method_wallet_presign_emergency_exit(
714
+ /*handle*/ uint64_t ptr,
715
+ RustBuffer vtxo_ids,
716
+ RustBuffer fee_rate_sat_per_vb
717
+ );
711
718
  /*handle*/ uint64_t uniffi_bark_ffi_fn_method_wallet_progress_exits(
712
719
  /*handle*/ uint64_t ptr,
713
720
  RustBuffer fee_rate_sat_per_vb
@@ -747,6 +754,10 @@ extern "C" {
747
754
  RustBuffer vtxo_ids,
748
755
  uint32_t scheduled_height
749
756
  );
757
+ /*handle*/ uint64_t uniffi_bark_ffi_fn_method_wallet_remaining_exit_transactions(
758
+ /*handle*/ uint64_t ptr,
759
+ RustBuffer vtxo_ids
760
+ );
750
761
  /*handle*/ uint64_t uniffi_bark_ffi_fn_method_wallet_run_daemon(
751
762
  /*handle*/ uint64_t ptr
752
763
  );
@@ -1305,6 +1316,8 @@ extern "C" {
1305
1316
  );
1306
1317
  uint16_t uniffi_bark_ffi_checksum_method_wallet_pending_round_states(
1307
1318
  );
1319
+ uint16_t uniffi_bark_ffi_checksum_method_wallet_presign_emergency_exit(
1320
+ );
1308
1321
  uint16_t uniffi_bark_ffi_checksum_method_wallet_progress_exits(
1309
1322
  );
1310
1323
  uint16_t uniffi_bark_ffi_checksum_method_wallet_progress_pending_rounds(
@@ -1325,6 +1338,8 @@ extern "C" {
1325
1338
  );
1326
1339
  uint16_t uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_scheduled(
1327
1340
  );
1341
+ uint16_t uniffi_bark_ffi_checksum_method_wallet_remaining_exit_transactions(
1342
+ );
1328
1343
  uint16_t uniffi_bark_ffi_checksum_method_wallet_run_daemon(
1329
1344
  );
1330
1345
  uint16_t uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment(
@@ -5358,7 +5373,7 @@ NativeBark::NativeBark(
5358
5373
  props["ubrn_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice"] = jsi::Function::createFromHostFunction(
5359
5374
  rt,
5360
5375
  jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice"),
5361
- 4,
5376
+ 5,
5362
5377
  [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
5363
5378
  return this->cpp_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice(rt, thisVal, args, count);
5364
5379
  }
@@ -5366,7 +5381,7 @@ NativeBark::NativeBark(
5366
5381
  props["ubrn_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice_for_address"] = jsi::Function::createFromHostFunction(
5367
5382
  rt,
5368
5383
  jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice_for_address"),
5369
- 5,
5384
+ 6,
5370
5385
  [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
5371
5386
  return this->cpp_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice_for_address(rt, thisVal, args, count);
5372
5387
  }
@@ -5907,6 +5922,14 @@ NativeBark::NativeBark(
5907
5922
  return this->cpp_uniffi_bark_ffi_fn_method_wallet_pending_round_states(rt, thisVal, args, count);
5908
5923
  }
5909
5924
  );
5925
+ props["ubrn_uniffi_bark_ffi_fn_method_wallet_presign_emergency_exit"] = jsi::Function::createFromHostFunction(
5926
+ rt,
5927
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_method_wallet_presign_emergency_exit"),
5928
+ 3,
5929
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
5930
+ return this->cpp_uniffi_bark_ffi_fn_method_wallet_presign_emergency_exit(rt, thisVal, args, count);
5931
+ }
5932
+ );
5910
5933
  props["ubrn_uniffi_bark_ffi_fn_method_wallet_progress_exits"] = jsi::Function::createFromHostFunction(
5911
5934
  rt,
5912
5935
  jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_method_wallet_progress_exits"),
@@ -5987,6 +6010,14 @@ NativeBark::NativeBark(
5987
6010
  return this->cpp_uniffi_bark_ffi_fn_method_wallet_refresh_vtxos_scheduled(rt, thisVal, args, count);
5988
6011
  }
5989
6012
  );
6013
+ props["ubrn_uniffi_bark_ffi_fn_method_wallet_remaining_exit_transactions"] = jsi::Function::createFromHostFunction(
6014
+ rt,
6015
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_method_wallet_remaining_exit_transactions"),
6016
+ 2,
6017
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
6018
+ return this->cpp_uniffi_bark_ffi_fn_method_wallet_remaining_exit_transactions(rt, thisVal, args, count);
6019
+ }
6020
+ );
5990
6021
  props["ubrn_uniffi_bark_ffi_fn_method_wallet_run_daemon"] = jsi::Function::createFromHostFunction(
5991
6022
  rt,
5992
6023
  jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_fn_method_wallet_run_daemon"),
@@ -7571,6 +7602,14 @@ NativeBark::NativeBark(
7571
7602
  return this->cpp_uniffi_bark_ffi_checksum_method_wallet_pending_round_states(rt, thisVal, args, count);
7572
7603
  }
7573
7604
  );
7605
+ props["ubrn_uniffi_bark_ffi_checksum_method_wallet_presign_emergency_exit"] = jsi::Function::createFromHostFunction(
7606
+ rt,
7607
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_checksum_method_wallet_presign_emergency_exit"),
7608
+ 0,
7609
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
7610
+ return this->cpp_uniffi_bark_ffi_checksum_method_wallet_presign_emergency_exit(rt, thisVal, args, count);
7611
+ }
7612
+ );
7574
7613
  props["ubrn_uniffi_bark_ffi_checksum_method_wallet_progress_exits"] = jsi::Function::createFromHostFunction(
7575
7614
  rt,
7576
7615
  jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_checksum_method_wallet_progress_exits"),
@@ -7651,6 +7690,14 @@ NativeBark::NativeBark(
7651
7690
  return this->cpp_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_scheduled(rt, thisVal, args, count);
7652
7691
  }
7653
7692
  );
7693
+ props["ubrn_uniffi_bark_ffi_checksum_method_wallet_remaining_exit_transactions"] = jsi::Function::createFromHostFunction(
7694
+ rt,
7695
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_checksum_method_wallet_remaining_exit_transactions"),
7696
+ 0,
7697
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
7698
+ return this->cpp_uniffi_bark_ffi_checksum_method_wallet_remaining_exit_transactions(rt, thisVal, args, count);
7699
+ }
7700
+ );
7654
7701
  props["ubrn_uniffi_bark_ffi_checksum_method_wallet_run_daemon"] = jsi::Function::createFromHostFunction(
7655
7702
  rt,
7656
7703
  jsi::PropNameID::forAscii(rt, "ubrn_uniffi_bark_ffi_checksum_method_wallet_run_daemon"),
@@ -8553,14 +8600,14 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_board_psbt(jsi::Runt
8553
8600
  return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
8554
8601
  }
8555
8602
  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) {
8556
- 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]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[3])
8603
+ 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]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[3]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[4])
8557
8604
  );
8558
8605
 
8559
8606
 
8560
8607
  return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
8561
8608
  }
8562
8609
  jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice_for_address(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
8563
- auto value = uniffi_bark_ffi_fn_method_wallet_bolt11_invoice_for_address(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]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[3]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[4])
8610
+ auto value = uniffi_bark_ffi_fn_method_wallet_bolt11_invoice_for_address(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]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[3]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[4]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[5])
8564
8611
  );
8565
8612
 
8566
8613
 
@@ -9045,6 +9092,13 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_pending_round_states
9045
9092
  );
9046
9093
 
9047
9094
 
9095
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
9096
+ }
9097
+ jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_presign_emergency_exit(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
9098
+ auto value = uniffi_bark_ffi_fn_method_wallet_presign_emergency_exit(uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2])
9099
+ );
9100
+
9101
+
9048
9102
  return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
9049
9103
  }
9050
9104
  jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_progress_exits(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
@@ -9121,6 +9175,13 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_refresh_vtxos_schedu
9121
9175
  );
9122
9176
 
9123
9177
 
9178
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
9179
+ }
9180
+ jsi::Value NativeBark::cpp_uniffi_bark_ffi_fn_method_wallet_remaining_exit_transactions(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
9181
+ auto value = uniffi_bark_ffi_fn_method_wallet_remaining_exit_transactions(uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::bark::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1])
9182
+ );
9183
+
9184
+
9124
9185
  return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker, value);
9125
9186
  }
9126
9187
  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) {
@@ -10572,6 +10633,13 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_method_wallet_pending_round_
10572
10633
  );
10573
10634
 
10574
10635
 
10636
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
10637
+ }
10638
+ jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_method_wallet_presign_emergency_exit(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
10639
+ auto value = uniffi_bark_ffi_checksum_method_wallet_presign_emergency_exit(
10640
+ );
10641
+
10642
+
10575
10643
  return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
10576
10644
  }
10577
10645
  jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_method_wallet_progress_exits(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
@@ -10642,6 +10710,13 @@ jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_
10642
10710
  );
10643
10711
 
10644
10712
 
10713
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
10714
+ }
10715
+ jsi::Value NativeBark::cpp_uniffi_bark_ffi_checksum_method_wallet_remaining_exit_transactions(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
10716
+ auto value = uniffi_bark_ffi_checksum_method_wallet_remaining_exit_transactions(
10717
+ );
10718
+
10719
+
10645
10720
  return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
10646
10721
  }
10647
10722
  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) {
@@ -141,6 +141,7 @@ class NativeBark : public jsi::HostObject {
141
141
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_pending_lightning_sends(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
142
142
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_pending_round_input_vtxos(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
143
143
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_pending_round_states(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
144
+ jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_presign_emergency_exit(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
144
145
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_progress_exits(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
145
146
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_progress_pending_rounds(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
146
147
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_properties(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
@@ -151,6 +152,7 @@ class NativeBark : public jsi::HostObject {
151
152
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_refresh_vtxos(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
152
153
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_refresh_vtxos_delegated(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
153
154
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_refresh_vtxos_scheduled(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
155
+ jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_remaining_exit_transactions(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
154
156
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_run_daemon(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
155
157
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_send_arkoor_payment(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
156
158
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_send_onchain(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
@@ -349,6 +351,7 @@ class NativeBark : public jsi::HostObject {
349
351
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_pending_lightning_sends(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
350
352
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_pending_round_input_vtxos(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
351
353
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_pending_round_states(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
354
+ jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_presign_emergency_exit(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
352
355
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_progress_exits(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
353
356
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_progress_pending_rounds(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
354
357
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_properties(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
@@ -359,6 +362,7 @@ class NativeBark : public jsi::HostObject {
359
362
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
360
363
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_delegated(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
361
364
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_scheduled(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
365
+ jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_remaining_exit_transactions(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
362
366
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_run_daemon(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
363
367
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
364
368
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_send_onchain(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
@@ -56,10 +56,15 @@ class WalletNotifications {
56
56
  const localHolder = this.wallet.notifications();
57
57
  this.holder = localHolder;
58
58
  (async () => {
59
+ // The loop stays live only while `holder` is still `localHolder`. An
60
+ // unsubscribe that lands while no native wait is pending (from inside a
61
+ // listener, or while an event is in flight) makes the cancel a no-op,
62
+ // so without this check the loop would keep running next to the loop of
63
+ // the next subscription and every event would be delivered twice.
59
64
  try {
60
- while (true) {
65
+ while (this.holder === localHolder) {
61
66
  const event = await localHolder.nextNotification();
62
- if (event == null) break;
67
+ if (event == null || this.holder !== localHolder) break;
63
68
  for (const listener of this.listeners) {
64
69
  try {
65
70
  listener(event);
@@ -1 +1 @@
1
- {"version":3,"names":["WalletNotifications","holder","listeners","Set","constructor","wallet","subscribe","listener","add","size","startLoop","delete","cancelNextNotificationWait","localHolder","notifications","event","nextNotification","err","console","error","exports"],"sourceRoot":"../../src","sources":["WalletNotifications.ts"],"mappings":";;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,CAAC;EACvBC,MAAM,GAAuC,IAAI;EACxCC,SAAS,GAAG,IAAIC,GAAG,CAAsC,CAAC;EAE3EC,WAAWA,CAAkBC,MAAuB,EAAE;IAAA,KAAzBA,MAAuB,GAAvBA,MAAuB;EAAG;EAEvDC,SAASA,CAACC,QAA6C,EAAe;IACpE,IAAI,CAACL,SAAS,CAACM,GAAG,CAACD,QAAQ,CAAC;IAE5B,IAAI,IAAI,CAACL,SAAS,CAACO,IAAI,KAAK,CAAC,EAAE;MAC7B,IAAI,CAACC,SAAS,CAAC,CAAC;IAClB;IAEA,OAAO,MAAM;MACX,IAAI,CAACR,SAAS,CAACS,MAAM,CAACJ,QAAQ,CAAC;MAC/B,IAAI,IAAI,CAACL,SAAS,CAACO,IAAI,KAAK,CAAC,EAAE;QAC7B,IAAI,CAACR,MAAM,EAAEW,0BAA0B,CAAC,CAAC;QACzC,IAAI,CAACX,MAAM,GAAG,IAAI;MACpB;IACF,CAAC;EACH;EAEQS,SAASA,CAAA,EAAS;IACxB,MAAMG,WAAW,GAAG,IAAI,CAACR,MAAM,CAACS,aAAa,CAAC,CAAC;IAC/C,IAAI,CAACb,MAAM,GAAGY,WAAW;IAEzB,CAAC,YAAY;MACX,IAAI;QACF,OAAO,IAAI,EAAE;UACX,MAAME,KAAK,GAAG,MAAMF,WAAW,CAACG,gBAAgB,CAAC,CAAC;UAClD,IAAID,KAAK,IAAI,IAAI,EAAE;UACnB,KAAK,MAAMR,QAAQ,IAAI,IAAI,CAACL,SAAS,EAAE;YACrC,IAAI;cACFK,QAAQ,CAACQ,KAAK,CAAC;YACjB,CAAC,CAAC,OAAOE,GAAG,EAAE;cACZC,OAAO,CAACC,KAAK,CAAC,qCAAqC,EAAEF,GAAG,CAAC;YAC3D;UACF;QACF;MACF,CAAC,CAAC,OAAOA,GAAG,EAAE;QACZC,OAAO,CAACC,KAAK,CAAC,iCAAiC,EAAEF,GAAG,CAAC;MACvD,CAAC,SAAS;QACR,IAAI,IAAI,CAAChB,MAAM,KAAKY,WAAW,EAAE;UAC/B,IAAI,CAACZ,MAAM,GAAG,IAAI;QACpB;MACF;IACF,CAAC,EAAE,CAAC;EACN;AACF;AAACmB,OAAA,CAAApB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"names":["WalletNotifications","holder","listeners","Set","constructor","wallet","subscribe","listener","add","size","startLoop","delete","cancelNextNotificationWait","localHolder","notifications","event","nextNotification","err","console","error","exports"],"sourceRoot":"../../src","sources":["WalletNotifications.ts"],"mappings":";;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,CAAC;EACvBC,MAAM,GAAuC,IAAI;EACxCC,SAAS,GAAG,IAAIC,GAAG,CAAsC,CAAC;EAE3EC,WAAWA,CAAkBC,MAAuB,EAAE;IAAA,KAAzBA,MAAuB,GAAvBA,MAAuB;EAAG;EAEvDC,SAASA,CAACC,QAA6C,EAAe;IACpE,IAAI,CAACL,SAAS,CAACM,GAAG,CAACD,QAAQ,CAAC;IAE5B,IAAI,IAAI,CAACL,SAAS,CAACO,IAAI,KAAK,CAAC,EAAE;MAC7B,IAAI,CAACC,SAAS,CAAC,CAAC;IAClB;IAEA,OAAO,MAAM;MACX,IAAI,CAACR,SAAS,CAACS,MAAM,CAACJ,QAAQ,CAAC;MAC/B,IAAI,IAAI,CAACL,SAAS,CAACO,IAAI,KAAK,CAAC,EAAE;QAC7B,IAAI,CAACR,MAAM,EAAEW,0BAA0B,CAAC,CAAC;QACzC,IAAI,CAACX,MAAM,GAAG,IAAI;MACpB;IACF,CAAC;EACH;EAEQS,SAASA,CAAA,EAAS;IACxB,MAAMG,WAAW,GAAG,IAAI,CAACR,MAAM,CAACS,aAAa,CAAC,CAAC;IAC/C,IAAI,CAACb,MAAM,GAAGY,WAAW;IAEzB,CAAC,YAAY;MACX;MACA;MACA;MACA;MACA;MACA,IAAI;QACF,OAAO,IAAI,CAACZ,MAAM,KAAKY,WAAW,EAAE;UAClC,MAAME,KAAK,GAAG,MAAMF,WAAW,CAACG,gBAAgB,CAAC,CAAC;UAClD,IAAID,KAAK,IAAI,IAAI,IAAI,IAAI,CAACd,MAAM,KAAKY,WAAW,EAAE;UAClD,KAAK,MAAMN,QAAQ,IAAI,IAAI,CAACL,SAAS,EAAE;YACrC,IAAI;cACFK,QAAQ,CAACQ,KAAK,CAAC;YACjB,CAAC,CAAC,OAAOE,GAAG,EAAE;cACZC,OAAO,CAACC,KAAK,CAAC,qCAAqC,EAAEF,GAAG,CAAC;YAC3D;UACF;QACF;MACF,CAAC,CAAC,OAAOA,GAAG,EAAE;QACZC,OAAO,CAACC,KAAK,CAAC,iCAAiC,EAAEF,GAAG,CAAC;MACvD,CAAC,SAAS;QACR,IAAI,IAAI,CAAChB,MAAM,KAAKY,WAAW,EAAE;UAC/B,IAAI,CAACZ,MAAM,GAAG,IAAI;QACpB;MACF;IACF,CAAC,EAAE,CAAC;EACN;AACF;AAACmB,OAAA,CAAApB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["getter","globalThis","NativeBark","_default","exports","default","isRustFutureContinuationCallbackTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/bark-ffi.ts"],"mappings":";;;;;;AAAA;AACA;;AAEA;AACA;AACA;;AA68BA,MAAMA,MAAmC,GAAGA,CAAA,KACzCC,UAAU,CAASC,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAClBL,MAAM,EAErB;AAsFA;AACA;AACA;AACA;AACA,MAAMM,8CAGL,GAAG,IAAI","ignoreList":[]}
1
+ {"version":3,"names":["getter","globalThis","NativeBark","_default","exports","default","isRustFutureContinuationCallbackTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/bark-ffi.ts"],"mappings":";;;;;;AAAA;AACA;;AAEA;AACA;AACA;;AA4YA,MAAMA,MAAmC,GAAGA,CAAA,KAAOC,UAAU,CAASC,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAClEL,MAAM,EAErB;AA0CA;AACA;AACA;AACA;AACA,MAAMM,8CAGL,GAAG,IAAI","ignoreList":[]}