@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.
Files changed (38) hide show
  1. package/README.md +1 -1
  2. package/cpp/generated/bark.cpp +632 -5
  3. package/cpp/generated/bark.hpp +10 -0
  4. package/lib/commonjs/Logger.js +48 -0
  5. package/lib/commonjs/Logger.js.map +1 -0
  6. package/lib/commonjs/generated/bark-ffi.js.map +1 -1
  7. package/lib/commonjs/generated/bark.js +187 -4
  8. package/lib/commonjs/generated/bark.js.map +1 -1
  9. package/lib/commonjs/index.js +13 -0
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/module/Logger.js +43 -0
  12. package/lib/module/Logger.js.map +1 -0
  13. package/lib/module/generated/bark-ffi.js.map +1 -1
  14. package/lib/module/generated/bark.js +186 -4
  15. package/lib/module/generated/bark.js.map +1 -1
  16. package/lib/module/index.js +3 -0
  17. package/lib/module/index.js.map +1 -1
  18. package/lib/typescript/commonjs/src/Logger.d.ts +18 -0
  19. package/lib/typescript/commonjs/src/Logger.d.ts.map +1 -0
  20. package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts +17 -1
  21. package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts.map +1 -1
  22. package/lib/typescript/commonjs/src/generated/bark.d.ts +79 -2
  23. package/lib/typescript/commonjs/src/generated/bark.d.ts.map +1 -1
  24. package/lib/typescript/commonjs/src/index.d.ts +1 -0
  25. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  26. package/lib/typescript/module/src/Logger.d.ts +18 -0
  27. package/lib/typescript/module/src/Logger.d.ts.map +1 -0
  28. package/lib/typescript/module/src/generated/bark-ffi.d.ts +17 -1
  29. package/lib/typescript/module/src/generated/bark-ffi.d.ts.map +1 -1
  30. package/lib/typescript/module/src/generated/bark.d.ts +79 -2
  31. package/lib/typescript/module/src/generated/bark.d.ts.map +1 -1
  32. package/lib/typescript/module/src/index.d.ts +1 -0
  33. package/lib/typescript/module/src/index.d.ts.map +1 -1
  34. package/package.json +4 -4
  35. package/src/Logger.ts +42 -0
  36. package/src/generated/bark-ffi.ts +37 -1
  37. package/src/generated/bark.ts +333 -2
  38. package/src/index.tsx +3 -0
@@ -38,6 +38,7 @@ class NativeBark : public jsi::HostObject {
38
38
  jsi::Value cpp_uniffi_bark_ffi_fn_constructor_wallet_create(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
39
39
  jsi::Value cpp_uniffi_bark_ffi_fn_constructor_wallet_create_with_onchain(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
40
40
  jsi::Value cpp_uniffi_bark_ffi_fn_constructor_wallet_open(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
41
+ jsi::Value cpp_uniffi_bark_ffi_fn_constructor_wallet_open_with_daemon(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
41
42
  jsi::Value cpp_uniffi_bark_ffi_fn_constructor_wallet_open_with_onchain(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
42
43
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_all_exits_claimable_at_height(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
43
44
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_all_vtxos(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
@@ -110,12 +111,14 @@ class NativeBark : public jsi::HostObject {
110
111
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_refresh_server(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
111
112
  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);
112
113
  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);
114
+ 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);
113
115
  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);
114
116
  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);
115
117
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_sign_exit_claim_inputs(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
116
118
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_spendable_vtxos(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
117
119
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_start_exit_for_entire_wallet(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
118
120
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_start_exit_for_vtxos(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
121
+ jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_stop_daemon(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
119
122
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_sync(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
120
123
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_sync_exits(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
121
124
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_sync_pending_boards(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
@@ -123,9 +126,11 @@ class NativeBark : public jsi::HostObject {
123
126
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_try_claim_lightning_receive(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
124
127
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_validate_arkoor_address(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
125
128
  jsi::Value cpp_uniffi_bark_ffi_fn_method_wallet_vtxos(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
129
+ jsi::Value cpp_uniffi_bark_ffi_fn_init_callback_vtable_barklogger(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
126
130
  jsi::Value cpp_uniffi_bark_ffi_fn_init_callback_vtable_customonchainwalletcallbacks(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
127
131
  jsi::Value cpp_uniffi_bark_ffi_fn_func_extract_tx_from_psbt(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
128
132
  jsi::Value cpp_uniffi_bark_ffi_fn_func_generate_mnemonic(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
133
+ jsi::Value cpp_uniffi_bark_ffi_fn_func_set_logger(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
129
134
  jsi::Value cpp_uniffi_bark_ffi_fn_func_validate_ark_address(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
130
135
  jsi::Value cpp_uniffi_bark_ffi_fn_func_validate_mnemonic(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
131
136
  jsi::Value cpp_ffi_bark_ffi_rust_future_poll_u8(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
@@ -178,6 +183,7 @@ class NativeBark : public jsi::HostObject {
178
183
  jsi::Value cpp_ffi_bark_ffi_rust_future_complete_void(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
179
184
  jsi::Value cpp_uniffi_bark_ffi_checksum_func_extract_tx_from_psbt(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
180
185
  jsi::Value cpp_uniffi_bark_ffi_checksum_func_generate_mnemonic(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
186
+ jsi::Value cpp_uniffi_bark_ffi_checksum_func_set_logger(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
181
187
  jsi::Value cpp_uniffi_bark_ffi_checksum_func_validate_ark_address(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
182
188
  jsi::Value cpp_uniffi_bark_ffi_checksum_func_validate_mnemonic(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
183
189
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_notificationholder_cancel_next_notification_wait(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
@@ -257,12 +263,14 @@ class NativeBark : public jsi::HostObject {
257
263
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_refresh_server(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
258
264
  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);
259
265
  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);
266
+ 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);
260
267
  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);
261
268
  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);
262
269
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_sign_exit_claim_inputs(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
263
270
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_spendable_vtxos(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
264
271
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_start_exit_for_entire_wallet(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
265
272
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_start_exit_for_vtxos(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
273
+ jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_stop_daemon(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
266
274
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_sync(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
267
275
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_sync_exits(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
268
276
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_wallet_sync_pending_boards(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
@@ -275,7 +283,9 @@ class NativeBark : public jsi::HostObject {
275
283
  jsi::Value cpp_uniffi_bark_ffi_checksum_constructor_wallet_create(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
276
284
  jsi::Value cpp_uniffi_bark_ffi_checksum_constructor_wallet_create_with_onchain(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
277
285
  jsi::Value cpp_uniffi_bark_ffi_checksum_constructor_wallet_open(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
286
+ jsi::Value cpp_uniffi_bark_ffi_checksum_constructor_wallet_open_with_daemon(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
278
287
  jsi::Value cpp_uniffi_bark_ffi_checksum_constructor_wallet_open_with_onchain(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
288
+ jsi::Value cpp_uniffi_bark_ffi_checksum_method_barklogger_log(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
279
289
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_get_balance(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
280
290
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_prepare_tx(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
281
291
  jsi::Value cpp_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_prepare_drain_tx(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ConsoleBarkLogger = void 0;
7
+ exports.barkAttachConsoleLogger = barkAttachConsoleLogger;
8
+ var _bark = require("./generated/bark.js");
9
+ /**
10
+ * A `BarkLogger` that forwards records to the JS `console`.
11
+ *
12
+ * Useful as a default during development. For production, implement
13
+ * `BarkLogger` yourself to forward to Sentry, Reactotron, etc.
14
+ */
15
+ class ConsoleBarkLogger {
16
+ log(level, target, message) {
17
+ const line = `[bark][${_bark.LogLevel[level]}][${target}] ${message}`;
18
+ switch (level) {
19
+ case _bark.LogLevel.Error:
20
+ console.error(line);
21
+ break;
22
+ case _bark.LogLevel.Warn:
23
+ console.warn(line);
24
+ break;
25
+ case _bark.LogLevel.Info:
26
+ console.info(line);
27
+ break;
28
+ case _bark.LogLevel.Debug:
29
+ case _bark.LogLevel.Trace:
30
+ console.log(line);
31
+ break;
32
+ }
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Install a default `ConsoleBarkLogger`. Returns the logger so callers can
38
+ * later detach it via `clearLogger()`.
39
+ *
40
+ * Calling this multiple times replaces the previous logger in-place.
41
+ */
42
+ exports.ConsoleBarkLogger = ConsoleBarkLogger;
43
+ function barkAttachConsoleLogger(maxLevel = _bark.LogLevel.Info) {
44
+ const logger = new ConsoleBarkLogger();
45
+ (0, _bark.setLogger)(logger, maxLevel);
46
+ return logger;
47
+ }
48
+ //# sourceMappingURL=Logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_bark","require","ConsoleBarkLogger","log","level","target","message","line","LogLevel","Error","console","error","Warn","warn","Info","info","Debug","Trace","exports","barkAttachConsoleLogger","maxLevel","logger","setLogger"],"sourceRoot":"../../src","sources":["Logger.ts"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,iBAAiB,CAAuB;EACnDC,GAAGA,CAACC,KAAe,EAAEC,MAAc,EAAEC,OAAe,EAAQ;IAC1D,MAAMC,IAAI,GAAG,UAAUC,cAAQ,CAACJ,KAAK,CAAC,KAAKC,MAAM,KAAKC,OAAO,EAAE;IAC/D,QAAQF,KAAK;MACX,KAAKI,cAAQ,CAACC,KAAK;QACjBC,OAAO,CAACC,KAAK,CAACJ,IAAI,CAAC;QACnB;MACF,KAAKC,cAAQ,CAACI,IAAI;QAChBF,OAAO,CAACG,IAAI,CAACN,IAAI,CAAC;QAClB;MACF,KAAKC,cAAQ,CAACM,IAAI;QAChBJ,OAAO,CAACK,IAAI,CAACR,IAAI,CAAC;QAClB;MACF,KAAKC,cAAQ,CAACQ,KAAK;MACnB,KAAKR,cAAQ,CAACS,KAAK;QACjBP,OAAO,CAACP,GAAG,CAACI,IAAI,CAAC;QACjB;IACJ;EACF;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AALAW,OAAA,CAAAhB,iBAAA,GAAAA,iBAAA;AAMO,SAASiB,uBAAuBA,CACrCC,QAAkB,GAAGZ,cAAQ,CAACM,IAAI,EACtB;EACZ,MAAMO,MAAM,GAAG,IAAInB,iBAAiB,CAAC,CAAC;EACtC,IAAAoB,eAAS,EAACD,MAAM,EAAED,QAAQ,CAAC;EAC3B,OAAOC,MAAM;AACf","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["getter","globalThis","NativeBark","_default","exports","default","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/bark-ffi.ts"],"mappings":";;;;;;AAAA;AACA;;AAEA;AACA;AACA;;AA+oBA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAmC,GAAGA,CAAA,KACzCC,UAAU,CAASC,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAClBL,MAAM,EAErB;AA8JA;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,MAAMM,8CAGL,GAAG,IAAI;AACR,MAAMC,mCAGL,GAAG,IAAI","ignoreList":[]}
1
+ {"version":3,"names":["getter","globalThis","NativeBark","_default","exports","default","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/bark-ffi.ts"],"mappings":";;;;;;AAAA;AACA;;AAEA;AACA;AACA;;AAwqBA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAmC,GAAGA,CAAA,KACzCC,UAAU,CAASC,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAClBL,MAAM,EAErB;AAyKA;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,MAAMM,8CAGL,GAAG,IAAI;AACR,MAAMC,mCAGL,GAAG,IAAI","ignoreList":[]}
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.WalletProperties = exports.WalletNotification_Tags = exports.WalletNotification = exports.Wallet = exports.Vtxo = exports.RoundState = exports.PendingBoard = exports.OutPoint = exports.OnchainWallet = exports.OnchainBalance = exports.OffboardResult = exports.NotificationHolder = exports.Network = exports.Movement = exports.LightningSend = exports.LightningReceive = exports.LightningInvoice = exports.FeeEstimate = exports.ExitVtxo = exports.ExitTransactionStatus = exports.ExitProgressStatus = exports.ExitClaimTransaction = exports.Destination = exports.CpfpParams = exports.Config = exports.BlockRef = exports.BarkError_Tags = exports.BarkError = exports.Balance = exports.ArkInfo = exports.AddressWithIndex = void 0;
6
+ exports.default = exports.WalletProperties = exports.WalletNotification_Tags = exports.WalletNotification = exports.Wallet = exports.Vtxo = exports.RoundState = exports.PendingBoard = exports.OutPoint = exports.OnchainWallet = exports.OnchainBalance = exports.OffboardResult = exports.NotificationHolder = exports.Network = exports.Movement = exports.LogLevel = exports.LightningSend = exports.LightningReceive = exports.LightningInvoice = exports.FeeEstimate = exports.ExitVtxo = exports.ExitTransactionStatus = exports.ExitProgressStatus = exports.ExitClaimTransaction = exports.Destination = exports.CpfpParams = exports.Config = exports.BlockRef = exports.BarkError_Tags = exports.BarkError = exports.Balance = exports.ArkInfo = exports.AddressWithIndex = void 0;
7
7
  exports.extractTxFromPsbt = extractTxFromPsbt;
8
8
  exports.generateMnemonic = generateMnemonic;
9
+ exports.setLogger = setLogger;
9
10
  exports.validateArkAddress = validateArkAddress;
10
11
  exports.validateMnemonic = validateMnemonic;
11
12
  var _barkFfi = _interopRequireDefault(require("./bark-ffi.js"));
@@ -39,6 +40,15 @@ function generateMnemonic() /*throws*/{
39
40
  return (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_func_generate_mnemonic(callStatus);
40
41
  }, /*liftString:*/FfiConverterString.lift));
41
42
  }
43
+ /**
44
+ * Install the foreign log sink. Must be called at most once,
45
+ * subsequent calls return an error
46
+ */
47
+ function setLogger(logger, maxLevel) /*throws*/{
48
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError), /*caller:*/callStatus => {
49
+ (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_func_set_logger(FfiConverterTypeBarkLogger.lower(logger), FfiConverterTypeLogLevel.lower(maxLevel), callStatus);
50
+ }, /*liftString:*/FfiConverterString.lift);
51
+ }
42
52
  function validateArkAddress(address) /*throws*/{
43
53
  return _uniffiBindgenReactNative.FfiConverterBool.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError), /*caller:*/callStatus => {
44
54
  return (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_func_validate_ark_address(FfiConverterString.lower(address), callStatus);
@@ -50,6 +60,46 @@ function validateMnemonic(mnemonic) /*throws*/{
50
60
  }, /*liftString:*/FfiConverterString.lift));
51
61
  }
52
62
 
63
+ /**
64
+ * Foreign sink for log records. Implement in Dart/Swift/Kotlin and pass to
65
+ * [set_logger]. The `log()` method must not call back into bark APIs that
66
+ * emit log records.
67
+ */
68
+
69
+ // Put the implementation in a struct so we don't pollute the top-level namespace
70
+ const uniffiCallbackInterfaceBarkLogger = {
71
+ // Create the VTable using a series of closures.
72
+ // ts automatically converts these into C callback functions.
73
+ vtable: {
74
+ log: (uniffiHandle, level, target, message) => {
75
+ const uniffiMakeCall = () => {
76
+ const jsCallback = FfiConverterTypeBarkLogger.lift(uniffiHandle);
77
+ return jsCallback.log(FfiConverterTypeLogLevel.lift(level), FfiConverterString.lift(target), FfiConverterString.lift(message));
78
+ };
79
+ const uniffiResult = _uniffiBindgenReactNative.UniffiResult.ready();
80
+ const uniffiHandleSuccess = obj => {};
81
+ const uniffiHandleError = (code, errBuf) => {
82
+ _uniffiBindgenReactNative.UniffiResult.writeError(uniffiResult, code, errBuf);
83
+ };
84
+ (0, _uniffiBindgenReactNative.uniffiTraitInterfaceCall)(/*makeCall:*/uniffiMakeCall, /*handleSuccess:*/uniffiHandleSuccess, /*handleError:*/uniffiHandleError, /*lowerString:*/FfiConverterString.lower);
85
+ return uniffiResult;
86
+ },
87
+ uniffiFree: uniffiHandle => {
88
+ // BarkLogger: this will throw a stale handle error if the handle isn't found.
89
+ FfiConverterTypeBarkLogger.drop(uniffiHandle);
90
+ },
91
+ uniffiClone: uniffiHandle => {
92
+ return FfiConverterTypeBarkLogger.clone(uniffiHandle);
93
+ }
94
+ },
95
+ register: () => {
96
+ (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_init_callback_vtable_barklogger(uniffiCallbackInterfaceBarkLogger.vtable);
97
+ }
98
+ };
99
+
100
+ // FfiConverter protocol for callback interfaces
101
+ const FfiConverterTypeBarkLogger = new _uniffiBindgenReactNative.FfiConverterCallback();
102
+
53
103
  /**
54
104
  * Callback interface for custom onchain wallet implementations
55
105
  *
@@ -1856,6 +1906,57 @@ const FfiConverterTypeBarkError = (() => {
1856
1906
  return new FFIConverter();
1857
1907
  })();
1858
1908
 
1909
+ /**
1910
+ * Severity of a log record forwarded to a foreign [BarkLogger].
1911
+ */
1912
+ let LogLevel = exports.LogLevel = /*#__PURE__*/function (LogLevel) {
1913
+ LogLevel[LogLevel["Error"] = 0] = "Error";
1914
+ LogLevel[LogLevel["Warn"] = 1] = "Warn";
1915
+ LogLevel[LogLevel["Info"] = 2] = "Info";
1916
+ LogLevel[LogLevel["Debug"] = 3] = "Debug";
1917
+ LogLevel[LogLevel["Trace"] = 4] = "Trace";
1918
+ return LogLevel;
1919
+ }({});
1920
+ const FfiConverterTypeLogLevel = (() => {
1921
+ const ordinalConverter = _uniffiBindgenReactNative.FfiConverterInt32;
1922
+ class FFIConverter extends _uniffiBindgenReactNative.AbstractFfiConverterByteArray {
1923
+ read(from) {
1924
+ switch (ordinalConverter.read(from)) {
1925
+ case 1:
1926
+ return LogLevel.Error;
1927
+ case 2:
1928
+ return LogLevel.Warn;
1929
+ case 3:
1930
+ return LogLevel.Info;
1931
+ case 4:
1932
+ return LogLevel.Debug;
1933
+ case 5:
1934
+ return LogLevel.Trace;
1935
+ default:
1936
+ throw new _uniffiBindgenReactNative.UniffiInternalError.UnexpectedEnumCase();
1937
+ }
1938
+ }
1939
+ write(value, into) {
1940
+ switch (value) {
1941
+ case LogLevel.Error:
1942
+ return ordinalConverter.write(1, into);
1943
+ case LogLevel.Warn:
1944
+ return ordinalConverter.write(2, into);
1945
+ case LogLevel.Info:
1946
+ return ordinalConverter.write(3, into);
1947
+ case LogLevel.Debug:
1948
+ return ordinalConverter.write(4, into);
1949
+ case LogLevel.Trace:
1950
+ return ordinalConverter.write(5, into);
1951
+ }
1952
+ }
1953
+ allocationSize(value) {
1954
+ return ordinalConverter.allocationSize(0);
1955
+ }
1956
+ }
1957
+ return new FFIConverter();
1958
+ })();
1959
+
1859
1960
  /**
1860
1961
  * Bitcoin network types
1861
1962
  */
@@ -2446,6 +2547,28 @@ class Wallet extends _uniffiBindgenReactNative.UniffiAbstractObject {
2446
2547
  }
2447
2548
  }
2448
2549
 
2550
+ /**
2551
+ * Open an existing Bark wallet and start running the daemon,
2552
+ * optionally with onchain capabilities.
2553
+ *
2554
+ * The daemon runs in the background and is stopped when the wallet is dropped.
2555
+ * Callback-based onchain wallets are not supported for daemon mode and the
2556
+ * wallet will be opened without onchain capabilities in that case.
2557
+ */
2558
+ static async openWithDaemon(mnemonic, config, datadir, onchainWallet, asyncOpts_) /*throws*/{
2559
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2560
+ try {
2561
+ return await (0, _uniffiBindgenReactNative.uniffiRustCallAsync)(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
2562
+ return (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_constructor_wallet_open_with_daemon(FfiConverterString.lower(mnemonic), FfiConverterTypeConfig.lower(config), FfiConverterString.lower(datadir), FfiConverterOptionalTypeOnchainWallet.lower(onchainWallet));
2563
+ }, /*pollFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_poll_u64, /*cancelFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_cancel_u64, /*completeFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_complete_u64, /*freeFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_free_u64, /*liftFunc:*/FfiConverterTypeWallet.lift.bind(FfiConverterTypeWallet), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError));
2564
+ } catch (__error) {
2565
+ if (uniffiIsDebug && __error instanceof Error) {
2566
+ __error.stack = __stack;
2567
+ }
2568
+ throw __error;
2569
+ }
2570
+ }
2571
+
2449
2572
  /**
2450
2573
  * Open an existing Bark wallet WITH onchain capabilities
2451
2574
  */
@@ -2562,11 +2685,11 @@ class Wallet extends _uniffiBindgenReactNative.UniffiAbstractObject {
2562
2685
  throw __error;
2563
2686
  }
2564
2687
  }
2565
- async bolt11Invoice(amountSats, asyncOpts_) /*throws*/{
2688
+ async bolt11Invoice(amountSats, description, asyncOpts_) /*throws*/{
2566
2689
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
2567
2690
  try {
2568
2691
  return await (0, _uniffiBindgenReactNative.uniffiRustCallAsync)(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
2569
- return (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice(uniffiTypeWalletObjectFactory.clonePointer(this), _uniffiBindgenReactNative.FfiConverterUInt64.lower(amountSats));
2692
+ return (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice(uniffiTypeWalletObjectFactory.clonePointer(this), _uniffiBindgenReactNative.FfiConverterUInt64.lower(amountSats), FfiConverterOptionalString.lower(description));
2570
2693
  }, /*pollFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer, /*cancelFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer, /*completeFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer, /*freeFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_free_rust_buffer, /*liftFunc:*/FfiConverterTypeLightningInvoice.lift.bind(FfiConverterTypeLightningInvoice), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError));
2571
2694
  } catch (__error) {
2572
2695
  if (uniffiIsDebug && __error instanceof Error) {
@@ -3751,6 +3874,29 @@ class Wallet extends _uniffiBindgenReactNative.UniffiAbstractObject {
3751
3874
  throw __error;
3752
3875
  }
3753
3876
  }
3877
+
3878
+ /**
3879
+ * Start a background daemon for the wallet.
3880
+ *
3881
+ * The daemon performs periodic syncs, exit progression and other
3882
+ * background work. It is stopped automatically when the wallet is dropped.
3883
+ * Callback-based onchain wallets are not supported for daemon mode and the
3884
+ * daemon will run without onchain capabilities in that case.
3885
+ * Calling this multiple times stops the previous daemon and starts a new one.
3886
+ */
3887
+ async runDaemon(onchainWallet, asyncOpts_) /*throws*/{
3888
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
3889
+ try {
3890
+ return await (0, _uniffiBindgenReactNative.uniffiRustCallAsync)(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
3891
+ return (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_method_wallet_run_daemon(uniffiTypeWalletObjectFactory.clonePointer(this), FfiConverterOptionalTypeOnchainWallet.lower(onchainWallet));
3892
+ }, /*pollFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_poll_void, /*cancelFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_cancel_void, /*completeFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_complete_void, /*freeFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_free_void, /*liftFunc:*/_v => {}, /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError));
3893
+ } catch (__error) {
3894
+ if (uniffiIsDebug && __error instanceof Error) {
3895
+ __error.stack = __stack;
3896
+ }
3897
+ throw __error;
3898
+ }
3899
+ }
3754
3900
  async sendArkoorPayment(arkAddress, amountSats, asyncOpts_) /*throws*/{
3755
3901
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
3756
3902
  try {
@@ -3857,6 +4003,23 @@ class Wallet extends _uniffiBindgenReactNative.UniffiAbstractObject {
3857
4003
  }
3858
4004
  }
3859
4005
 
4006
+ /**
4007
+ * Stop the running daemon if any. No-op otherwise.
4008
+ */
4009
+ async stopDaemon(asyncOpts_) /*throws*/{
4010
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
4011
+ try {
4012
+ return await (0, _uniffiBindgenReactNative.uniffiRustCallAsync)(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
4013
+ return (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_method_wallet_stop_daemon(uniffiTypeWalletObjectFactory.clonePointer(this));
4014
+ }, /*pollFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_poll_void, /*cancelFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_cancel_void, /*completeFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_complete_void, /*freeFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_free_void, /*liftFunc:*/_v => {}, /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError));
4015
+ } catch (__error) {
4016
+ if (uniffiIsDebug && __error instanceof Error) {
4017
+ __error.stack = __stack;
4018
+ }
4019
+ throw __error;
4020
+ }
4021
+ }
4022
+
3860
4023
  /**
3861
4024
  * Lightweight sync with Ark server and blockchain
3862
4025
  * Note: Bark's sync() handles errors internally with logging.
@@ -4092,6 +4255,9 @@ const FfiConverterArrayString = new _uniffiBindgenReactNative.FfiConverterArray(
4092
4255
  // FfiConverter for WalletNotification | undefined
4093
4256
  const FfiConverterOptionalTypeWalletNotification = new _uniffiBindgenReactNative.FfiConverterOptional(FfiConverterTypeWalletNotification);
4094
4257
 
4258
+ // FfiConverter for OnchainWalletLike | undefined
4259
+ const FfiConverterOptionalTypeOnchainWallet = new _uniffiBindgenReactNative.FfiConverterOptional(FfiConverterTypeOnchainWallet);
4260
+
4095
4261
  // FfiConverter for Array<string> | undefined
4096
4262
  const FfiConverterOptionalArrayString = new _uniffiBindgenReactNative.FfiConverterOptional(FfiConverterArrayString);
4097
4263
 
@@ -4119,6 +4285,9 @@ function uniffiEnsureInitialized() {
4119
4285
  if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_func_generate_mnemonic() !== 49933) {
4120
4286
  throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_func_generate_mnemonic");
4121
4287
  }
4288
+ if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_func_set_logger() !== 62790) {
4289
+ throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_func_set_logger");
4290
+ }
4122
4291
  if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_func_validate_ark_address() !== 49932) {
4123
4292
  throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_func_validate_ark_address");
4124
4293
  }
@@ -4161,7 +4330,7 @@ function uniffiEnsureInitialized() {
4161
4330
  if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_board_amount() !== 57213) {
4162
4331
  throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_board_amount");
4163
4332
  }
4164
- if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_bolt11_invoice() !== 8901) {
4333
+ if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_bolt11_invoice() !== 47558) {
4165
4334
  throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_bolt11_invoice");
4166
4335
  }
4167
4336
  if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_broadcast_tx() !== 10756) {
@@ -4356,6 +4525,9 @@ function uniffiEnsureInitialized() {
4356
4525
  if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_delegated() !== 16216) {
4357
4526
  throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_delegated");
4358
4527
  }
4528
+ if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_run_daemon() !== 21553) {
4529
+ throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_run_daemon");
4530
+ }
4359
4531
  if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment() !== 30372) {
4360
4532
  throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment");
4361
4533
  }
@@ -4374,6 +4546,9 @@ function uniffiEnsureInitialized() {
4374
4546
  if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_start_exit_for_vtxos() !== 26632) {
4375
4547
  throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_start_exit_for_vtxos");
4376
4548
  }
4549
+ if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_stop_daemon() !== 9450) {
4550
+ throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_stop_daemon");
4551
+ }
4377
4552
  if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_sync() !== 22105) {
4378
4553
  throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_sync");
4379
4554
  }
@@ -4410,9 +4585,15 @@ function uniffiEnsureInitialized() {
4410
4585
  if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open() !== 31794) {
4411
4586
  throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_constructor_wallet_open");
4412
4587
  }
4588
+ if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open_with_daemon() !== 8446) {
4589
+ throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_constructor_wallet_open_with_daemon");
4590
+ }
4413
4591
  if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open_with_onchain() !== 22896) {
4414
4592
  throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_constructor_wallet_open_with_onchain");
4415
4593
  }
4594
+ if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_barklogger_log() !== 1414) {
4595
+ throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_barklogger_log");
4596
+ }
4416
4597
  if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_get_balance() !== 16407) {
4417
4598
  throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_get_balance");
4418
4599
  }
@@ -4440,6 +4621,7 @@ function uniffiEnsureInitialized() {
4440
4621
  if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_store_signed_p2a_cpfp() !== 41685) {
4441
4622
  throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_store_signed_p2a_cpfp");
4442
4623
  }
4624
+ uniffiCallbackInterfaceBarkLogger.register();
4443
4625
  uniffiCallbackInterfaceCustomOnchainWalletCallbacks.register();
4444
4626
  }
4445
4627
  var _default = exports.default = Object.freeze({
@@ -4461,6 +4643,7 @@ var _default = exports.default = Object.freeze({
4461
4643
  FfiConverterTypeLightningInvoice,
4462
4644
  FfiConverterTypeLightningReceive,
4463
4645
  FfiConverterTypeLightningSend,
4646
+ FfiConverterTypeLogLevel,
4464
4647
  FfiConverterTypeMovement,
4465
4648
  FfiConverterTypeNetwork,
4466
4649
  FfiConverterTypeNotificationHolder,