@secondts/bark-react-native 0.23.0 → 0.24.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.
@@ -1 +1 @@
1
- {"version":3,"names":["getter","globalThis","NativeBark","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/bark-ffi.ts"],"mappings":";;AAAA;AACA;;AAEA;AACA;AACA;;AAi1BA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAmC,GAAGA,CAAA,KACzCC,UAAU,CAASC,UAAU;AAChC,eAAeF,MAAM;;AAErB;;AA6KA;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,MAAMG,8CAGL,GAAG,IAAI;AACR,MAAMC,mCAGL,GAAG,IAAI","ignoreList":[]}
1
+ {"version":3,"names":["getter","globalThis","NativeBark","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/bark-ffi.ts"],"mappings":";;AAAA;AACA;;AAEA;AACA;AACA;;AAi2BA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAmC,GAAGA,CAAA,KACzCC,UAAU,CAASC,UAAU;AAChC,eAAeF,MAAM;;AAErB;;AA6KA;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,MAAMG,8CAGL,GAAG,IAAI;AACR,MAAMC,mCAGL,GAAG,IAAI","ignoreList":[]}
@@ -20,6 +20,16 @@ typeof process !== "object" ||
20
20
  process?.env?.NODE_ENV !== "production" || false;
21
21
  // Public interface members begin here.
22
22
 
23
+ /**
24
+ * Default for `Config.vtxo_key_gap_limit`: the run of consecutive unused
25
+ * seed-derived VTXO key indices a scan crosses before concluding a VTXO
26
+ * isn't ours.
27
+ */
28
+ export function defaultVtxoKeyGapLimit() {
29
+ return FfiConverterUInt32.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
30
+ return nativeModule().ubrn_uniffi_bark_ffi_fn_func_default_vtxo_key_gap_limit(callStatus);
31
+ }, /*liftString:*/FfiConverterString.lift));
32
+ }
23
33
  /**
24
34
  * Extract a signed transaction from a PSBT
25
35
  *
@@ -47,6 +57,16 @@ export function generateMnemonic() /*throws*/{
47
57
  return nativeModule().ubrn_uniffi_bark_ffi_fn_func_generate_mnemonic(callStatus);
48
58
  }, /*liftString:*/FfiConverterString.lift));
49
59
  }
60
+ /**
61
+ * Largest value `Config.vtxo_key_gap_limit` (or an import/recovery
62
+ * `gap_limit` override) accepts. A scan that matches nothing runs the limit
63
+ * to its end, so an unbounded limit is unbounded work.
64
+ */
65
+ export function maxVtxoKeyGapLimit() {
66
+ return FfiConverterUInt32.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
67
+ return nativeModule().ubrn_uniffi_bark_ffi_fn_func_max_vtxo_key_gap_limit(callStatus);
68
+ }, /*liftString:*/FfiConverterString.lift));
69
+ }
50
70
  /**
51
71
  * Validate an Ark address (basic format check only)
52
72
  *
@@ -382,7 +402,8 @@ const FfiConverterTypeConfig = (() => {
382
402
  offboardRequiredConfirmations: FfiConverterOptionalUInt32.read(from),
383
403
  daemonManualSync: FfiConverterOptionalBool.read(from),
384
404
  lightningReceiveClaimRetries: FfiConverterOptionalUInt8.read(from),
385
- userAgent: FfiConverterOptionalString.read(from)
405
+ userAgent: FfiConverterOptionalString.read(from),
406
+ vtxoKeyGapLimit: FfiConverterOptionalUInt32.read(from)
386
407
  };
387
408
  }
388
409
  write(value, into) {
@@ -403,9 +424,10 @@ const FfiConverterTypeConfig = (() => {
403
424
  FfiConverterOptionalBool.write(value.daemonManualSync, into);
404
425
  FfiConverterOptionalUInt8.write(value.lightningReceiveClaimRetries, into);
405
426
  FfiConverterOptionalString.write(value.userAgent, into);
427
+ FfiConverterOptionalUInt32.write(value.vtxoKeyGapLimit, into);
406
428
  }
407
429
  allocationSize(value) {
408
- return FfiConverterString.allocationSize(value.serverAddress) + FfiConverterOptionalString.allocationSize(value.serverAccessToken) + FfiConverterOptionalString.allocationSize(value.esploraAddress) + FfiConverterOptionalString.allocationSize(value.bitcoindAddress) + FfiConverterOptionalString.allocationSize(value.bitcoindCookiefile) + FfiConverterOptionalString.allocationSize(value.bitcoindUser) + FfiConverterOptionalString.allocationSize(value.bitcoindPass) + FfiConverterOptionalUInt16.allocationSize(value.vtxoRefreshExpiryThreshold) + FfiConverterOptionalUInt16.allocationSize(value.vtxoExitMargin) + FfiConverterOptionalUInt16.allocationSize(value.htlcRecvClaimDelta) + FfiConverterOptionalUInt64.allocationSize(value.fallbackFeeRate) + FfiConverterOptionalUInt32.allocationSize(value.roundTxRequiredConfirmations) + FfiConverterOptionalUInt64.allocationSize(value.daemonSyncIntervalSecs) + FfiConverterOptionalUInt32.allocationSize(value.offboardRequiredConfirmations) + FfiConverterOptionalBool.allocationSize(value.daemonManualSync) + FfiConverterOptionalUInt8.allocationSize(value.lightningReceiveClaimRetries) + FfiConverterOptionalString.allocationSize(value.userAgent);
430
+ return FfiConverterString.allocationSize(value.serverAddress) + FfiConverterOptionalString.allocationSize(value.serverAccessToken) + FfiConverterOptionalString.allocationSize(value.esploraAddress) + FfiConverterOptionalString.allocationSize(value.bitcoindAddress) + FfiConverterOptionalString.allocationSize(value.bitcoindCookiefile) + FfiConverterOptionalString.allocationSize(value.bitcoindUser) + FfiConverterOptionalString.allocationSize(value.bitcoindPass) + FfiConverterOptionalUInt16.allocationSize(value.vtxoRefreshExpiryThreshold) + FfiConverterOptionalUInt16.allocationSize(value.vtxoExitMargin) + FfiConverterOptionalUInt16.allocationSize(value.htlcRecvClaimDelta) + FfiConverterOptionalUInt64.allocationSize(value.fallbackFeeRate) + FfiConverterOptionalUInt32.allocationSize(value.roundTxRequiredConfirmations) + FfiConverterOptionalUInt64.allocationSize(value.daemonSyncIntervalSecs) + FfiConverterOptionalUInt32.allocationSize(value.offboardRequiredConfirmations) + FfiConverterOptionalBool.allocationSize(value.daemonManualSync) + FfiConverterOptionalUInt8.allocationSize(value.lightningReceiveClaimRetries) + FfiConverterOptionalString.allocationSize(value.userAgent) + FfiConverterOptionalUInt32.allocationSize(value.vtxoKeyGapLimit);
409
431
  }
410
432
  }
411
433
  return new FFIConverter();
@@ -896,6 +918,52 @@ const FfiConverterTypeFeeSchedule = (() => {
896
918
  }
897
919
  return new FFIConverter();
898
920
  })();
921
+
922
+ /**
923
+ * Arguments for `Wallet::import_vtxo` / `Wallet::import_vtxos`, mirroring
924
+ * `bark::ImportVtxoArgs`.
925
+ *
926
+ * Every field has a default, so callers only set what they need.
927
+ */
928
+
929
+ /**
930
+ * Generated factory for {@link ImportVtxoArgs} record objects.
931
+ */
932
+ export const ImportVtxoArgs = (() => {
933
+ const defaults = () => ({
934
+ gapLimit: undefined,
935
+ skipStatusCheck: false,
936
+ allowPartial: false
937
+ });
938
+ const create = (() => {
939
+ return uniffiCreateRecord(defaults);
940
+ })();
941
+ return Object.freeze({
942
+ create,
943
+ new: create,
944
+ defaults: () => Object.freeze(defaults())
945
+ });
946
+ })();
947
+ const FfiConverterTypeImportVtxoArgs = (() => {
948
+ class FFIConverter extends AbstractFfiConverterByteArray {
949
+ read(from) {
950
+ return {
951
+ gapLimit: FfiConverterOptionalUInt32.read(from),
952
+ skipStatusCheck: FfiConverterBool.read(from),
953
+ allowPartial: FfiConverterBool.read(from)
954
+ };
955
+ }
956
+ write(value, into) {
957
+ FfiConverterOptionalUInt32.write(value.gapLimit, into);
958
+ FfiConverterBool.write(value.skipStatusCheck, into);
959
+ FfiConverterBool.write(value.allowPartial, into);
960
+ }
961
+ allocationSize(value) {
962
+ return FfiConverterOptionalUInt32.allocationSize(value.gapLimit) + FfiConverterBool.allocationSize(value.skipStatusCheck) + FfiConverterBool.allocationSize(value.allowPartial);
963
+ }
964
+ }
965
+ return new FFIConverter();
966
+ })();
899
967
  /**
900
968
  * Generated factory for {@link LightningInvoice} record objects.
901
969
  */
@@ -1595,7 +1663,6 @@ const FfiConverterTypeVtxo = (() => {
1595
1663
  export const WalletOpenArgs = (() => {
1596
1664
  const defaults = () => ({
1597
1665
  runDaemon: true,
1598
- onchain: undefined,
1599
1666
  createIfNotExists: true,
1600
1667
  createWithoutServer: false,
1601
1668
  skipRecovery: false
@@ -5543,15 +5610,20 @@ export class Wallet extends UniffiAbstractObject {
5543
5610
  /**
5544
5611
  * Import a VTXO from its serialized form (hex or base64).
5545
5612
  *
5546
- * The parameter keeps its historical `vtxo_base64` name for foreign
5613
+ * The VTXO is stored in the state the server reports for it, so one that
5614
+ * was already spent is recorded as spent rather than refused. Pass `args`
5615
+ * to widen the key-scan gap limit, skip the server status check, or allow
5616
+ * partial success; omit it for the defaults.
5617
+ *
5618
+ * The first parameter keeps its historical `vtxo_base64` name for foreign
5547
5619
  * binding compatibility (uniffi exposes parameter names), but hex as
5548
5620
  * returned by [`Wallet::vtxo_encoded`] is accepted too.
5549
5621
  */
5550
- async importVtxo(vtxoBase64, asyncOpts_) /*throws*/{
5622
+ async importVtxo(vtxoBase64, args = undefined, asyncOpts_) /*throws*/{
5551
5623
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
5552
5624
  try {
5553
5625
  return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
5554
- return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_import_vtxo(uniffiTypeWalletObjectFactory.clonePointer(this), FfiConverterString.lower(vtxoBase64));
5626
+ return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_import_vtxo(uniffiTypeWalletObjectFactory.clonePointer(this), FfiConverterString.lower(vtxoBase64), FfiConverterOptionalTypeImportVtxoArgs.lower(args));
5555
5627
  }, /*pollFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_poll_void, /*cancelFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_cancel_void, /*completeFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_complete_void, /*freeFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_free_void, /*liftFunc:*/_v => {}, /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeError.lift.bind(FfiConverterTypeError));
5556
5628
  } catch (__error) {
5557
5629
  if (uniffiIsDebug && __error instanceof Error) {
@@ -5560,6 +5632,29 @@ export class Wallet extends UniffiAbstractObject {
5560
5632
  throw __error;
5561
5633
  }
5562
5634
  }
5635
+
5636
+ /**
5637
+ * Import several VTXOs (hex or base64) under a single key scan and a
5638
+ * single write, which is why this is not just a loop over `import_vtxo`.
5639
+ *
5640
+ * Returns the ids now held — whether this call stored them or found them
5641
+ * already present — so a failed batch can be retried. One VTXO that cannot
5642
+ * be imported discards the whole batch unless `args.allow_partial` is set,
5643
+ * in which case the ones that did import are kept.
5644
+ */
5645
+ async importVtxos(encodedVtxos, args = undefined, asyncOpts_) /*throws*/{
5646
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
5647
+ try {
5648
+ return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
5649
+ return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_import_vtxos(uniffiTypeWalletObjectFactory.clonePointer(this), FfiConverterArrayString.lower(encodedVtxos), FfiConverterOptionalTypeImportVtxoArgs.lower(args));
5650
+ }, /*pollFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer, /*cancelFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer, /*completeFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer, /*freeFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_free_rust_buffer, /*liftFunc:*/FfiConverterArrayString.lift.bind(FfiConverterArrayString), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeError.lift.bind(FfiConverterTypeError));
5651
+ } catch (__error) {
5652
+ if (uniffiIsDebug && __error instanceof Error) {
5653
+ __error.stack = __stack;
5654
+ }
5655
+ throw __error;
5656
+ }
5657
+ }
5563
5658
  async isInvoicePaid(paymentHash, asyncOpts_) /*throws*/{
5564
5659
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
5565
5660
  try {
@@ -5986,12 +6081,16 @@ export class Wallet extends UniffiAbstractObject {
5986
6081
  * Recover the given VTXO ids from the server, importing the ones this
5987
6082
  * wallet owns that are still spendable. Use it to retry ids a previous
5988
6083
  * scan reported as `failed`.
6084
+ *
6085
+ * `gap_limit` overrides `Config.vtxo_key_gap_limit` for the key scan that
6086
+ * decides which of `vtxo_ids` this wallet owns. Widen it to reach ids a
6087
+ * previous scan bucketed as `foreign`.
5989
6088
  */
5990
- async recoverVtxos(vtxoIds, asyncOpts_) /*throws*/{
6089
+ async recoverVtxos(vtxoIds, gapLimit = undefined, asyncOpts_) /*throws*/{
5991
6090
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
5992
6091
  try {
5993
6092
  return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
5994
- return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_recover_vtxos(uniffiTypeWalletObjectFactory.clonePointer(this), FfiConverterArrayString.lower(vtxoIds));
6093
+ return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_recover_vtxos(uniffiTypeWalletObjectFactory.clonePointer(this), FfiConverterArrayString.lower(vtxoIds), FfiConverterOptionalUInt32.lower(gapLimit));
5995
6094
  }, /*pollFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer, /*cancelFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer, /*completeFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer, /*freeFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_free_rust_buffer, /*liftFunc:*/FfiConverterTypeRecoveryReport.lift.bind(FfiConverterTypeRecoveryReport), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeError.lift.bind(FfiConverterTypeError));
5996
6095
  } catch (__error) {
5997
6096
  if (uniffiIsDebug && __error instanceof Error) {
@@ -6460,6 +6559,9 @@ const FfiConverterOptionalTypeBlockRef = new FfiConverterOptional(FfiConverterTy
6460
6559
  // FfiConverter for ExitTransactionStatus | undefined
6461
6560
  const FfiConverterOptionalTypeExitTransactionStatus = new FfiConverterOptional(FfiConverterTypeExitTransactionStatus);
6462
6561
 
6562
+ // FfiConverter for ImportVtxoArgs | undefined
6563
+ const FfiConverterOptionalTypeImportVtxoArgs = new FfiConverterOptional(FfiConverterTypeImportVtxoArgs);
6564
+
6463
6565
  // FfiConverter for RecoveryReport | undefined
6464
6566
  const FfiConverterOptionalTypeRecoveryReport = new FfiConverterOptional(FfiConverterTypeRecoveryReport);
6465
6567
 
@@ -6559,12 +6661,18 @@ function uniffiEnsureInitialized() {
6559
6661
  if (bindingsContractVersion !== scaffoldingContractVersion) {
6560
6662
  throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
6561
6663
  }
6664
+ if (nativeModule().ubrn_uniffi_bark_ffi_checksum_func_default_vtxo_key_gap_limit() !== 3344) {
6665
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_func_default_vtxo_key_gap_limit");
6666
+ }
6562
6667
  if (nativeModule().ubrn_uniffi_bark_ffi_checksum_func_extract_tx_from_psbt() !== 8893) {
6563
6668
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_func_extract_tx_from_psbt");
6564
6669
  }
6565
6670
  if (nativeModule().ubrn_uniffi_bark_ffi_checksum_func_generate_mnemonic() !== 65033) {
6566
6671
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_func_generate_mnemonic");
6567
6672
  }
6673
+ if (nativeModule().ubrn_uniffi_bark_ffi_checksum_func_max_vtxo_key_gap_limit() !== 15808) {
6674
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_func_max_vtxo_key_gap_limit");
6675
+ }
6568
6676
  if (nativeModule().ubrn_uniffi_bark_ffi_checksum_func_validate_ark_address() !== 43084) {
6569
6677
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_func_validate_ark_address");
6570
6678
  }
@@ -6769,9 +6877,12 @@ function uniffiEnsureInitialized() {
6769
6877
  if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_history_by_payment_method() !== 11845) {
6770
6878
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_history_by_payment_method");
6771
6879
  }
6772
- if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_import_vtxo() !== 48135) {
6880
+ if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_import_vtxo() !== 26027) {
6773
6881
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_import_vtxo");
6774
6882
  }
6883
+ if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_import_vtxos() !== 13727) {
6884
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_import_vtxos");
6885
+ }
6775
6886
  if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_is_invoice_paid() !== 31079) {
6776
6887
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_is_invoice_paid");
6777
6888
  }
@@ -6871,7 +6982,7 @@ function uniffiEnsureInitialized() {
6871
6982
  if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_properties() !== 9773) {
6872
6983
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_properties");
6873
6984
  }
6874
- if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_recover_vtxos() !== 640) {
6985
+ if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_recover_vtxos() !== 56476) {
6875
6986
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_recover_vtxos");
6876
6987
  }
6877
6988
  if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_recovery_report() !== 10331) {
@@ -6997,6 +7108,7 @@ export default Object.freeze({
6997
7108
  FfiConverterTypeFeeEstimate,
6998
7109
  FfiConverterTypeFeeRates,
6999
7110
  FfiConverterTypeFeeSchedule,
7111
+ FfiConverterTypeImportVtxoArgs,
7000
7112
  FfiConverterTypeLightningInvoice,
7001
7113
  FfiConverterTypeLightningReceive,
7002
7114
  FfiConverterTypeLightningReceiveFees,