@secondts/bark 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -15,11 +15,10 @@ export const onchainwallet_balance: (a: number) => number;
15
15
  export const onchainwallet_newAddress: (a: number) => number;
16
16
  export const onchainwallet_send: (a: number, b: number, c: number, d: number, e: number) => number;
17
17
  export const __wbg_wallet_free: (a: number, b: number) => void;
18
- export const wallet_create: (a: number) => number;
19
- export const wallet_open: (a: number) => number;
20
- export const wallet_createWithOnchain: (a: number, b: number) => number;
21
- export const wallet_openWithOnchain: (a: number, b: number) => number;
18
+ export const wallet_open: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
19
+ export const wallet_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
22
20
  export const wallet_sync: (a: number) => number;
21
+ export const wallet_syncForceExitedVtxos: (a: number) => number;
23
22
  export const wallet_maintenance: (a: number) => number;
24
23
  export const wallet_maintenanceWithOnchain: (a: number, b: number) => number;
25
24
  export const wallet_maintenanceDelegated: (a: number) => number;
@@ -92,7 +91,6 @@ export const wallet_progressPendingRounds: (a: number) => number;
92
91
  export const wallet_refreshServer: (a: number) => number;
93
92
  export const wallet_getFirstExpiringVtxoBlockheight: (a: number) => number;
94
93
  export const wallet_getNextRequiredRefreshBlockheight: (a: number) => number;
95
- export const wallet_maybeScheduleMaintenanceRefresh: (a: number) => number;
96
94
  export const wallet_broadcastTx: (a: number, b: number, c: number) => number;
97
95
  export const wallet_mailboxIdentifier: (a: number, b: number) => void;
98
96
  export const wallet_mailboxAuthorization: (a: number, b: number) => void;
@@ -127,16 +125,16 @@ export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
127
125
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
128
126
  export const rustsecp256k1_v0_10_0_default_illegal_callback_fn: (a: number, b: number) => void;
129
127
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
130
- export const __wasm_bindgen_func_elem_728: (a: number, b: number, c: number, d: number) => void;
131
- export const __wasm_bindgen_func_elem_15275: (a: number, b: number, c: number, d: number) => void;
132
- export const __wasm_bindgen_func_elem_738: (a: number, b: number, c: number, d: number) => void;
133
- export const __wasm_bindgen_func_elem_15278: (a: number, b: number, c: number) => number;
134
- export const __wasm_bindgen_func_elem_13590: (a: number, b: number, c: number) => void;
135
- export const __wasm_bindgen_func_elem_13288: (a: number, b: number, c: number) => void;
136
- export const __wasm_bindgen_func_elem_15277: (a: number, b: number, c: number) => void;
137
- export const __wasm_bindgen_func_elem_12867: (a: number, b: number) => void;
138
- export const __wasm_bindgen_func_elem_13744: (a: number, b: number) => void;
139
- export const __wasm_bindgen_func_elem_19152: (a: number, b: number) => void;
128
+ export const __wasm_bindgen_func_elem_732: (a: number, b: number, c: number, d: number) => void;
129
+ export const __wasm_bindgen_func_elem_15631: (a: number, b: number, c: number, d: number) => void;
130
+ export const __wasm_bindgen_func_elem_740: (a: number, b: number, c: number, d: number) => void;
131
+ export const __wasm_bindgen_func_elem_15633: (a: number, b: number, c: number) => number;
132
+ export const __wasm_bindgen_func_elem_13669: (a: number, b: number, c: number) => void;
133
+ export const __wasm_bindgen_func_elem_13382: (a: number, b: number, c: number) => void;
134
+ export const __wasm_bindgen_func_elem_15634: (a: number, b: number, c: number) => void;
135
+ export const __wasm_bindgen_func_elem_12963: (a: number, b: number) => void;
136
+ export const __wasm_bindgen_func_elem_13822: (a: number, b: number) => void;
137
+ export const __wasm_bindgen_func_elem_19550: (a: number, b: number) => void;
140
138
  export const __wbindgen_export: (a: number, b: number) => number;
141
139
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
142
140
  export const __wbindgen_export3: (a: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secondts/bark",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Bark FFI bindings for the browser via WebAssembly (IndexedDB persister)",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -58,5 +58,5 @@
58
58
  "registry": "https://registry.npmjs.org/",
59
59
  "access": "public"
60
60
  },
61
- "releaseTag": "v0.10.0+bark.0.2.5"
61
+ "releaseTag": "v0.11.0+bark-0.3.0"
62
62
  }
@@ -67,6 +67,40 @@ export interface ExitTransactionStatus {
67
67
  transactionCount: number;
68
68
  }
69
69
 
70
+ /**
71
+ * Optional arguments for [`Wallet::open`]
72
+ *
73
+ * Every field has a default, so callers only set what they need.
74
+ */
75
+ export interface OpenWalletArgs {
76
+ /**
77
+ * Whether to run the background daemon
78
+ *
79
+ * When disabled, you must manually call `Wallet::sync` to sync the wallet.
80
+ *
81
+ * Default: true
82
+ */
83
+ runDaemon?: boolean;
84
+ /**
85
+ * Optional name for IndexedDb
86
+ *
87
+ * Default: name based on wallet fingerprint
88
+ */
89
+ indexedDbName?: string;
90
+ /**
91
+ * Whether to create a new wallet if no wallet exists
92
+ *
93
+ * Default: true
94
+ */
95
+ createIfNotExists?: boolean;
96
+ /**
97
+ * Whether to create a new wallet even if the Ark server cannot be reached
98
+ *
99
+ * Default: false
100
+ */
101
+ createWithoutServer?: boolean;
102
+ }
103
+
70
104
  /**
71
105
  * Parameters for creating a CPFP (Child Pays For Parent) transaction
72
106
  */
@@ -149,7 +183,7 @@ export interface Bolt11InvoiceArgs {
149
183
 
150
184
  export interface CheckLightningPaymentArgs {
151
185
  paymentHash: string;
152
- wait: boolean;
186
+ wait?: boolean;
153
187
  }
154
188
 
155
189
  export interface Config {
@@ -160,7 +194,6 @@ export interface Config {
160
194
  bitcoindCookiefile?: string;
161
195
  bitcoindUser?: string;
162
196
  bitcoindPass?: string;
163
- network: Network;
164
197
  vtxoRefreshExpiryThreshold?: number;
165
198
  vtxoExitMargin?: number;
166
199
  htlcRecvClaimDelta?: number;
@@ -170,6 +203,7 @@ export interface Config {
170
203
  offboardRequiredConfirmations?: number;
171
204
  daemonManualSync?: boolean;
172
205
  lightningReceiveClaimRetries?: number;
206
+ userAgent?: string;
173
207
  }
174
208
 
175
209
  export interface DrainExitsArgs {
@@ -260,6 +294,7 @@ export interface OnchainBalance {
260
294
  }
261
295
 
262
296
  export interface OnchainWalletDefaultArgs {
297
+ network: Network;
263
298
  mnemonic: string;
264
299
  config: Config;
265
300
  dbName: string;
@@ -268,13 +303,13 @@ export interface OnchainWalletDefaultArgs {
268
303
  export interface PayLightningInvoiceArgs {
269
304
  invoice: string;
270
305
  amountSats?: number;
271
- wait: boolean;
306
+ wait?: boolean;
272
307
  }
273
308
 
274
309
  export interface PayLightningOfferArgs {
275
310
  offer: string;
276
311
  amountSats?: number;
277
- wait: boolean;
312
+ wait?: boolean;
278
313
  }
279
314
 
280
315
  export interface PendingBoard {
@@ -288,12 +323,12 @@ export interface ProgressExitsArgs {
288
323
  }
289
324
 
290
325
  export interface TryClaimAllLightningReceivesArgs {
291
- wait: boolean;
326
+ wait?: boolean;
292
327
  }
293
328
 
294
329
  export interface TryClaimLightningReceiveArgs {
295
330
  paymentHash: string;
296
- wait: boolean;
331
+ wait?: boolean;
297
332
  }
298
333
 
299
334
  export interface Vtxo {
@@ -314,19 +349,6 @@ export interface Vtxo {
314
349
  exitTxWeightWu: number;
315
350
  }
316
351
 
317
- export interface WalletCreateArgs {
318
- mnemonic: string;
319
- config: Config;
320
- dbName: string;
321
- forceRescan: boolean;
322
- }
323
-
324
- export interface WalletOpenArgs {
325
- mnemonic: string;
326
- config: Config;
327
- dbName: string;
328
- }
329
-
330
352
  export interface WalletProperties {
331
353
  network: Network;
332
354
  fingerprint: string;
@@ -427,9 +449,13 @@ export class Wallet {
427
449
  cancelPendingRound(roundId: number): Promise<void>;
428
450
  checkLightningPayment(args: CheckLightningPaymentArgs): Promise<LightningSendStatus>;
429
451
  claimableLightningReceiveBalanceSats(): Promise<number>;
430
- config(): Promise<Config>;
431
- static create(args: WalletCreateArgs): Promise<Wallet>;
432
- static createWithOnchain(onchainWallet: OnchainWallet, args: WalletCreateArgs): Promise<Wallet>;
452
+ config(): Config;
453
+ /**
454
+ * Low-level function to initialize a wallet
455
+ *
456
+ * You probably want to use [`Wallet::open`] instead.
457
+ */
458
+ static create(network: Network, mnemonic_or_seed: string, config: Config, indexedDbName: string | null | undefined, createWithoutServer: boolean): Promise<void>;
433
459
  drainExits(args: DrainExitsArgs): Promise<ExitClaimTransaction>;
434
460
  estimateArkoorPaymentFee(amountSats: number): Promise<FeeEstimate>;
435
461
  estimateBoardFee(amountSats: number): Promise<FeeEstimate>;
@@ -462,7 +488,6 @@ export class Wallet {
462
488
  maintenanceRefresh(): Promise<string | undefined>;
463
489
  maintenanceWithOnchain(onchainWallet: OnchainWallet): Promise<void>;
464
490
  maintenanceWithOnchainDelegated(onchainWallet: OnchainWallet): Promise<void>;
465
- maybeScheduleMaintenanceRefresh(): Promise<number | undefined>;
466
491
  network(): Promise<Network>;
467
492
  newAddress(): Promise<string>;
468
493
  newAddressWithIndex(): Promise<AddressWithIndex>;
@@ -470,8 +495,17 @@ export class Wallet {
470
495
  notifications(): NotificationHolder;
471
496
  offboardAll(bitcoinAddress: string): Promise<OffboardResult>;
472
497
  offboardVtxos(vtxoIds: string[], bitcoinAddress: string): Promise<string>;
473
- static open(args: WalletOpenArgs): Promise<Wallet>;
474
- static openWithOnchain(onchainWallet: OnchainWallet, args: WalletOpenArgs): Promise<Wallet>;
498
+ /**
499
+ * Open a wallet, mirroring [`bark::Wallet::open`]: a single entry point
500
+ * with everything optional. Set `createIfNotExists` to create the wallet
501
+ * if it doesn't exist yet (replacing the old `create` constructor).
502
+ *
503
+ * There is no separate `withOnchain` variant: onchain operations
504
+ * (boarding, exits, ...) take the onchain wallet per-call, and the web
505
+ * build has no background daemon, so the onchain wallet is never needed
506
+ * at open time.
507
+ */
508
+ static open(network: Network, mnemonic_or_seed: string, config: Config, onchain: OnchainWallet | null | undefined, args: OpenWalletArgs): Promise<Wallet>;
475
509
  payLightningInvoice(args: PayLightningInvoiceArgs): Promise<LightningSendStatus>;
476
510
  payLightningOffer(args: PayLightningOfferArgs): Promise<LightningSendStatus>;
477
511
  peekAddress(index: number): Promise<string>;
@@ -489,7 +523,7 @@ export class Wallet {
489
523
  refreshServer(): Promise<void>;
490
524
  refreshVtxos(vtxoIds: string[]): Promise<string | undefined>;
491
525
  refreshVtxosDelegated(vtxoIds: string[]): Promise<RoundState | undefined>;
492
- sendArkoorPayment(arkAddress: string, amountSats: number): Promise<string>;
526
+ sendArkoorPayment(arkAddress: string, amountSats: number): Promise<void>;
493
527
  sendOnchain(address: string, amountSats: number): Promise<string>;
494
528
  signExitClaimInputs(psbtBase64: string): Promise<string>;
495
529
  spendableVtxos(): Promise<Vtxo[]>;
@@ -498,6 +532,12 @@ export class Wallet {
498
532
  stuckFailedLightningSends(): Promise<LightningSend[]>;
499
533
  sync(): Promise<void>;
500
534
  syncExits(onchainWallet: OnchainWallet): Promise<void>;
535
+ /**
536
+ * Scan for VTXOs that were force-exited on-chain without the user asking
537
+ * and route them into the unilateral-exit flow so the funds can be claimed.
538
+ * This already runs automatically as part of `sync`.
539
+ */
540
+ syncForceExitedVtxos(): Promise<void>;
501
541
  syncPendingBoards(): Promise<void>;
502
542
  tryClaimAllLightningReceives(args: TryClaimAllLightningReceivesArgs): Promise<LightningReceive[]>;
503
543
  tryClaimLightningReceive(args: TryClaimLightningReceiveArgs): Promise<void>;
@@ -531,11 +571,10 @@ export interface InitOutput {
531
571
  readonly onchainwallet_newAddress: (a: number) => number;
532
572
  readonly onchainwallet_send: (a: number, b: number, c: number, d: number, e: number) => number;
533
573
  readonly __wbg_wallet_free: (a: number, b: number) => void;
534
- readonly wallet_create: (a: number) => number;
535
- readonly wallet_open: (a: number) => number;
536
- readonly wallet_createWithOnchain: (a: number, b: number) => number;
537
- readonly wallet_openWithOnchain: (a: number, b: number) => number;
574
+ readonly wallet_open: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
575
+ readonly wallet_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
538
576
  readonly wallet_sync: (a: number) => number;
577
+ readonly wallet_syncForceExitedVtxos: (a: number) => number;
539
578
  readonly wallet_maintenance: (a: number) => number;
540
579
  readonly wallet_maintenanceWithOnchain: (a: number, b: number) => number;
541
580
  readonly wallet_maintenanceDelegated: (a: number) => number;
@@ -608,7 +647,6 @@ export interface InitOutput {
608
647
  readonly wallet_refreshServer: (a: number) => number;
609
648
  readonly wallet_getFirstExpiringVtxoBlockheight: (a: number) => number;
610
649
  readonly wallet_getNextRequiredRefreshBlockheight: (a: number) => number;
611
- readonly wallet_maybeScheduleMaintenanceRefresh: (a: number) => number;
612
650
  readonly wallet_broadcastTx: (a: number, b: number, c: number) => number;
613
651
  readonly wallet_mailboxIdentifier: (a: number, b: number) => void;
614
652
  readonly wallet_mailboxAuthorization: (a: number, b: number) => void;
@@ -643,16 +681,16 @@ export interface InitOutput {
643
681
  readonly rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
644
682
  readonly rustsecp256k1_v0_10_0_default_illegal_callback_fn: (a: number, b: number) => void;
645
683
  readonly rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
646
- readonly __wasm_bindgen_func_elem_728: (a: number, b: number, c: number, d: number) => void;
647
- readonly __wasm_bindgen_func_elem_15275: (a: number, b: number, c: number, d: number) => void;
648
- readonly __wasm_bindgen_func_elem_738: (a: number, b: number, c: number, d: number) => void;
649
- readonly __wasm_bindgen_func_elem_15278: (a: number, b: number, c: number) => number;
650
- readonly __wasm_bindgen_func_elem_13590: (a: number, b: number, c: number) => void;
651
- readonly __wasm_bindgen_func_elem_13288: (a: number, b: number, c: number) => void;
652
- readonly __wasm_bindgen_func_elem_15277: (a: number, b: number, c: number) => void;
653
- readonly __wasm_bindgen_func_elem_12867: (a: number, b: number) => void;
654
- readonly __wasm_bindgen_func_elem_13744: (a: number, b: number) => void;
655
- readonly __wasm_bindgen_func_elem_19152: (a: number, b: number) => void;
684
+ readonly __wasm_bindgen_func_elem_732: (a: number, b: number, c: number, d: number) => void;
685
+ readonly __wasm_bindgen_func_elem_15631: (a: number, b: number, c: number, d: number) => void;
686
+ readonly __wasm_bindgen_func_elem_740: (a: number, b: number, c: number, d: number) => void;
687
+ readonly __wasm_bindgen_func_elem_15633: (a: number, b: number, c: number) => number;
688
+ readonly __wasm_bindgen_func_elem_13669: (a: number, b: number, c: number) => void;
689
+ readonly __wasm_bindgen_func_elem_13382: (a: number, b: number, c: number) => void;
690
+ readonly __wasm_bindgen_func_elem_15634: (a: number, b: number, c: number) => void;
691
+ readonly __wasm_bindgen_func_elem_12963: (a: number, b: number) => void;
692
+ readonly __wasm_bindgen_func_elem_13822: (a: number, b: number) => void;
693
+ readonly __wasm_bindgen_func_elem_19550: (a: number, b: number) => void;
656
694
  readonly __wbindgen_export: (a: number, b: number) => number;
657
695
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
658
696
  readonly __wbindgen_export3: (a: number) => void;