@secondts/bark-react-native 0.13.0 → 0.14.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.
@@ -182,6 +182,13 @@ interface NativeModuleInterface {
182
182
  description: Uint8Array,
183
183
  token: Uint8Array
184
184
  ): bigint;
185
+ ubrn_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice_for_address(
186
+ ptr: bigint,
187
+ amountSats: bigint,
188
+ claimDestination: Uint8Array,
189
+ description: Uint8Array,
190
+ token: Uint8Array
191
+ ): bigint;
185
192
  ubrn_uniffi_bark_ffi_fn_method_wallet_broadcast_tx(
186
193
  ptr: bigint,
187
194
  txHex: Uint8Array
@@ -396,6 +403,14 @@ interface NativeModuleInterface {
396
403
  ptr: bigint
397
404
  ): bigint;
398
405
  ubrn_uniffi_bark_ffi_fn_method_wallet_properties(ptr: bigint): bigint;
406
+ ubrn_uniffi_bark_ffi_fn_method_wallet_recover_vtxos(
407
+ ptr: bigint,
408
+ vtxoIds: Uint8Array
409
+ ): bigint;
410
+ ubrn_uniffi_bark_ffi_fn_method_wallet_recovery_report(
411
+ ptr: bigint,
412
+ uniffi_out_err: UniffiRustCallStatus
413
+ ): Uint8Array;
399
414
  ubrn_uniffi_bark_ffi_fn_method_wallet_refresh_server(ptr: bigint): bigint;
400
415
  ubrn_uniffi_bark_ffi_fn_method_wallet_refresh_vtxos(
401
416
  ptr: bigint,
@@ -405,6 +420,11 @@ interface NativeModuleInterface {
405
420
  ptr: bigint,
406
421
  vtxoIds: Uint8Array
407
422
  ): bigint;
423
+ ubrn_uniffi_bark_ffi_fn_method_wallet_refresh_vtxos_scheduled(
424
+ ptr: bigint,
425
+ vtxoIds: Uint8Array,
426
+ scheduledHeight: number
427
+ ): bigint;
408
428
  ubrn_uniffi_bark_ffi_fn_method_wallet_run_daemon(ptr: bigint): bigint;
409
429
  ubrn_uniffi_bark_ffi_fn_method_wallet_send_arkoor_payment(
410
430
  ptr: bigint,
@@ -648,6 +668,7 @@ interface NativeModuleInterface {
648
668
  ubrn_uniffi_bark_ffi_checksum_method_wallet_board_all(): number;
649
669
  ubrn_uniffi_bark_ffi_checksum_method_wallet_board_amount(): number;
650
670
  ubrn_uniffi_bark_ffi_checksum_method_wallet_bolt11_invoice(): number;
671
+ ubrn_uniffi_bark_ffi_checksum_method_wallet_bolt11_invoice_for_address(): number;
651
672
  ubrn_uniffi_bark_ffi_checksum_method_wallet_broadcast_tx(): number;
652
673
  ubrn_uniffi_bark_ffi_checksum_method_wallet_cancel_all_pending_rounds(): number;
653
674
  ubrn_uniffi_bark_ffi_checksum_method_wallet_cancel_lightning_receive(): number;
@@ -708,9 +729,12 @@ interface NativeModuleInterface {
708
729
  ubrn_uniffi_bark_ffi_checksum_method_wallet_progress_exits(): number;
709
730
  ubrn_uniffi_bark_ffi_checksum_method_wallet_progress_pending_rounds(): number;
710
731
  ubrn_uniffi_bark_ffi_checksum_method_wallet_properties(): number;
732
+ ubrn_uniffi_bark_ffi_checksum_method_wallet_recover_vtxos(): number;
733
+ ubrn_uniffi_bark_ffi_checksum_method_wallet_recovery_report(): number;
711
734
  ubrn_uniffi_bark_ffi_checksum_method_wallet_refresh_server(): number;
712
735
  ubrn_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos(): number;
713
736
  ubrn_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_delegated(): number;
737
+ ubrn_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_scheduled(): number;
714
738
  ubrn_uniffi_bark_ffi_checksum_method_wallet_run_daemon(): number;
715
739
  ubrn_uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment(): number;
716
740
  ubrn_uniffi_bark_ffi_checksum_method_wallet_send_onchain(): number;
@@ -1027,7 +1027,7 @@ export type LightningReceive = {
1027
1027
  amountSats: /*u64*/ bigint;
1028
1028
  /**
1029
1029
  * Receive progress: "awaiting-payment" | "htlcs-ready" |
1030
- * "preimage-revealed" | "settled"
1030
+ * "preimage-revealed" | "delivering" | "settled"
1031
1031
  */
1032
1032
  state: string;
1033
1033
  /**
@@ -1038,6 +1038,13 @@ export type LightningReceive = {
1038
1038
  * Unix timestamp (seconds), set only when the receive is settled.
1039
1039
  */
1040
1040
  settledAt?: /*i64*/ bigint;
1041
+ /**
1042
+ * Ark address the claimed VTXO is delivered to, for receives created with
1043
+ * `bolt11_invoice_for_address`. `None` for ordinary receives claimed by
1044
+ * this wallet, and always `None` once settled — the settled record does
1045
+ * not carry the destination.
1046
+ */
1047
+ claimDestination?: string;
1041
1048
  };
1042
1049
 
1043
1050
  /**
@@ -1068,6 +1075,7 @@ const FfiConverterTypeLightningReceive = (() => {
1068
1075
  state: FfiConverterString.read(from),
1069
1076
  paymentPreimage: FfiConverterOptionalString.read(from),
1070
1077
  settledAt: FfiConverterOptionalInt64.read(from),
1078
+ claimDestination: FfiConverterOptionalString.read(from),
1071
1079
  };
1072
1080
  }
1073
1081
  write(value: TypeName, into: RustBuffer): void {
@@ -1077,6 +1085,7 @@ const FfiConverterTypeLightningReceive = (() => {
1077
1085
  FfiConverterString.write(value.state, into);
1078
1086
  FfiConverterOptionalString.write(value.paymentPreimage, into);
1079
1087
  FfiConverterOptionalInt64.write(value.settledAt, into);
1088
+ FfiConverterOptionalString.write(value.claimDestination, into);
1080
1089
  }
1081
1090
  allocationSize(value: TypeName): number {
1082
1091
  return (
@@ -1085,7 +1094,8 @@ const FfiConverterTypeLightningReceive = (() => {
1085
1094
  FfiConverterUInt64.allocationSize(value.amountSats) +
1086
1095
  FfiConverterString.allocationSize(value.state) +
1087
1096
  FfiConverterOptionalString.allocationSize(value.paymentPreimage) +
1088
- FfiConverterOptionalInt64.allocationSize(value.settledAt)
1097
+ FfiConverterOptionalInt64.allocationSize(value.settledAt) +
1098
+ FfiConverterOptionalString.allocationSize(value.claimDestination)
1089
1099
  );
1090
1100
  }
1091
1101
  }
@@ -1456,6 +1466,153 @@ const FfiConverterTypePendingBoard = (() => {
1456
1466
  return new FFIConverter();
1457
1467
  })();
1458
1468
 
1469
+ /**
1470
+ * One bucket of a [`RecoveryReport`].
1471
+ *
1472
+ * `total_sats` only sums the VTXOs whose amount is known, so it can
1473
+ * under-count `failed`, where a VTXO may have failed before being fetched.
1474
+ * `vtxo_ids` is sorted, since upstream buckets them unordered.
1475
+ */
1476
+ export type RecoveryBucket = {
1477
+ vtxoIds: Array<string>;
1478
+ totalSats: /*u64*/ bigint;
1479
+ };
1480
+
1481
+ /**
1482
+ * Generated factory for {@link RecoveryBucket} record objects.
1483
+ */
1484
+ export const RecoveryBucket = (() => {
1485
+ const defaults = () => ({});
1486
+ const create = (() => {
1487
+ return uniffiCreateRecord<RecoveryBucket, ReturnType<typeof defaults>>(
1488
+ defaults
1489
+ );
1490
+ })();
1491
+ return Object.freeze({
1492
+ create,
1493
+ new: create,
1494
+ defaults: () => Object.freeze(defaults()) as Partial<RecoveryBucket>,
1495
+ });
1496
+ })();
1497
+
1498
+ const FfiConverterTypeRecoveryBucket = (() => {
1499
+ type TypeName = RecoveryBucket;
1500
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1501
+ read(from: RustBuffer): TypeName {
1502
+ return {
1503
+ vtxoIds: FfiConverterArrayString.read(from),
1504
+ totalSats: FfiConverterUInt64.read(from),
1505
+ };
1506
+ }
1507
+ write(value: TypeName, into: RustBuffer): void {
1508
+ FfiConverterArrayString.write(value.vtxoIds, into);
1509
+ FfiConverterUInt64.write(value.totalSats, into);
1510
+ }
1511
+ allocationSize(value: TypeName): number {
1512
+ return (
1513
+ FfiConverterArrayString.allocationSize(value.vtxoIds) +
1514
+ FfiConverterUInt64.allocationSize(value.totalSats)
1515
+ );
1516
+ }
1517
+ }
1518
+ return new FFIConverter();
1519
+ })();
1520
+
1521
+ /**
1522
+ * Outcome of a recovery scan: every VTXO id the scan looked at, bucketed by
1523
+ * what was decided about it.
1524
+ *
1525
+ * `skipped` vs `failed` is the load-bearing distinction: a `skipped` VTXO was
1526
+ * decided not to be spendable (spent, exited, or reported non-spendable),
1527
+ * while a `failed` one could not be decided because of an error, so its funds
1528
+ * may still be missing. `failed` is retryable via `recover_vtxos`; a `foreign`
1529
+ * id instead sits beyond the key-derivation gap limit and needs a wider scan.
1530
+ */
1531
+ export type RecoveryReport = {
1532
+ /**
1533
+ * Spendable VTXOs that were successfully re-imported.
1534
+ */
1535
+ recovered: RecoveryBucket;
1536
+ /**
1537
+ * Deliberately left out: spent into a newer recovered VTXO, exited
1538
+ * on-chain, or reported non-spendable by the server.
1539
+ */
1540
+ skipped: RecoveryBucket;
1541
+ /**
1542
+ * No matching key could be derived within the gap limit (50 consecutive
1543
+ * unused indices). For a mailbox scan these are most likely this wallet's
1544
+ * own VTXOs, keyed beyond the limit, so funds may be missing; retrying
1545
+ * won't help, only a wider gap limit. For `recover_vtxos` it just means
1546
+ * the caller passed an id this wallet doesn't own.
1547
+ */
1548
+ foreign: RecoveryBucket;
1549
+ /**
1550
+ * Could not be decided due to an error. Not known to be spent, so funds
1551
+ * may be missing. Retryable.
1552
+ */
1553
+ failed: RecoveryBucket;
1554
+ /**
1555
+ * Already fully exited on-chain.
1556
+ */
1557
+ exited: RecoveryBucket;
1558
+ /**
1559
+ * Whether the scan accounted for every VTXO: no `failed`, no `foreign`.
1560
+ */
1561
+ isComplete: boolean;
1562
+ };
1563
+
1564
+ /**
1565
+ * Generated factory for {@link RecoveryReport} record objects.
1566
+ */
1567
+ export const RecoveryReport = (() => {
1568
+ const defaults = () => ({});
1569
+ const create = (() => {
1570
+ return uniffiCreateRecord<RecoveryReport, ReturnType<typeof defaults>>(
1571
+ defaults
1572
+ );
1573
+ })();
1574
+ return Object.freeze({
1575
+ create,
1576
+ new: create,
1577
+ defaults: () => Object.freeze(defaults()) as Partial<RecoveryReport>,
1578
+ });
1579
+ })();
1580
+
1581
+ const FfiConverterTypeRecoveryReport = (() => {
1582
+ type TypeName = RecoveryReport;
1583
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1584
+ read(from: RustBuffer): TypeName {
1585
+ return {
1586
+ recovered: FfiConverterTypeRecoveryBucket.read(from),
1587
+ skipped: FfiConverterTypeRecoveryBucket.read(from),
1588
+ foreign: FfiConverterTypeRecoveryBucket.read(from),
1589
+ failed: FfiConverterTypeRecoveryBucket.read(from),
1590
+ exited: FfiConverterTypeRecoveryBucket.read(from),
1591
+ isComplete: FfiConverterBool.read(from),
1592
+ };
1593
+ }
1594
+ write(value: TypeName, into: RustBuffer): void {
1595
+ FfiConverterTypeRecoveryBucket.write(value.recovered, into);
1596
+ FfiConverterTypeRecoveryBucket.write(value.skipped, into);
1597
+ FfiConverterTypeRecoveryBucket.write(value.foreign, into);
1598
+ FfiConverterTypeRecoveryBucket.write(value.failed, into);
1599
+ FfiConverterTypeRecoveryBucket.write(value.exited, into);
1600
+ FfiConverterBool.write(value.isComplete, into);
1601
+ }
1602
+ allocationSize(value: TypeName): number {
1603
+ return (
1604
+ FfiConverterTypeRecoveryBucket.allocationSize(value.recovered) +
1605
+ FfiConverterTypeRecoveryBucket.allocationSize(value.skipped) +
1606
+ FfiConverterTypeRecoveryBucket.allocationSize(value.foreign) +
1607
+ FfiConverterTypeRecoveryBucket.allocationSize(value.failed) +
1608
+ FfiConverterTypeRecoveryBucket.allocationSize(value.exited) +
1609
+ FfiConverterBool.allocationSize(value.isComplete)
1610
+ );
1611
+ }
1612
+ }
1613
+ return new FFIConverter();
1614
+ })();
1615
+
1459
1616
  /**
1460
1617
  * A pending round state
1461
1618
  */
@@ -1523,6 +1680,13 @@ export type Vtxo = {
1523
1680
  * estimate exit cost without loading the full genesis.
1524
1681
  */
1525
1682
  exitTxWeightWu: /*u64*/ bigint;
1683
+ /**
1684
+ * Whether this VTXO's recovery state has been asserted with the server:
1685
+ * its id posted to the recovery mailbox and its signed transaction chain
1686
+ * registered. Only ever moves from `false` to `true`; the sync-time
1687
+ * catch-up re-uploads the ones still `false`.
1688
+ */
1689
+ registered: boolean;
1526
1690
  };
1527
1691
 
1528
1692
  /**
@@ -1552,6 +1716,7 @@ const FfiConverterTypeVtxo = (() => {
1552
1716
  state: FfiConverterString.read(from),
1553
1717
  exitDepth: FfiConverterUInt32.read(from),
1554
1718
  exitTxWeightWu: FfiConverterUInt64.read(from),
1719
+ registered: FfiConverterBool.read(from),
1555
1720
  };
1556
1721
  }
1557
1722
  write(value: TypeName, into: RustBuffer): void {
@@ -1562,6 +1727,7 @@ const FfiConverterTypeVtxo = (() => {
1562
1727
  FfiConverterString.write(value.state, into);
1563
1728
  FfiConverterUInt32.write(value.exitDepth, into);
1564
1729
  FfiConverterUInt64.write(value.exitTxWeightWu, into);
1730
+ FfiConverterBool.write(value.registered, into);
1565
1731
  }
1566
1732
  allocationSize(value: TypeName): number {
1567
1733
  return (
@@ -1571,7 +1737,8 @@ const FfiConverterTypeVtxo = (() => {
1571
1737
  FfiConverterString.allocationSize(value.kind) +
1572
1738
  FfiConverterString.allocationSize(value.state) +
1573
1739
  FfiConverterUInt32.allocationSize(value.exitDepth) +
1574
- FfiConverterUInt64.allocationSize(value.exitTxWeightWu)
1740
+ FfiConverterUInt64.allocationSize(value.exitTxWeightWu) +
1741
+ FfiConverterBool.allocationSize(value.registered)
1575
1742
  );
1576
1743
  }
1577
1744
  }
@@ -1614,6 +1781,16 @@ export type WalletOpenArgs = {
1614
1781
  * Default: false
1615
1782
  */
1616
1783
  createWithoutServer: boolean;
1784
+ /**
1785
+ * Whether to skip the seed-recovery mailbox scan
1786
+ *
1787
+ * The scan runs on the open that creates the wallet locally and makes
1788
+ * network calls; its result is available from `Wallet::recovery_report`.
1789
+ * Set this to open without it.
1790
+ *
1791
+ * Default: false
1792
+ */
1793
+ skipRecovery: boolean;
1617
1794
  };
1618
1795
 
1619
1796
  /**
@@ -1625,6 +1802,7 @@ export const WalletOpenArgs = (() => {
1625
1802
  onchain: undefined,
1626
1803
  createIfNotExists: true,
1627
1804
  createWithoutServer: false,
1805
+ skipRecovery: false,
1628
1806
  });
1629
1807
  const create = (() => {
1630
1808
  return uniffiCreateRecord<WalletOpenArgs, ReturnType<typeof defaults>>(
@@ -1648,6 +1826,7 @@ const FfiConverterTypeWalletOpenArgs = (() => {
1648
1826
  onchain: FfiConverterOptionalTypeOnchainWallet.read(from),
1649
1827
  createIfNotExists: FfiConverterBool.read(from),
1650
1828
  createWithoutServer: FfiConverterBool.read(from),
1829
+ skipRecovery: FfiConverterBool.read(from),
1651
1830
  };
1652
1831
  }
1653
1832
  write(value: TypeName, into: RustBuffer): void {
@@ -1656,6 +1835,7 @@ const FfiConverterTypeWalletOpenArgs = (() => {
1656
1835
  FfiConverterOptionalTypeOnchainWallet.write(value.onchain, into);
1657
1836
  FfiConverterBool.write(value.createIfNotExists, into);
1658
1837
  FfiConverterBool.write(value.createWithoutServer, into);
1838
+ FfiConverterBool.write(value.skipRecovery, into);
1659
1839
  }
1660
1840
  allocationSize(value: TypeName): number {
1661
1841
  return (
@@ -1663,7 +1843,8 @@ const FfiConverterTypeWalletOpenArgs = (() => {
1663
1843
  FfiConverterString.allocationSize(value.datadir) +
1664
1844
  FfiConverterOptionalTypeOnchainWallet.allocationSize(value.onchain) +
1665
1845
  FfiConverterBool.allocationSize(value.createIfNotExists) +
1666
- FfiConverterBool.allocationSize(value.createWithoutServer)
1846
+ FfiConverterBool.allocationSize(value.createWithoutServer) +
1847
+ FfiConverterBool.allocationSize(value.skipRecovery)
1667
1848
  );
1668
1849
  }
1669
1850
  }
@@ -3788,6 +3969,29 @@ export interface WalletLike {
3788
3969
  token: string | undefined,
3789
3970
  asyncOpts_?: { signal: AbortSignal }
3790
3971
  ): /*throws*/ Promise<LightningInvoice>;
3972
+ /**
3973
+ * Create an invoice whose claimed VTXO is delivered to `claim_destination`
3974
+ * (an Ark address), letting that wallet receive while offline.
3975
+ *
3976
+ * The claim is signed directly to that address's own policy, so this wallet
3977
+ * has no custodial control and cannot redirect the payment. It can still
3978
+ * strand it: delivering the signed output to the destination's mailbox is a
3979
+ * separate step only this wallet can perform, and the recipient has no
3980
+ * independent way to recover the funds until it happens. Delivery resumes
3981
+ * automatically on restart, so a crash recovers on its own — but running
3982
+ * this for someone else means they trust you to stay online and eventually
3983
+ * deliver, not that they trust you with custody.
3984
+ *
3985
+ * A `claim_destination` owned by this wallet is claimed locally instead of
3986
+ * going through its mailbox.
3987
+ */
3988
+ bolt11InvoiceForAddress(
3989
+ amountSats: /*u64*/ bigint,
3990
+ claimDestination: string,
3991
+ description: string | undefined,
3992
+ token: string | undefined,
3993
+ asyncOpts_?: { signal: AbortSignal }
3994
+ ): /*throws*/ Promise<LightningInvoice>;
3791
3995
  broadcastTx(
3792
3996
  txHex: string,
3793
3997
  asyncOpts_?: { signal: AbortSignal }
@@ -4020,6 +4224,27 @@ export interface WalletLike {
4020
4224
  properties(asyncOpts_?: {
4021
4225
  signal: AbortSignal;
4022
4226
  }): /*throws*/ Promise<WalletProperties>;
4227
+ /**
4228
+ * Recover the given VTXO ids from the server, importing the ones this
4229
+ * wallet owns that are still spendable. Use it to retry ids a previous
4230
+ * scan reported as `failed`.
4231
+ */
4232
+ recoverVtxos(
4233
+ vtxoIds: Array<string>,
4234
+ asyncOpts_?: { signal: AbortSignal }
4235
+ ): /*throws*/ Promise<RecoveryReport>;
4236
+ /**
4237
+ * Result of the seed-recovery scan that ran during `Wallet::open`, or none
4238
+ * if no report was produced.
4239
+ *
4240
+ * Recovery only runs on the open that creates the wallet locally, and not
4241
+ * at all when `WalletOpenArgs.skip_recovery` is set, so this is empty on
4242
+ * every subsequent open. It is also empty when the scan itself failed
4243
+ * outright — bark logs that and lets open succeed, so an empty result does
4244
+ * not prove no funds are missing. `isComplete == false` means funds may
4245
+ * still be missing; retry the report's `failed` ids with `recoverVtxos`.
4246
+ */
4247
+ recoveryReport(): RecoveryReport | undefined;
4023
4248
  refreshServer(asyncOpts_?: { signal: AbortSignal }): /*throws*/ Promise<void>;
4024
4249
  refreshVtxos(
4025
4250
  vtxoIds: Array<string>,
@@ -4029,6 +4254,17 @@ export interface WalletLike {
4029
4254
  vtxoIds: Array<string>,
4030
4255
  asyncOpts_?: { signal: AbortSignal }
4031
4256
  ): /*throws*/ Promise<RoundState | undefined>;
4257
+ /**
4258
+ * Schedule a delegated refresh for `scheduled_height` instead of the next
4259
+ * round. The refresh fee is priced against the VTXO's remaining lifetime at
4260
+ * that height, and the server charges less the closer a VTXO is to expiry,
4261
+ * so scheduling further out never costs more than refreshing now.
4262
+ */
4263
+ refreshVtxosScheduled(
4264
+ vtxoIds: Array<string>,
4265
+ scheduledHeight: /*u32*/ number,
4266
+ asyncOpts_?: { signal: AbortSignal }
4267
+ ): /*throws*/ Promise<RoundState | undefined>;
4032
4268
  /**
4033
4269
  * Start the background daemon. The onchain wallet used by the daemon is
4034
4270
  * the one supplied to `Wallet::open` (see `WalletOpenArgs.onchain`).
@@ -4492,6 +4728,65 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
4492
4728
  }
4493
4729
  }
4494
4730
 
4731
+ /**
4732
+ * Create an invoice whose claimed VTXO is delivered to `claim_destination`
4733
+ * (an Ark address), letting that wallet receive while offline.
4734
+ *
4735
+ * The claim is signed directly to that address's own policy, so this wallet
4736
+ * has no custodial control and cannot redirect the payment. It can still
4737
+ * strand it: delivering the signed output to the destination's mailbox is a
4738
+ * separate step only this wallet can perform, and the recipient has no
4739
+ * independent way to recover the funds until it happens. Delivery resumes
4740
+ * automatically on restart, so a crash recovers on its own — but running
4741
+ * this for someone else means they trust you to stay online and eventually
4742
+ * deliver, not that they trust you with custody.
4743
+ *
4744
+ * A `claim_destination` owned by this wallet is claimed locally instead of
4745
+ * going through its mailbox.
4746
+ */
4747
+ async bolt11InvoiceForAddress(
4748
+ amountSats: /*u64*/ bigint,
4749
+ claimDestination: string,
4750
+ description: string | undefined = undefined,
4751
+ token: string | undefined = undefined,
4752
+ asyncOpts_?: { signal: AbortSignal }
4753
+ ): Promise<LightningInvoice> /*throws*/ {
4754
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
4755
+ try {
4756
+ return await uniffiRustCallAsync(
4757
+ /*rustCaller:*/ uniffiCaller,
4758
+ /*rustFutureFunc:*/ () => {
4759
+ return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice_for_address(
4760
+ uniffiTypeWalletObjectFactory.clonePointer(this),
4761
+ FfiConverterUInt64.lower(amountSats),
4762
+ FfiConverterString.lower(claimDestination),
4763
+ FfiConverterOptionalString.lower(description),
4764
+ FfiConverterOptionalString.lower(token)
4765
+ );
4766
+ },
4767
+ /*pollFunc:*/ nativeModule()
4768
+ .ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer,
4769
+ /*cancelFunc:*/ nativeModule()
4770
+ .ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer,
4771
+ /*completeFunc:*/ nativeModule()
4772
+ .ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer,
4773
+ /*freeFunc:*/ nativeModule()
4774
+ .ubrn_ffi_bark_ffi_rust_future_free_rust_buffer,
4775
+ /*liftFunc:*/ FfiConverterTypeLightningInvoice.lift.bind(
4776
+ FfiConverterTypeLightningInvoice
4777
+ ),
4778
+ /*liftString:*/ FfiConverterString.lift,
4779
+ /*asyncOpts:*/ asyncOpts_,
4780
+ /*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError)
4781
+ );
4782
+ } catch (__error: any) {
4783
+ if (uniffiIsDebug && __error instanceof Error) {
4784
+ __error.stack = __stack;
4785
+ }
4786
+ throw __error;
4787
+ }
4788
+ }
4789
+
4495
4790
  async broadcastTx(
4496
4791
  txHex: string,
4497
4792
  asyncOpts_?: { signal: AbortSignal }
@@ -6558,6 +6853,73 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
6558
6853
  }
6559
6854
  }
6560
6855
 
6856
+ /**
6857
+ * Recover the given VTXO ids from the server, importing the ones this
6858
+ * wallet owns that are still spendable. Use it to retry ids a previous
6859
+ * scan reported as `failed`.
6860
+ */
6861
+ async recoverVtxos(
6862
+ vtxoIds: Array<string>,
6863
+ asyncOpts_?: { signal: AbortSignal }
6864
+ ): Promise<RecoveryReport> /*throws*/ {
6865
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
6866
+ try {
6867
+ return await uniffiRustCallAsync(
6868
+ /*rustCaller:*/ uniffiCaller,
6869
+ /*rustFutureFunc:*/ () => {
6870
+ return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_recover_vtxos(
6871
+ uniffiTypeWalletObjectFactory.clonePointer(this),
6872
+ FfiConverterArrayString.lower(vtxoIds)
6873
+ );
6874
+ },
6875
+ /*pollFunc:*/ nativeModule()
6876
+ .ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer,
6877
+ /*cancelFunc:*/ nativeModule()
6878
+ .ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer,
6879
+ /*completeFunc:*/ nativeModule()
6880
+ .ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer,
6881
+ /*freeFunc:*/ nativeModule()
6882
+ .ubrn_ffi_bark_ffi_rust_future_free_rust_buffer,
6883
+ /*liftFunc:*/ FfiConverterTypeRecoveryReport.lift.bind(
6884
+ FfiConverterTypeRecoveryReport
6885
+ ),
6886
+ /*liftString:*/ FfiConverterString.lift,
6887
+ /*asyncOpts:*/ asyncOpts_,
6888
+ /*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError)
6889
+ );
6890
+ } catch (__error: any) {
6891
+ if (uniffiIsDebug && __error instanceof Error) {
6892
+ __error.stack = __stack;
6893
+ }
6894
+ throw __error;
6895
+ }
6896
+ }
6897
+
6898
+ /**
6899
+ * Result of the seed-recovery scan that ran during `Wallet::open`, or none
6900
+ * if no report was produced.
6901
+ *
6902
+ * Recovery only runs on the open that creates the wallet locally, and not
6903
+ * at all when `WalletOpenArgs.skip_recovery` is set, so this is empty on
6904
+ * every subsequent open. It is also empty when the scan itself failed
6905
+ * outright — bark logs that and lets open succeed, so an empty result does
6906
+ * not prove no funds are missing. `isComplete == false` means funds may
6907
+ * still be missing; retry the report's `failed` ids with `recoverVtxos`.
6908
+ */
6909
+ recoveryReport(): RecoveryReport | undefined {
6910
+ return FfiConverterOptionalTypeRecoveryReport.lift(
6911
+ uniffiCaller.rustCall(
6912
+ /*caller:*/ (callStatus) => {
6913
+ return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_recovery_report(
6914
+ uniffiTypeWalletObjectFactory.clonePointer(this),
6915
+ callStatus
6916
+ );
6917
+ },
6918
+ /*liftString:*/ FfiConverterString.lift
6919
+ )
6920
+ );
6921
+ }
6922
+
6561
6923
  async refreshServer(asyncOpts_?: {
6562
6924
  signal: AbortSignal;
6563
6925
  }): Promise<void> /*throws*/ {
@@ -6663,6 +7025,51 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
6663
7025
  }
6664
7026
  }
6665
7027
 
7028
+ /**
7029
+ * Schedule a delegated refresh for `scheduled_height` instead of the next
7030
+ * round. The refresh fee is priced against the VTXO's remaining lifetime at
7031
+ * that height, and the server charges less the closer a VTXO is to expiry,
7032
+ * so scheduling further out never costs more than refreshing now.
7033
+ */
7034
+ async refreshVtxosScheduled(
7035
+ vtxoIds: Array<string>,
7036
+ scheduledHeight: /*u32*/ number,
7037
+ asyncOpts_?: { signal: AbortSignal }
7038
+ ): Promise<RoundState | undefined> /*throws*/ {
7039
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
7040
+ try {
7041
+ return await uniffiRustCallAsync(
7042
+ /*rustCaller:*/ uniffiCaller,
7043
+ /*rustFutureFunc:*/ () => {
7044
+ return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_refresh_vtxos_scheduled(
7045
+ uniffiTypeWalletObjectFactory.clonePointer(this),
7046
+ FfiConverterArrayString.lower(vtxoIds),
7047
+ FfiConverterUInt32.lower(scheduledHeight)
7048
+ );
7049
+ },
7050
+ /*pollFunc:*/ nativeModule()
7051
+ .ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer,
7052
+ /*cancelFunc:*/ nativeModule()
7053
+ .ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer,
7054
+ /*completeFunc:*/ nativeModule()
7055
+ .ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer,
7056
+ /*freeFunc:*/ nativeModule()
7057
+ .ubrn_ffi_bark_ffi_rust_future_free_rust_buffer,
7058
+ /*liftFunc:*/ FfiConverterOptionalTypeRoundState.lift.bind(
7059
+ FfiConverterOptionalTypeRoundState
7060
+ ),
7061
+ /*liftString:*/ FfiConverterString.lift,
7062
+ /*asyncOpts:*/ asyncOpts_,
7063
+ /*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError)
7064
+ );
7065
+ } catch (__error: any) {
7066
+ if (uniffiIsDebug && __error instanceof Error) {
7067
+ __error.stack = __stack;
7068
+ }
7069
+ throw __error;
7070
+ }
7071
+ }
7072
+
6666
7073
  /**
6667
7074
  * Start the background daemon. The onchain wallet used by the daemon is
6668
7075
  * the one supplied to `Wallet::open` (see `WalletOpenArgs.onchain`).
@@ -7383,6 +7790,11 @@ const FfiConverterOptionalTypeExitTransactionStatus = new FfiConverterOptional(
7383
7790
  FfiConverterTypeExitTransactionStatus
7384
7791
  );
7385
7792
 
7793
+ // FfiConverter for RecoveryReport | undefined
7794
+ const FfiConverterOptionalTypeRecoveryReport = new FfiConverterOptional(
7795
+ FfiConverterTypeRecoveryReport
7796
+ );
7797
+
7386
7798
  // FfiConverter for RoundState | undefined
7387
7799
  const FfiConverterOptionalTypeRoundState = new FfiConverterOptional(
7388
7800
  FfiConverterTypeRoundState
@@ -7732,6 +8144,14 @@ function uniffiEnsureInitialized() {
7732
8144
  "uniffi_bark_ffi_checksum_method_wallet_bolt11_invoice"
7733
8145
  );
7734
8146
  }
8147
+ if (
8148
+ nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_bolt11_invoice_for_address() !==
8149
+ 56368
8150
+ ) {
8151
+ throw new UniffiInternalError.ApiChecksumMismatch(
8152
+ "uniffi_bark_ffi_checksum_method_wallet_bolt11_invoice_for_address"
8153
+ );
8154
+ }
7735
8155
  if (
7736
8156
  nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_broadcast_tx() !==
7737
8157
  46367
@@ -8212,6 +8632,22 @@ function uniffiEnsureInitialized() {
8212
8632
  "uniffi_bark_ffi_checksum_method_wallet_properties"
8213
8633
  );
8214
8634
  }
8635
+ if (
8636
+ nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_recover_vtxos() !==
8637
+ 640
8638
+ ) {
8639
+ throw new UniffiInternalError.ApiChecksumMismatch(
8640
+ "uniffi_bark_ffi_checksum_method_wallet_recover_vtxos"
8641
+ );
8642
+ }
8643
+ if (
8644
+ nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_recovery_report() !==
8645
+ 54899
8646
+ ) {
8647
+ throw new UniffiInternalError.ApiChecksumMismatch(
8648
+ "uniffi_bark_ffi_checksum_method_wallet_recovery_report"
8649
+ );
8650
+ }
8215
8651
  if (
8216
8652
  nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_refresh_server() !==
8217
8653
  41162
@@ -8236,6 +8672,14 @@ function uniffiEnsureInitialized() {
8236
8672
  "uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_delegated"
8237
8673
  );
8238
8674
  }
8675
+ if (
8676
+ nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_scheduled() !==
8677
+ 50488
8678
+ ) {
8679
+ throw new UniffiInternalError.ApiChecksumMismatch(
8680
+ "uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_scheduled"
8681
+ );
8682
+ }
8239
8683
  if (
8240
8684
  nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_run_daemon() !==
8241
8685
  9520
@@ -8438,6 +8882,8 @@ export default Object.freeze({
8438
8882
  FfiConverterTypeOnchainWallet,
8439
8883
  FfiConverterTypeOutPoint,
8440
8884
  FfiConverterTypePendingBoard,
8885
+ FfiConverterTypeRecoveryBucket,
8886
+ FfiConverterTypeRecoveryReport,
8441
8887
  FfiConverterTypeRoundState,
8442
8888
  FfiConverterTypeVtxo,
8443
8889
  FfiConverterTypeWallet,