@secondts/bark-react-native 0.12.2 → 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.
@@ -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 }
@@ -3890,6 +4094,13 @@ export interface WalletLike {
3890
4094
  paymentMethodValue: string,
3891
4095
  asyncOpts_?: { signal: AbortSignal }
3892
4096
  ): /*throws*/ Promise<Array<Movement>>;
4097
+ /**
4098
+ * Import a VTXO from its serialized form (hex or base64).
4099
+ *
4100
+ * The parameter keeps its historical `vtxo_base64` name for foreign
4101
+ * binding compatibility (uniffi exposes parameter names), but hex as
4102
+ * returned by [`Wallet::vtxo_encoded`] is accepted too.
4103
+ */
3893
4104
  importVtxo(
3894
4105
  vtxoBase64: string,
3895
4106
  asyncOpts_?: { signal: AbortSignal }
@@ -4013,6 +4224,27 @@ export interface WalletLike {
4013
4224
  properties(asyncOpts_?: {
4014
4225
  signal: AbortSignal;
4015
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;
4016
4248
  refreshServer(asyncOpts_?: { signal: AbortSignal }): /*throws*/ Promise<void>;
4017
4249
  refreshVtxos(
4018
4250
  vtxoIds: Array<string>,
@@ -4022,6 +4254,17 @@ export interface WalletLike {
4022
4254
  vtxoIds: Array<string>,
4023
4255
  asyncOpts_?: { signal: AbortSignal }
4024
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>;
4025
4268
  /**
4026
4269
  * Start the background daemon. The onchain wallet used by the daemon is
4027
4270
  * the one supplied to `Wallet::open` (see `WalletOpenArgs.onchain`).
@@ -4083,6 +4326,15 @@ export interface WalletLike {
4083
4326
  address: string,
4084
4327
  asyncOpts_?: { signal: AbortSignal }
4085
4328
  ): /*throws*/ Promise<boolean>;
4329
+ /**
4330
+ * Hex-encoded serialization of the full VTXO (genesis chain included),
4331
+ * re-importable via [`Wallet::import_vtxo`]. Mirrors bark-rest
4332
+ * `GET /vtxos/{id}/encoded`.
4333
+ */
4334
+ vtxoEncoded(
4335
+ vtxoId: string,
4336
+ asyncOpts_?: { signal: AbortSignal }
4337
+ ): /*throws*/ Promise<string>;
4086
4338
  vtxos(asyncOpts_?: { signal: AbortSignal }): /*throws*/ Promise<Array<Vtxo>>;
4087
4339
  }
4088
4340
  /**
@@ -4476,6 +4728,65 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
4476
4728
  }
4477
4729
  }
4478
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
+
4479
4790
  async broadcastTx(
4480
4791
  txHex: string,
4481
4792
  asyncOpts_?: { signal: AbortSignal }
@@ -5419,6 +5730,13 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
5419
5730
  }
5420
5731
  }
5421
5732
 
5733
+ /**
5734
+ * Import a VTXO from its serialized form (hex or base64).
5735
+ *
5736
+ * The parameter keeps its historical `vtxo_base64` name for foreign
5737
+ * binding compatibility (uniffi exposes parameter names), but hex as
5738
+ * returned by [`Wallet::vtxo_encoded`] is accepted too.
5739
+ */
5422
5740
  async importVtxo(
5423
5741
  vtxoBase64: string,
5424
5742
  asyncOpts_?: { signal: AbortSignal }
@@ -6535,6 +6853,73 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
6535
6853
  }
6536
6854
  }
6537
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
+
6538
6923
  async refreshServer(asyncOpts_?: {
6539
6924
  signal: AbortSignal;
6540
6925
  }): Promise<void> /*throws*/ {
@@ -6640,6 +7025,51 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
6640
7025
  }
6641
7026
  }
6642
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
+
6643
7073
  /**
6644
7074
  * Start the background daemon. The onchain wallet used by the daemon is
6645
7075
  * the one supplied to `Wallet::open` (see `WalletOpenArgs.onchain`).
@@ -7184,6 +7614,46 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
7184
7614
  }
7185
7615
  }
7186
7616
 
7617
+ /**
7618
+ * Hex-encoded serialization of the full VTXO (genesis chain included),
7619
+ * re-importable via [`Wallet::import_vtxo`]. Mirrors bark-rest
7620
+ * `GET /vtxos/{id}/encoded`.
7621
+ */
7622
+ async vtxoEncoded(
7623
+ vtxoId: string,
7624
+ asyncOpts_?: { signal: AbortSignal }
7625
+ ): Promise<string> /*throws*/ {
7626
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
7627
+ try {
7628
+ return await uniffiRustCallAsync(
7629
+ /*rustCaller:*/ uniffiCaller,
7630
+ /*rustFutureFunc:*/ () => {
7631
+ return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_vtxo_encoded(
7632
+ uniffiTypeWalletObjectFactory.clonePointer(this),
7633
+ FfiConverterString.lower(vtxoId)
7634
+ );
7635
+ },
7636
+ /*pollFunc:*/ nativeModule()
7637
+ .ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer,
7638
+ /*cancelFunc:*/ nativeModule()
7639
+ .ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer,
7640
+ /*completeFunc:*/ nativeModule()
7641
+ .ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer,
7642
+ /*freeFunc:*/ nativeModule()
7643
+ .ubrn_ffi_bark_ffi_rust_future_free_rust_buffer,
7644
+ /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
7645
+ /*liftString:*/ FfiConverterString.lift,
7646
+ /*asyncOpts:*/ asyncOpts_,
7647
+ /*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError)
7648
+ );
7649
+ } catch (__error: any) {
7650
+ if (uniffiIsDebug && __error instanceof Error) {
7651
+ __error.stack = __stack;
7652
+ }
7653
+ throw __error;
7654
+ }
7655
+ }
7656
+
7187
7657
  async vtxos(asyncOpts_?: {
7188
7658
  signal: AbortSignal;
7189
7659
  }): Promise<Array<Vtxo>> /*throws*/ {
@@ -7320,6 +7790,11 @@ const FfiConverterOptionalTypeExitTransactionStatus = new FfiConverterOptional(
7320
7790
  FfiConverterTypeExitTransactionStatus
7321
7791
  );
7322
7792
 
7793
+ // FfiConverter for RecoveryReport | undefined
7794
+ const FfiConverterOptionalTypeRecoveryReport = new FfiConverterOptional(
7795
+ FfiConverterTypeRecoveryReport
7796
+ );
7797
+
7323
7798
  // FfiConverter for RoundState | undefined
7324
7799
  const FfiConverterOptionalTypeRoundState = new FfiConverterOptional(
7325
7800
  FfiConverterTypeRoundState
@@ -7669,6 +8144,14 @@ function uniffiEnsureInitialized() {
7669
8144
  "uniffi_bark_ffi_checksum_method_wallet_bolt11_invoice"
7670
8145
  );
7671
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
+ }
7672
8155
  if (
7673
8156
  nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_broadcast_tx() !==
7674
8157
  46367
@@ -7887,7 +8370,7 @@ function uniffiEnsureInitialized() {
7887
8370
  }
7888
8371
  if (
7889
8372
  nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_import_vtxo() !==
7890
- 42571
8373
+ 48135
7891
8374
  ) {
7892
8375
  throw new UniffiInternalError.ApiChecksumMismatch(
7893
8376
  "uniffi_bark_ffi_checksum_method_wallet_import_vtxo"
@@ -8149,6 +8632,22 @@ function uniffiEnsureInitialized() {
8149
8632
  "uniffi_bark_ffi_checksum_method_wallet_properties"
8150
8633
  );
8151
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
+ }
8152
8651
  if (
8153
8652
  nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_refresh_server() !==
8154
8653
  41162
@@ -8173,6 +8672,14 @@ function uniffiEnsureInitialized() {
8173
8672
  "uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_delegated"
8174
8673
  );
8175
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
+ }
8176
8683
  if (
8177
8684
  nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_run_daemon() !==
8178
8685
  9520
@@ -8300,6 +8807,14 @@ function uniffiEnsureInitialized() {
8300
8807
  "uniffi_bark_ffi_checksum_method_wallet_validate_arkoor_address"
8301
8808
  );
8302
8809
  }
8810
+ if (
8811
+ nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_vtxo_encoded() !==
8812
+ 25637
8813
+ ) {
8814
+ throw new UniffiInternalError.ApiChecksumMismatch(
8815
+ "uniffi_bark_ffi_checksum_method_wallet_vtxo_encoded"
8816
+ );
8817
+ }
8303
8818
  if (
8304
8819
  nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_vtxos() !== 33207
8305
8820
  ) {
@@ -8367,6 +8882,8 @@ export default Object.freeze({
8367
8882
  FfiConverterTypeOnchainWallet,
8368
8883
  FfiConverterTypeOutPoint,
8369
8884
  FfiConverterTypePendingBoard,
8885
+ FfiConverterTypeRecoveryBucket,
8886
+ FfiConverterTypeRecoveryReport,
8370
8887
  FfiConverterTypeRoundState,
8371
8888
  FfiConverterTypeVtxo,
8372
8889
  FfiConverterTypeWallet,