@secondts/bark-react-native 0.22.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,5 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import { type UniffiGcObject, type UniffiHandle, FfiConverterObject, FfiConverterObjectWithCallbacks, RustBuffer, UniffiAbstractObject, destructorGuardSymbol, pointerLiteralSymbol, uniffiTypeNameSymbol, variantOrdinalSymbol } from "uniffi-bindgen-react-native";
3
+ /**
4
+ * Default for `Config.vtxo_key_gap_limit`: the run of consecutive unused
5
+ * seed-derived VTXO key indices a scan crosses before concluding a VTXO
6
+ * isn't ours.
7
+ */
8
+ export declare function defaultVtxoKeyGapLimit(): number;
3
9
  /**
4
10
  * Extract a signed transaction from a PSBT
5
11
  *
@@ -19,6 +25,12 @@ export declare function extractTxFromPsbt(psbtBase64: string): string;
19
25
  * Generate a new 12-word BIP39 mnemonic
20
26
  */
21
27
  export declare function generateMnemonic(): string;
28
+ /**
29
+ * Largest value `Config.vtxo_key_gap_limit` (or an import/recovery
30
+ * `gap_limit` override) accepts. A scan that matches nothing runs the limit
31
+ * to its end, so an unbounded limit is unbounded work.
32
+ */
33
+ export declare function maxVtxoKeyGapLimit(): number;
22
34
  /**
23
35
  * Validate an Ark address (basic format check only)
24
36
  *
@@ -190,13 +202,27 @@ export type Config = {
190
202
  daemonManualSync?: boolean;
191
203
  lightningReceiveClaimRetries?: number;
192
204
  userAgent?: string;
205
+ /**
206
+ * How many consecutive unused seed-derived VTXO key indices a scan
207
+ * crosses before concluding a VTXO isn't ours.
208
+ *
209
+ * Used by `Wallet::recover_vtxos` and `Wallet::import_vtxo(s)`, and by
210
+ * the seed-recovery scan that runs at wallet creation. Every match
211
+ * extends the window, so this bounds the run of unused indices, not the
212
+ * total keys derived. Raise it for a wallet that handed out many
213
+ * addresses without receiving into them.
214
+ *
215
+ * Default: 250. Capped at 100_000; a higher value is rejected when the
216
+ * wallet is opened or created.
217
+ */
218
+ vtxoKeyGapLimit?: number;
193
219
  };
194
220
  /**
195
221
  * Generated factory for {@link Config} record objects.
196
222
  */
197
223
  export declare const Config: Readonly<{
198
- create: (partial: Partial<Config> & Required<Omit<Config, "serverAccessToken" | "esploraAddress" | "bitcoindAddress" | "bitcoindCookiefile" | "bitcoindUser" | "bitcoindPass" | "vtxoRefreshExpiryThreshold" | "vtxoExitMargin" | "htlcRecvClaimDelta" | "fallbackFeeRate" | "roundTxRequiredConfirmations" | "daemonSyncIntervalSecs" | "offboardRequiredConfirmations" | "daemonManualSync" | "lightningReceiveClaimRetries" | "userAgent">>) => Config;
199
- new: (partial: Partial<Config> & Required<Omit<Config, "serverAccessToken" | "esploraAddress" | "bitcoindAddress" | "bitcoindCookiefile" | "bitcoindUser" | "bitcoindPass" | "vtxoRefreshExpiryThreshold" | "vtxoExitMargin" | "htlcRecvClaimDelta" | "fallbackFeeRate" | "roundTxRequiredConfirmations" | "daemonSyncIntervalSecs" | "offboardRequiredConfirmations" | "daemonManualSync" | "lightningReceiveClaimRetries" | "userAgent">>) => Config;
224
+ create: (partial: Partial<Config> & Required<Omit<Config, "serverAccessToken" | "esploraAddress" | "bitcoindAddress" | "bitcoindCookiefile" | "bitcoindUser" | "bitcoindPass" | "vtxoRefreshExpiryThreshold" | "vtxoExitMargin" | "htlcRecvClaimDelta" | "fallbackFeeRate" | "roundTxRequiredConfirmations" | "daemonSyncIntervalSecs" | "offboardRequiredConfirmations" | "daemonManualSync" | "lightningReceiveClaimRetries" | "userAgent" | "vtxoKeyGapLimit">>) => Config;
225
+ new: (partial: Partial<Config> & Required<Omit<Config, "serverAccessToken" | "esploraAddress" | "bitcoindAddress" | "bitcoindCookiefile" | "bitcoindUser" | "bitcoindPass" | "vtxoRefreshExpiryThreshold" | "vtxoExitMargin" | "htlcRecvClaimDelta" | "fallbackFeeRate" | "roundTxRequiredConfirmations" | "daemonSyncIntervalSecs" | "offboardRequiredConfirmations" | "daemonManualSync" | "lightningReceiveClaimRetries" | "userAgent" | "vtxoKeyGapLimit">>) => Config;
200
226
  defaults: () => Partial<Config>;
201
227
  }>;
202
228
  /**
@@ -436,6 +462,44 @@ export declare const FeeSchedule: Readonly<{
436
462
  new: (partial: Partial<FeeSchedule> & Required<Omit<FeeSchedule, never>>) => FeeSchedule;
437
463
  defaults: () => Partial<FeeSchedule>;
438
464
  }>;
465
+ /**
466
+ * Arguments for `Wallet::import_vtxo` / `Wallet::import_vtxos`, mirroring
467
+ * `bark::ImportVtxoArgs`.
468
+ *
469
+ * Every field has a default, so callers only set what they need.
470
+ */
471
+ export type ImportVtxoArgs = {
472
+ /**
473
+ * Gap limit for the key scan that decides whether we own the VTXOs,
474
+ * overriding `Config.vtxo_key_gap_limit` for this call.
475
+ *
476
+ * Default: none (use the wallet's configured limit)
477
+ */
478
+ gapLimit?: number;
479
+ /**
480
+ * Import as spendable without asking the server for each VTXO's state.
481
+ * Skipping the check is faster but can leave the wallet holding spent
482
+ * VTXOs marked spendable, which then fail when selected as inputs.
483
+ *
484
+ * Default: false
485
+ */
486
+ skipStatusCheck: boolean;
487
+ /**
488
+ * Keep the VTXOs that import successfully even when another one in the
489
+ * batch fails; the returned ids are the ones that were kept.
490
+ *
491
+ * Default: false, so a single failure discards the whole batch.
492
+ */
493
+ allowPartial: boolean;
494
+ };
495
+ /**
496
+ * Generated factory for {@link ImportVtxoArgs} record objects.
497
+ */
498
+ export declare const ImportVtxoArgs: Readonly<{
499
+ create: (partial: Partial<ImportVtxoArgs> & Required<Omit<ImportVtxoArgs, "gapLimit" | "skipStatusCheck" | "allowPartial">>) => ImportVtxoArgs;
500
+ new: (partial: Partial<ImportVtxoArgs> & Required<Omit<ImportVtxoArgs, "gapLimit" | "skipStatusCheck" | "allowPartial">>) => ImportVtxoArgs;
501
+ defaults: () => Partial<ImportVtxoArgs>;
502
+ }>;
439
503
  export type LightningInvoice = {
440
504
  invoice: string;
441
505
  paymentHash: string;
@@ -706,11 +770,12 @@ export type RecoveryReport = {
706
770
  */
707
771
  skipped: RecoveryBucket;
708
772
  /**
709
- * No matching key could be derived within the gap limit (50 consecutive
710
- * unused indices). For a mailbox scan these are most likely this wallet's
773
+ * No matching key could be derived within the gap limit (the configured
774
+ * run of consecutive unused key indices, 250 by default). For a mailbox scan these are most likely this wallet's
711
775
  * own VTXOs, keyed beyond the limit, so funds may be missing; retrying
712
- * won't help, only a wider gap limit. For `recover_vtxos` it just means
713
- * the caller passed an id this wallet doesn't own.
776
+ * won't help, only a wider gap limit (see `Config.vtxo_key_gap_limit` and
777
+ * the `gap_limit` override on `recover_vtxos`). For `recover_vtxos` it
778
+ * just means the caller passed an id this wallet doesn't own.
714
779
  */
715
780
  foreign: RecoveryBucket;
716
781
  /**
@@ -756,16 +821,26 @@ export declare const RefreshFees: Readonly<{
756
821
  export type RoundState = {
757
822
  id: number;
758
823
  /**
759
- * Whether the round is ongoing
824
+ * Whether the interactive part of the round is ongoing. Equivalent to
825
+ * `state` being `Pending` or `Ongoing`; kept for compatibility.
760
826
  */
761
827
  ongoing: boolean;
828
+ /**
829
+ * Lifecycle phase of the participation.
830
+ */
831
+ state: RoundFlowKind;
832
+ /**
833
+ * Block height a delegated participation waits for, if it asked the
834
+ * server to schedule one. Only set while `state` is `DelegatedPending`.
835
+ */
836
+ scheduledHeight?: number;
762
837
  };
763
838
  /**
764
839
  * Generated factory for {@link RoundState} record objects.
765
840
  */
766
841
  export declare const RoundState: Readonly<{
767
- create: (partial: Partial<RoundState> & Required<Omit<RoundState, never>>) => RoundState;
768
- new: (partial: Partial<RoundState> & Required<Omit<RoundState, never>>) => RoundState;
842
+ create: (partial: Partial<RoundState> & Required<Omit<RoundState, "scheduledHeight">>) => RoundState;
843
+ new: (partial: Partial<RoundState> & Required<Omit<RoundState, "scheduledHeight">>) => RoundState;
769
844
  defaults: () => Partial<RoundState>;
770
845
  }>;
771
846
  export type Vtxo = {
@@ -840,7 +915,7 @@ export type WalletOpenArgs = {
840
915
  * Whether to skip the seed-recovery mailbox scan
841
916
  *
842
917
  * The scan runs on the open that creates the wallet locally and makes
843
- * network calls; its result is available from `Wallet::recovery_report`.
918
+ * network calls; its outcome is available from `Wallet::recovery_status`.
844
919
  * Set this to open without it.
845
920
  *
846
921
  * Default: false
@@ -2108,6 +2183,178 @@ export declare const OnchainUtxo: Readonly<{
2108
2183
  * An onchain UTXO known to the wallet, mirroring `bark::onchain::Utxo`.
2109
2184
  */
2110
2185
  export type OnchainUtxo = InstanceType<(typeof OnchainUtxo)[keyof Omit<typeof OnchainUtxo, "instanceOf">]>;
2186
+ export declare enum RecoveryStatus_Tags {
2187
+ NotRun = "NotRun",
2188
+ Failed = "Failed",
2189
+ Completed = "Completed"
2190
+ }
2191
+ /**
2192
+ * Outcome of the seed-recovery scan `Wallet::open` runs, mirroring
2193
+ * `bark::RecoveryStatus`.
2194
+ *
2195
+ * The three variants are distinguishable on purpose: `NotRun` means nothing
2196
+ * was attempted (wallet already existed locally, or `skip_recovery` was set),
2197
+ * `Failed` means the scan errored before producing a report so funds may be
2198
+ * missing until a retry succeeds, and `Completed` carries the report — whose
2199
+ * `is_complete` can still be `false` for individual VTXOs.
2200
+ *
2201
+ * Serde/TS tags: `"not-run"` | `"failed"` | `"completed"`.
2202
+ */
2203
+ export declare const RecoveryStatus: Readonly<{
2204
+ instanceOf: (obj: any) => obj is RecoveryStatus;
2205
+ NotRun: {
2206
+ new (): {
2207
+ readonly tag: RecoveryStatus_Tags.NotRun;
2208
+ /**
2209
+ * @private
2210
+ * This field is private and should not be used, use `tag` instead.
2211
+ */
2212
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2213
+ };
2214
+ new(): {
2215
+ readonly tag: RecoveryStatus_Tags.NotRun;
2216
+ /**
2217
+ * @private
2218
+ * This field is private and should not be used, use `tag` instead.
2219
+ */
2220
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2221
+ };
2222
+ instanceOf(obj: any): obj is {
2223
+ readonly tag: RecoveryStatus_Tags.NotRun;
2224
+ /**
2225
+ * @private
2226
+ * This field is private and should not be used, use `tag` instead.
2227
+ */
2228
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2229
+ };
2230
+ };
2231
+ Failed: {
2232
+ new (inner: {
2233
+ message: string;
2234
+ }): {
2235
+ readonly tag: RecoveryStatus_Tags.Failed;
2236
+ readonly inner: Readonly<{
2237
+ message: string;
2238
+ }>;
2239
+ /**
2240
+ * @private
2241
+ * This field is private and should not be used, use `tag` instead.
2242
+ */
2243
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2244
+ };
2245
+ new(inner: {
2246
+ message: string;
2247
+ }): {
2248
+ readonly tag: RecoveryStatus_Tags.Failed;
2249
+ readonly inner: Readonly<{
2250
+ message: string;
2251
+ }>;
2252
+ /**
2253
+ * @private
2254
+ * This field is private and should not be used, use `tag` instead.
2255
+ */
2256
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2257
+ };
2258
+ instanceOf(obj: any): obj is {
2259
+ readonly tag: RecoveryStatus_Tags.Failed;
2260
+ readonly inner: Readonly<{
2261
+ message: string;
2262
+ }>;
2263
+ /**
2264
+ * @private
2265
+ * This field is private and should not be used, use `tag` instead.
2266
+ */
2267
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2268
+ };
2269
+ };
2270
+ Completed: {
2271
+ new (inner: {
2272
+ report: RecoveryReport;
2273
+ }): {
2274
+ readonly tag: RecoveryStatus_Tags.Completed;
2275
+ readonly inner: Readonly<{
2276
+ report: RecoveryReport;
2277
+ }>;
2278
+ /**
2279
+ * @private
2280
+ * This field is private and should not be used, use `tag` instead.
2281
+ */
2282
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2283
+ };
2284
+ new(inner: {
2285
+ report: RecoveryReport;
2286
+ }): {
2287
+ readonly tag: RecoveryStatus_Tags.Completed;
2288
+ readonly inner: Readonly<{
2289
+ report: RecoveryReport;
2290
+ }>;
2291
+ /**
2292
+ * @private
2293
+ * This field is private and should not be used, use `tag` instead.
2294
+ */
2295
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2296
+ };
2297
+ instanceOf(obj: any): obj is {
2298
+ readonly tag: RecoveryStatus_Tags.Completed;
2299
+ readonly inner: Readonly<{
2300
+ report: RecoveryReport;
2301
+ }>;
2302
+ /**
2303
+ * @private
2304
+ * This field is private and should not be used, use `tag` instead.
2305
+ */
2306
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2307
+ };
2308
+ };
2309
+ }>;
2310
+ /**
2311
+ * Outcome of the seed-recovery scan `Wallet::open` runs, mirroring
2312
+ * `bark::RecoveryStatus`.
2313
+ *
2314
+ * The three variants are distinguishable on purpose: `NotRun` means nothing
2315
+ * was attempted (wallet already existed locally, or `skip_recovery` was set),
2316
+ * `Failed` means the scan errored before producing a report so funds may be
2317
+ * missing until a retry succeeds, and `Completed` carries the report — whose
2318
+ * `is_complete` can still be `false` for individual VTXOs.
2319
+ *
2320
+ * Serde/TS tags: `"not-run"` | `"failed"` | `"completed"`.
2321
+ */
2322
+ export type RecoveryStatus = InstanceType<(typeof RecoveryStatus)[keyof Omit<typeof RecoveryStatus, "instanceOf">]>;
2323
+ /**
2324
+ * Lifecycle phase of a round participation, mirroring
2325
+ * `bark::round::RoundFlowKind`.
2326
+ *
2327
+ * Serde/TS tags match upstream's `Display` form: `"delegated-pending"` |
2328
+ * `"pending"` | `"ongoing"` | `"awaiting-confirmations"` | `"failed"` |
2329
+ * `"canceled"`.
2330
+ */
2331
+ export declare enum RoundFlowKind {
2332
+ /**
2333
+ * Delegated participation waiting for its scheduled round. See
2334
+ * [`RoundState::scheduled_height`].
2335
+ */
2336
+ DelegatedPending = 0,
2337
+ /**
2338
+ * Interactive participation waiting for its round.
2339
+ */
2340
+ Pending = 1,
2341
+ /**
2342
+ * The interactive part is being played out with the server.
2343
+ */
2344
+ Ongoing = 2,
2345
+ /**
2346
+ * The round finished; waiting for its funding tx to confirm.
2347
+ */
2348
+ AwaitingConfirmations = 3,
2349
+ /**
2350
+ * The participation failed.
2351
+ */
2352
+ Failed = 4,
2353
+ /**
2354
+ * The user canceled the participation.
2355
+ */
2356
+ Canceled = 5
2357
+ }
2111
2358
  export declare enum VtxoLockHolder_Tags {
2112
2359
  Action = "Action",
2113
2360
  Movement = "Movement"
@@ -2557,6 +2804,18 @@ export interface CustomOnchainWalletCallbacks {
2557
2804
  * * `tx_hex` - Hex-encoded transaction
2558
2805
  */
2559
2806
  registerTx(txHex: string): void;
2807
+ /**
2808
+ * Mark a wallet-known transaction as evicted from the mempool
2809
+ *
2810
+ * Bark calls this when a CPFP it broadcast was RBF-replaced by a competing
2811
+ * party, so the tx's inputs should return to coin selection immediately
2812
+ * instead of waiting for the sync eviction grace period. Only ever called
2813
+ * for a tx that has definitively been superseded on-chain.
2814
+ *
2815
+ * # Arguments
2816
+ * * `txid` - Hex-encoded transaction id
2817
+ */
2818
+ evictTx(txid: string): void;
2560
2819
  /**
2561
2820
  * Create a signed P2A CPFP transaction
2562
2821
  *
@@ -2644,6 +2903,18 @@ export declare class CustomOnchainWalletCallbacksImpl extends UniffiAbstractObje
2644
2903
  * * `tx_hex` - Hex-encoded transaction
2645
2904
  */
2646
2905
  registerTx(txHex: string): void;
2906
+ /**
2907
+ * Mark a wallet-known transaction as evicted from the mempool
2908
+ *
2909
+ * Bark calls this when a CPFP it broadcast was RBF-replaced by a competing
2910
+ * party, so the tx's inputs should return to coin selection immediately
2911
+ * instead of waiting for the sync eviction grace period. Only ever called
2912
+ * for a tx that has definitively been superseded on-chain.
2913
+ *
2914
+ * # Arguments
2915
+ * * `txid` - Hex-encoded transaction id
2916
+ */
2917
+ evictTx(txid: string): void;
2647
2918
  /**
2648
2919
  * Create a signed P2A CPFP transaction
2649
2920
  *
@@ -2784,6 +3055,15 @@ export interface OnchainWalletLike {
2784
3055
  balance(asyncOpts_?: {
2785
3056
  signal: AbortSignal;
2786
3057
  }): Promise<OnchainBalance>;
3058
+ /**
3059
+ * Mark a wallet-known transaction as evicted from the mempool, so its
3060
+ * inputs return to coin selection immediately. Only for a tx that has
3061
+ * definitively been superseded on-chain (e.g. an RBF-replaced exit CPFP);
3062
+ * evicting a still-in-flight tx invites a self-inflicted double-spend.
3063
+ */
3064
+ evictTx(txid: string, asyncOpts_?: {
3065
+ signal: AbortSignal;
3066
+ }): Promise<void>;
2787
3067
  /**
2788
3068
  * Cached network fee-rate estimates from the wallet's chain source.
2789
3069
  */
@@ -2857,6 +3137,15 @@ export declare class OnchainWallet extends UniffiAbstractObject implements Oncha
2857
3137
  balance(asyncOpts_?: {
2858
3138
  signal: AbortSignal;
2859
3139
  }): Promise<OnchainBalance>;
3140
+ /**
3141
+ * Mark a wallet-known transaction as evicted from the mempool, so its
3142
+ * inputs return to coin selection immediately. Only for a tx that has
3143
+ * definitively been superseded on-chain (e.g. an RBF-replaced exit CPFP);
3144
+ * evicting a still-in-flight tx invites a self-inflicted double-spend.
3145
+ */
3146
+ evictTx(txid: string, asyncOpts_?: {
3147
+ signal: AbortSignal;
3148
+ }): Promise<void>;
2860
3149
  /**
2861
3150
  * Cached network fee-rate estimates from the wallet's chain source.
2862
3151
  */
@@ -3074,13 +3363,30 @@ export interface WalletLike {
3074
3363
  /**
3075
3364
  * Import a VTXO from its serialized form (hex or base64).
3076
3365
  *
3077
- * The parameter keeps its historical `vtxo_base64` name for foreign
3366
+ * The VTXO is stored in the state the server reports for it, so one that
3367
+ * was already spent is recorded as spent rather than refused. Pass `args`
3368
+ * to widen the key-scan gap limit, skip the server status check, or allow
3369
+ * partial success; omit it for the defaults.
3370
+ *
3371
+ * The first parameter keeps its historical `vtxo_base64` name for foreign
3078
3372
  * binding compatibility (uniffi exposes parameter names), but hex as
3079
3373
  * returned by [`Wallet::vtxo_encoded`] is accepted too.
3080
3374
  */
3081
- importVtxo(vtxoBase64: string, asyncOpts_?: {
3375
+ importVtxo(vtxoBase64: string, args: ImportVtxoArgs | undefined, asyncOpts_?: {
3082
3376
  signal: AbortSignal;
3083
3377
  }): Promise<void>;
3378
+ /**
3379
+ * Import several VTXOs (hex or base64) under a single key scan and a
3380
+ * single write, which is why this is not just a loop over `import_vtxo`.
3381
+ *
3382
+ * Returns the ids now held — whether this call stored them or found them
3383
+ * already present — so a failed batch can be retried. One VTXO that cannot
3384
+ * be imported discards the whole batch unless `args.allow_partial` is set,
3385
+ * in which case the ones that did import are kept.
3386
+ */
3387
+ importVtxos(encodedVtxos: Array<string>, args: ImportVtxoArgs | undefined, asyncOpts_?: {
3388
+ signal: AbortSignal;
3389
+ }): Promise<Array<string>>;
3084
3390
  isInvoicePaid(paymentHash: string, asyncOpts_?: {
3085
3391
  signal: AbortSignal;
3086
3392
  }): Promise<boolean>;
@@ -3191,22 +3497,32 @@ export interface WalletLike {
3191
3497
  * Recover the given VTXO ids from the server, importing the ones this
3192
3498
  * wallet owns that are still spendable. Use it to retry ids a previous
3193
3499
  * scan reported as `failed`.
3500
+ *
3501
+ * `gap_limit` overrides `Config.vtxo_key_gap_limit` for the key scan that
3502
+ * decides which of `vtxo_ids` this wallet owns. Widen it to reach ids a
3503
+ * previous scan bucketed as `foreign`.
3194
3504
  */
3195
- recoverVtxos(vtxoIds: Array<string>, asyncOpts_?: {
3505
+ recoverVtxos(vtxoIds: Array<string>, gapLimit: /*u32*/ number | undefined, asyncOpts_?: {
3196
3506
  signal: AbortSignal;
3197
3507
  }): Promise<RecoveryReport>;
3198
3508
  /**
3199
- * Result of the seed-recovery scan that ran during `Wallet::open`, or none
3200
- * if no report was produced.
3509
+ * The report of the seed-recovery scan that ran during `Wallet::open`, or
3510
+ * none if the scan did not complete. Use `recovery_status` to tell a scan
3511
+ * that failed apart from one that never ran.
3512
+ */
3513
+ recoveryReport(): RecoveryReport | undefined;
3514
+ /**
3515
+ * Outcome of the seed-recovery scan that ran during `Wallet::open`.
3201
3516
  *
3202
3517
  * Recovery only runs on the open that creates the wallet locally, and not
3203
- * at all when `WalletOpenArgs.skip_recovery` is set, so this is empty on
3204
- * every subsequent open. It is also empty when the scan itself failed
3205
- * outright — bark logs that and lets open succeed, so an empty result does
3206
- * not prove no funds are missing. `isComplete == false` means funds may
3207
- * still be missing; retry the report's `failed` ids with `recoverVtxos`.
3518
+ * at all when `WalletOpenArgs.skip_recovery` is set, so this is `NotRun`
3519
+ * on every subsequent open. `Failed` means the scan errored before
3520
+ * producing a report — bark logs that and lets open succeed — so funds
3521
+ * may be missing until a retry; `Completed` carries the report, and
3522
+ * `isComplete == false` there means funds may still be missing. Retry the
3523
+ * report's `failed` ids with `recoverVtxos`.
3208
3524
  */
3209
- recoveryReport(): RecoveryReport | undefined;
3525
+ recoveryStatus(): RecoveryStatus;
3210
3526
  refreshServer(asyncOpts_?: {
3211
3527
  signal: AbortSignal;
3212
3528
  }): Promise<void>;
@@ -3256,6 +3572,14 @@ export interface WalletLike {
3256
3572
  stopDaemon(asyncOpts_?: {
3257
3573
  signal: AbortSignal;
3258
3574
  }): Promise<void>;
3575
+ /**
3576
+ * Stop the background daemon and wait until its tasks have finished, so
3577
+ * nothing runs in the background afterwards (e.g. before deleting the
3578
+ * wallet's datadir). No-op when no daemon is running.
3579
+ */
3580
+ stopDaemonWait(asyncOpts_?: {
3581
+ signal: AbortSignal;
3582
+ }): Promise<void>;
3259
3583
  stuckFailedLightningSends(asyncOpts_?: {
3260
3584
  signal: AbortSignal;
3261
3585
  }): Promise<Array<LightningSend>>;
@@ -3287,6 +3611,12 @@ export interface WalletLike {
3287
3611
  unlockVtxos(vtxoIds: Array<string>, expectedHolder: VtxoLockHolder | undefined, asyncOpts_?: {
3288
3612
  signal: AbortSignal;
3289
3613
  }): Promise<void>;
3614
+ /**
3615
+ * Whether this wallet can pay `address` out-of-round: same network and
3616
+ * server, a supported VTXO policy, and only delivery mechanisms this bark
3617
+ * supports. An address listing no delivery mechanism is valid. Errors only
3618
+ * when the address does not parse.
3619
+ */
3290
3620
  validateArkoorAddress(address: string, asyncOpts_?: {
3291
3621
  signal: AbortSignal;
3292
3622
  }): Promise<boolean>;
@@ -3488,13 +3818,30 @@ export declare class Wallet extends UniffiAbstractObject implements WalletLike {
3488
3818
  /**
3489
3819
  * Import a VTXO from its serialized form (hex or base64).
3490
3820
  *
3491
- * The parameter keeps its historical `vtxo_base64` name for foreign
3821
+ * The VTXO is stored in the state the server reports for it, so one that
3822
+ * was already spent is recorded as spent rather than refused. Pass `args`
3823
+ * to widen the key-scan gap limit, skip the server status check, or allow
3824
+ * partial success; omit it for the defaults.
3825
+ *
3826
+ * The first parameter keeps its historical `vtxo_base64` name for foreign
3492
3827
  * binding compatibility (uniffi exposes parameter names), but hex as
3493
3828
  * returned by [`Wallet::vtxo_encoded`] is accepted too.
3494
3829
  */
3495
- importVtxo(vtxoBase64: string, asyncOpts_?: {
3830
+ importVtxo(vtxoBase64: string, args?: ImportVtxoArgs | undefined, asyncOpts_?: {
3496
3831
  signal: AbortSignal;
3497
3832
  }): Promise<void>;
3833
+ /**
3834
+ * Import several VTXOs (hex or base64) under a single key scan and a
3835
+ * single write, which is why this is not just a loop over `import_vtxo`.
3836
+ *
3837
+ * Returns the ids now held — whether this call stored them or found them
3838
+ * already present — so a failed batch can be retried. One VTXO that cannot
3839
+ * be imported discards the whole batch unless `args.allow_partial` is set,
3840
+ * in which case the ones that did import are kept.
3841
+ */
3842
+ importVtxos(encodedVtxos: Array<string>, args?: ImportVtxoArgs | undefined, asyncOpts_?: {
3843
+ signal: AbortSignal;
3844
+ }): Promise<Array<string>>;
3498
3845
  isInvoicePaid(paymentHash: string, asyncOpts_?: {
3499
3846
  signal: AbortSignal;
3500
3847
  }): Promise<boolean>;
@@ -3605,22 +3952,32 @@ export declare class Wallet extends UniffiAbstractObject implements WalletLike {
3605
3952
  * Recover the given VTXO ids from the server, importing the ones this
3606
3953
  * wallet owns that are still spendable. Use it to retry ids a previous
3607
3954
  * scan reported as `failed`.
3955
+ *
3956
+ * `gap_limit` overrides `Config.vtxo_key_gap_limit` for the key scan that
3957
+ * decides which of `vtxo_ids` this wallet owns. Widen it to reach ids a
3958
+ * previous scan bucketed as `foreign`.
3608
3959
  */
3609
- recoverVtxos(vtxoIds: Array<string>, asyncOpts_?: {
3960
+ recoverVtxos(vtxoIds: Array<string>, gapLimit?: /*u32*/ number | undefined, asyncOpts_?: {
3610
3961
  signal: AbortSignal;
3611
3962
  }): Promise<RecoveryReport>;
3612
3963
  /**
3613
- * Result of the seed-recovery scan that ran during `Wallet::open`, or none
3614
- * if no report was produced.
3964
+ * The report of the seed-recovery scan that ran during `Wallet::open`, or
3965
+ * none if the scan did not complete. Use `recovery_status` to tell a scan
3966
+ * that failed apart from one that never ran.
3967
+ */
3968
+ recoveryReport(): RecoveryReport | undefined;
3969
+ /**
3970
+ * Outcome of the seed-recovery scan that ran during `Wallet::open`.
3615
3971
  *
3616
3972
  * Recovery only runs on the open that creates the wallet locally, and not
3617
- * at all when `WalletOpenArgs.skip_recovery` is set, so this is empty on
3618
- * every subsequent open. It is also empty when the scan itself failed
3619
- * outright — bark logs that and lets open succeed, so an empty result does
3620
- * not prove no funds are missing. `isComplete == false` means funds may
3621
- * still be missing; retry the report's `failed` ids with `recoverVtxos`.
3973
+ * at all when `WalletOpenArgs.skip_recovery` is set, so this is `NotRun`
3974
+ * on every subsequent open. `Failed` means the scan errored before
3975
+ * producing a report — bark logs that and lets open succeed — so funds
3976
+ * may be missing until a retry; `Completed` carries the report, and
3977
+ * `isComplete == false` there means funds may still be missing. Retry the
3978
+ * report's `failed` ids with `recoverVtxos`.
3622
3979
  */
3623
- recoveryReport(): RecoveryReport | undefined;
3980
+ recoveryStatus(): RecoveryStatus;
3624
3981
  refreshServer(asyncOpts_?: {
3625
3982
  signal: AbortSignal;
3626
3983
  }): Promise<void>;
@@ -3670,6 +4027,14 @@ export declare class Wallet extends UniffiAbstractObject implements WalletLike {
3670
4027
  stopDaemon(asyncOpts_?: {
3671
4028
  signal: AbortSignal;
3672
4029
  }): Promise<void>;
4030
+ /**
4031
+ * Stop the background daemon and wait until its tasks have finished, so
4032
+ * nothing runs in the background afterwards (e.g. before deleting the
4033
+ * wallet's datadir). No-op when no daemon is running.
4034
+ */
4035
+ stopDaemonWait(asyncOpts_?: {
4036
+ signal: AbortSignal;
4037
+ }): Promise<void>;
3673
4038
  stuckFailedLightningSends(asyncOpts_?: {
3674
4039
  signal: AbortSignal;
3675
4040
  }): Promise<Array<LightningSend>>;
@@ -3701,6 +4066,12 @@ export declare class Wallet extends UniffiAbstractObject implements WalletLike {
3701
4066
  unlockVtxos(vtxoIds: Array<string>, expectedHolder: VtxoLockHolder | undefined, asyncOpts_?: {
3702
4067
  signal: AbortSignal;
3703
4068
  }): Promise<void>;
4069
+ /**
4070
+ * Whether this wallet can pay `address` out-of-round: same network and
4071
+ * server, a supported VTXO policy, and only delivery mechanisms this bark
4072
+ * supports. An address listing no delivery mechanism is valid. Errors only
4073
+ * when the address does not parse.
4074
+ */
3704
4075
  validateArkoorAddress(address: string, asyncOpts_?: {
3705
4076
  signal: AbortSignal;
3706
4077
  }): Promise<boolean>;
@@ -3992,6 +4363,13 @@ declare const _default: Readonly<{
3992
4363
  lift(value: Uint8Array): FeeSchedule;
3993
4364
  lower(value: FeeSchedule): Uint8Array;
3994
4365
  };
4366
+ FfiConverterTypeImportVtxoArgs: {
4367
+ read(from: RustBuffer): ImportVtxoArgs;
4368
+ write(value: ImportVtxoArgs, into: RustBuffer): void;
4369
+ allocationSize(value: ImportVtxoArgs): number;
4370
+ lift(value: Uint8Array): ImportVtxoArgs;
4371
+ lower(value: ImportVtxoArgs): Uint8Array;
4372
+ };
3995
4373
  FfiConverterTypeLightningInvoice: {
3996
4374
  read(from: RustBuffer): LightningInvoice;
3997
4375
  write(value: LightningInvoice, into: RustBuffer): void;
@@ -4120,6 +4498,13 @@ declare const _default: Readonly<{
4120
4498
  lift(value: Uint8Array): RecoveryReport;
4121
4499
  lower(value: RecoveryReport): Uint8Array;
4122
4500
  };
4501
+ FfiConverterTypeRecoveryStatus: {
4502
+ read(from: RustBuffer): RecoveryStatus;
4503
+ write(value: RecoveryStatus, into: RustBuffer): void;
4504
+ allocationSize(value: RecoveryStatus): number;
4505
+ lift(value: Uint8Array): RecoveryStatus;
4506
+ lower(value: RecoveryStatus): Uint8Array;
4507
+ };
4123
4508
  FfiConverterTypeRefreshFees: {
4124
4509
  read(from: RustBuffer): RefreshFees;
4125
4510
  write(value: RefreshFees, into: RustBuffer): void;
@@ -4127,6 +4512,13 @@ declare const _default: Readonly<{
4127
4512
  lift(value: Uint8Array): RefreshFees;
4128
4513
  lower(value: RefreshFees): Uint8Array;
4129
4514
  };
4515
+ FfiConverterTypeRoundFlowKind: {
4516
+ read(from: RustBuffer): RoundFlowKind;
4517
+ write(value: RoundFlowKind, into: RustBuffer): void;
4518
+ allocationSize(value: RoundFlowKind): number;
4519
+ lift(value: Uint8Array): RoundFlowKind;
4520
+ lower(value: RoundFlowKind): Uint8Array;
4521
+ };
4130
4522
  FfiConverterTypeRoundState: {
4131
4523
  read(from: RustBuffer): RoundState;
4132
4524
  write(value: RoundState, into: RustBuffer): void;