@lightninglabs/wavelength-core 0.1.1-rc3 → 0.1.2-rc4

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,22 +1,23 @@
1
- import type { CreateWalletRequest, DepositRequest, ExitRequest, ExitStatusRequest, ExitSummaryRequest, GetExitPlanRequest, ListRequest, OpenWalletFromPasskeyRequest, ReceiveRequest, SendRequest, SweepWalletRequest, UnlockWalletRequest } from './requests.ts';
2
- import type { Balance, CreateWalletResult, DepositResult, ExitResult, ExitStatusResult, ExitSummaryResult, GetExitPlanResult, ListResult, OpenWalletFromPasskeyResult, PrepareSendResult, ReceiveResult, SendResult, SweepWalletResult, UnlockWalletResult } from './results.ts';
1
+ import type { CreateWalletRequest, DepositRequest, ExternalSeedWalletRequest, ExitRequest, ExitStatusRequest, ExitSummaryRequest, GetExitPlanRequest, ListRequest, OpenWalletFromPasskeyRequest, ReceiveRequest, SendRequest, SweepWalletRequest, UnlockWalletRequest } from './requests.ts';
2
+ import type { Balance, CreateWalletResult, DepositResult, ExternalSeedWalletOpenResult, ExitResult, ExitStatusResult, ExitSummaryResult, GetExitPlanResult, ListResult, OpenWalletFromPasskeyResult, PrepareSendResult, ReceiveResult, SendResult, SweepWalletResult, UnlockWalletResult } from './results.ts';
3
3
  import { type RuntimeConfig } from './config.ts';
4
- import type { WavelengthClient } from './client.ts';
4
+ import type { ExternalSeedWalletClient } from './client.ts';
5
5
  import type { WavelengthEvent, WavelengthListener } from './events.ts';
6
6
  import type { WalletInfo, WalletStatus } from './state.ts';
7
7
  import type { FacadeMethod, ServerTransport } from './facade.ts';
8
8
  import type { Entry } from './generated.ts';
9
9
  import { type ActivityStreamOptions } from './activity-options.ts';
10
10
  /**
11
- * Implements the transport-agnostic half of {@link WavelengthClient}: every RPC
12
- * verb is expressed in terms of the abstract invokeFacade, so a transport (web
13
- * wasm, React Native gomobile, or a future one) supplies only the pipe:
14
- * invokeFacade, ready, the activity-stream plumbing, and its {@link ServerTransport}
15
- * flavor. The shared subscribe/emit listener machinery and typed wrappers live
16
- * here. The facade catalog, public contract, native dispatch, and response
17
- * normalization remain separate synchronization points.
11
+ * Implements the transport-agnostic half of
12
+ * {@link ExternalSeedWalletClient}: every RPC verb is expressed in terms of
13
+ * the abstract invokeFacade, so a transport (web wasm, React Native gomobile,
14
+ * or a future one) supplies only the pipe: invokeFacade, ready, the
15
+ * activity-stream plumbing, and its {@link ServerTransport} flavor. The shared
16
+ * subscribe/emit listener machinery and typed wrappers live here. The facade
17
+ * catalog, public contract, native dispatch, and response normalization remain
18
+ * separate synchronization points.
18
19
  */
19
- export declare abstract class BaseWavelengthClient implements WavelengthClient {
20
+ export declare abstract class BaseWavelengthClient implements ExternalSeedWalletClient {
20
21
  #private;
21
22
  protected readonly listeners: Set<WavelengthListener>;
22
23
  abstract ready(): Promise<void>;
@@ -40,6 +41,7 @@ export declare abstract class BaseWavelengthClient implements WavelengthClient {
40
41
  */
41
42
  protected enqueueLifecycle<T>(op: () => Promise<T>): Promise<T>;
42
43
  start(config: RuntimeConfig): Promise<WalletInfo>;
44
+ startExternalSeedWallet(config: RuntimeConfig, req: ExternalSeedWalletRequest): Promise<ExternalSeedWalletOpenResult>;
43
45
  stop(): Promise<void>;
44
46
  /**
45
47
  * Called at the very start of a stop, before the daemon RPC, so a transport
@@ -1 +1 @@
1
- {"version":3,"file":"base-client.d.ts","sourceRoot":"","sources":["../src/base-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,4BAA4B,EAC5B,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,OAAO,EACP,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,E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;IAa9D,IAAI,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAIjD,IAAI,CAAC,GAAG,GAAE,WAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAIhD,IAAI,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAI3C,UAAU,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAI7D,WAAW,CAAC,GAAG,GAAE,kBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIrE,WAAW,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIhE,WAAW,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIhE,SAAS,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,IAAI;IAQnD,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,eAAe;IAkBrC,SAAS,CAAC,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK;IAIrD;;;;OAIG;IACH,OAAO,IAAI,IAAI;CAIhB"}
@@ -1,16 +1,18 @@
1
+ import { validateExternalSeedWalletRequest } from "./requests.js";
1
2
  import { validateRuntimeConfig } from "./config.js";
2
- import { assertFacadeMethod, toGoCreateWalletReq, toGoUnlockWalletReq, toMobileConfig, } from "./facade.js";
3
+ import { assertFacadeMethod, toExternalSeedWalletStartParams, toGoCreateWalletReq, toGoUnlockWalletReq, toMobileConfig, } from "./facade.js";
3
4
  import { WavelengthError, errorMessage } from "./errors.js";
4
5
  import { normalizeEntry, normalizeFacadeResult, } from "./response-normalization.js";
5
6
  import { validateActivityStreamOptions, } from "./activity-options.js";
6
7
  /**
7
- * Implements the transport-agnostic half of {@link WavelengthClient}: every RPC
8
- * verb is expressed in terms of the abstract invokeFacade, so a transport (web
9
- * wasm, React Native gomobile, or a future one) supplies only the pipe:
10
- * invokeFacade, ready, the activity-stream plumbing, and its {@link ServerTransport}
11
- * flavor. The shared subscribe/emit listener machinery and typed wrappers live
12
- * here. The facade catalog, public contract, native dispatch, and response
13
- * normalization remain separate synchronization points.
8
+ * Implements the transport-agnostic half of
9
+ * {@link ExternalSeedWalletClient}: every RPC verb is expressed in terms of
10
+ * the abstract invokeFacade, so a transport (web wasm, React Native gomobile,
11
+ * or a future one) supplies only the pipe: invokeFacade, ready, the
12
+ * activity-stream plumbing, and its {@link ServerTransport} flavor. The shared
13
+ * subscribe/emit listener machinery and typed wrappers live here. The facade
14
+ * catalog, public contract, native dispatch, and response normalization remain
15
+ * separate synchronization points.
14
16
  */
15
17
  export class BaseWavelengthClient {
16
18
  listeners = new Set();
@@ -19,16 +21,20 @@ export class BaseWavelengthClient {
19
21
  // click, a stop issued mid-start) run one at a time in invocation order
20
22
  // instead of interleaving at the transport's exclusive resources.
21
23
  #lifecycleTail = Promise.resolve();
22
- // The raw facade escape hatch. It rejects the lifecycle verbs 'start' and
23
- // 'stop' so they can only run through the typed start()/stop(): those are
24
- // where the web transports take and release the cross-tab runtime lock, and a
25
- // raw call would bypass it. The typed methods dispatch through
26
- // callFacadeInternal, which carries no such guard.
24
+ // The raw facade escape hatch rejects start, startExternalSeedWallet, and
25
+ // stop so they can only run through typed lifecycle methods. Those are where
26
+ // web transports take and release the cross-tab runtime lock; a raw call
27
+ // would bypass it. Typed methods dispatch through callFacadeInternal instead.
27
28
  async callFacade(method, params = {}) {
28
- if (method === 'start' || method === 'stop') {
29
- throw new WavelengthError(`Call ${method}() instead of callFacade('${method}'): the ${method} ` +
30
- 'lifecycle verb runs through the typed method, which manages the ' +
31
- 'cross-tab runtime lock.');
29
+ if (method === 'start' ||
30
+ method === 'startExternalSeedWallet' ||
31
+ method === 'stop') {
32
+ const typedCall = method === 'startExternalSeedWallet'
33
+ ? 'ExternalSeedWalletClient.startExternalSeedWallet()'
34
+ : `${method}()`;
35
+ throw new WavelengthError(`Call ${typedCall} instead of callFacade('${method}'): the ` +
36
+ `${method} lifecycle verb runs through the typed method, which ` +
37
+ 'manages the cross-tab runtime lock.');
32
38
  }
33
39
  return this.callFacadeInternal(method, params);
34
40
  }
@@ -71,6 +77,14 @@ export class BaseWavelengthClient {
71
77
  await this.callFacadeInternal('start', toMobileConfig(config, this.serverTransport));
72
78
  return this.getInfo();
73
79
  }
80
+ async startExternalSeedWallet(config, req) {
81
+ validateRuntimeConfig(config, this.serverTransport);
82
+ validateExternalSeedWalletRequest(req);
83
+ if (typeof config.dataDir !== 'string' || config.dataDir.trim() === '') {
84
+ throw new WavelengthError('startExternalSeedWallet requires a final nonempty config.dataDir', 'invalid_config');
85
+ }
86
+ return this.callFacadeInternal('startExternalSeedWallet', toExternalSeedWalletStartParams(config, req, this.serverTransport));
87
+ }
74
88
  async stop() {
75
89
  // Snapshot any per-session teardown token before the stop is issued, so
76
90
  // afterDaemonStopped acts on the session this stop belongs to even if a new
package/dist/client.d.ts CHANGED
@@ -3,12 +3,15 @@ import type { RuntimeConfig } from './config.ts';
3
3
  import type { FacadeMethod } from './facade.ts';
4
4
  import type { WalletInfo, WalletStatus } from './state.ts';
5
5
  import type { ActivityStreamOptions } from './activity-options.ts';
6
- import type { CreateWalletRequest, DepositRequest, ExitRequest, ExitStatusRequest, ExitSummaryRequest, GetExitPlanRequest, ListRequest, OpenWalletFromPasskeyRequest, ReceiveRequest, SendRequest, SweepWalletRequest, UnlockWalletRequest } from './requests.ts';
7
- import type { Balance, CreateWalletResult, DepositResult, ExitResult, ExitStatusResult, ExitSummaryResult, GetExitPlanResult, ListResult, OpenWalletFromPasskeyResult, PrepareSendResult, ReceiveResult, SendResult, SweepWalletResult, UnlockWalletResult } from './results.ts';
6
+ import type { CreateWalletRequest, DepositRequest, ExternalSeedWalletRequest, ExitRequest, ExitStatusRequest, ExitSummaryRequest, GetExitPlanRequest, ListRequest, OpenWalletFromPasskeyRequest, ReceiveRequest, SendRequest, SweepWalletRequest, UnlockWalletRequest } from './requests.ts';
7
+ import type { Balance, CreateWalletResult, DepositResult, ExternalSeedWalletOpenResult, ExitResult, ExitStatusResult, ExitSummaryResult, GetExitPlanResult, ListResult, OpenWalletFromPasskeyResult, PrepareSendResult, ReceiveResult, SendResult, SweepWalletResult, UnlockWalletResult } from './results.ts';
8
8
  /**
9
- * The framework-agnostic contract every Wavelength transport implements. It wraps
10
- * the embedded daemon's lifecycle, wallet operations, and activity stream behind
11
- * typed, camelCase-normalized methods.
9
+ * The framework-agnostic contract every Wavelength transport implements. It
10
+ * wraps the embedded daemon's lifecycle, wallet operations, and activity
11
+ * stream behind typed, camelCase-normalized methods.
12
+ *
13
+ * External-seed startup is an additive transport capability;
14
+ * see {@link ExternalSeedWalletClient}.
12
15
  */
13
16
  export interface WavelengthClient {
14
17
  /** Resolves once the runtime assets are loaded and the client is usable. */
@@ -75,11 +78,11 @@ export interface WavelengthClient {
75
78
  * low-level escape hatch for facade verbs the typed methods do not cover;
76
79
  * prefer the typed methods wherever they exist.
77
80
  *
78
- * Rejects the lifecycle verbs `'start'` and `'stop'`: use the typed
79
- * {@link start} and {@link stop} instead. On the web transports those verbs
80
- * take and release the cross-tab runtime lock, so allowing a raw
81
- * `callFacade('start')` or `callFacade('stop')` would bypass it, defeat the
82
- * multi-tab guard, and could strand the lock until the page reloads.
81
+ * Rejects the lifecycle verbs `'start'`, `'startExternalSeedWallet'`, and
82
+ * `'stop'`. Use the typed methods here or on
83
+ * {@link ExternalSeedWalletClient} instead. On web those methods take and
84
+ * release the cross-tab runtime lock. Raw lifecycle dispatch would bypass
85
+ * that guard.
83
86
  */
84
87
  callFacade<T = unknown>(method: FacadeMethod, params?: unknown): Promise<T>;
85
88
  /** Reports whether the embedded daemon is running. */
@@ -102,4 +105,18 @@ export interface WavelengthClient {
102
105
  */
103
106
  dispose(): void;
104
107
  }
108
+ /**
109
+ * Additive client capability for callers that derive external wallet entropy
110
+ * and select the final storage profile themselves. Official web and React
111
+ * Native clients implement it. Custom clients can keep implementing
112
+ * {@link WavelengthClient} unless they need external-seed startup.
113
+ */
114
+ export interface ExternalSeedWalletClient extends WavelengthClient {
115
+ /**
116
+ * Atomically starts the daemon at the final configured profile and imports
117
+ * or unlocks a wallet from exactly 16 bytes of external seed entropy. This is
118
+ * a lifecycle operation: call {@link stop} before selecting another wallet.
119
+ */
120
+ startExternalSeedWallet(config: RuntimeConfig, req: ExternalSeedWalletRequest): Promise<ExternalSeedWalletOpenResult>;
121
+ }
105
122
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,4BAA4B,EAC5B,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,OAAO,EACP,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,2BAA2B,EAC3B,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAEtB;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB;;;;;OAKG;IACH,KAAK,CAAC,MAAM,EAAE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AC,IAAI,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,kEAAkE;IAClE,YAAY,IAAI,IAAI,CAAC;IACrB;;;;;;OAMG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IAChE;;;;OAIG;IACH,uBAAuB,CACrB,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,yBAAyB,GAC7B,OAAO,CAAC,4BAA4B,CAAC,CAAC;CAC1C"}
@@ -17,8 +17,15 @@ export declare class ActivityStream {
17
17
  });
18
18
  start(): void;
19
19
  stop(): void;
20
+ /**
21
+ * Returns the preimage seen for a payment hash, or undefined. It is the only
22
+ * route to a settled send's proof of payment; see #preimages.
23
+ */
24
+ preimageFor(paymentHash: string): string | undefined;
25
+ /** Every preimage seen so far, for merging into a refreshed snapshot. */
26
+ preimages(): ReadonlyMap<string, string>;
20
27
  /** Forwarded 'activity' client events; debounced into one onActivity call. */
21
- noteActivity(entry: Pick<Entry, 'cursor'>): void;
28
+ noteActivity(entry: Pick<Entry, 'cursor'> & Partial<Entry>): void;
22
29
  /** Forwarded 'activityStream' client events: the stream was lost; reopen. */
23
30
  noteStreamLost(): void;
24
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../src/engine/activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAQ3C;;;;;;GAMG;AACH,qBAAa,cAAc;;gBAmBb,IAAI,EAAE;QAChB,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,eAAe,GAAG,cAAc,CAAC,CAAC;QACjE,UAAU,EAAE,MAAM,IAAI,CAAC;QACvB,WAAW,EAAE,MAAM,IAAI,CAAC;QACxB,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KAChC;IAID,KAAK,IAAI,IAAI;IAYb,IAAI,IAAI,IAAI;IAaZ,8EAA8E;IAC9E,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAI;IAWhD,6EAA6E;IAC7E,cAAc,IAAI,IAAI;CAoEvB"}
1
+ {"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../src/engine/activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAQ3C;;;;;;GAMG;AACH,qBAAa,cAAc;;gBAmCb,IAAI,EAAE;QAChB,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,eAAe,GAAG,cAAc,CAAC,CAAC;QACjE,UAAU,EAAE,MAAM,IAAI,CAAC;QACvB,WAAW,EAAE,MAAM,IAAI,CAAC;QACxB,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KAChC;IAID,KAAK,IAAI,IAAI;IAYb,IAAI,IAAI,IAAI;IAcZ;;;OAGG;IACH,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIpD,yEAAyE;IACzE,SAAS,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC;IAIxC,8EAA8E;IAC9E,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI;IAkBjE,6EAA6E;IAC7E,cAAc,IAAI,IAAI;CAoEvB"}
@@ -9,6 +9,22 @@ import { ACTIVITY_DEBOUNCE_MS, STREAM_BACKOFF_CAP_MS, STREAM_BACKOFF_MS, STREAM_
9
9
  export class ActivityStream {
10
10
  #running = false;
11
11
  #cursor = 0;
12
+ /**
13
+ * Preimages seen on the stream, keyed by payment hash.
14
+ *
15
+ * The daemon reveals a send's preimage exactly once, on the entry it pushes
16
+ * when the swap settles, and omits it from the list snapshot that every
17
+ * later refresh reads. Without remembering it here the field is unreachable
18
+ * through any public API: the stream event is consumed for its cursor and
19
+ * the body discarded, and the refresh that follows overwrites the entry with
20
+ * a copy that has none.
21
+ *
22
+ * That matters because a preimage is proof of payment, and the only way a
23
+ * caller can demonstrate to a third party that an invoice was actually
24
+ * settled. Holding them in memory is enough: they are re-delivered on the
25
+ * includeExisting replay when a stream reopens.
26
+ */
27
+ #preimages = new Map();
12
28
  #backoff = STREAM_BACKOFF_MS;
13
29
  #failures = 0;
14
30
  #lifecycleGeneration = 0;
@@ -41,10 +57,22 @@ export class ActivityStream {
41
57
  this.#running = false;
42
58
  this.#lifecycleGeneration += 1;
43
59
  this.#cursor = 0;
60
+ this.#preimages.clear();
44
61
  clearTimeout(this.#retryTimer);
45
62
  clearTimeout(this.#debounce);
46
63
  this.#opts.client.stopActivity();
47
64
  }
65
+ /**
66
+ * Returns the preimage seen for a payment hash, or undefined. It is the only
67
+ * route to a settled send's proof of payment; see #preimages.
68
+ */
69
+ preimageFor(paymentHash) {
70
+ return this.#preimages.get(paymentHash);
71
+ }
72
+ /** Every preimage seen so far, for merging into a refreshed snapshot. */
73
+ preimages() {
74
+ return this.#preimages;
75
+ }
48
76
  /** Forwarded 'activity' client events; debounced into one onActivity call. */
49
77
  noteActivity(entry) {
50
78
  if (!this.#running) {
@@ -53,6 +81,12 @@ export class ActivityStream {
53
81
  if (Number.isSafeInteger(entry.cursor) && entry.cursor > this.#cursor) {
54
82
  this.#cursor = entry.cursor;
55
83
  }
84
+ // Capture the proof before the body is dropped. This is the only moment
85
+ // it exists anywhere the SDK can see.
86
+ const progress = entry.progress;
87
+ if (progress?.paymentHash && progress.preimage) {
88
+ this.#preimages.set(progress.paymentHash, progress.preimage);
89
+ }
56
90
  clearTimeout(this.#debounce);
57
91
  this.#debounce = setTimeout(() => this.#opts.onActivity(), ACTIVITY_DEBOUNCE_MS);
58
92
  }
@@ -1,16 +1,26 @@
1
1
  import type { WavelengthClient } from '../client.ts';
2
2
  import type { RuntimeConfig } from '../config.ts';
3
+ import { type WavelengthPerformanceListener } from '../performance.ts';
3
4
  import { type ExitBatchEvent, type ExitBatchOptions, type ExitBatchResult } from '../exit.ts';
4
5
  import type { CreateWalletRequest, DepositRequest, ExitRequest, ExitStatusRequest, ExitSummaryRequest, GetExitPlanRequest, ListRequest, OpenWalletFromPasskeyRequest, ReceiveRequest, RestoreWalletRequest, SendRequest, SweepWalletRequest, UnlockWalletRequest } from '../requests.ts';
5
- import type { CreateWalletResult, DepositResult, ExitResult, ExitStatusResult, ExitSummaryResult, GetExitPlanResult, ListResult, OpenWalletFromPasskeyResult, PrepareSendResult, ReceiveResult, SendResult, SweepWalletResult, UnlockWalletResult } from '../results.ts';
6
+ import type { CreateWalletResult, DepositResult, Entry, ExitResult, ExitStatusResult, ExitSummaryResult, GetExitPlanResult, ListResult, OpenWalletFromPasskeyResult, PrepareSendResult, ReceiveResult, SendResult, SweepWalletResult, UnlockWalletResult } from '../results.ts';
6
7
  import { type WalletInfo } from '../state.ts';
7
8
  import type { WalletSnapshot } from './snapshot.ts';
9
+ /** The instrumentation options every arm of {@link WalletEngineOptions} shares. */
10
+ type WalletEnginePerformanceOptions = {
11
+ /**
12
+ * Receives structured timing samples for runtime readiness, wallet
13
+ * create/open RPCs, post-operation info adoption, and sync polling. Omit it
14
+ * to keep performance instrumentation disabled.
15
+ */
16
+ onPerformance?: WavelengthPerformanceListener;
17
+ };
8
18
  /**
9
19
  * Options for {@link createWalletEngine}. A discriminated union: the type
10
20
  * requires config when autoStart is true, so autoStart cannot be set without
11
21
  * a config to start from.
12
22
  */
13
- export type WalletEngineOptions = {
23
+ export type WalletEngineOptions = WalletEnginePerformanceOptions & ({
14
24
  /** The transport client the engine drives. */
15
25
  client: WavelengthClient;
16
26
  /** Default runtime config used by autoStart and by start() with no argument. */
@@ -24,7 +34,7 @@ export type WalletEngineOptions = {
24
34
  config?: RuntimeConfig;
25
35
  /** Start the runtime automatically once it is ready. Requires config; omit or set false when config is unset. */
26
36
  autoStart?: false;
27
- };
37
+ });
28
38
  /**
29
39
  * Removes a key from every arm of a union type. TypeScript's built-in Omit
30
40
  * does not distribute over unions (it flattens to the union of all keys
@@ -117,4 +127,18 @@ export interface WalletEngine {
117
127
  }
118
128
  /** Creates a {@link WalletEngine} over any transport client. */
119
129
  export declare function createWalletEngine(options: WalletEngineOptions): WalletEngine;
130
+ /**
131
+ * Puts back the preimages the list snapshot drops.
132
+ *
133
+ * The daemon reveals a send's preimage once, on the stream entry it pushes at
134
+ * settle, and never again: every list read returns the entry with the field
135
+ * empty. So a refresh would otherwise erase proof of payment that the SDK had
136
+ * already seen, and a caller who blinked would have no way to get it back.
137
+ *
138
+ * Entries that already carry a preimage, or for which none was ever seen, are
139
+ * returned untouched, so this allocates nothing in the ordinary case and never
140
+ * invents a value it was not given.
141
+ */
142
+ export declare function restorePreimages(entries: readonly Entry[], preimages: ReadonlyMap<string, string>): Entry[];
143
+ export {};
120
144
  //# sourceMappingURL=engine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/engine/engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,4BAA4B,EAC5B,cAAc,EACd,oBAAoB,EACpB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAEV,k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