@qntx/wallet-engine 0.9.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.
@@ -1,4 +1,4 @@
1
- import { a as networkById, i as SOLANA_NETWORKS, n as NETWORKS, r as NetworkInfo, t as BITCOIN_NETWORKS } from "./registry-LcFSPrE1.mjs";
1
+ import { a as networkById, i as SOLANA_NETWORKS, n as NETWORKS, r as NetworkInfo, t as BITCOIN_NETWORKS } from "./registry-Deo5WQe1.mjs";
2
2
  import * as z from "zod/mini";
3
3
  export declare const INSTALL_ID_HEADER = "x-install-id";
4
4
  export declare const PROVIDERS_HEADER = "x-gateway-providers";
@@ -1,8 +1,8 @@
1
- import { i as networkById, n as NETWORKS, r as SOLANA_NETWORKS, t as BITCOIN_NETWORKS } from "./registry-CHiAn88k.mjs";
1
+ import { i as networkById, n as NETWORKS, r as SOLANA_NETWORKS, t as BITCOIN_NETWORKS } from "./registry-wYrcuFNc.mjs";
2
2
  import { utf8ToBytes } from "@noble/hashes/utils.js";
3
3
  import * as z from "zod/mini";
4
- import { sha256 } from "@noble/hashes/sha2.js";
5
4
  import { base64 } from "@scure/base";
5
+ import { sha256 } from "@noble/hashes/sha2.js";
6
6
  // src/gateway/contract/endpoint.ts
7
7
  /** One gateway route: its verb, versioned path template, and request/response schemas. */
8
8
  function endpoint(method, path, request, response) {
package/dist/index.d.mts CHANGED
@@ -1,8 +1,9 @@
1
- import { $ as sparkStore, A as RiskFinding, At as ControllerOptions, B as ParseOptions, C as SparkDepositInput, Ct as EngineCollection, D as BrowserOrigin, Dt as EventBus, E as SignLogOutcome, Et as EngineLogger, F as PreparedZap, G as PreparedSparkAction, H as PaymentParse, I as ZapRecipient, J as SparkAccountState, K as SparkDisplay, L as prepareZap, M as SignatureResult, N as PrepareZapContext, O as RequestMethod, Ot as createEventBus, P as PrepareZapParams, Q as SparkControllerState, R as PayParams, S as RequestStage, St as PhishingStatus, T as SignLogEntry, Tt as PublicStore, U as PaymentRequest, V as PaymentOption, W as parsePayment, X as SparkController, Y as SparkClientFactory, Z as SparkControllerOptions, _ as PendingRequest, _t as PendingConnection, at as AddressBookEntry, b as RequestControllerState, bt as PhishingControllerOptions, ct as NetworkController, dt as ConnectionController, et as PaymentNote, f as Eip1193Event, ft as ConnectionOrigin, g as PayInput, h as EvmSignInput, ht as ConnectionState, it as AddressBookState, j as TransactionController, k as RequestOrigin, kt as Controller, l as SolanaWalletHandler, lt as Esplora, m as Eip1193Request, mt as ConnectionSession, n as WeblnHandler, nt as RequestCheckCode, ot as AddressBookRecord, p as Eip1193Handler, pt as ConnectionScope, q as SparkResult, rt as AddressBookController, st as AddressFamily, t as ProviderError, tt as SparkActivity, u as Nip07Handler, ut as AccountGroup$1, v as REQUEST_TTL_MS, vt as PHISHING_REFRESH_MS, w as SparkExitInput, wt as EngineStore, x as RequestInput, xt as PhishingState, y as RequestController, yt as PhishingController, z as WithdrawLnurlParams } from "./errors-CP1G6KCc.mjs";
1
+ import { $ as PrepareZapContext, A as PayInput, At as EngineCollection, B as SignLogEntry, C as ConnectionOrigin, Ct as NetworkController, Dt as AddressBookEntry, E as ConnectionState, Et as AddressBookState, F as RequestControllerState, Ft as createEventBus, G as RiskFinding, H as BrowserOrigin, I as RequestInput, It as Controller, J as PHISHING_REFRESH_MS, K as TransactionController, L as RequestStage, Lt as ControllerOptions, M as REQUEST_TTL_MS, Mt as PublicStore, N as RESIMULATE_AFTER_MS, Nt as EngineLogger, O as PendingConnection, Ot as AddressBookRecord, P as RequestController, Pt as EventBus, Q as PhishingStatus, R as SparkDepositInput, S as ConnectionController, St as RequestCheckCode, T as ConnectionSession, Tt as AddressBookController, U as RequestMethod, V as SignLogOutcome, W as RequestOrigin, X as PhishingControllerOptions, Y as PhishingController, Z as PhishingState, _t as SparkControllerOptions, at as WithdrawLnurlParams, b as BitcoinWalletHandler, bt as PaymentNote, ct as PaymentParse, dt as PreparedSparkAction, et as PrepareZapParams, f as Eip1193Event, ft as SparkDisplay, gt as SparkController, ht as SparkClientFactory, it as PayParams, j as PendingRequest, jt as EngineStore, k as EvmSignInput, kt as AddressFamily, l as SolanaWalletHandler, lt as PaymentRequest, m as Eip1193Request, mt as SparkAccountState, n as WeblnHandler, nt as ZapRecipient, ot as ParseOptions, p as Eip1193Handler, pt as SparkResult, q as SignatureResult, rt as prepareZap, st as PaymentOption, t as ProviderError, tt as PreparedZap, u as Nip07Handler, ut as parsePayment, vt as SparkControllerState, w as ConnectionScope, wt as Esplora, x as AccountGroup$1, xt as SparkActivity, yt as sparkStore, z as SparkExitInput } from "./errors-Bglz0VYn.mjs";
2
2
  import { BackupHeader, BackupInfo, InitialFactor, UnlockFactor, Wallet, WalletInfo } from "@qntx/wallet";
3
3
  import { LightningInvoice, SparkExitChain, SparkNetwork } from "@qntx/spark";
4
4
  import { Event, Filter } from "@qntx/nostr";
5
5
  import { WalletSyncSigner } from "@qntx/wallet/nostr";
6
+ import { getEnsAddress } from "viem/ens";
6
7
  type EngineErrorCode = "closed" | "integrity" | "invalid-input";
7
8
  /** Typed engine errors: store codes are `closed` and `integrity` (decrypt or bind failure). */
8
9
  export declare class EngineStoreError extends Error {
@@ -57,6 +58,8 @@ type AccountGroup = {
57
58
  readonly hidden: boolean;
58
59
  /** A social identity (64 lowercase hex) bound to this group; one identity binds one group. */
59
60
  readonly boundPubkey?: string;
61
+ /** Device-local opt-in to signing messages that cannot be shown as text; absent means off. */
62
+ readonly blindSigning?: true;
60
63
  /** Last local modification time (ms); reconcile-created entries start at 0. */
61
64
  readonly updatedAt: number;
62
65
  };
@@ -92,6 +95,7 @@ type DiscoveryNetworks = {
92
95
  };
93
96
  type AccountTreeControllerOptions = {
94
97
  readonly wallet: Wallet;
98
+ readonly setTimer: (ms: number, fn: () => void) => () => void;
95
99
  readonly spark: SparkController;
96
100
  readonly sparkNetwork: SparkNetwork;
97
101
  readonly networks?: DiscoveryNetworks;
@@ -113,7 +117,7 @@ export declare class AccountTreeController extends Controller<AccountTreeState>
113
117
  private readonly options;
114
118
  private col;
115
119
  private sparkUnsubscribe;
116
- private totalsTimer;
120
+ private cancelTotals;
117
121
  private persistChain;
118
122
  constructor(options: AccountTreeControllerOptions);
119
123
  setStore(store: EngineStore | undefined): void;
@@ -129,6 +133,13 @@ export declare class AccountTreeController extends Controller<AccountTreeState>
129
133
  renameWallet(walletId: string, name: string): void;
130
134
  renameGroup(walletId: string, index: number, name: string): void;
131
135
  setHidden(walletId: string, index: number, hidden: boolean): void;
136
+ /**
137
+ * Device-local opt-in to blind signing: no factor, the setting lives in the main runtime —
138
+ * per-request verification and the kernel's blind prompt are the real protection.
139
+ */
140
+ setBlindSigning(walletId: string, index: number, enabled: boolean): void;
141
+ /** Whether the group opted in to signing messages that cannot be shown as text. */
142
+ blindSigning(walletId: string, index: number): boolean;
132
143
  select(walletId: string, index: number): void;
133
144
  /**
134
145
  * Binds a social identity to one group. The identity is unique across the whole tree — every
@@ -311,11 +322,22 @@ export declare class BackupController extends Controller<BackupControllerState>
311
322
  readonly name: string;
312
323
  readonly header: BackupHeader;
313
324
  }>>;
325
+ /**
326
+ * Merges a cloud backup into the vault. Wallets with a BIP-39 passphrase restore only when
327
+ * `passphrases` carries theirs; the rest come back in `passphraseRequired`.
328
+ */
314
329
  restore(options: {
315
330
  readonly name: string;
316
331
  readonly backupFactor: UnlockFactor;
332
+ readonly passphrases?: ReadonlyArray<{
333
+ readonly walletId: string;
334
+ readonly passphrase: string;
335
+ }>;
317
336
  readonly factor?: InitialFactor;
318
- }): Promise<ReadonlyArray<WalletInfo>>;
337
+ }): Promise<{
338
+ readonly wallets: ReadonlyArray<WalletInfo>;
339
+ readonly passphraseRequired: ReadonlyArray<string>;
340
+ }>;
319
341
  private reconcileOrThrow;
320
342
  private readRecord;
321
343
  private writeRecord;
@@ -375,6 +397,7 @@ type MetaSyncControllerOptions = {
375
397
  readonly metaSync: MetaSyncConfig | undefined;
376
398
  readonly logger: EngineLogger;
377
399
  readonly now: () => number;
400
+ readonly setTimer: (ms: number, fn: () => void) => () => void;
378
401
  readonly verifyEvent: (event: Event) => boolean;
379
402
  };
380
403
  /**
@@ -416,6 +439,11 @@ export declare class MetaSyncController extends Controller<MetaSyncState> {
416
439
  private onTreeChange;
417
440
  private publishNow;
418
441
  }
442
+ type EnsResolution = {
443
+ readonly name: string;
444
+ readonly address: string;
445
+ readonly checks: ReadonlyArray<RequestCheckCode>;
446
+ };
419
447
  type EngineOptions = {
420
448
  readonly wallet: Wallet;
421
449
  /**
@@ -475,6 +503,7 @@ type WalletEngine = {
475
503
  readonly nip07: Nip07Handler;
476
504
  readonly webln: WeblnHandler;
477
505
  readonly solanaWallet: SolanaWalletHandler;
506
+ readonly bitcoinWallet: BitcoinWalletHandler;
478
507
  /** The phishing list: lifecycle is independent of the lock state. */
479
508
  readonly phishing: PhishingController;
480
509
  /** Read and receive surface; every payment goes through `requests`. */
@@ -485,6 +514,10 @@ type WalletEngine = {
485
514
  readonly zaps: {
486
515
  readonly prepare: (params: PrepareZapParams) => Promise<PreparedZap>;
487
516
  };
517
+ readonly names: {
518
+ /** Forward-resolves an ENS name for a send on `network`; throws when it cannot resolve. */
519
+ readonly resolve: (name: string, network: string) => Promise<EnsResolution>;
520
+ };
488
521
  readonly payments: {
489
522
  readonly parse: (input: string, network: SparkNetwork) => PaymentParse;
490
523
  readonly resolve: (input: string, network: SparkNetwork) => Promise<PaymentParse>;
@@ -529,5 +562,5 @@ type ResolveOptions = ParseOptions & {
529
562
  export declare function resolvePayment(input: string, options: ResolveOptions): Promise<PaymentParse>;
530
563
  export declare function encodeExitChain(chain: SparkExitChain): Uint8Array;
531
564
  export declare function decodeExitChain(bytes: Uint8Array): SparkExitChain;
532
- export { type AccountGroup, type AccountTreeState, AddressBookController, type AddressBookEntry, type AddressBookErrorCategory, type AddressBookState, type AddressFamily, type BackupControllerState, type BackupErrorCategory, type BrowserOrigin, type CloudStore, type AccountGroup$1 as ConnectionAccountGroup, ConnectionController, type ConnectionOrigin, type ConnectionScope, type ConnectionSession, type ConnectionState, Controller, type ControllerOptions, type Eip1193Event, Eip1193Handler, type Eip1193Request, type EngineCollection, type EngineErrorCode, type EngineLogger, type EngineOptions, type EngineStore, type EventBus, type EvmSignInput, type MetaDoc, type MetaDocGroup, type MetaDocTree, type MetaDocWallet, type MetaSyncConfig, type MetaSyncRelayPort, type MetaSyncState, type MetaSyncWalletStatus, PHISHING_REFRESH_MS, type PayInput, type PayParams, type PaymentNote, type PaymentOption, type PaymentParse, type PaymentRequest, type PendingConnection, type PendingRequest, PhishingController, type PhishingControllerOptions, type PhishingState, type PhishingStatus, type PrepareZapContext, type PrepareZapParams, type PreparedSparkAction, type PreparedZap, ProviderError, type PublicStore, REQUEST_TTL_MS, type RequestCheckCode, RequestController, type RequestControllerState, type RequestInput, type RequestMethod, type RequestOrigin, type RequestStage, type RiskFinding, type SignLogEntry, type SignLogOutcome, type SignatureResult, type SparkAccountState, type SparkActivity, type SparkClientFactory, SparkController, type SparkControllerOptions, type SparkControllerState, type SparkDepositInput, type SparkDisplay, type SparkErrorCategory, type SparkExitInput, type SparkResult, type WalletEngine, type WithdrawLnurlParams, type ZapRecipient, createEventBus, parsePayment, prepareZap, sparkStore };
565
+ export { type AccountGroup, type AccountTreeState, AddressBookController, type AddressBookEntry, type AddressBookErrorCategory, type AddressBookState, type AddressFamily, type BackupControllerState, type BackupErrorCategory, type BrowserOrigin, type CloudStore, type AccountGroup$1 as ConnectionAccountGroup, ConnectionController, type ConnectionOrigin, type ConnectionScope, type ConnectionSession, type ConnectionState, Controller, type ControllerOptions, type Eip1193Event, Eip1193Handler, type Eip1193Request, type EngineCollection, type EngineErrorCode, type EngineLogger, type EngineOptions, type EngineStore, type EventBus, type EvmSignInput, type MetaDoc, type MetaDocGroup, type MetaDocTree, type MetaDocWallet, type MetaSyncConfig, type MetaSyncRelayPort, type MetaSyncState, type MetaSyncWalletStatus, PHISHING_REFRESH_MS, type PayInput, type PayParams, type PaymentNote, type PaymentOption, type PaymentParse, type PaymentRequest, type PendingConnection, type PendingRequest, PhishingController, type PhishingControllerOptions, type PhishingState, type PhishingStatus, type PrepareZapContext, type PrepareZapParams, type PreparedSparkAction, type PreparedZap, ProviderError, type PublicStore, REQUEST_TTL_MS, RESIMULATE_AFTER_MS, type RequestCheckCode, RequestController, type RequestControllerState, type RequestInput, type RequestMethod, type RequestOrigin, type RequestStage, type RiskFinding, type SignLogEntry, type SignLogOutcome, type SignatureResult, type SparkAccountState, type SparkActivity, type SparkClientFactory, SparkController, type SparkControllerOptions, type SparkControllerState, type SparkDepositInput, type SparkDisplay, type SparkErrorCategory, type SparkExitInput, type SparkResult, type WalletEngine, type WithdrawLnurlParams, type ZapRecipient, createEventBus, parsePayment, prepareZap, sparkStore };
533
566
  //# sourceMappingURL=index.d.mts.map