@secondts/bark-react-native 0.5.3 → 0.6.2

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,123 +1,45 @@
1
1
  /// <reference types="node" />
2
- import { type UniffiGcObject, type UniffiHandle, FfiConverterObject, RustBuffer, UniffiAbstractObject, destructorGuardSymbol, pointerLiteralSymbol, uniffiTypeNameSymbol } from "uniffi-bindgen-react-native";
2
+ import { type UniffiGcObject, type UniffiHandle, FfiConverterObject, FfiConverterObjectWithCallbacks, RustBuffer, UniffiAbstractObject, destructorGuardSymbol, pointerLiteralSymbol, uniffiTypeNameSymbol } from "uniffi-bindgen-react-native";
3
+ /**
4
+ * Extract a signed transaction from a PSBT
5
+ *
6
+ * Takes a base64-encoded PSBT and extracts the final signed transaction.
7
+ * This is useful after signing a PSBT (e.g., from drain_exits) before broadcasting.
8
+ *
9
+ * # Arguments
10
+ *
11
+ * * `psbt_base64` - Base64-encoded PSBT string
12
+ *
13
+ * # Returns
14
+ *
15
+ * Hex-encoded signed transaction ready for broadcasting
16
+ */
3
17
  export declare function extractTxFromPsbt(psbtBase64: string): string;
18
+ /**
19
+ * Generate a new 12-word BIP39 mnemonic
20
+ */
4
21
  export declare function generateMnemonic(): string;
5
22
  /**
6
- * Install the foreign log sink. Must be called at most once,
7
- * subsequent calls return an error
23
+ * Validate an Ark address (basic format check only)
24
+ *
25
+ * This only validates the format of the address, not whether it belongs
26
+ * to a specific Ark server. For full validation against a connected server,
27
+ * use Wallet::validate_arkoor_address() instead.
8
28
  */
9
- export declare function setLogger(logger: BarkLogger, maxLevel: LogLevel): void;
10
29
  export declare function validateArkAddress(address: string): boolean;
11
- export declare function validateMnemonic(mnemonic: string): boolean;
12
30
  /**
13
- * Foreign sink for log records. Implement in Dart/Swift/Kotlin and pass to
14
- * [set_logger]. The `log()` method must not call back into bark APIs that
15
- * emit log records.
31
+ * Validate a BIP39 mnemonic phrase
16
32
  */
17
- export interface BarkLogger {
18
- log(level: LogLevel, target: string, message: string): void;
19
- }
33
+ export declare function validateMnemonic(mnemonic: string): boolean;
20
34
  /**
21
- * Callback interface for custom onchain wallet implementations
35
+ * Install the foreign logger.
22
36
  *
23
- * Implement this interface in Dart/Swift/Kotlin to provide your own wallet.
24
- */
25
- export interface CustomOnchainWalletCallbacks {
26
- /**
27
- * Get the wallet balance in satoshis
28
- */
29
- getBalance(): bigint;
30
- /**
31
- * Prepare a transaction to send to given destinations
32
- *
33
- * # Arguments
34
- * * `destinations` - List of destinations with addresses and amounts
35
- * * `fee_rate_sat_per_vb` - Fee rate in sats per vbyte
36
- *
37
- * # Returns
38
- * Base64-encoded PSBT
39
- */
40
- prepareTx(destinations: Array<Destination>, feeRateSatPerVb: bigint): string;
41
- /**
42
- * Prepare a transaction that drains the wallet to a single address
43
- *
44
- * # Arguments
45
- * * `address` - Bitcoin address to drain to
46
- * * `fee_rate_sat_per_vb` - Fee rate in sats per vbyte
47
- *
48
- * # Returns
49
- * Base64-encoded PSBT
50
- */
51
- prepareDrainTx(address: string, feeRateSatPerVb: bigint): string;
52
- /**
53
- * Sign and finalize a PSBT
54
- *
55
- * # Arguments
56
- * * `psbt_base64` - Base64-encoded PSBT
57
- *
58
- * # Returns
59
- * Hex-encoded signed transaction
60
- */
61
- finishTx(psbtBase64: string): string;
62
- /**
63
- * Get a wallet transaction by txid
64
- *
65
- * # Arguments
66
- * * `txid` - Transaction ID as hex string
67
- *
68
- * # Returns
69
- * Hex-encoded transaction, or null if not found
70
- */
71
- getWalletTx(txid: string): /*throws*/ string | undefined;
72
- /**
73
- * Get the block hash where a transaction was confirmed
74
- *
75
- * # Arguments
76
- * * `txid` - Transaction ID as hex string
77
- *
78
- * # Returns
79
- * Block reference with height and hash, or null if unconfirmed
80
- */
81
- getWalletTxConfirmedBlock(txid: string): /*throws*/ BlockRef | undefined;
82
- /**
83
- * Find transaction that spends a given output
84
- *
85
- * # Arguments
86
- * * `outpoint` - Transaction outpoint to check
87
- *
88
- * # Returns
89
- * Hex-encoded spending transaction, or null if unspent
90
- */
91
- getSpendingTx(outpoint: OutPoint): /*throws*/ string | undefined;
92
- /**
93
- * Create a signed P2A CPFP transaction
94
- *
95
- * # Arguments
96
- * * `params` - CPFP transaction parameters
97
- *
98
- * # Returns
99
- * Hex-encoded signed CPFP transaction
100
- */
101
- makeSignedP2aCpfp(params: CpfpParams): string;
102
- /**
103
- * Store a signed P2A CPFP transaction in the wallet
104
- *
105
- * # Arguments
106
- * * `tx_hex` - Hex-encoded transaction
107
- */
108
- storeSignedP2aCpfp(txHex: string): void;
109
- }
110
- /**
111
- * An Ark address with its derivation index
37
+ * On first call, installs the bridge with `log::set_logger`. Subsequent calls
38
+ * will return an error.
112
39
  */
40
+ export declare function setLogger(logger: BarkLogger, maxLevel: LogLevel): void;
113
41
  export type AddressWithIndex = {
114
- /**
115
- * The Ark address string
116
- */
117
42
  address: string;
118
- /**
119
- * The derivation index
120
- */
121
43
  index: number;
122
44
  };
123
45
  /**
@@ -128,72 +50,29 @@ export declare const AddressWithIndex: Readonly<{
128
50
  new: (partial: Partial<AddressWithIndex> & Required<Omit<AddressWithIndex, never>>) => AddressWithIndex;
129
51
  defaults: () => Partial<AddressWithIndex>;
130
52
  }>;
131
- /**
132
- * Ark server configuration information
133
- */
134
53
  export type ArkInfo = {
135
- /**
136
- * The bitcoin network the server operates on
137
- */
138
54
  network: Network;
139
- /**
140
- * The Ark server pubkey as hex string
141
- */
142
55
  serverPubkey: string;
143
- /**
144
- * The interval between each round in seconds
145
- */
146
56
  roundIntervalSecs: bigint;
147
- /**
148
- * Number of nonces per round
149
- */
150
57
  nbRoundNonces: number;
151
- /**
152
- * Delta between exit confirmation and coins becoming spendable
153
- */
154
58
  vtxoExitDelta: number;
155
- /**
156
- * Expiration delta of the VTXO
157
- */
158
59
  vtxoExpiryDelta: number;
159
- /**
160
- * The number of blocks after which an HTLC-send VTXO expires once granted
161
- */
162
60
  htlcSendExpiryDelta: number;
163
- /**
164
- * The number of blocks to keep between Lightning and Ark HTLCs expiries
165
- */
166
61
  htlcExpiryDelta: number;
167
- /**
168
- * Maximum amount of a VTXO in sats (null if no limit)
169
- */
170
62
  maxVtxoAmountSats?: bigint;
171
- /**
172
- * The number of confirmations required to register a board vtxo
173
- */
174
63
  requiredBoardConfirmations: number;
175
- /**
176
- * Maximum CLTV delta server will allow clients to request an invoice generation with
177
- */
178
64
  maxUserInvoiceCltvDelta: number;
179
- /**
180
- * Minimum amount for a board the server will cosign in sats
181
- */
182
65
  minBoardAmountSats: bigint;
183
- /**
184
- * Offboard fee rate in sats per vbyte
185
- */
186
- offboardFeerateSatPerVb: bigint;
187
- /**
188
- * Whether the Ark server requires anti-DoS measures for lightning receives
189
- */
190
66
  lnReceiveAntiDosRequired: boolean;
191
67
  /**
192
- * Fee schedule as JSON string
193
- * Contains board, offboard, refresh, lightning send/receive fee details.
194
- * Parse this JSON to access the full fee schedule for all operations.
68
+ * Fee schedule as JSON string (contains board, offboard, refresh, lightning fees)
195
69
  */
196
70
  feeScheduleJson: string;
71
+ /**
72
+ * Maximum exit depth (genesis chain length) allowed for a VTXO before the
73
+ * server refuses to cosign further OOR transactions spending it.
74
+ */
75
+ maxVtxoExitDepth: number;
197
76
  };
198
77
  /**
199
78
  * Generated factory for {@link ArkInfo} record objects.
@@ -203,35 +82,12 @@ export declare const ArkInfo: Readonly<{
203
82
  new: (partial: Partial<ArkInfo> & Required<Omit<ArkInfo, "maxVtxoAmountSats">>) => ArkInfo;
204
83
  defaults: () => Partial<ArkInfo>;
205
84
  }>;
206
- /**
207
- * Detailed balance breakdown of the wallet
208
- */
209
85
  export type Balance = {
210
- /**
211
- * Spendable off-chain balance (Ark) in sats
212
- */
213
86
  spendableSats: bigint;
214
- /**
215
- * Coins locked in a round
216
- */
217
87
  pendingInRoundSats: bigint;
218
- /**
219
- * Coins being unilaterally exited
220
- */
221
88
  pendingExitSats: bigint;
222
- /**
223
- * Coins pending as Lightning sends
224
- */
225
89
  pendingLightningSendSats: bigint;
226
- /**
227
- * Claimable pending Lightning receives
228
- * Note: Bark only tracks claimable receives, not total pending.
229
- * The upstream Balance struct only provides claimable_lightning_receive.
230
- */
231
90
  claimableLightningReceiveSats: bigint;
232
- /**
233
- * Coins pending board confirmations
234
- */
235
91
  pendingBoardSats: bigint;
236
92
  };
237
93
  /**
@@ -257,98 +113,40 @@ export declare const BlockRef: Readonly<{
257
113
  new: (partial: Partial<BlockRef> & Required<Omit<BlockRef, never>>) => BlockRef;
258
114
  defaults: () => Partial<BlockRef>;
259
115
  }>;
260
- /**
261
- * Configuration for creating/opening a Bark wallet
262
- */
263
116
  export type Config = {
264
- /**
265
- * Ark server address
266
- */
267
117
  serverAddress: string;
268
- /**
269
- * Access token for private Ark servers (sent as `ark-access-token` HTTP header)
270
- */
271
118
  serverAccessToken?: string;
272
- /**
273
- * Esplora HTTP REST server address
274
- */
275
119
  esploraAddress?: string;
276
- /**
277
- * Bitcoind RPC server address
278
- */
279
120
  bitcoindAddress?: string;
280
- /**
281
- * Bitcoind RPC cookie file path
282
- */
283
121
  bitcoindCookiefile?: string;
284
- /**
285
- * Bitcoind RPC username
286
- */
287
122
  bitcoindUser?: string;
288
- /**
289
- * Bitcoind RPC password
290
- */
291
123
  bitcoindPass?: string;
292
- /**
293
- * Bitcoin network
294
- */
295
124
  network: Network;
296
- /**
297
- * Number of blocks before expiration to refresh VTXOs
298
- */
299
125
  vtxoRefreshExpiryThreshold?: number;
300
- /**
301
- * Upper limit of blocks needed to safely exit VTXOs
302
- */
303
126
  vtxoExitMargin?: number;
304
- /**
305
- * Number of blocks to claim a HTLC-recv VTXO
306
- */
307
127
  htlcRecvClaimDelta?: number;
308
- /**
309
- * Fallback fee rate in sat/kWu
310
- */
311
128
  fallbackFeeRate?: bigint;
312
- /**
313
- * Confirmations required before considering a round tx fully confirmed
314
- */
315
129
  roundTxRequiredConfirmations?: number;
316
- /**
317
- * Fast sync interval for daemon tasks (lightning sync) in seconds
318
- */
319
- daemonFastSyncIntervalSecs?: bigint;
320
- /**
321
- * Slow sync interval for daemon tasks (onchain, exits, boards, etc.) in seconds
322
- */
323
- daemonSlowSyncIntervalSecs?: bigint;
130
+ daemonSyncIntervalSecs?: bigint;
131
+ offboardRequiredConfirmations?: number;
132
+ daemonManualSync?: boolean;
133
+ lightningReceiveClaimRetries?: number;
324
134
  };
325
135
  /**
326
136
  * Generated factory for {@link Config} record objects.
327
137
  */
328
138
  export declare const Config: Readonly<{
329
- create: (partial: Partial<Config> & Required<Omit<Config, "serverAccessToken" | "esploraAddress" | "bitcoindAddress" | "bitcoindCookiefile" | "bitcoindUser" | "bitcoindPass" | "vtxoRefreshExpiryThreshold" | "vtxoExitMargin" | "htlcRecvClaimDelta" | "fallbackFeeRate" | "roundTxRequiredConfirmations" | "daemonFastSyncIntervalSecs" | "daemonSlowSyncIntervalSecs">>) => Config;
330
- new: (partial: Partial<Config> & Required<Omit<Config, "serverAccessToken" | "esploraAddress" | "bitcoindAddress" | "bitcoindCookiefile" | "bitcoindUser" | "bitcoindPass" | "vtxoRefreshExpiryThreshold" | "vtxoExitMargin" | "htlcRecvClaimDelta" | "fallbackFeeRate" | "roundTxRequiredConfirmations" | "daemonFastSyncIntervalSecs" | "daemonSlowSyncIntervalSecs">>) => Config;
139
+ create: (partial: Partial<Config> & Required<Omit<Config, "serverAccessToken" | "esploraAddress" | "bitcoindAddress" | "bitcoindCookiefile" | "bitcoindUser" | "bitcoindPass" | "vtxoRefreshExpiryThreshold" | "vtxoExitMargin" | "htlcRecvClaimDelta" | "fallbackFeeRate" | "roundTxRequiredConfirmations" | "daemonSyncIntervalSecs" | "offboardRequiredConfirmations" | "daemonManualSync" | "lightningReceiveClaimRetries">>) => Config;
140
+ new: (partial: Partial<Config> & Required<Omit<Config, "serverAccessToken" | "esploraAddress" | "bitcoindAddress" | "bitcoindCookiefile" | "bitcoindUser" | "bitcoindPass" | "vtxoRefreshExpiryThreshold" | "vtxoExitMargin" | "htlcRecvClaimDelta" | "fallbackFeeRate" | "roundTxRequiredConfirmations" | "daemonSyncIntervalSecs" | "offboardRequiredConfirmations" | "daemonManualSync" | "lightningReceiveClaimRetries">>) => Config;
331
141
  defaults: () => Partial<Config>;
332
142
  }>;
333
143
  /**
334
144
  * Parameters for creating a CPFP (Child Pays For Parent) transaction
335
145
  */
336
146
  export type CpfpParams = {
337
- /**
338
- * Parent transaction to fee-bump (hex-encoded)
339
- */
340
147
  txHex: string;
341
- /**
342
- * Fee strategy: "Effective" for normal fee, "Rbf" for replace-by-fee
343
- */
344
148
  feesType: string;
345
- /**
346
- * Target effective fee rate in sat/vB
347
- */
348
149
  effectiveFeeRateSatPerVb: bigint;
349
- /**
350
- * Current package fee in sats (only required for RBF)
351
- */
352
150
  currentPackageFeeSats?: bigint;
353
151
  };
354
152
  /**
@@ -378,13 +176,7 @@ export declare const Destination: Readonly<{
378
176
  * Claim transaction for exited funds
379
177
  */
380
178
  export type ExitClaimTransaction = {
381
- /**
382
- * Base64-encoded PSBT
383
- */
384
179
  psbtBase64: string;
385
- /**
386
- * Transaction fee in sats
387
- */
388
180
  feeSats: bigint;
389
181
  };
390
182
  /**
@@ -399,17 +191,8 @@ export declare const ExitClaimTransaction: Readonly<{
399
191
  * Status of an exit progression
400
192
  */
401
193
  export type ExitProgressStatus = {
402
- /**
403
- * VTXO ID being exited
404
- */
405
194
  vtxoId: string;
406
- /**
407
- * Current state
408
- */
409
195
  state: string;
410
- /**
411
- * Error if any occurred
412
- */
413
196
  error?: string;
414
197
  };
415
198
  /**
@@ -424,21 +207,9 @@ export declare const ExitProgressStatus: Readonly<{
424
207
  * Detailed status of an exit transaction
425
208
  */
426
209
  export type ExitTransactionStatus = {
427
- /**
428
- * VTXO ID
429
- */
430
210
  vtxoId: string;
431
- /**
432
- * Current state
433
- */
434
211
  state: string;
435
- /**
436
- * State history (if requested)
437
- */
438
212
  history?: Array<string>;
439
- /**
440
- * Number of transactions
441
- */
442
213
  transactionCount: number;
443
214
  };
444
215
  /**
@@ -450,24 +221,12 @@ export declare const ExitTransactionStatus: Readonly<{
450
221
  defaults: () => Partial<ExitTransactionStatus>;
451
222
  }>;
452
223
  /**
453
- * A VTXO in the exit process
224
+ * A VTXO that is being unilaterally exited
454
225
  */
455
226
  export type ExitVtxo = {
456
- /**
457
- * VTXO ID
458
- */
459
227
  vtxoId: string;
460
- /**
461
- * Amount in sats
462
- */
463
228
  amountSats: bigint;
464
- /**
465
- * Current exit state
466
- */
467
229
  state: string;
468
- /**
469
- * Whether this exit is claimable
470
- */
471
230
  isClaimable: boolean;
472
231
  };
473
232
  /**
@@ -478,27 +237,10 @@ export declare const ExitVtxo: Readonly<{
478
237
  new: (partial: Partial<ExitVtxo> & Required<Omit<ExitVtxo, never>>) => ExitVtxo;
479
238
  defaults: () => Partial<ExitVtxo>;
480
239
  }>;
481
- /**
482
- * Result of a fee estimation
483
- */
484
240
  export type FeeEstimate = {
485
- /**
486
- * The total amount including fees in sats
487
- */
488
241
  grossAmountSats: bigint;
489
- /**
490
- * The fee amount charged by the server in sats
491
- */
492
242
  feeSats: bigint;
493
- /**
494
- * The amount excluding fees in sats.
495
- * For sends, this is the amount the recipient receives.
496
- * For receives, this is the amount the user gets.
497
- */
498
243
  netAmountSats: bigint;
499
- /**
500
- * The VTXO IDs that would be spent for this operation
501
- */
502
244
  vtxosSpent: Array<string>;
503
245
  };
504
246
  /**
@@ -509,17 +251,9 @@ export declare const FeeEstimate: Readonly<{
509
251
  new: (partial: Partial<FeeEstimate> & Required<Omit<FeeEstimate, never>>) => FeeEstimate;
510
252
  defaults: () => Partial<FeeEstimate>;
511
253
  }>;
512
- /**
513
- * Result of creating a BOLT11 invoice
514
- */
515
254
  export type LightningInvoice = {
516
- /**
517
- * The BOLT11 invoice string
518
- */
519
255
  invoice: string;
520
- /**
521
- * Amount in sats
522
- */
256
+ paymentHash: string;
523
257
  amountSats: bigint;
524
258
  };
525
259
  /**
@@ -530,29 +264,12 @@ export declare const LightningInvoice: Readonly<{
530
264
  new: (partial: Partial<LightningInvoice> & Required<Omit<LightningInvoice, never>>) => LightningInvoice;
531
265
  defaults: () => Partial<LightningInvoice>;
532
266
  }>;
533
- /**
534
- * Status of a pending Lightning receive
535
- */
536
267
  export type LightningReceive = {
537
- /**
538
- * Payment hash
539
- */
540
268
  paymentHash: string;
541
- /**
542
- * The BOLT11 invoice
543
- */
269
+ paymentPreimage: string;
544
270
  invoice: string;
545
- /**
546
- * Amount in sats
547
- */
548
271
  amountSats: bigint;
549
- /**
550
- * Whether HTLC VTXOs have been received
551
- */
552
272
  hasHtlcVtxos: boolean;
553
- /**
554
- * Whether preimage has been revealed
555
- */
556
273
  preimageRevealed: boolean;
557
274
  };
558
275
  /**
@@ -563,25 +280,10 @@ export declare const LightningReceive: Readonly<{
563
280
  new: (partial: Partial<LightningReceive> & Required<Omit<LightningReceive, never>>) => LightningReceive;
564
281
  defaults: () => Partial<LightningReceive>;
565
282
  }>;
566
- /**
567
- * Lightning send payment information
568
- */
569
283
  export type LightningSend = {
570
- /**
571
- * The invoice being paid
572
- */
573
284
  invoice: string;
574
- /**
575
- * Amount in sats
576
- */
577
285
  amountSats: bigint;
578
- /**
579
- * Number of HTLC VTXOs locked
580
- */
581
286
  htlcVtxoCount: number;
582
- /**
583
- * Payment preimage (only present if payment completed)
584
- */
585
287
  preimage?: string;
586
288
  };
587
289
  /**
@@ -592,73 +294,22 @@ export declare const LightningSend: Readonly<{
592
294
  new: (partial: Partial<LightningSend> & Required<Omit<LightningSend, "preimage">>) => LightningSend;
593
295
  defaults: () => Partial<LightningSend>;
594
296
  }>;
595
- /**
596
- * Wallet movement/transaction record
597
- */
598
297
  export type Movement = {
599
- /**
600
- * Movement ID
601
- */
602
298
  id: number;
603
- /**
604
- * Status (pending, successful, failed, canceled)
605
- */
606
299
  status: string;
607
- /**
608
- * Subsystem name
609
- */
610
300
  subsystemName: string;
611
- /**
612
- * Subsystem kind
613
- */
614
301
  subsystemKind: string;
615
- /**
616
- * Metadata as JSON string
617
- */
618
302
  metadataJson: string;
619
- /**
620
- * Intended balance change in sats
621
- */
622
303
  intendedBalanceSats: bigint;
623
- /**
624
- * Effective balance change in sats
625
- */
626
304
  effectiveBalanceSats: bigint;
627
- /**
628
- * Offchain fee in sats
629
- */
630
305
  offchainFeeSats: bigint;
631
- /**
632
- * Addresses/invoices sent to
633
- */
634
306
  sentToAddresses: Array<string>;
635
- /**
636
- * Addresses/invoices received on
637
- */
638
307
  receivedOnAddresses: Array<string>;
639
- /**
640
- * Input VTXO IDs
641
- */
642
308
  inputVtxoIds: Array<string>;
643
- /**
644
- * Output VTXO IDs
645
- */
646
309
  outputVtxoIds: Array<string>;
647
- /**
648
- * VTXOs sent to exit system
649
- */
650
310
  exitedVtxoIds: Array<string>;
651
- /**
652
- * Created at timestamp
653
- */
654
311
  createdAt: string;
655
- /**
656
- * Updated at timestamp
657
- */
658
312
  updatedAt: string;
659
- /**
660
- * Completed at timestamp (null if not completed)
661
- */
662
313
  completedAt?: string;
663
314
  };
664
315
  /**
@@ -669,13 +320,7 @@ export declare const Movement: Readonly<{
669
320
  new: (partial: Partial<Movement> & Required<Omit<Movement, "completedAt">>) => Movement;
670
321
  defaults: () => Partial<Movement>;
671
322
  }>;
672
- /**
673
- * Result of an offboard operation
674
- */
675
323
  export type OffboardResult = {
676
- /**
677
- * The round ID
678
- */
679
324
  roundId: string;
680
325
  };
681
326
  /**
@@ -686,21 +331,9 @@ export declare const OffboardResult: Readonly<{
686
331
  new: (partial: Partial<OffboardResult> & Required<Omit<OffboardResult, never>>) => OffboardResult;
687
332
  defaults: () => Partial<OffboardResult>;
688
333
  }>;
689
- /**
690
- * Onchain Bitcoin wallet balance
691
- */
692
334
  export type OnchainBalance = {
693
- /**
694
- * Confirmed balance in sats
695
- */
696
335
  confirmedSats: bigint;
697
- /**
698
- * Pending balance (trusted + untrusted) in sats
699
- */
700
336
  pendingSats: bigint;
701
- /**
702
- * Total balance in sats
703
- */
704
337
  totalSats: bigint;
705
338
  };
706
339
  /**
@@ -726,21 +359,9 @@ export declare const OutPoint: Readonly<{
726
359
  new: (partial: Partial<OutPoint> & Required<Omit<OutPoint, never>>) => OutPoint;
727
360
  defaults: () => Partial<OutPoint>;
728
361
  }>;
729
- /**
730
- * Pending board transaction information
731
- */
732
362
  export type PendingBoard = {
733
- /**
734
- * VTXO ID that will be created once board is registered
735
- */
736
363
  vtxoId: string;
737
- /**
738
- * Amount being boarded in sats
739
- */
740
364
  amountSats: bigint;
741
- /**
742
- * On-chain transaction ID
743
- */
744
365
  txid: string;
745
366
  };
746
367
  /**
@@ -755,9 +376,6 @@ export declare const PendingBoard: Readonly<{
755
376
  * A pending round state
756
377
  */
757
378
  export type RoundState = {
758
- /**
759
- * Round ID
760
- */
761
379
  id: number;
762
380
  /**
763
381
  * Whether the round is ongoing
@@ -772,30 +390,22 @@ export declare const RoundState: Readonly<{
772
390
  new: (partial: Partial<RoundState> & Required<Omit<RoundState, never>>) => RoundState;
773
391
  defaults: () => Partial<RoundState>;
774
392
  }>;
775
- /**
776
- * Simplified view of a VTXO
777
- */
778
393
  export type Vtxo = {
779
- /**
780
- * VTXO id like "686...9aa:0"
781
- */
782
394
  id: string;
783
- /**
784
- * Amount in sats
785
- */
786
395
  amountSats: bigint;
787
- /**
788
- * Expiry height (0 if unknown)
789
- */
790
396
  expiryHeight: number;
397
+ kind: string;
398
+ state: string;
791
399
  /**
792
- * Type of VTXO (e.g., "board", "round", "arkoor")
400
+ * Genesis chain length. Compare against `ArkInfo.max_vtxo_exit_depth` to
401
+ * detect VTXOs nearing the server's OOR-cosign refusal threshold.
793
402
  */
794
- kind: string;
403
+ exitDepth: number;
795
404
  /**
796
- * State of VTXO (e.g., "spendable", "spent", "locked")
405
+ * Weight units of the unilateral exit transaction chain. Lets clients
406
+ * estimate exit cost without loading the full genesis.
797
407
  */
798
- state: string;
408
+ exitTxWeightWu: bigint;
799
409
  };
800
410
  /**
801
411
  * Generated factory for {@link Vtxo} record objects.
@@ -805,9 +415,6 @@ export declare const Vtxo: Readonly<{
805
415
  new: (partial: Partial<Vtxo> & Required<Omit<Vtxo, never>>) => Vtxo;
806
416
  defaults: () => Partial<Vtxo>;
807
417
  }>;
808
- /**
809
- * Read-only properties of the wallet
810
- */
811
418
  export type WalletProperties = {
812
419
  network: Network;
813
420
  fingerprint: string;
@@ -837,7 +444,7 @@ export declare enum BarkError_Tags {
837
444
  ServerPubkeyChanged = "ServerPubkeyChanged"
838
445
  }
839
446
  /**
840
- * Error types that can occur when using the Bark wallet
447
+ * Error types that can occur when using the Bark wallet FFI
841
448
  */
842
449
  export declare const BarkError: Readonly<{
843
450
  instanceOf: (obj: any) => obj is BarkError;
@@ -2047,11 +1654,11 @@ export declare const BarkError: Readonly<{
2047
1654
  };
2048
1655
  }>;
2049
1656
  /**
2050
- * Error types that can occur when using the Bark wallet
1657
+ * Error types that can occur when using the Bark wallet FFI
2051
1658
  */
2052
1659
  export type BarkError = InstanceType<(typeof BarkError)[keyof Omit<typeof BarkError, "instanceOf">]>;
2053
1660
  /**
2054
- * Severity of a log record forwarded to a foreign [BarkLogger].
1661
+ * Severity of a log record.
2055
1662
  */
2056
1663
  export declare enum LogLevel {
2057
1664
  Error = 0,
@@ -2060,9 +1667,6 @@ export declare enum LogLevel {
2060
1667
  Debug = 3,
2061
1668
  Trace = 4
2062
1669
  }
2063
- /**
2064
- * Bitcoin network types
2065
- */
2066
1670
  export declare enum Network {
2067
1671
  Bitcoin = 0,
2068
1672
  Testnet = 1,
@@ -2189,36 +1793,261 @@ export declare const WalletNotification: Readonly<{
2189
1793
  */
2190
1794
  export type WalletNotification = InstanceType<(typeof WalletNotification)[keyof Omit<typeof WalletNotification, "instanceOf">]>;
2191
1795
  /**
2192
- * Pull-based handle for consuming wallet notifications.
1796
+ * Foreign-implemented sink for log records.
1797
+ *
1798
+ * IMPORTANT: implementations must not call back into bark APIs that
1799
+ * themselves emit log records, or the foreign runtime may stack-overflow
1800
+ * or deadlock.
1801
+ */
1802
+ export interface BarkLogger {
1803
+ log(level: LogLevel, target: string, message: string): void;
1804
+ }
1805
+ /**
1806
+ * Foreign-implemented sink for log records.
1807
+ *
1808
+ * IMPORTANT: implementations must not call back into bark APIs that
1809
+ * themselves emit log records, or the foreign runtime may stack-overflow
1810
+ * or deadlock.
1811
+ */
1812
+ export declare class BarkLoggerImpl extends UniffiAbstractObject implements BarkLogger {
1813
+ readonly [uniffiTypeNameSymbol] = "BarkLoggerImpl";
1814
+ readonly [destructorGuardSymbol]: UniffiGcObject;
1815
+ readonly [pointerLiteralSymbol]: UniffiHandle;
1816
+ private constructor();
1817
+ log(level: LogLevel, target: string, message: string): void;
1818
+ /**
1819
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1820
+ */
1821
+ uniffiDestroy(): void;
1822
+ static instanceOf(obj: any): obj is BarkLoggerImpl;
1823
+ }
1824
+ /**
1825
+ * Callback interface for custom onchain wallet implementations
1826
+ *
1827
+ * Foreign languages implement this trait to provide their own wallet functionality.
1828
+ */
1829
+ export interface CustomOnchainWalletCallbacks {
1830
+ /**
1831
+ * Get the wallet balance in satoshis
1832
+ */
1833
+ getBalance(): bigint;
1834
+ /**
1835
+ * Prepare a transaction to send to given destinations
1836
+ *
1837
+ * # Arguments
1838
+ * * `destinations` - List of destinations with addresses and amounts
1839
+ * * `fee_rate_sat_per_vb` - Fee rate in sats per vbyte
1840
+ *
1841
+ * # Returns
1842
+ * Base64-encoded PSBT
1843
+ */
1844
+ prepareTx(destinations: Array<Destination>, feeRateSatPerVb: bigint): string;
1845
+ /**
1846
+ * Prepare a transaction that drains the wallet to a single address
1847
+ *
1848
+ * # Arguments
1849
+ * * `address` - Bitcoin address to drain to
1850
+ * * `fee_rate_sat_per_vb` - Fee rate in sats per vbyte
1851
+ *
1852
+ * # Returns
1853
+ * Base64-encoded PSBT
1854
+ */
1855
+ prepareDrainTx(address: string, feeRateSatPerVb: bigint): string;
1856
+ /**
1857
+ * Sign and finalize a PSBT
1858
+ *
1859
+ * # Arguments
1860
+ * * `psbt_base64` - Base64-encoded PSBT
1861
+ *
1862
+ * # Returns
1863
+ * Base64-encoded fully signed PSBT (all witnesses filled in)
1864
+ */
1865
+ finishPsbt(psbtBase64: string): string;
1866
+ /**
1867
+ * Get a wallet transaction by txid
1868
+ *
1869
+ * # Arguments
1870
+ * * `txid` - Transaction ID as hex string
1871
+ *
1872
+ * # Returns
1873
+ * Hex-encoded transaction, or null if not found
1874
+ */
1875
+ getWalletTx(txid: string): /*throws*/ string | undefined;
1876
+ /**
1877
+ * Get the block hash where a transaction was confirmed
1878
+ *
1879
+ * # Arguments
1880
+ * * `txid` - Transaction ID as hex string
1881
+ *
1882
+ * # Returns
1883
+ * Block reference with height and hash, or null if unconfirmed
1884
+ */
1885
+ getWalletTxConfirmedBlock(txid: string): /*throws*/ BlockRef | undefined;
1886
+ /**
1887
+ * Find transaction that spends a given output
1888
+ *
1889
+ * # Arguments
1890
+ * * `outpoint` - Transaction outpoint to check
1891
+ *
1892
+ * # Returns
1893
+ * Hex-encoded spending transaction, or null if unspent
1894
+ */
1895
+ getSpendingTx(outpoint: OutPoint): /*throws*/ string | undefined;
1896
+ /**
1897
+ * Create a signed P2A CPFP transaction
1898
+ *
1899
+ * # Arguments
1900
+ * * `params` - CPFP transaction parameters
1901
+ *
1902
+ * # Returns
1903
+ * Hex-encoded signed CPFP transaction
1904
+ */
1905
+ makeSignedP2aCpfp(params: CpfpParams): string;
1906
+ /**
1907
+ * Store a signed P2A CPFP transaction in the wallet
1908
+ *
1909
+ * # Arguments
1910
+ * * `tx_hex` - Hex-encoded transaction
1911
+ */
1912
+ storeSignedP2aCpfp(txHex: string): void;
1913
+ }
1914
+ /**
1915
+ * Callback interface for custom onchain wallet implementations
1916
+ *
1917
+ * Foreign languages implement this trait to provide their own wallet functionality.
1918
+ */
1919
+ export declare class CustomOnchainWalletCallbacksImpl extends UniffiAbstractObject implements CustomOnchainWalletCallbacks {
1920
+ readonly [uniffiTypeNameSymbol] = "CustomOnchainWalletCallbacksImpl";
1921
+ readonly [destructorGuardSymbol]: UniffiGcObject;
1922
+ readonly [pointerLiteralSymbol]: UniffiHandle;
1923
+ private constructor();
1924
+ /**
1925
+ * Get the wallet balance in satoshis
1926
+ */
1927
+ getBalance(): bigint;
1928
+ /**
1929
+ * Prepare a transaction to send to given destinations
1930
+ *
1931
+ * # Arguments
1932
+ * * `destinations` - List of destinations with addresses and amounts
1933
+ * * `fee_rate_sat_per_vb` - Fee rate in sats per vbyte
1934
+ *
1935
+ * # Returns
1936
+ * Base64-encoded PSBT
1937
+ */
1938
+ prepareTx(destinations: Array<Destination>, feeRateSatPerVb: bigint): string;
1939
+ /**
1940
+ * Prepare a transaction that drains the wallet to a single address
1941
+ *
1942
+ * # Arguments
1943
+ * * `address` - Bitcoin address to drain to
1944
+ * * `fee_rate_sat_per_vb` - Fee rate in sats per vbyte
1945
+ *
1946
+ * # Returns
1947
+ * Base64-encoded PSBT
1948
+ */
1949
+ prepareDrainTx(address: string, feeRateSatPerVb: bigint): string;
1950
+ /**
1951
+ * Sign and finalize a PSBT
1952
+ *
1953
+ * # Arguments
1954
+ * * `psbt_base64` - Base64-encoded PSBT
1955
+ *
1956
+ * # Returns
1957
+ * Base64-encoded fully signed PSBT (all witnesses filled in)
1958
+ */
1959
+ finishPsbt(psbtBase64: string): string;
1960
+ /**
1961
+ * Get a wallet transaction by txid
1962
+ *
1963
+ * # Arguments
1964
+ * * `txid` - Transaction ID as hex string
1965
+ *
1966
+ * # Returns
1967
+ * Hex-encoded transaction, or null if not found
1968
+ */
1969
+ getWalletTx(txid: string): string | undefined;
1970
+ /**
1971
+ * Get the block hash where a transaction was confirmed
1972
+ *
1973
+ * # Arguments
1974
+ * * `txid` - Transaction ID as hex string
1975
+ *
1976
+ * # Returns
1977
+ * Block reference with height and hash, or null if unconfirmed
1978
+ */
1979
+ getWalletTxConfirmedBlock(txid: string): BlockRef | undefined;
1980
+ /**
1981
+ * Find transaction that spends a given output
1982
+ *
1983
+ * # Arguments
1984
+ * * `outpoint` - Transaction outpoint to check
1985
+ *
1986
+ * # Returns
1987
+ * Hex-encoded spending transaction, or null if unspent
1988
+ */
1989
+ getSpendingTx(outpoint: OutPoint): string | undefined;
1990
+ /**
1991
+ * Create a signed P2A CPFP transaction
1992
+ *
1993
+ * # Arguments
1994
+ * * `params` - CPFP transaction parameters
1995
+ *
1996
+ * # Returns
1997
+ * Hex-encoded signed CPFP transaction
1998
+ */
1999
+ makeSignedP2aCpfp(params: CpfpParams): string;
2000
+ /**
2001
+ * Store a signed P2A CPFP transaction in the wallet
2002
+ *
2003
+ * # Arguments
2004
+ * * `tx_hex` - Hex-encoded transaction
2005
+ */
2006
+ storeSignedP2aCpfp(txHex: string): void;
2007
+ /**
2008
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
2009
+ */
2010
+ uniffiDestroy(): void;
2011
+ static instanceOf(obj: any): obj is CustomOnchainWalletCallbacksImpl;
2012
+ }
2013
+ /**
2014
+ * Pull-based notification handle exposed over FFI.
2193
2015
  *
2194
- * Obtain via `Wallet.notifications()`. Call `next_notification()` in a loop
2016
+ * Obtain via `Wallet::notifications()`. Call `next_notification()` in a loop
2195
2017
  * to receive events. Call `cancel_next_notification_wait()` to unblock a
2196
2018
  * pending wait without destroying the underlying stream.
2197
2019
  *
2198
- * Each call to `Wallet.notifications()` creates an independent stream backed
2199
- * by a new broadcast receiver. Only one consumer loop per holder is assumed.
2020
+ * Each call to `Wallet::notifications()` creates an independent stream backed
2021
+ * by a new broadcast receiver existing holders are unaffected.
2022
+ *
2023
+ * This holder is intended for a single consumer loop. Concurrent calls to
2024
+ * `next_notification()` on the same holder are not supported and will return
2025
+ * `None` immediately.
2200
2026
  */
2201
2027
  export interface NotificationHolderLike {
2202
2028
  /**
2203
2029
  * Cancel the currently pending `next_notification()` wait.
2204
2030
  *
2205
- * Causes a blocked `next_notification()` to return null.
2206
- * Has no effect when no wait is active.
2207
- * Does NOT destroy the underlying stream; subsequent calls to
2208
- * `next_notification()` will still work.
2031
+ * Causes a blocked `next_notification()` to return `None`.
2032
+ * Has no effect if no wait is currently active.
2033
+ *
2034
+ * This does NOT destroy the underlying `NotificationStream`; a subsequent
2035
+ * call to `next_notification()` will work normally and wait for new events.
2209
2036
  */
2210
2037
  cancelNextNotificationWait(): void;
2211
2038
  /**
2212
- * Wait for the next notification.
2039
+ * Wait for the next wallet notification.
2213
2040
  *
2214
- * Returns null if the wait was cancelled via `cancel_next_notification_wait()`
2215
- * or if the wallet's notification source was shut down permanently.
2041
+ * Returns `None` when:
2042
+ * - `cancel_next_notification_wait()` was called while this was pending
2043
+ * (cancellation only affects the current wait; the stream lives on)
2044
+ * - The wallet's notification source was shut down permanently
2216
2045
  *
2217
- * After a cancellation this method can be called again normally — the
2218
- * underlying stream is preserved and a fresh cancel channel is set up on
2219
- * every entry.
2046
+ * Returns `Err(BarkError::Internal)` if called concurrently on the same holder.
2220
2047
  *
2221
- * Throws `BarkError.Internal` if called concurrently on the same holder.
2048
+ * After a cancellation this method can be called again normally the
2049
+ * underlying `NotificationStream` is preserved in `self.stream` and a
2050
+ * fresh per-wait cancel channel is created on every entry.
2222
2051
  */
2223
2052
  nextNotification(asyncOpts_?: {
2224
2053
  signal: AbortSignal;
@@ -2229,14 +2058,18 @@ export interface NotificationHolderLike {
2229
2058
  */
2230
2059
  export type NotificationHolderInterface = NotificationHolderLike;
2231
2060
  /**
2232
- * Pull-based handle for consuming wallet notifications.
2061
+ * Pull-based notification handle exposed over FFI.
2233
2062
  *
2234
- * Obtain via `Wallet.notifications()`. Call `next_notification()` in a loop
2063
+ * Obtain via `Wallet::notifications()`. Call `next_notification()` in a loop
2235
2064
  * to receive events. Call `cancel_next_notification_wait()` to unblock a
2236
2065
  * pending wait without destroying the underlying stream.
2237
2066
  *
2238
- * Each call to `Wallet.notifications()` creates an independent stream backed
2239
- * by a new broadcast receiver. Only one consumer loop per holder is assumed.
2067
+ * Each call to `Wallet::notifications()` creates an independent stream backed
2068
+ * by a new broadcast receiver existing holders are unaffected.
2069
+ *
2070
+ * This holder is intended for a single consumer loop. Concurrent calls to
2071
+ * `next_notification()` on the same holder are not supported and will return
2072
+ * `None` immediately.
2240
2073
  */
2241
2074
  export declare class NotificationHolder extends UniffiAbstractObject implements NotificationHolderLike {
2242
2075
  readonly [uniffiTypeNameSymbol] = "NotificationHolder";
@@ -2246,23 +2079,26 @@ export declare class NotificationHolder extends UniffiAbstractObject implements
2246
2079
  /**
2247
2080
  * Cancel the currently pending `next_notification()` wait.
2248
2081
  *
2249
- * Causes a blocked `next_notification()` to return null.
2250
- * Has no effect when no wait is active.
2251
- * Does NOT destroy the underlying stream; subsequent calls to
2252
- * `next_notification()` will still work.
2082
+ * Causes a blocked `next_notification()` to return `None`.
2083
+ * Has no effect if no wait is currently active.
2084
+ *
2085
+ * This does NOT destroy the underlying `NotificationStream`; a subsequent
2086
+ * call to `next_notification()` will work normally and wait for new events.
2253
2087
  */
2254
2088
  cancelNextNotificationWait(): void;
2255
2089
  /**
2256
- * Wait for the next notification.
2090
+ * Wait for the next wallet notification.
2257
2091
  *
2258
- * Returns null if the wait was cancelled via `cancel_next_notification_wait()`
2259
- * or if the wallet's notification source was shut down permanently.
2092
+ * Returns `None` when:
2093
+ * - `cancel_next_notification_wait()` was called while this was pending
2094
+ * (cancellation only affects the current wait; the stream lives on)
2095
+ * - The wallet's notification source was shut down permanently
2260
2096
  *
2261
- * After a cancellation this method can be called again normally — the
2262
- * underlying stream is preserved and a fresh cancel channel is set up on
2263
- * every entry.
2097
+ * Returns `Err(BarkError::Internal)` if called concurrently on the same holder.
2264
2098
  *
2265
- * Throws `BarkError.Internal` if called concurrently on the same holder.
2099
+ * After a cancellation this method can be called again normally the
2100
+ * underlying `NotificationStream` is preserved in `self.stream` and a
2101
+ * fresh per-wait cancel channel is created on every entry.
2266
2102
  */
2267
2103
  nextNotification(asyncOpts_?: {
2268
2104
  signal: AbortSignal;
@@ -2274,36 +2110,20 @@ export declare class NotificationHolder extends UniffiAbstractObject implements
2274
2110
  static instanceOf(obj: any): obj is NotificationHolder;
2275
2111
  }
2276
2112
  /**
2277
- * Onchain Bitcoin wallet for boarding and exits
2278
- *
2279
- * Supports two implementations:
2280
- * - Default: BDK-based wallet (built-in)
2281
- * - Custom: Your own wallet implementation via callbacks
2113
+ * UniFFI-facing onchain wallet. Supports two backends:
2114
+ * - BDK (real onchain wallet via `bark::onchain::OnchainWallet`)
2115
+ * - Callback (foreign-language implementation)
2282
2116
  */
2283
2117
  export interface OnchainWalletLike {
2284
- /**
2285
- * Get the onchain wallet balance
2286
- */
2287
2118
  balance(asyncOpts_?: {
2288
2119
  signal: AbortSignal;
2289
2120
  }): Promise<OnchainBalance>;
2290
- /**
2291
- * Generate a new Bitcoin address
2292
- */
2293
2121
  newAddress(asyncOpts_?: {
2294
2122
  signal: AbortSignal;
2295
2123
  }): Promise<string>;
2296
- /**
2297
- * Send Bitcoin to an address
2298
- * Returns the transaction ID
2299
- */
2300
2124
  send(address: string, amountSats: bigint, feeRateSatPerVb: bigint, asyncOpts_?: {
2301
2125
  signal: AbortSignal;
2302
2126
  }): Promise<string>;
2303
- /**
2304
- * Sync the onchain wallet with the blockchain
2305
- * Returns the amount synced in satoshis
2306
- */
2307
2127
  sync(asyncOpts_?: {
2308
2128
  signal: AbortSignal;
2309
2129
  }): Promise</*u64*/ bigint>;
@@ -2313,11 +2133,9 @@ export interface OnchainWalletLike {
2313
2133
  */
2314
2134
  export type OnchainWalletInterface = OnchainWalletLike;
2315
2135
  /**
2316
- * Onchain Bitcoin wallet for boarding and exits
2317
- *
2318
- * Supports two implementations:
2319
- * - Default: BDK-based wallet (built-in)
2320
- * - Custom: Your own wallet implementation via callbacks
2136
+ * UniFFI-facing onchain wallet. Supports two backends:
2137
+ * - BDK (real onchain wallet via `bark::onchain::OnchainWallet`)
2138
+ * - Callback (foreign-language implementation)
2321
2139
  */
2322
2140
  export declare class OnchainWallet extends UniffiAbstractObject implements OnchainWalletLike {
2323
2141
  readonly [uniffiTypeNameSymbol] = "OnchainWallet";
@@ -2325,45 +2143,24 @@ export declare class OnchainWallet extends UniffiAbstractObject implements Oncha
2325
2143
  readonly [pointerLiteralSymbol]: UniffiHandle;
2326
2144
  private constructor();
2327
2145
  /**
2328
- * Create an onchain wallet using a custom implementation
2329
- *
2330
- * Use this when you have an existing wallet implementation in your language
2331
- * (Dart/Swift/Kotlin) and want to integrate it with Bark for boarding and exits.
2332
- * Your implementation must handle all wallet operations via the callbacks interface.
2146
+ * Callback-backed wallet for foreign-language implementations.
2333
2147
  */
2334
2148
  static custom(callbacks: CustomOnchainWalletCallbacks): OnchainWalletLike;
2335
2149
  /**
2336
- * Create or load an onchain wallet using a default BDK implementation shipped with Bark
2337
- *
2338
- * The wallet uses BDK for onchain operations
2339
- * and the same chain source configuration as the Bark wallet (esplora_address or bitcoind_*).
2150
+ * BDK-backed wallet. Opens the shared sqlite cache.
2340
2151
  */
2341
2152
  static default_(mnemonic: string, config: Config, datadir: string, asyncOpts_?: {
2342
2153
  signal: AbortSignal;
2343
2154
  }): Promise<OnchainWalletLike>;
2344
- /**
2345
- * Get the onchain wallet balance
2346
- */
2347
2155
  balance(asyncOpts_?: {
2348
2156
  signal: AbortSignal;
2349
2157
  }): Promise<OnchainBalance>;
2350
- /**
2351
- * Generate a new Bitcoin address
2352
- */
2353
2158
  newAddress(asyncOpts_?: {
2354
2159
  signal: AbortSignal;
2355
2160
  }): Promise<string>;
2356
- /**
2357
- * Send Bitcoin to an address
2358
- * Returns the transaction ID
2359
- */
2360
2161
  send(address: string, amountSats: bigint, feeRateSatPerVb: bigint, asyncOpts_?: {
2361
2162
  signal: AbortSignal;
2362
2163
  }): Promise<string>;
2363
- /**
2364
- * Sync the onchain wallet with the blockchain
2365
- * Returns the amount synced in satoshis
2366
- */
2367
2164
  sync(asyncOpts_?: {
2368
2165
  signal: AbortSignal;
2369
2166
  }): Promise</*u64*/ bigint>;
@@ -2374,557 +2171,222 @@ export declare class OnchainWallet extends UniffiAbstractObject implements Oncha
2374
2171
  static instanceOf(obj: any): obj is OnchainWallet;
2375
2172
  }
2376
2173
  /**
2377
- * The main Bark wallet interface for Ark operations
2174
+ * UniFFI-facing Bark wallet.
2175
+ *
2176
+ * Wraps `core::Wallet` and adds:
2177
+ * - `run_async` runtime offload on every entry point
2178
+ * - mailbox processor task + cancellation on drop
2179
+ * - LNURL `pay_lightning_address`
2180
+ * - Daemon control methods
2181
+ * - Notification holder
2182
+ * - Callback onchain dispatch
2378
2183
  */
2379
2184
  export interface WalletLike {
2380
- /**
2381
- * Get earliest block height when all exits will be claimable
2382
- *
2383
- * Returns null if no exits or any exit has undetermined claimability.
2384
- */
2385
2185
  allExitsClaimableAtHeight(asyncOpts_?: {
2386
2186
  signal: AbortSignal;
2387
2187
  }): Promise</*u32*/ /*u32*/ number | undefined>;
2388
- /**
2389
- * Get all VTXOs (including spent)
2390
- */
2391
2188
  allVtxos(asyncOpts_?: {
2392
2189
  signal: AbortSignal;
2393
2190
  }): Promise<Array<Vtxo>>;
2394
- /**
2395
- * Get Ark server info (null if not connected)
2396
- */
2397
2191
  arkInfo(asyncOpts_?: {
2398
2192
  signal: AbortSignal;
2399
2193
  }): Promise<ArkInfo | undefined>;
2400
2194
  balance(asyncOpts_?: {
2401
2195
  signal: AbortSignal;
2402
2196
  }): Promise<Balance>;
2403
- /**
2404
- * Board all funds from onchain wallet into Ark
2405
- */
2406
2197
  boardAll(onchainWallet: OnchainWalletLike, asyncOpts_?: {
2407
2198
  signal: AbortSignal;
2408
2199
  }): Promise<PendingBoard>;
2409
- /**
2410
- * Board a specific amount from onchain wallet into Ark
2411
- */
2412
2200
  boardAmount(onchainWallet: OnchainWalletLike, amountSats: bigint, asyncOpts_?: {
2413
2201
  signal: AbortSignal;
2414
2202
  }): Promise<PendingBoard>;
2415
2203
  bolt11Invoice(amountSats: bigint, description: string | undefined, asyncOpts_?: {
2416
2204
  signal: AbortSignal;
2417
2205
  }): Promise<LightningInvoice>;
2418
- /**
2419
- * Broadcast a signed transaction to the Bitcoin network
2420
- *
2421
- * Takes a hex-encoded transaction and broadcasts it via the wallet's chain source.
2422
- * This is useful after extracting a transaction from a PSBT using extract_tx_from_psbt.
2423
- *
2424
- * # Arguments
2425
- *
2426
- * * `tx_hex` - Hex-encoded signed transaction
2427
- *
2428
- * Returns the transaction ID (txid) of the broadcasted transaction
2429
- */
2430
2206
  broadcastTx(txHex: string, asyncOpts_?: {
2431
2207
  signal: AbortSignal;
2432
2208
  }): Promise<string>;
2433
- /**
2434
- * Cancel all pending rounds
2435
- */
2436
2209
  cancelAllPendingRounds(asyncOpts_?: {
2437
2210
  signal: AbortSignal;
2438
2211
  }): Promise<void>;
2439
- /**
2440
- * Cancel a pending lightning receive by payment hash
2441
- *
2442
- * Server will refuse if HTLCs already granted, preimage already revealed,
2443
- * or receive already finished.
2444
- *
2445
- * # Arguments
2446
- *
2447
- * * `payment_hash` - Payment hash as hex string
2448
- */
2449
2212
  cancelLightningReceive(paymentHash: string, asyncOpts_?: {
2450
2213
  signal: AbortSignal;
2451
2214
  }): Promise<void>;
2452
- /**
2453
- * Cancel a specific pending round
2454
- */
2455
2215
  cancelPendingRound(roundId: number, asyncOpts_?: {
2456
2216
  signal: AbortSignal;
2457
2217
  }): Promise<void>;
2458
- /**
2459
- * Check lightning payment status by payment hash
2460
- *
2461
- * # Arguments
2462
- *
2463
- * * `payment_hash` - Payment hash as hex string
2464
- * * `wait` - Whether to wait for the payment to complete
2465
- *
2466
- * Returns the preimage if payment is successful, null if still pending
2467
- */
2468
2218
  checkLightningPayment(paymentHash: string, wait: boolean, asyncOpts_?: {
2469
2219
  signal: AbortSignal;
2470
2220
  }): Promise<string | undefined>;
2471
- /**
2472
- * Get claimable lightning receive balance
2473
- */
2474
2221
  claimableLightningReceiveBalanceSats(asyncOpts_?: {
2475
2222
  signal: AbortSignal;
2476
2223
  }): Promise</*u64*/ bigint>;
2477
- /**
2478
- * Get wallet config
2479
- */
2480
2224
  config(asyncOpts_?: {
2481
2225
  signal: AbortSignal;
2482
2226
  }): Promise<Config>;
2483
- /**
2484
- * Drain claimable exits to an address
2485
- *
2486
- * Builds a signed PSBT that claims exited funds and sends them to the address.
2487
- * The PSBT can be broadcast directly or modified before broadcasting.
2488
- *
2489
- * # Arguments
2490
- *
2491
- * * `vtxo_ids` - List of claimable VTXO IDs to drain (empty = drain all)
2492
- * * `address` - Bitcoin address to send claimed funds to
2493
- * * `fee_rate_sat_per_vb` - Optional fee rate override in sats/vB
2494
- */
2495
2227
  drainExits(vtxoIds: Array<string>, address: string, feeRateSatPerVb: /*u64*/ bigint | undefined, asyncOpts_?: {
2496
2228
  signal: AbortSignal;
2497
2229
  }): Promise<ExitClaimTransaction>;
2498
- /**
2499
- * Estimate the fee for an arkoor payment
2500
- *
2501
- * # Arguments
2502
- *
2503
- * * `amount_sats` - Amount to send in sats
2504
- */
2505
2230
  estimateArkoorPaymentFee(amountSats: bigint, asyncOpts_?: {
2506
2231
  signal: AbortSignal;
2507
2232
  }): Promise<FeeEstimate>;
2508
- /**
2509
- * Estimate the fee for a board operation
2510
- *
2511
- * # Arguments
2512
- *
2513
- * * `amount_sats` - Amount to board in sats
2514
- */
2515
2233
  estimateBoardFee(amountSats: bigint, asyncOpts_?: {
2516
2234
  signal: AbortSignal;
2517
2235
  }): Promise<FeeEstimate>;
2518
- /**
2519
- * Estimate the fee for a lightning receive
2520
- *
2521
- * # Arguments
2522
- *
2523
- * * `amount_sats` - Amount to receive in sats
2524
- */
2525
2236
  estimateLightningReceiveFee(amountSats: bigint, asyncOpts_?: {
2526
2237
  signal: AbortSignal;
2527
2238
  }): Promise<FeeEstimate>;
2528
- /**
2529
- * Estimate the fee for a lightning send
2530
- *
2531
- * # Arguments
2532
- *
2533
- * * `amount_sats` - Amount to send in sats
2534
- */
2535
2239
  estimateLightningSendFee(amountSats: bigint, asyncOpts_?: {
2536
2240
  signal: AbortSignal;
2537
2241
  }): Promise<FeeEstimate>;
2538
- /**
2539
- * Estimate the fee for offboarding all spendable VTXOs
2540
- *
2541
- * # Arguments
2542
- *
2543
- * * `address` - Destination address for the offboard
2544
- */
2545
2242
  estimateOffboardAllFee(address: string, asyncOpts_?: {
2546
2243
  signal: AbortSignal;
2547
2244
  }): Promise<FeeEstimate>;
2548
- /**
2549
- * Estimate the fee for an offboard operation
2550
- *
2551
- * # Arguments
2552
- *
2553
- * * `address` - Destination address for the offboard
2554
- * * `vtxo_ids` - VTXOs to offboard
2555
- */
2556
2245
  estimateOffboardFee(address: string, vtxoIds: Array<string>, asyncOpts_?: {
2557
2246
  signal: AbortSignal;
2558
2247
  }): Promise<FeeEstimate>;
2559
- /**
2560
- * Estimate the fee for a refresh operation
2561
- *
2562
- * # Arguments
2563
- *
2564
- * * `vtxo_ids` - VTXOs to refresh
2565
- */
2566
2248
  estimateRefreshFee(vtxoIds: Array<string>, asyncOpts_?: {
2567
2249
  signal: AbortSignal;
2568
2250
  }): Promise<FeeEstimate>;
2569
- /**
2570
- * Estimate the fee for a send onchain operation
2571
- *
2572
- * # Arguments
2573
- *
2574
- * * `address` - Destination address
2575
- * * `amount_sats` - Amount to send in sats
2576
- */
2577
2251
  estimateSendOnchainFee(address: string, amountSats: bigint, asyncOpts_?: {
2578
2252
  signal: AbortSignal;
2579
2253
  }): Promise<FeeEstimate>;
2580
- /**
2581
- * Get the wallet's BIP32 fingerprint
2582
- */
2583
2254
  fingerprint(): string;
2584
- /**
2585
- * Get detailed exit status for a specific VTXO
2586
- *
2587
- * Returns detailed status including current state, history, and transactions.
2588
- *
2589
- * # Arguments
2590
- *
2591
- * * `vtxo_id` - The VTXO ID to check
2592
- * * `include_history` - Whether to include full state machine history
2593
- * * `include_transactions` - Whether to include transaction details
2594
- */
2595
2255
  getExitStatus(vtxoId: string, includeHistory: boolean, includeTransactions: boolean, asyncOpts_?: {
2596
2256
  signal: AbortSignal;
2597
2257
  }): Promise<ExitTransactionStatus | undefined>;
2598
- /**
2599
- * Get all VTXOs currently in exit process
2600
- */
2601
2258
  getExitVtxos(asyncOpts_?: {
2602
2259
  signal: AbortSignal;
2603
2260
  }): Promise<Array<ExitVtxo>>;
2604
- /**
2605
- * Get VTXOs expiring within threshold blocks
2606
- */
2607
2261
  getExpiringVtxos(thresholdBlocks: number, asyncOpts_?: {
2608
2262
  signal: AbortSignal;
2609
2263
  }): Promise<Array<Vtxo>>;
2610
- /**
2611
- * Get the block height of the first expiring VTXO
2612
- *
2613
- * Returns null if there are no spendable VTXOs.
2614
- */
2615
2264
  getFirstExpiringVtxoBlockheight(asyncOpts_?: {
2616
2265
  signal: AbortSignal;
2617
2266
  }): Promise</*u32*/ /*u32*/ number | undefined>;
2618
- /**
2619
- * Get the next block height when a refresh should be performed
2620
- *
2621
- * This is calculated as the first expiring VTXO height minus the refresh threshold.
2622
- * Returns null if there are no VTXOs to refresh.
2623
- */
2624
2267
  getNextRequiredRefreshBlockheight(asyncOpts_?: {
2625
2268
  signal: AbortSignal;
2626
2269
  }): Promise</*u32*/ /*u32*/ number | undefined>;
2627
- /**
2628
- * Get a specific VTXO by ID
2629
- */
2630
2270
  getVtxoById(vtxoId: string, asyncOpts_?: {
2631
2271
  signal: AbortSignal;
2632
2272
  }): Promise<Vtxo>;
2633
- /**
2634
- * Get VTXOs that should be refreshed
2635
- */
2636
2273
  getVtxosToRefresh(asyncOpts_?: {
2637
2274
  signal: AbortSignal;
2638
2275
  }): Promise<Array<Vtxo>>;
2639
- /**
2640
- * Check if any exits are pending
2641
- */
2642
2276
  hasPendingExits(asyncOpts_?: {
2643
2277
  signal: AbortSignal;
2644
2278
  }): Promise<boolean>;
2645
- /**
2646
- * Get all wallet movements (transaction history)
2647
- */
2648
2279
  history(asyncOpts_?: {
2649
2280
  signal: AbortSignal;
2650
2281
  }): Promise<Array<Movement>>;
2651
- /**
2652
- * Get wallet movements filtered by payment method
2653
- *
2654
- * # Arguments
2655
- *
2656
- * * `payment_method_type` - Type (e.g. "ark", "bitcoin", "invoice", "offer", "lightning_address", "custom")
2657
- * * `payment_method_value` - Value (e.g. an address or invoice string)
2658
- */
2659
2282
  historyByPaymentMethod(paymentMethodType: string, paymentMethodValue: string, asyncOpts_?: {
2660
2283
  signal: AbortSignal;
2661
2284
  }): Promise<Array<Movement>>;
2662
- /**
2663
- * Import a serialized VTXO into the wallet
2664
- *
2665
- * Allows recovering VTXOs by importing their serialized form.
2666
- * The VTXO data should be base64-encoded.
2667
- *
2668
- * # Arguments
2669
- *
2670
- * * `vtxo_base64` - Base64-encoded serialized VTXO
2671
- */
2672
2285
  importVtxo(vtxoBase64: string, asyncOpts_?: {
2673
2286
  signal: AbortSignal;
2674
2287
  }): Promise<void>;
2675
- /**
2676
- * Get lightning receive status by payment hash
2677
- *
2678
- * # Arguments
2679
- *
2680
- * * `payment_hash` - Payment hash as hex string
2681
- */
2682
2288
  lightningReceiveStatus(paymentHash: string, asyncOpts_?: {
2683
2289
  signal: AbortSignal;
2684
2290
  }): Promise<LightningReceive | undefined>;
2685
- /**
2686
- * List all exits that are claimable
2687
- *
2688
- * Returns exits ready to be drained to onchain wallet.
2689
- */
2690
2291
  listClaimableExits(asyncOpts_?: {
2691
2292
  signal: AbortSignal;
2692
2293
  }): Promise<Array<ExitVtxo>>;
2693
- /**
2694
- * Create a new authorization for your server mailbox
2695
- *
2696
- * This generates an authorization token that can be used to manage
2697
- * your server mailbox. Useful for delegating mailbox access.
2698
- *
2699
- * Returns the mailbox authorization as a hex-encoded string.
2700
- */
2701
2294
  mailboxAuthorization(): string;
2702
- /**
2703
- * Get the mailbox identifier for push notifications
2704
- *
2705
- * This identifier can be registered with a push notification service
2706
- * to receive alerts when VTXOs arrive in your mailbox. The mailbox
2707
- * receives all incoming VTXOs regardless of source (arkoor payments,
2708
- * Lightning receives, or round outputs).
2709
- *
2710
- * Returns the mailbox identifier as a hex-encoded public key.
2711
- */
2712
2295
  mailboxIdentifier(): string;
2713
2296
  maintenance(asyncOpts_?: {
2714
2297
  signal: AbortSignal;
2715
2298
  }): Promise<void>;
2716
- /**
2717
- * Perform maintenance in delegated (non-interactive) mode
2718
- *
2719
- * This schedules refresh operations but doesn't wait for completion.
2720
- * Use this when you want to queue operations without blocking.
2721
- */
2722
2299
  maintenanceDelegated(asyncOpts_?: {
2723
2300
  signal: AbortSignal;
2724
2301
  }): Promise<void>;
2725
- /**
2726
- * Perform maintenance refresh
2727
- */
2728
2302
  maintenanceRefresh(asyncOpts_?: {
2729
2303
  signal: AbortSignal;
2730
2304
  }): Promise<string | undefined>;
2731
- /**
2732
- * Full maintenance including onchain wallet sync
2733
- *
2734
- * More thorough than maintenance() - also syncs onchain wallet and exits.
2735
- */
2736
2305
  maintenanceWithOnchain(onchainWallet: OnchainWalletLike, asyncOpts_?: {
2737
2306
  signal: AbortSignal;
2738
2307
  }): Promise<void>;
2739
- /**
2740
- * Perform maintenance with onchain wallet in delegated mode
2741
- */
2742
2308
  maintenanceWithOnchainDelegated(onchainWallet: OnchainWalletLike, asyncOpts_?: {
2743
2309
  signal: AbortSignal;
2744
2310
  }): Promise<void>;
2745
- /**
2746
- * Schedule a maintenance refresh if VTXOs need refreshing
2747
- *
2748
- * Returns the round ID if a refresh was scheduled, null otherwise.
2749
- */
2750
2311
  maybeScheduleMaintenanceRefresh(asyncOpts_?: {
2751
2312
  signal: AbortSignal;
2752
2313
  }): Promise</*u32*/ /*u32*/ number | undefined>;
2753
- /**
2754
- * Get the Bitcoin network this wallet is using
2755
- */
2756
2314
  network(asyncOpts_?: {
2757
2315
  signal: AbortSignal;
2758
2316
  }): Promise<Network>;
2759
2317
  newAddress(asyncOpts_?: {
2760
2318
  signal: AbortSignal;
2761
2319
  }): Promise<string>;
2762
- /**
2763
- * Generate a new address and return it with its index
2764
- */
2765
2320
  newAddressWithIndex(asyncOpts_?: {
2766
2321
  signal: AbortSignal;
2767
2322
  }): Promise<AddressWithIndex>;
2768
- /**
2769
- * Get the timestamp when the next round will start (Unix timestamp in seconds)
2770
- * Returns an error if the server hasn't provided round timing info
2771
- */
2772
2323
  nextRoundStartTime(asyncOpts_?: {
2773
2324
  signal: AbortSignal;
2774
2325
  }): Promise</*u64*/ bigint>;
2775
- /**
2776
- * Get a pull-based notification holder for this wallet.
2777
- *
2778
- * Call `next_notification()` in a loop to receive events.
2779
- * Call `cancel_next_notification_wait()` to unblock a pending wait without
2780
- * destroying the stream.
2781
- */
2782
2326
  notifications(): NotificationHolderLike;
2783
2327
  offboardAll(bitcoinAddress: string, asyncOpts_?: {
2784
2328
  signal: AbortSignal;
2785
2329
  }): Promise<OffboardResult>;
2786
- /**
2787
- * Offboard specific VTXOs to a Bitcoin address
2788
- */
2789
2330
  offboardVtxos(vtxoIds: Array<string>, bitcoinAddress: string, asyncOpts_?: {
2790
2331
  signal: AbortSignal;
2791
2332
  }): Promise<string>;
2333
+ /**
2334
+ * Pay to a Lightning Address (LNURL). UniFFI-only — lnurl-rs is not wasm-compatible.
2335
+ */
2792
2336
  payLightningAddress(lightningAddress: string, amountSats: bigint, comment: string | undefined, asyncOpts_?: {
2793
2337
  signal: AbortSignal;
2794
2338
  }): Promise<LightningSend>;
2795
2339
  payLightningInvoice(invoice: string, amountSats: /*u64*/ bigint | undefined, asyncOpts_?: {
2796
2340
  signal: AbortSignal;
2797
2341
  }): Promise<LightningSend>;
2798
- /**
2799
- * Pay a BOLT12 lightning offer
2800
- *
2801
- * # Arguments
2802
- *
2803
- * * `offer` - BOLT12 offer string
2804
- * * `amount_sats` - Optional amount in sats (required if offer doesn't specify amount)
2805
- */
2806
2342
  payLightningOffer(offer: string, amountSats: /*u64*/ bigint | undefined, asyncOpts_?: {
2807
2343
  signal: AbortSignal;
2808
2344
  }): Promise<LightningSend>;
2809
- /**
2810
- * DEPRECATED: use `peek_address` instead
2811
- */
2812
- peakAddress(index: number, asyncOpts_?: {
2813
- signal: AbortSignal;
2814
- }): Promise<string>;
2815
- /**
2816
- * Peek at an address at a specific index
2817
- */
2818
2345
  peekAddress(index: number, asyncOpts_?: {
2819
2346
  signal: AbortSignal;
2820
2347
  }): Promise<string>;
2821
- /**
2822
- * Get all VTXOs that are part of pending boards
2823
- */
2824
2348
  pendingBoardVtxos(asyncOpts_?: {
2825
2349
  signal: AbortSignal;
2826
2350
  }): Promise<Array<Vtxo>>;
2827
- /**
2828
- * Get all pending board operations
2829
- */
2830
2351
  pendingBoards(asyncOpts_?: {
2831
2352
  signal: AbortSignal;
2832
2353
  }): Promise<Array<PendingBoard>>;
2833
- /**
2834
- * Get total amount in pending exits (sats)
2835
- */
2836
2354
  pendingExitsTotalSats(asyncOpts_?: {
2837
2355
  signal: AbortSignal;
2838
2356
  }): Promise</*u64*/ bigint>;
2839
- /**
2840
- * Get all pending lightning receives
2841
- */
2842
2357
  pendingLightningReceives(asyncOpts_?: {
2843
2358
  signal: AbortSignal;
2844
2359
  }): Promise<Array<LightningReceive>>;
2845
- /**
2846
- * Get VTXOs locked in pending Lightning sends
2847
- */
2848
2360
  pendingLightningSendVtxos(asyncOpts_?: {
2849
2361
  signal: AbortSignal;
2850
2362
  }): Promise<Array<Vtxo>>;
2851
- /**
2852
- * Get all pending lightning sends
2853
- */
2854
2363
  pendingLightningSends(asyncOpts_?: {
2855
2364
  signal: AbortSignal;
2856
2365
  }): Promise<Array<LightningSend>>;
2857
- /**
2858
- * Get VTXOs being used as inputs in pending rounds
2859
- */
2860
2366
  pendingRoundInputVtxos(asyncOpts_?: {
2861
2367
  signal: AbortSignal;
2862
2368
  }): Promise<Array<Vtxo>>;
2863
- /**
2864
- * Get all pending round states
2865
- */
2866
2369
  pendingRoundStates(asyncOpts_?: {
2867
2370
  signal: AbortSignal;
2868
2371
  }): Promise<Array<RoundState>>;
2869
- /**
2870
- * Progress unilateral exits (broadcast, fee bump, advance state machine)
2871
- *
2872
- * This is the critical method for actually moving exits forward.
2873
- * Call periodically after starting exits.
2874
- *
2875
- * # Arguments
2876
- *
2877
- * * `onchain_wallet` - Onchain wallet for building exit transactions
2878
- * * `fee_rate_sat_per_vb` - Optional fee rate override in sats/vB
2879
- */
2880
2372
  progressExits(onchainWallet: OnchainWalletLike, feeRateSatPerVb: /*u64*/ bigint | undefined, asyncOpts_?: {
2881
2373
  signal: AbortSignal;
2882
2374
  }): Promise<Array<ExitProgressStatus>>;
2883
- /**
2884
- * Progress pending rounds
2885
- *
2886
- * Advances the state of all pending rounds. Call periodically.
2887
- */
2888
2375
  progressPendingRounds(asyncOpts_?: {
2889
2376
  signal: AbortSignal;
2890
2377
  }): Promise<void>;
2891
- /**
2892
- * Get wallet properties
2893
- */
2894
2378
  properties(asyncOpts_?: {
2895
2379
  signal: AbortSignal;
2896
2380
  }): Promise<WalletProperties>;
2897
- /**
2898
- * Refresh the Ark server connection
2899
- *
2900
- * Re-establishes connection if it was lost.
2901
- */
2902
2381
  refreshServer(asyncOpts_?: {
2903
2382
  signal: AbortSignal;
2904
2383
  }): Promise<void>;
2905
- /**
2906
- * Refresh specific VTXOs
2907
- */
2908
2384
  refreshVtxos(vtxoIds: Array<string>, asyncOpts_?: {
2909
2385
  signal: AbortSignal;
2910
2386
  }): Promise<string | undefined>;
2911
- /**
2912
- * Refresh VTXOs in delegated (non-interactive) mode
2913
- *
2914
- * Returns the round state if a refresh was scheduled, null otherwise.
2915
- */
2916
2387
  refreshVtxosDelegated(vtxoIds: Array<string>, asyncOpts_?: {
2917
2388
  signal: AbortSignal;
2918
2389
  }): Promise<RoundState | undefined>;
2919
- /**
2920
- * Start a background daemon for the wallet.
2921
- *
2922
- * The daemon performs periodic syncs, exit progression and other
2923
- * background work. It is stopped automatically when the wallet is dropped.
2924
- * Callback-based onchain wallets are not supported for daemon mode and the
2925
- * daemon will run without onchain capabilities in that case.
2926
- * Calling this multiple times stops the previous daemon and starts a new one.
2927
- */
2928
2390
  runDaemon(onchainWallet: OnchainWalletLike | undefined, asyncOpts_?: {
2929
2391
  signal: AbortSignal;
2930
2392
  }): Promise<void>;
@@ -2934,88 +2396,36 @@ export interface WalletLike {
2934
2396
  sendOnchain(address: string, amountSats: bigint, asyncOpts_?: {
2935
2397
  signal: AbortSignal;
2936
2398
  }): Promise<string>;
2937
- /**
2938
- * Sign exit claim inputs in an external PSBT
2939
- *
2940
- * This is useful if you want to combine exit claims with other inputs
2941
- * in a single transaction.
2942
- *
2943
- * # Arguments
2944
- *
2945
- * * `psbt_base64` - Base64-encoded PSBT to sign
2946
- *
2947
- * Returns the signed PSBT
2948
- */
2949
2399
  signExitClaimInputs(psbtBase64: string, asyncOpts_?: {
2950
2400
  signal: AbortSignal;
2951
2401
  }): Promise<string>;
2952
- /**
2953
- * Get all spendable VTXOs
2954
- */
2955
2402
  spendableVtxos(asyncOpts_?: {
2956
2403
  signal: AbortSignal;
2957
2404
  }): Promise<Array<Vtxo>>;
2958
- /**
2959
- * Start unilateral exit for the entire wallet
2960
- */
2961
2405
  startExitForEntireWallet(asyncOpts_?: {
2962
2406
  signal: AbortSignal;
2963
2407
  }): Promise<void>;
2964
- /**
2965
- * Start unilateral exit for specific VTXOs
2966
- *
2967
- * Marks specific VTXOs for exit. Call progress_exits() to actually advance them.
2968
- */
2969
2408
  startExitForVtxos(vtxoIds: Array<string>, asyncOpts_?: {
2970
2409
  signal: AbortSignal;
2971
2410
  }): Promise<void>;
2972
- /**
2973
- * Stop the running daemon if any. No-op otherwise.
2974
- */
2975
2411
  stopDaemon(asyncOpts_?: {
2976
2412
  signal: AbortSignal;
2977
2413
  }): Promise<void>;
2978
- /**
2979
- * Lightweight sync with Ark server and blockchain
2980
- * Note: Bark's sync() handles errors internally with logging.
2981
- * The Throws annotation is for forward compatibility only.
2982
- */
2983
2414
  sync(asyncOpts_?: {
2984
2415
  signal: AbortSignal;
2985
2416
  }): Promise<void>;
2986
- /**
2987
- * Sync exit state (checks status but doesn't progress)
2988
- */
2989
2417
  syncExits(onchainWallet: OnchainWalletLike, asyncOpts_?: {
2990
2418
  signal: AbortSignal;
2991
2419
  }): Promise<void>;
2992
- /**
2993
- * Sync pending board transactions
2994
- */
2995
2420
  syncPendingBoards(asyncOpts_?: {
2996
2421
  signal: AbortSignal;
2997
2422
  }): Promise<void>;
2998
2423
  tryClaimAllLightningReceives(wait: boolean, asyncOpts_?: {
2999
2424
  signal: AbortSignal;
3000
- }): Promise<Array<LightningReceive>>;
3001
- /**
3002
- * Try to claim a specific lightning receive by payment hash
3003
- *
3004
- * # Arguments
3005
- *
3006
- * * `payment_hash` - Payment hash as hex string
3007
- * * `wait` - Whether to wait for claim to complete
3008
- */
2425
+ }): Promise<Array<LightningReceive>>;
3009
2426
  tryClaimLightningReceive(paymentHash: string, wait: boolean, asyncOpts_?: {
3010
2427
  signal: AbortSignal;
3011
2428
  }): Promise<void>;
3012
- /**
3013
- * Validate an Ark address against the connected server
3014
- *
3015
- * This performs full validation including checking if the address
3016
- * belongs to the currently connected Ark server.
3017
- * For basic format validation only, use validate_ark_address() instead.
3018
- */
3019
2429
  validateArkoorAddress(address: string, asyncOpts_?: {
3020
2430
  signal: AbortSignal;
3021
2431
  }): Promise<boolean>;
@@ -3028,596 +2438,244 @@ export interface WalletLike {
3028
2438
  */
3029
2439
  export type WalletInterface = WalletLike;
3030
2440
  /**
3031
- * The main Bark wallet interface for Ark operations
2441
+ * UniFFI-facing Bark wallet.
2442
+ *
2443
+ * Wraps `core::Wallet` and adds:
2444
+ * - `run_async` runtime offload on every entry point
2445
+ * - mailbox processor task + cancellation on drop
2446
+ * - LNURL `pay_lightning_address`
2447
+ * - Daemon control methods
2448
+ * - Notification holder
2449
+ * - Callback onchain dispatch
3032
2450
  */
3033
2451
  export declare class Wallet extends UniffiAbstractObject implements WalletLike {
3034
2452
  readonly [uniffiTypeNameSymbol] = "Wallet";
3035
2453
  readonly [destructorGuardSymbol]: UniffiGcObject;
3036
2454
  readonly [pointerLiteralSymbol]: UniffiHandle;
3037
2455
  private constructor();
3038
- /**
3039
- * Create a new Bark wallet
3040
- */
3041
2456
  static create(mnemonic: string, config: Config, datadir: string, forceRescan: boolean, asyncOpts_?: {
3042
2457
  signal: AbortSignal;
3043
2458
  }): Promise<WalletLike>;
3044
- /**
3045
- * Create a new Bark wallet WITH onchain capabilities
3046
- */
3047
2459
  static createWithOnchain(mnemonic: string, config: Config, datadir: string, onchainWallet: OnchainWalletLike, forceRescan: boolean, asyncOpts_?: {
3048
2460
  signal: AbortSignal;
3049
2461
  }): Promise<WalletLike>;
3050
- /**
3051
- * Open an existing Bark wallet
3052
- */
3053
2462
  static open(mnemonic: string, config: Config, datadir: string, asyncOpts_?: {
3054
2463
  signal: AbortSignal;
3055
2464
  }): Promise<WalletLike>;
3056
2465
  /**
3057
- * Open an existing Bark wallet and start running the daemon,
3058
- * optionally with onchain capabilities.
3059
- *
3060
- * The daemon runs in the background and is stopped when the wallet is dropped.
3061
- * Callback-based onchain wallets are not supported for daemon mode and the
3062
- * wallet will be opened without onchain capabilities in that case.
2466
+ * Open an existing wallet and start running the daemon.
3063
2467
  */
3064
2468
  static openWithDaemon(mnemonic: string, config: Config, datadir: string, onchainWallet: OnchainWalletLike | undefined, asyncOpts_?: {
3065
2469
  signal: AbortSignal;
3066
2470
  }): Promise<WalletLike>;
3067
- /**
3068
- * Open an existing Bark wallet WITH onchain capabilities
3069
- */
3070
2471
  static openWithOnchain(mnemonic: string, config: Config, datadir: string, onchainWallet: OnchainWalletLike, asyncOpts_?: {
3071
2472
  signal: AbortSignal;
3072
2473
  }): Promise<WalletLike>;
3073
- /**
3074
- * Get earliest block height when all exits will be claimable
3075
- *
3076
- * Returns null if no exits or any exit has undetermined claimability.
3077
- */
3078
2474
  allExitsClaimableAtHeight(asyncOpts_?: {
3079
2475
  signal: AbortSignal;
3080
2476
  }): Promise</*u32*/ /*u32*/ number | undefined>;
3081
- /**
3082
- * Get all VTXOs (including spent)
3083
- */
3084
2477
  allVtxos(asyncOpts_?: {
3085
2478
  signal: AbortSignal;
3086
2479
  }): Promise<Array<Vtxo>>;
3087
- /**
3088
- * Get Ark server info (null if not connected)
3089
- */
3090
2480
  arkInfo(asyncOpts_?: {
3091
2481
  signal: AbortSignal;
3092
2482
  }): Promise<ArkInfo | undefined>;
3093
2483
  balance(asyncOpts_?: {
3094
2484
  signal: AbortSignal;
3095
2485
  }): Promise<Balance>;
3096
- /**
3097
- * Board all funds from onchain wallet into Ark
3098
- */
3099
2486
  boardAll(onchainWallet: OnchainWalletLike, asyncOpts_?: {
3100
2487
  signal: AbortSignal;
3101
2488
  }): Promise<PendingBoard>;
3102
- /**
3103
- * Board a specific amount from onchain wallet into Ark
3104
- */
3105
2489
  boardAmount(onchainWallet: OnchainWalletLike, amountSats: bigint, asyncOpts_?: {
3106
2490
  signal: AbortSignal;
3107
2491
  }): Promise<PendingBoard>;
3108
2492
  bolt11Invoice(amountSats: bigint, description: string | undefined, asyncOpts_?: {
3109
2493
  signal: AbortSignal;
3110
2494
  }): Promise<LightningInvoice>;
3111
- /**
3112
- * Broadcast a signed transaction to the Bitcoin network
3113
- *
3114
- * Takes a hex-encoded transaction and broadcasts it via the wallet's chain source.
3115
- * This is useful after extracting a transaction from a PSBT using extract_tx_from_psbt.
3116
- *
3117
- * # Arguments
3118
- *
3119
- * * `tx_hex` - Hex-encoded signed transaction
3120
- *
3121
- * Returns the transaction ID (txid) of the broadcasted transaction
3122
- */
3123
2495
  broadcastTx(txHex: string, asyncOpts_?: {
3124
2496
  signal: AbortSignal;
3125
2497
  }): Promise<string>;
3126
- /**
3127
- * Cancel all pending rounds
3128
- */
3129
2498
  cancelAllPendingRounds(asyncOpts_?: {
3130
2499
  signal: AbortSignal;
3131
2500
  }): Promise<void>;
3132
- /**
3133
- * Cancel a pending lightning receive by payment hash
3134
- *
3135
- * Server will refuse if HTLCs already granted, preimage already revealed,
3136
- * or receive already finished.
3137
- *
3138
- * # Arguments
3139
- *
3140
- * * `payment_hash` - Payment hash as hex string
3141
- */
3142
2501
  cancelLightningReceive(paymentHash: string, asyncOpts_?: {
3143
2502
  signal: AbortSignal;
3144
2503
  }): Promise<void>;
3145
- /**
3146
- * Cancel a specific pending round
3147
- */
3148
2504
  cancelPendingRound(roundId: number, asyncOpts_?: {
3149
2505
  signal: AbortSignal;
3150
2506
  }): Promise<void>;
3151
- /**
3152
- * Check lightning payment status by payment hash
3153
- *
3154
- * # Arguments
3155
- *
3156
- * * `payment_hash` - Payment hash as hex string
3157
- * * `wait` - Whether to wait for the payment to complete
3158
- *
3159
- * Returns the preimage if payment is successful, null if still pending
3160
- */
3161
2507
  checkLightningPayment(paymentHash: string, wait: boolean, asyncOpts_?: {
3162
2508
  signal: AbortSignal;
3163
2509
  }): Promise<string | undefined>;
3164
- /**
3165
- * Get claimable lightning receive balance
3166
- */
3167
2510
  claimableLightningReceiveBalanceSats(asyncOpts_?: {
3168
2511
  signal: AbortSignal;
3169
2512
  }): Promise</*u64*/ bigint>;
3170
- /**
3171
- * Get wallet config
3172
- */
3173
2513
  config(asyncOpts_?: {
3174
2514
  signal: AbortSignal;
3175
2515
  }): Promise<Config>;
3176
- /**
3177
- * Drain claimable exits to an address
3178
- *
3179
- * Builds a signed PSBT that claims exited funds and sends them to the address.
3180
- * The PSBT can be broadcast directly or modified before broadcasting.
3181
- *
3182
- * # Arguments
3183
- *
3184
- * * `vtxo_ids` - List of claimable VTXO IDs to drain (empty = drain all)
3185
- * * `address` - Bitcoin address to send claimed funds to
3186
- * * `fee_rate_sat_per_vb` - Optional fee rate override in sats/vB
3187
- */
3188
2516
  drainExits(vtxoIds: Array<string>, address: string, feeRateSatPerVb: /*u64*/ bigint | undefined, asyncOpts_?: {
3189
2517
  signal: AbortSignal;
3190
2518
  }): Promise<ExitClaimTransaction>;
3191
- /**
3192
- * Estimate the fee for an arkoor payment
3193
- *
3194
- * # Arguments
3195
- *
3196
- * * `amount_sats` - Amount to send in sats
3197
- */
3198
2519
  estimateArkoorPaymentFee(amountSats: bigint, asyncOpts_?: {
3199
2520
  signal: AbortSignal;
3200
2521
  }): Promise<FeeEstimate>;
3201
- /**
3202
- * Estimate the fee for a board operation
3203
- *
3204
- * # Arguments
3205
- *
3206
- * * `amount_sats` - Amount to board in sats
3207
- */
3208
2522
  estimateBoardFee(amountSats: bigint, asyncOpts_?: {
3209
2523
  signal: AbortSignal;
3210
2524
  }): Promise<FeeEstimate>;
3211
- /**
3212
- * Estimate the fee for a lightning receive
3213
- *
3214
- * # Arguments
3215
- *
3216
- * * `amount_sats` - Amount to receive in sats
3217
- */
3218
2525
  estimateLightningReceiveFee(amountSats: bigint, asyncOpts_?: {
3219
2526
  signal: AbortSignal;
3220
2527
  }): Promise<FeeEstimate>;
3221
- /**
3222
- * Estimate the fee for a lightning send
3223
- *
3224
- * # Arguments
3225
- *
3226
- * * `amount_sats` - Amount to send in sats
3227
- */
3228
2528
  estimateLightningSendFee(amountSats: bigint, asyncOpts_?: {
3229
2529
  signal: AbortSignal;
3230
2530
  }): Promise<FeeEstimate>;
3231
- /**
3232
- * Estimate the fee for offboarding all spendable VTXOs
3233
- *
3234
- * # Arguments
3235
- *
3236
- * * `address` - Destination address for the offboard
3237
- */
3238
2531
  estimateOffboardAllFee(address: string, asyncOpts_?: {
3239
2532
  signal: AbortSignal;
3240
2533
  }): Promise<FeeEstimate>;
3241
- /**
3242
- * Estimate the fee for an offboard operation
3243
- *
3244
- * # Arguments
3245
- *
3246
- * * `address` - Destination address for the offboard
3247
- * * `vtxo_ids` - VTXOs to offboard
3248
- */
3249
2534
  estimateOffboardFee(address: string, vtxoIds: Array<string>, asyncOpts_?: {
3250
2535
  signal: AbortSignal;
3251
2536
  }): Promise<FeeEstimate>;
3252
- /**
3253
- * Estimate the fee for a refresh operation
3254
- *
3255
- * # Arguments
3256
- *
3257
- * * `vtxo_ids` - VTXOs to refresh
3258
- */
3259
2537
  estimateRefreshFee(vtxoIds: Array<string>, asyncOpts_?: {
3260
2538
  signal: AbortSignal;
3261
2539
  }): Promise<FeeEstimate>;
3262
- /**
3263
- * Estimate the fee for a send onchain operation
3264
- *
3265
- * # Arguments
3266
- *
3267
- * * `address` - Destination address
3268
- * * `amount_sats` - Amount to send in sats
3269
- */
3270
2540
  estimateSendOnchainFee(address: string, amountSats: bigint, asyncOpts_?: {
3271
2541
  signal: AbortSignal;
3272
2542
  }): Promise<FeeEstimate>;
3273
- /**
3274
- * Get the wallet's BIP32 fingerprint
3275
- */
3276
2543
  fingerprint(): string;
3277
- /**
3278
- * Get detailed exit status for a specific VTXO
3279
- *
3280
- * Returns detailed status including current state, history, and transactions.
3281
- *
3282
- * # Arguments
3283
- *
3284
- * * `vtxo_id` - The VTXO ID to check
3285
- * * `include_history` - Whether to include full state machine history
3286
- * * `include_transactions` - Whether to include transaction details
3287
- */
3288
2544
  getExitStatus(vtxoId: string, includeHistory: boolean, includeTransactions: boolean, asyncOpts_?: {
3289
2545
  signal: AbortSignal;
3290
2546
  }): Promise<ExitTransactionStatus | undefined>;
3291
- /**
3292
- * Get all VTXOs currently in exit process
3293
- */
3294
2547
  getExitVtxos(asyncOpts_?: {
3295
2548
  signal: AbortSignal;
3296
2549
  }): Promise<Array<ExitVtxo>>;
3297
- /**
3298
- * Get VTXOs expiring within threshold blocks
3299
- */
3300
2550
  getExpiringVtxos(thresholdBlocks: number, asyncOpts_?: {
3301
2551
  signal: AbortSignal;
3302
2552
  }): Promise<Array<Vtxo>>;
3303
- /**
3304
- * Get the block height of the first expiring VTXO
3305
- *
3306
- * Returns null if there are no spendable VTXOs.
3307
- */
3308
2553
  getFirstExpiringVtxoBlockheight(asyncOpts_?: {
3309
2554
  signal: AbortSignal;
3310
2555
  }): Promise</*u32*/ /*u32*/ number | undefined>;
3311
- /**
3312
- * Get the next block height when a refresh should be performed
3313
- *
3314
- * This is calculated as the first expiring VTXO height minus the refresh threshold.
3315
- * Returns null if there are no VTXOs to refresh.
3316
- */
3317
2556
  getNextRequiredRefreshBlockheight(asyncOpts_?: {
3318
2557
  signal: AbortSignal;
3319
2558
  }): Promise</*u32*/ /*u32*/ number | undefined>;
3320
- /**
3321
- * Get a specific VTXO by ID
3322
- */
3323
2559
  getVtxoById(vtxoId: string, asyncOpts_?: {
3324
2560
  signal: AbortSignal;
3325
2561
  }): Promise<Vtxo>;
3326
- /**
3327
- * Get VTXOs that should be refreshed
3328
- */
3329
2562
  getVtxosToRefresh(asyncOpts_?: {
3330
2563
  signal: AbortSignal;
3331
2564
  }): Promise<Array<Vtxo>>;
3332
- /**
3333
- * Check if any exits are pending
3334
- */
3335
2565
  hasPendingExits(asyncOpts_?: {
3336
2566
  signal: AbortSignal;
3337
2567
  }): Promise<boolean>;
3338
- /**
3339
- * Get all wallet movements (transaction history)
3340
- */
3341
2568
  history(asyncOpts_?: {
3342
2569
  signal: AbortSignal;
3343
2570
  }): Promise<Array<Movement>>;
3344
- /**
3345
- * Get wallet movements filtered by payment method
3346
- *
3347
- * # Arguments
3348
- *
3349
- * * `payment_method_type` - Type (e.g. "ark", "bitcoin", "invoice", "offer", "lightning_address", "custom")
3350
- * * `payment_method_value` - Value (e.g. an address or invoice string)
3351
- */
3352
2571
  historyByPaymentMethod(paymentMethodType: string, paymentMethodValue: string, asyncOpts_?: {
3353
2572
  signal: AbortSignal;
3354
2573
  }): Promise<Array<Movement>>;
3355
- /**
3356
- * Import a serialized VTXO into the wallet
3357
- *
3358
- * Allows recovering VTXOs by importing their serialized form.
3359
- * The VTXO data should be base64-encoded.
3360
- *
3361
- * # Arguments
3362
- *
3363
- * * `vtxo_base64` - Base64-encoded serialized VTXO
3364
- */
3365
2574
  importVtxo(vtxoBase64: string, asyncOpts_?: {
3366
2575
  signal: AbortSignal;
3367
2576
  }): Promise<void>;
3368
- /**
3369
- * Get lightning receive status by payment hash
3370
- *
3371
- * # Arguments
3372
- *
3373
- * * `payment_hash` - Payment hash as hex string
3374
- */
3375
2577
  lightningReceiveStatus(paymentHash: string, asyncOpts_?: {
3376
2578
  signal: AbortSignal;
3377
2579
  }): Promise<LightningReceive | undefined>;
3378
- /**
3379
- * List all exits that are claimable
3380
- *
3381
- * Returns exits ready to be drained to onchain wallet.
3382
- */
3383
2580
  listClaimableExits(asyncOpts_?: {
3384
2581
  signal: AbortSignal;
3385
2582
  }): Promise<Array<ExitVtxo>>;
3386
- /**
3387
- * Create a new authorization for your server mailbox
3388
- *
3389
- * This generates an authorization token that can be used to manage
3390
- * your server mailbox. Useful for delegating mailbox access.
3391
- *
3392
- * Returns the mailbox authorization as a hex-encoded string.
3393
- */
3394
2583
  mailboxAuthorization(): string;
3395
- /**
3396
- * Get the mailbox identifier for push notifications
3397
- *
3398
- * This identifier can be registered with a push notification service
3399
- * to receive alerts when VTXOs arrive in your mailbox. The mailbox
3400
- * receives all incoming VTXOs regardless of source (arkoor payments,
3401
- * Lightning receives, or round outputs).
3402
- *
3403
- * Returns the mailbox identifier as a hex-encoded public key.
3404
- */
3405
2584
  mailboxIdentifier(): string;
3406
2585
  maintenance(asyncOpts_?: {
3407
2586
  signal: AbortSignal;
3408
2587
  }): Promise<void>;
3409
- /**
3410
- * Perform maintenance in delegated (non-interactive) mode
3411
- *
3412
- * This schedules refresh operations but doesn't wait for completion.
3413
- * Use this when you want to queue operations without blocking.
3414
- */
3415
2588
  maintenanceDelegated(asyncOpts_?: {
3416
2589
  signal: AbortSignal;
3417
2590
  }): Promise<void>;
3418
- /**
3419
- * Perform maintenance refresh
3420
- */
3421
2591
  maintenanceRefresh(asyncOpts_?: {
3422
2592
  signal: AbortSignal;
3423
2593
  }): Promise<string | undefined>;
3424
- /**
3425
- * Full maintenance including onchain wallet sync
3426
- *
3427
- * More thorough than maintenance() - also syncs onchain wallet and exits.
3428
- */
3429
2594
  maintenanceWithOnchain(onchainWallet: OnchainWalletLike, asyncOpts_?: {
3430
2595
  signal: AbortSignal;
3431
2596
  }): Promise<void>;
3432
- /**
3433
- * Perform maintenance with onchain wallet in delegated mode
3434
- */
3435
2597
  maintenanceWithOnchainDelegated(onchainWallet: OnchainWalletLike, asyncOpts_?: {
3436
2598
  signal: AbortSignal;
3437
2599
  }): Promise<void>;
3438
- /**
3439
- * Schedule a maintenance refresh if VTXOs need refreshing
3440
- *
3441
- * Returns the round ID if a refresh was scheduled, null otherwise.
3442
- */
3443
2600
  maybeScheduleMaintenanceRefresh(asyncOpts_?: {
3444
2601
  signal: AbortSignal;
3445
2602
  }): Promise</*u32*/ /*u32*/ number | undefined>;
3446
- /**
3447
- * Get the Bitcoin network this wallet is using
3448
- */
3449
2603
  network(asyncOpts_?: {
3450
2604
  signal: AbortSignal;
3451
2605
  }): Promise<Network>;
3452
2606
  newAddress(asyncOpts_?: {
3453
2607
  signal: AbortSignal;
3454
2608
  }): Promise<string>;
3455
- /**
3456
- * Generate a new address and return it with its index
3457
- */
3458
2609
  newAddressWithIndex(asyncOpts_?: {
3459
2610
  signal: AbortSignal;
3460
2611
  }): Promise<AddressWithIndex>;
3461
- /**
3462
- * Get the timestamp when the next round will start (Unix timestamp in seconds)
3463
- * Returns an error if the server hasn't provided round timing info
3464
- */
3465
2612
  nextRoundStartTime(asyncOpts_?: {
3466
2613
  signal: AbortSignal;
3467
2614
  }): Promise</*u64*/ bigint>;
3468
- /**
3469
- * Get a pull-based notification holder for this wallet.
3470
- *
3471
- * Call `next_notification()` in a loop to receive events.
3472
- * Call `cancel_next_notification_wait()` to unblock a pending wait without
3473
- * destroying the stream.
3474
- */
3475
2615
  notifications(): NotificationHolderLike;
3476
2616
  offboardAll(bitcoinAddress: string, asyncOpts_?: {
3477
2617
  signal: AbortSignal;
3478
2618
  }): Promise<OffboardResult>;
3479
- /**
3480
- * Offboard specific VTXOs to a Bitcoin address
3481
- */
3482
2619
  offboardVtxos(vtxoIds: Array<string>, bitcoinAddress: string, asyncOpts_?: {
3483
2620
  signal: AbortSignal;
3484
2621
  }): Promise<string>;
2622
+ /**
2623
+ * Pay to a Lightning Address (LNURL). UniFFI-only — lnurl-rs is not wasm-compatible.
2624
+ */
3485
2625
  payLightningAddress(lightningAddress: string, amountSats: bigint, comment: string | undefined, asyncOpts_?: {
3486
2626
  signal: AbortSignal;
3487
2627
  }): Promise<LightningSend>;
3488
2628
  payLightningInvoice(invoice: string, amountSats: /*u64*/ bigint | undefined, asyncOpts_?: {
3489
2629
  signal: AbortSignal;
3490
2630
  }): Promise<LightningSend>;
3491
- /**
3492
- * Pay a BOLT12 lightning offer
3493
- *
3494
- * # Arguments
3495
- *
3496
- * * `offer` - BOLT12 offer string
3497
- * * `amount_sats` - Optional amount in sats (required if offer doesn't specify amount)
3498
- */
3499
2631
  payLightningOffer(offer: string, amountSats: /*u64*/ bigint | undefined, asyncOpts_?: {
3500
2632
  signal: AbortSignal;
3501
2633
  }): Promise<LightningSend>;
3502
- /**
3503
- * DEPRECATED: use `peek_address` instead
3504
- */
3505
- peakAddress(index: number, asyncOpts_?: {
3506
- signal: AbortSignal;
3507
- }): Promise<string>;
3508
- /**
3509
- * Peek at an address at a specific index
3510
- */
3511
2634
  peekAddress(index: number, asyncOpts_?: {
3512
2635
  signal: AbortSignal;
3513
2636
  }): Promise<string>;
3514
- /**
3515
- * Get all VTXOs that are part of pending boards
3516
- */
3517
2637
  pendingBoardVtxos(asyncOpts_?: {
3518
2638
  signal: AbortSignal;
3519
2639
  }): Promise<Array<Vtxo>>;
3520
- /**
3521
- * Get all pending board operations
3522
- */
3523
2640
  pendingBoards(asyncOpts_?: {
3524
2641
  signal: AbortSignal;
3525
2642
  }): Promise<Array<PendingBoard>>;
3526
- /**
3527
- * Get total amount in pending exits (sats)
3528
- */
3529
2643
  pendingExitsTotalSats(asyncOpts_?: {
3530
2644
  signal: AbortSignal;
3531
2645
  }): Promise</*u64*/ bigint>;
3532
- /**
3533
- * Get all pending lightning receives
3534
- */
3535
2646
  pendingLightningReceives(asyncOpts_?: {
3536
2647
  signal: AbortSignal;
3537
2648
  }): Promise<Array<LightningReceive>>;
3538
- /**
3539
- * Get VTXOs locked in pending Lightning sends
3540
- */
3541
2649
  pendingLightningSendVtxos(asyncOpts_?: {
3542
2650
  signal: AbortSignal;
3543
2651
  }): Promise<Array<Vtxo>>;
3544
- /**
3545
- * Get all pending lightning sends
3546
- */
3547
2652
  pendingLightningSends(asyncOpts_?: {
3548
2653
  signal: AbortSignal;
3549
2654
  }): Promise<Array<LightningSend>>;
3550
- /**
3551
- * Get VTXOs being used as inputs in pending rounds
3552
- */
3553
2655
  pendingRoundInputVtxos(asyncOpts_?: {
3554
2656
  signal: AbortSignal;
3555
2657
  }): Promise<Array<Vtxo>>;
3556
- /**
3557
- * Get all pending round states
3558
- */
3559
2658
  pendingRoundStates(asyncOpts_?: {
3560
2659
  signal: AbortSignal;
3561
2660
  }): Promise<Array<RoundState>>;
3562
- /**
3563
- * Progress unilateral exits (broadcast, fee bump, advance state machine)
3564
- *
3565
- * This is the critical method for actually moving exits forward.
3566
- * Call periodically after starting exits.
3567
- *
3568
- * # Arguments
3569
- *
3570
- * * `onchain_wallet` - Onchain wallet for building exit transactions
3571
- * * `fee_rate_sat_per_vb` - Optional fee rate override in sats/vB
3572
- */
3573
2661
  progressExits(onchainWallet: OnchainWalletLike, feeRateSatPerVb: /*u64*/ bigint | undefined, asyncOpts_?: {
3574
2662
  signal: AbortSignal;
3575
2663
  }): Promise<Array<ExitProgressStatus>>;
3576
- /**
3577
- * Progress pending rounds
3578
- *
3579
- * Advances the state of all pending rounds. Call periodically.
3580
- */
3581
2664
  progressPendingRounds(asyncOpts_?: {
3582
2665
  signal: AbortSignal;
3583
2666
  }): Promise<void>;
3584
- /**
3585
- * Get wallet properties
3586
- */
3587
2667
  properties(asyncOpts_?: {
3588
2668
  signal: AbortSignal;
3589
2669
  }): Promise<WalletProperties>;
3590
- /**
3591
- * Refresh the Ark server connection
3592
- *
3593
- * Re-establishes connection if it was lost.
3594
- */
3595
2670
  refreshServer(asyncOpts_?: {
3596
2671
  signal: AbortSignal;
3597
2672
  }): Promise<void>;
3598
- /**
3599
- * Refresh specific VTXOs
3600
- */
3601
2673
  refreshVtxos(vtxoIds: Array<string>, asyncOpts_?: {
3602
2674
  signal: AbortSignal;
3603
2675
  }): Promise<string | undefined>;
3604
- /**
3605
- * Refresh VTXOs in delegated (non-interactive) mode
3606
- *
3607
- * Returns the round state if a refresh was scheduled, null otherwise.
3608
- */
3609
2676
  refreshVtxosDelegated(vtxoIds: Array<string>, asyncOpts_?: {
3610
2677
  signal: AbortSignal;
3611
2678
  }): Promise<RoundState | undefined>;
3612
- /**
3613
- * Start a background daemon for the wallet.
3614
- *
3615
- * The daemon performs periodic syncs, exit progression and other
3616
- * background work. It is stopped automatically when the wallet is dropped.
3617
- * Callback-based onchain wallets are not supported for daemon mode and the
3618
- * daemon will run without onchain capabilities in that case.
3619
- * Calling this multiple times stops the previous daemon and starts a new one.
3620
- */
3621
2679
  runDaemon(onchainWallet: OnchainWalletLike | undefined, asyncOpts_?: {
3622
2680
  signal: AbortSignal;
3623
2681
  }): Promise<void>;
@@ -3627,88 +2685,36 @@ export declare class Wallet extends UniffiAbstractObject implements WalletLike {
3627
2685
  sendOnchain(address: string, amountSats: bigint, asyncOpts_?: {
3628
2686
  signal: AbortSignal;
3629
2687
  }): Promise<string>;
3630
- /**
3631
- * Sign exit claim inputs in an external PSBT
3632
- *
3633
- * This is useful if you want to combine exit claims with other inputs
3634
- * in a single transaction.
3635
- *
3636
- * # Arguments
3637
- *
3638
- * * `psbt_base64` - Base64-encoded PSBT to sign
3639
- *
3640
- * Returns the signed PSBT
3641
- */
3642
2688
  signExitClaimInputs(psbtBase64: string, asyncOpts_?: {
3643
2689
  signal: AbortSignal;
3644
2690
  }): Promise<string>;
3645
- /**
3646
- * Get all spendable VTXOs
3647
- */
3648
2691
  spendableVtxos(asyncOpts_?: {
3649
2692
  signal: AbortSignal;
3650
2693
  }): Promise<Array<Vtxo>>;
3651
- /**
3652
- * Start unilateral exit for the entire wallet
3653
- */
3654
2694
  startExitForEntireWallet(asyncOpts_?: {
3655
2695
  signal: AbortSignal;
3656
2696
  }): Promise<void>;
3657
- /**
3658
- * Start unilateral exit for specific VTXOs
3659
- *
3660
- * Marks specific VTXOs for exit. Call progress_exits() to actually advance them.
3661
- */
3662
2697
  startExitForVtxos(vtxoIds: Array<string>, asyncOpts_?: {
3663
2698
  signal: AbortSignal;
3664
2699
  }): Promise<void>;
3665
- /**
3666
- * Stop the running daemon if any. No-op otherwise.
3667
- */
3668
2700
  stopDaemon(asyncOpts_?: {
3669
2701
  signal: AbortSignal;
3670
2702
  }): Promise<void>;
3671
- /**
3672
- * Lightweight sync with Ark server and blockchain
3673
- * Note: Bark's sync() handles errors internally with logging.
3674
- * The Throws annotation is for forward compatibility only.
3675
- */
3676
2703
  sync(asyncOpts_?: {
3677
2704
  signal: AbortSignal;
3678
2705
  }): Promise<void>;
3679
- /**
3680
- * Sync exit state (checks status but doesn't progress)
3681
- */
3682
2706
  syncExits(onchainWallet: OnchainWalletLike, asyncOpts_?: {
3683
2707
  signal: AbortSignal;
3684
2708
  }): Promise<void>;
3685
- /**
3686
- * Sync pending board transactions
3687
- */
3688
2709
  syncPendingBoards(asyncOpts_?: {
3689
2710
  signal: AbortSignal;
3690
2711
  }): Promise<void>;
3691
2712
  tryClaimAllLightningReceives(wait: boolean, asyncOpts_?: {
3692
2713
  signal: AbortSignal;
3693
2714
  }): Promise<Array<LightningReceive>>;
3694
- /**
3695
- * Try to claim a specific lightning receive by payment hash
3696
- *
3697
- * # Arguments
3698
- *
3699
- * * `payment_hash` - Payment hash as hex string
3700
- * * `wait` - Whether to wait for claim to complete
3701
- */
3702
2715
  tryClaimLightningReceive(paymentHash: string, wait: boolean, asyncOpts_?: {
3703
2716
  signal: AbortSignal;
3704
2717
  }): Promise<void>;
3705
- /**
3706
- * Validate an Ark address against the connected server
3707
- *
3708
- * This performs full validation including checking if the address
3709
- * belongs to the currently connected Ark server.
3710
- * For basic format validation only, use validate_ark_address() instead.
3711
- */
3712
2718
  validateArkoorAddress(address: string, asyncOpts_?: {
3713
2719
  signal: AbortSignal;
3714
2720
  }): Promise<boolean>;
@@ -3763,6 +2769,7 @@ declare const _default: Readonly<{
3763
2769
  lift(value: Uint8Array): BarkError;
3764
2770
  lower(value: BarkError): Uint8Array;
3765
2771
  };
2772
+ FfiConverterTypeBarkLogger: FfiConverterObjectWithCallbacks<BarkLogger>;
3766
2773
  FfiConverterTypeBlockRef: {
3767
2774
  read(from: RustBuffer): BlockRef;
3768
2775
  write(value: BlockRef, into: RustBuffer): void;
@@ -3784,6 +2791,7 @@ declare const _default: Readonly<{
3784
2791
  lift(value: Uint8Array): CpfpParams;
3785
2792
  lower(value: CpfpParams): Uint8Array;
3786
2793
  };
2794
+ FfiConverterTypeCustomOnchainWalletCallbacks: FfiConverterObjectWithCallbacks<CustomOnchainWalletCallbacks>;
3787
2795
  FfiConverterTypeDestination: {
3788
2796
  read(from: RustBuffer): Destination;
3789
2797
  write(value: Destination, into: RustBuffer): void;