@secondts/bark-react-native 0.22.0 → 0.23.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.
@@ -756,16 +756,26 @@ export declare const RefreshFees: Readonly<{
756
756
  export type RoundState = {
757
757
  id: number;
758
758
  /**
759
- * Whether the round is ongoing
759
+ * Whether the interactive part of the round is ongoing. Equivalent to
760
+ * `state` being `Pending` or `Ongoing`; kept for compatibility.
760
761
  */
761
762
  ongoing: boolean;
763
+ /**
764
+ * Lifecycle phase of the participation.
765
+ */
766
+ state: RoundFlowKind;
767
+ /**
768
+ * Block height a delegated participation waits for, if it asked the
769
+ * server to schedule one. Only set while `state` is `DelegatedPending`.
770
+ */
771
+ scheduledHeight?: number;
762
772
  };
763
773
  /**
764
774
  * Generated factory for {@link RoundState} record objects.
765
775
  */
766
776
  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;
777
+ create: (partial: Partial<RoundState> & Required<Omit<RoundState, "scheduledHeight">>) => RoundState;
778
+ new: (partial: Partial<RoundState> & Required<Omit<RoundState, "scheduledHeight">>) => RoundState;
769
779
  defaults: () => Partial<RoundState>;
770
780
  }>;
771
781
  export type Vtxo = {
@@ -840,7 +850,7 @@ export type WalletOpenArgs = {
840
850
  * Whether to skip the seed-recovery mailbox scan
841
851
  *
842
852
  * The scan runs on the open that creates the wallet locally and makes
843
- * network calls; its result is available from `Wallet::recovery_report`.
853
+ * network calls; its outcome is available from `Wallet::recovery_status`.
844
854
  * Set this to open without it.
845
855
  *
846
856
  * Default: false
@@ -2108,6 +2118,178 @@ export declare const OnchainUtxo: Readonly<{
2108
2118
  * An onchain UTXO known to the wallet, mirroring `bark::onchain::Utxo`.
2109
2119
  */
2110
2120
  export type OnchainUtxo = InstanceType<(typeof OnchainUtxo)[keyof Omit<typeof OnchainUtxo, "instanceOf">]>;
2121
+ export declare enum RecoveryStatus_Tags {
2122
+ NotRun = "NotRun",
2123
+ Failed = "Failed",
2124
+ Completed = "Completed"
2125
+ }
2126
+ /**
2127
+ * Outcome of the seed-recovery scan `Wallet::open` runs, mirroring
2128
+ * `bark::RecoveryStatus`.
2129
+ *
2130
+ * The three variants are distinguishable on purpose: `NotRun` means nothing
2131
+ * was attempted (wallet already existed locally, or `skip_recovery` was set),
2132
+ * `Failed` means the scan errored before producing a report so funds may be
2133
+ * missing until a retry succeeds, and `Completed` carries the report — whose
2134
+ * `is_complete` can still be `false` for individual VTXOs.
2135
+ *
2136
+ * Serde/TS tags: `"not-run"` | `"failed"` | `"completed"`.
2137
+ */
2138
+ export declare const RecoveryStatus: Readonly<{
2139
+ instanceOf: (obj: any) => obj is RecoveryStatus;
2140
+ NotRun: {
2141
+ new (): {
2142
+ readonly tag: RecoveryStatus_Tags.NotRun;
2143
+ /**
2144
+ * @private
2145
+ * This field is private and should not be used, use `tag` instead.
2146
+ */
2147
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2148
+ };
2149
+ new(): {
2150
+ readonly tag: RecoveryStatus_Tags.NotRun;
2151
+ /**
2152
+ * @private
2153
+ * This field is private and should not be used, use `tag` instead.
2154
+ */
2155
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2156
+ };
2157
+ instanceOf(obj: any): obj is {
2158
+ readonly tag: RecoveryStatus_Tags.NotRun;
2159
+ /**
2160
+ * @private
2161
+ * This field is private and should not be used, use `tag` instead.
2162
+ */
2163
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2164
+ };
2165
+ };
2166
+ Failed: {
2167
+ new (inner: {
2168
+ message: string;
2169
+ }): {
2170
+ readonly tag: RecoveryStatus_Tags.Failed;
2171
+ readonly inner: Readonly<{
2172
+ message: string;
2173
+ }>;
2174
+ /**
2175
+ * @private
2176
+ * This field is private and should not be used, use `tag` instead.
2177
+ */
2178
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2179
+ };
2180
+ new(inner: {
2181
+ message: string;
2182
+ }): {
2183
+ readonly tag: RecoveryStatus_Tags.Failed;
2184
+ readonly inner: Readonly<{
2185
+ message: string;
2186
+ }>;
2187
+ /**
2188
+ * @private
2189
+ * This field is private and should not be used, use `tag` instead.
2190
+ */
2191
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2192
+ };
2193
+ instanceOf(obj: any): obj is {
2194
+ readonly tag: RecoveryStatus_Tags.Failed;
2195
+ readonly inner: Readonly<{
2196
+ message: string;
2197
+ }>;
2198
+ /**
2199
+ * @private
2200
+ * This field is private and should not be used, use `tag` instead.
2201
+ */
2202
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2203
+ };
2204
+ };
2205
+ Completed: {
2206
+ new (inner: {
2207
+ report: RecoveryReport;
2208
+ }): {
2209
+ readonly tag: RecoveryStatus_Tags.Completed;
2210
+ readonly inner: Readonly<{
2211
+ report: RecoveryReport;
2212
+ }>;
2213
+ /**
2214
+ * @private
2215
+ * This field is private and should not be used, use `tag` instead.
2216
+ */
2217
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2218
+ };
2219
+ new(inner: {
2220
+ report: RecoveryReport;
2221
+ }): {
2222
+ readonly tag: RecoveryStatus_Tags.Completed;
2223
+ readonly inner: Readonly<{
2224
+ report: RecoveryReport;
2225
+ }>;
2226
+ /**
2227
+ * @private
2228
+ * This field is private and should not be used, use `tag` instead.
2229
+ */
2230
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2231
+ };
2232
+ instanceOf(obj: any): obj is {
2233
+ readonly tag: RecoveryStatus_Tags.Completed;
2234
+ readonly inner: Readonly<{
2235
+ report: RecoveryReport;
2236
+ }>;
2237
+ /**
2238
+ * @private
2239
+ * This field is private and should not be used, use `tag` instead.
2240
+ */
2241
+ readonly [uniffiTypeNameSymbol]: "RecoveryStatus";
2242
+ };
2243
+ };
2244
+ }>;
2245
+ /**
2246
+ * Outcome of the seed-recovery scan `Wallet::open` runs, mirroring
2247
+ * `bark::RecoveryStatus`.
2248
+ *
2249
+ * The three variants are distinguishable on purpose: `NotRun` means nothing
2250
+ * was attempted (wallet already existed locally, or `skip_recovery` was set),
2251
+ * `Failed` means the scan errored before producing a report so funds may be
2252
+ * missing until a retry succeeds, and `Completed` carries the report — whose
2253
+ * `is_complete` can still be `false` for individual VTXOs.
2254
+ *
2255
+ * Serde/TS tags: `"not-run"` | `"failed"` | `"completed"`.
2256
+ */
2257
+ export type RecoveryStatus = InstanceType<(typeof RecoveryStatus)[keyof Omit<typeof RecoveryStatus, "instanceOf">]>;
2258
+ /**
2259
+ * Lifecycle phase of a round participation, mirroring
2260
+ * `bark::round::RoundFlowKind`.
2261
+ *
2262
+ * Serde/TS tags match upstream's `Display` form: `"delegated-pending"` |
2263
+ * `"pending"` | `"ongoing"` | `"awaiting-confirmations"` | `"failed"` |
2264
+ * `"canceled"`.
2265
+ */
2266
+ export declare enum RoundFlowKind {
2267
+ /**
2268
+ * Delegated participation waiting for its scheduled round. See
2269
+ * [`RoundState::scheduled_height`].
2270
+ */
2271
+ DelegatedPending = 0,
2272
+ /**
2273
+ * Interactive participation waiting for its round.
2274
+ */
2275
+ Pending = 1,
2276
+ /**
2277
+ * The interactive part is being played out with the server.
2278
+ */
2279
+ Ongoing = 2,
2280
+ /**
2281
+ * The round finished; waiting for its funding tx to confirm.
2282
+ */
2283
+ AwaitingConfirmations = 3,
2284
+ /**
2285
+ * The participation failed.
2286
+ */
2287
+ Failed = 4,
2288
+ /**
2289
+ * The user canceled the participation.
2290
+ */
2291
+ Canceled = 5
2292
+ }
2111
2293
  export declare enum VtxoLockHolder_Tags {
2112
2294
  Action = "Action",
2113
2295
  Movement = "Movement"
@@ -2557,6 +2739,18 @@ export interface CustomOnchainWalletCallbacks {
2557
2739
  * * `tx_hex` - Hex-encoded transaction
2558
2740
  */
2559
2741
  registerTx(txHex: string): void;
2742
+ /**
2743
+ * Mark a wallet-known transaction as evicted from the mempool
2744
+ *
2745
+ * Bark calls this when a CPFP it broadcast was RBF-replaced by a competing
2746
+ * party, so the tx's inputs should return to coin selection immediately
2747
+ * instead of waiting for the sync eviction grace period. Only ever called
2748
+ * for a tx that has definitively been superseded on-chain.
2749
+ *
2750
+ * # Arguments
2751
+ * * `txid` - Hex-encoded transaction id
2752
+ */
2753
+ evictTx(txid: string): void;
2560
2754
  /**
2561
2755
  * Create a signed P2A CPFP transaction
2562
2756
  *
@@ -2644,6 +2838,18 @@ export declare class CustomOnchainWalletCallbacksImpl extends UniffiAbstractObje
2644
2838
  * * `tx_hex` - Hex-encoded transaction
2645
2839
  */
2646
2840
  registerTx(txHex: string): void;
2841
+ /**
2842
+ * Mark a wallet-known transaction as evicted from the mempool
2843
+ *
2844
+ * Bark calls this when a CPFP it broadcast was RBF-replaced by a competing
2845
+ * party, so the tx's inputs should return to coin selection immediately
2846
+ * instead of waiting for the sync eviction grace period. Only ever called
2847
+ * for a tx that has definitively been superseded on-chain.
2848
+ *
2849
+ * # Arguments
2850
+ * * `txid` - Hex-encoded transaction id
2851
+ */
2852
+ evictTx(txid: string): void;
2647
2853
  /**
2648
2854
  * Create a signed P2A CPFP transaction
2649
2855
  *
@@ -2784,6 +2990,15 @@ export interface OnchainWalletLike {
2784
2990
  balance(asyncOpts_?: {
2785
2991
  signal: AbortSignal;
2786
2992
  }): Promise<OnchainBalance>;
2993
+ /**
2994
+ * Mark a wallet-known transaction as evicted from the mempool, so its
2995
+ * inputs return to coin selection immediately. Only for a tx that has
2996
+ * definitively been superseded on-chain (e.g. an RBF-replaced exit CPFP);
2997
+ * evicting a still-in-flight tx invites a self-inflicted double-spend.
2998
+ */
2999
+ evictTx(txid: string, asyncOpts_?: {
3000
+ signal: AbortSignal;
3001
+ }): Promise<void>;
2787
3002
  /**
2788
3003
  * Cached network fee-rate estimates from the wallet's chain source.
2789
3004
  */
@@ -2857,6 +3072,15 @@ export declare class OnchainWallet extends UniffiAbstractObject implements Oncha
2857
3072
  balance(asyncOpts_?: {
2858
3073
  signal: AbortSignal;
2859
3074
  }): Promise<OnchainBalance>;
3075
+ /**
3076
+ * Mark a wallet-known transaction as evicted from the mempool, so its
3077
+ * inputs return to coin selection immediately. Only for a tx that has
3078
+ * definitively been superseded on-chain (e.g. an RBF-replaced exit CPFP);
3079
+ * evicting a still-in-flight tx invites a self-inflicted double-spend.
3080
+ */
3081
+ evictTx(txid: string, asyncOpts_?: {
3082
+ signal: AbortSignal;
3083
+ }): Promise<void>;
2860
3084
  /**
2861
3085
  * Cached network fee-rate estimates from the wallet's chain source.
2862
3086
  */
@@ -3196,17 +3420,23 @@ export interface WalletLike {
3196
3420
  signal: AbortSignal;
3197
3421
  }): Promise<RecoveryReport>;
3198
3422
  /**
3199
- * Result of the seed-recovery scan that ran during `Wallet::open`, or none
3200
- * if no report was produced.
3423
+ * The report of the seed-recovery scan that ran during `Wallet::open`, or
3424
+ * none if the scan did not complete. Use `recovery_status` to tell a scan
3425
+ * that failed apart from one that never ran.
3426
+ */
3427
+ recoveryReport(): RecoveryReport | undefined;
3428
+ /**
3429
+ * Outcome of the seed-recovery scan that ran during `Wallet::open`.
3201
3430
  *
3202
3431
  * 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`.
3432
+ * at all when `WalletOpenArgs.skip_recovery` is set, so this is `NotRun`
3433
+ * on every subsequent open. `Failed` means the scan errored before
3434
+ * producing a report — bark logs that and lets open succeed — so funds
3435
+ * may be missing until a retry; `Completed` carries the report, and
3436
+ * `isComplete == false` there means funds may still be missing. Retry the
3437
+ * report's `failed` ids with `recoverVtxos`.
3208
3438
  */
3209
- recoveryReport(): RecoveryReport | undefined;
3439
+ recoveryStatus(): RecoveryStatus;
3210
3440
  refreshServer(asyncOpts_?: {
3211
3441
  signal: AbortSignal;
3212
3442
  }): Promise<void>;
@@ -3256,6 +3486,14 @@ export interface WalletLike {
3256
3486
  stopDaemon(asyncOpts_?: {
3257
3487
  signal: AbortSignal;
3258
3488
  }): Promise<void>;
3489
+ /**
3490
+ * Stop the background daemon and wait until its tasks have finished, so
3491
+ * nothing runs in the background afterwards (e.g. before deleting the
3492
+ * wallet's datadir). No-op when no daemon is running.
3493
+ */
3494
+ stopDaemonWait(asyncOpts_?: {
3495
+ signal: AbortSignal;
3496
+ }): Promise<void>;
3259
3497
  stuckFailedLightningSends(asyncOpts_?: {
3260
3498
  signal: AbortSignal;
3261
3499
  }): Promise<Array<LightningSend>>;
@@ -3287,6 +3525,12 @@ export interface WalletLike {
3287
3525
  unlockVtxos(vtxoIds: Array<string>, expectedHolder: VtxoLockHolder | undefined, asyncOpts_?: {
3288
3526
  signal: AbortSignal;
3289
3527
  }): Promise<void>;
3528
+ /**
3529
+ * Whether this wallet can pay `address` out-of-round: same network and
3530
+ * server, a supported VTXO policy, and only delivery mechanisms this bark
3531
+ * supports. An address listing no delivery mechanism is valid. Errors only
3532
+ * when the address does not parse.
3533
+ */
3290
3534
  validateArkoorAddress(address: string, asyncOpts_?: {
3291
3535
  signal: AbortSignal;
3292
3536
  }): Promise<boolean>;
@@ -3610,17 +3854,23 @@ export declare class Wallet extends UniffiAbstractObject implements WalletLike {
3610
3854
  signal: AbortSignal;
3611
3855
  }): Promise<RecoveryReport>;
3612
3856
  /**
3613
- * Result of the seed-recovery scan that ran during `Wallet::open`, or none
3614
- * if no report was produced.
3857
+ * The report of the seed-recovery scan that ran during `Wallet::open`, or
3858
+ * none if the scan did not complete. Use `recovery_status` to tell a scan
3859
+ * that failed apart from one that never ran.
3860
+ */
3861
+ recoveryReport(): RecoveryReport | undefined;
3862
+ /**
3863
+ * Outcome of the seed-recovery scan that ran during `Wallet::open`.
3615
3864
  *
3616
3865
  * 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`.
3866
+ * at all when `WalletOpenArgs.skip_recovery` is set, so this is `NotRun`
3867
+ * on every subsequent open. `Failed` means the scan errored before
3868
+ * producing a report — bark logs that and lets open succeed — so funds
3869
+ * may be missing until a retry; `Completed` carries the report, and
3870
+ * `isComplete == false` there means funds may still be missing. Retry the
3871
+ * report's `failed` ids with `recoverVtxos`.
3622
3872
  */
3623
- recoveryReport(): RecoveryReport | undefined;
3873
+ recoveryStatus(): RecoveryStatus;
3624
3874
  refreshServer(asyncOpts_?: {
3625
3875
  signal: AbortSignal;
3626
3876
  }): Promise<void>;
@@ -3670,6 +3920,14 @@ export declare class Wallet extends UniffiAbstractObject implements WalletLike {
3670
3920
  stopDaemon(asyncOpts_?: {
3671
3921
  signal: AbortSignal;
3672
3922
  }): Promise<void>;
3923
+ /**
3924
+ * Stop the background daemon and wait until its tasks have finished, so
3925
+ * nothing runs in the background afterwards (e.g. before deleting the
3926
+ * wallet's datadir). No-op when no daemon is running.
3927
+ */
3928
+ stopDaemonWait(asyncOpts_?: {
3929
+ signal: AbortSignal;
3930
+ }): Promise<void>;
3673
3931
  stuckFailedLightningSends(asyncOpts_?: {
3674
3932
  signal: AbortSignal;
3675
3933
  }): Promise<Array<LightningSend>>;
@@ -3701,6 +3959,12 @@ export declare class Wallet extends UniffiAbstractObject implements WalletLike {
3701
3959
  unlockVtxos(vtxoIds: Array<string>, expectedHolder: VtxoLockHolder | undefined, asyncOpts_?: {
3702
3960
  signal: AbortSignal;
3703
3961
  }): Promise<void>;
3962
+ /**
3963
+ * Whether this wallet can pay `address` out-of-round: same network and
3964
+ * server, a supported VTXO policy, and only delivery mechanisms this bark
3965
+ * supports. An address listing no delivery mechanism is valid. Errors only
3966
+ * when the address does not parse.
3967
+ */
3704
3968
  validateArkoorAddress(address: string, asyncOpts_?: {
3705
3969
  signal: AbortSignal;
3706
3970
  }): Promise<boolean>;
@@ -4120,6 +4384,13 @@ declare const _default: Readonly<{
4120
4384
  lift(value: Uint8Array): RecoveryReport;
4121
4385
  lower(value: RecoveryReport): Uint8Array;
4122
4386
  };
4387
+ FfiConverterTypeRecoveryStatus: {
4388
+ read(from: RustBuffer): RecoveryStatus;
4389
+ write(value: RecoveryStatus, into: RustBuffer): void;
4390
+ allocationSize(value: RecoveryStatus): number;
4391
+ lift(value: Uint8Array): RecoveryStatus;
4392
+ lower(value: RecoveryStatus): Uint8Array;
4393
+ };
4123
4394
  FfiConverterTypeRefreshFees: {
4124
4395
  read(from: RustBuffer): RefreshFees;
4125
4396
  write(value: RefreshFees, into: RustBuffer): void;
@@ -4127,6 +4398,13 @@ declare const _default: Readonly<{
4127
4398
  lift(value: Uint8Array): RefreshFees;
4128
4399
  lower(value: RefreshFees): Uint8Array;
4129
4400
  };
4401
+ FfiConverterTypeRoundFlowKind: {
4402
+ read(from: RustBuffer): RoundFlowKind;
4403
+ write(value: RoundFlowKind, into: RustBuffer): void;
4404
+ allocationSize(value: RoundFlowKind): number;
4405
+ lift(value: Uint8Array): RoundFlowKind;
4406
+ lower(value: RoundFlowKind): Uint8Array;
4407
+ };
4130
4408
  FfiConverterTypeRoundState: {
4131
4409
  read(from: RustBuffer): RoundState;
4132
4410
  write(value: RoundState, into: RustBuffer): void;