@onekeyfe/hwk-ledger-adapter 1.1.26-alpha.14 → 1.1.26-alpha.20

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.
package/dist/index.d.mts CHANGED
@@ -6,26 +6,101 @@ import { SignerBtc as SignerBtc$1 } from '@ledgerhq/device-signer-kit-bitcoin';
6
6
  import { SignerSolana } from '@ledgerhq/device-signer-kit-solana';
7
7
  import Transport from '@ledgerhq/hw-transport';
8
8
 
9
- interface LedgerAdapterOptions {
10
- /**
11
- * `true` emit `REQUEST_SELECT_DEVICE` on multi-device discovery and await
12
- * `uiResponse({ type: RECEIVE_SELECT_DEVICE, payload: { sdkConnectId } })`.
13
- * `false` (default) — silently pick the first device.
14
- */
15
- handleSelectDevice?: boolean;
9
+ /**
10
+ * Re-export DMK types under local aliases for backward compatibility.
11
+ * These replace the previous duck-typed interfaces with the real SDK types.
12
+ */
13
+ type DmkDiscoveredDevice = DiscoveredDevice;
14
+ /**
15
+ * DMK DeviceAction — the Observable-based return type of all DMK signer methods.
16
+ *
17
+ * This is a permissive alias for `ExecuteDeviceActionReturnType` that accepts
18
+ * any Error and IntermediateValue generics. Signer wrapper code only cares about
19
+ * the Output type and the observable/cancel shape.
20
+ */
21
+ type DeviceAction<T> = ExecuteDeviceActionReturnType<T, any, any>;
22
+ /**
23
+ * DMK DeviceActionState — re-exported with permissive Error/IntermediateValue.
24
+ * The real type is a discriminated union on `status`.
25
+ */
26
+ type DeviceActionState<T> = DeviceActionState$1<T, any, any>;
27
+ /** ETH address result — re-exported from DMK for backward compatibility. */
28
+ type SignerEvmAddress = Address;
29
+ /** ETH signature result — re-exported from DMK for backward compatibility. */
30
+ type SignerEvmSignature = Signature;
31
+ /** BTC address result (WalletAddress not exported from DMK top-level). */
32
+ interface SignerBtcAddress {
33
+ address: string;
34
+ }
35
+
36
+ /** Optional context attached to the rejection when a canceller fires. */
37
+ interface CancelReason {
38
+ code?: number;
39
+ tag?: string;
40
+ message?: string;
41
+ }
42
+ /**
43
+ * Convert a DMK DeviceAction (Observable-based) into a Promise.
44
+ * Handles pending -> completed/error state transitions and interaction callbacks.
45
+ *
46
+ * Tracks the last DMK step observed (e.g. `signer.eth.steps.blindSignTransactionFallback`)
47
+ * and attaches it to the rejected error as a non-enumerable `_lastStep` property,
48
+ * so upstream error classifiers can distinguish failure contexts (e.g. Blind signing
49
+ * disabled vs. generic Invalid data).
50
+ *
51
+ * @param timeoutMs Idle watchdog ms. Re-armed on each emission, paused
52
+ * during interactive pending. 0 disables. Default 65s
53
+ * (covers DMK's 60s + margin; we're a backstop only).
54
+ * @param onRegisterCanceller Optional callback that receives a function which, when
55
+ * called, unsubscribes and cancels the underlying DeviceAction
56
+ * (releases DMK's IntentQueue slot). Caller is responsible
57
+ * for invoking the canceller on timeout/abort scenarios.
58
+ */
59
+ declare function deviceActionToPromise<T>(action: DeviceAction<T>, onInteraction?: (interaction: string) => void, timeoutMs?: number, onRegisterCanceller?: (cancel: (reason?: CancelReason) => void) => void, onIntermediate?: (intermediateValue: unknown) => void): Promise<T>;
60
+
61
+ interface AppMetadata {
62
+ versionName: string;
63
+ versionId: number;
64
+ version: string;
65
+ versionDisplayName: string | null;
66
+ description: string | null;
67
+ icon: string | null;
68
+ bytes: number | null;
69
+ currencyId: string | null;
70
+ isDevTools: boolean;
71
+ }
72
+ interface FirmwareVersion {
73
+ /** BOLOS version on the secure element — the user-facing firmware version. */
74
+ seVersion: string;
75
+ /** MCU SEPH (SE–MCU link protocol) version. */
76
+ mcuSephVersion: string;
77
+ /** MCU bootloader version. */
78
+ mcuBootloaderVersion: string;
79
+ /** Hardware revision (e.g. "00" / "01" on Nano X). */
80
+ hwVersion: string;
16
81
  }
82
+ /** Full GetOsVersionResponse projected to a plain serializable shape. */
83
+ interface LedgerDeviceInfo extends FirmwareVersion {
84
+ isBootloader: boolean;
85
+ isOsu: boolean;
86
+ targetId: number;
87
+ seTargetId?: number;
88
+ mcuTargetId?: number;
89
+ /** Secure element flags as hex string (raw bytes turned readable). */
90
+ seFlagsHex: string;
91
+ }
92
+
17
93
  declare class LedgerAdapter implements IHardwareWallet {
18
94
  readonly vendor: "ledger";
19
95
  private readonly connector;
20
96
  private readonly emitter;
21
- private readonly _handleSelectDevice;
22
97
  private _discoveredDevices;
23
98
  private _sessions;
24
99
  private readonly _uiRegistry;
25
100
  private _btcHighIndexConfirmedThisSession;
26
101
  private readonly _jobQueue;
27
102
  private _doConnectAbortController;
28
- constructor(connector: IConnector, options?: LedgerAdapterOptions);
103
+ constructor(connector: IConnector);
29
104
  get activeTransport(): TransportType | null;
30
105
  getAvailableTransports(): TransportType[];
31
106
  switchTransport(_type: TransportType): Promise<void>;
@@ -39,6 +114,9 @@ declare class LedgerAdapter implements IHardwareWallet {
39
114
  dispose(): Promise<void>;
40
115
  uiResponse(response: UiResponseEvent): void;
41
116
  searchDevices(options?: SearchDevicesOptions): Promise<DeviceInfo[]>;
117
+ /** Compact snapshot helpers for diagnostic logs. */
118
+ private _snapshotSessions;
119
+ private _snapshotDiscovered;
42
120
  private static readonly MAX_BUSINESS_RETRY_BUDGET;
43
121
  private static readonly STUCK_APP_RETRY_DELAY_MS;
44
122
  private static readonly MAX_DOCONNECT_CONFIRMS;
@@ -67,6 +145,11 @@ declare class LedgerAdapter implements IHardwareWallet {
67
145
  tronGetAddress(connectId: string, deviceId: string, params: TronGetAddressParams): Promise<Response<TronAddress>>;
68
146
  tronSignTransaction(connectId: string, deviceId: string, params: TronSignTxParams): Promise<Response<TronSignedTx>>;
69
147
  tronSignMessage(connectId: string, deviceId: string, params: TronSignMsgParams): Promise<Response<TronSignature>>;
148
+ installApp(connectId: string, appName: string): Promise<Response<void>>;
149
+ listInstalledApps(connectId: string): Promise<Response<AppMetadata[]>>;
150
+ listAvailableApps(connectId: string): Promise<Response<AppMetadata[]>>;
151
+ getLedgerFirmwareVersion(connectId: string): Promise<Response<FirmwareVersion>>;
152
+ getLedgerDeviceInfo(connectId: string): Promise<Response<LedgerDeviceInfo>>;
70
153
  on<K extends keyof HardwareEventMap>(event: K, listener: (event: HardwareEventMap[K]) => void): void;
71
154
  on(event: string, listener: DeviceEventListener): void;
72
155
  off<K extends keyof HardwareEventMap>(event: K, listener: (event: HardwareEventMap[K]) => void): void;
@@ -98,7 +181,7 @@ declare class LedgerAdapter implements IHardwareWallet {
98
181
  *
99
182
  * - If a session already exists for the given connectId, reuse it.
100
183
  * - If ANY session exists (Ledger IDs are ephemeral), reuse it.
101
- * - Otherwise: search → 1 device: auto-connect, multiple: ask user, 0: throw.
184
+ * - Otherwise: search → 1 USB device: auto-connect, multiple USB devices: throw, 0: throw.
102
185
  */
103
186
  private _connectingPromise;
104
187
  private _waitForDeviceConnect;
@@ -115,7 +198,6 @@ declare class LedgerAdapter implements IHardwareWallet {
115
198
  private _doConnect;
116
199
  private _connectFirstOrSelect;
117
200
  private _connectDeviceOrThrow;
118
- private _chooseDeviceFromList;
119
201
  /**
120
202
  * Call the connector with automatic session resolution and disconnect retry.
121
203
  *
@@ -178,33 +260,6 @@ declare class LedgerAdapter implements IHardwareWallet {
178
260
  private connectorDeviceToDeviceInfo;
179
261
  }
180
262
 
181
- /**
182
- * Re-export DMK types under local aliases for backward compatibility.
183
- * These replace the previous duck-typed interfaces with the real SDK types.
184
- */
185
- type DmkDiscoveredDevice = DiscoveredDevice;
186
- /**
187
- * DMK DeviceAction — the Observable-based return type of all DMK signer methods.
188
- *
189
- * This is a permissive alias for `ExecuteDeviceActionReturnType` that accepts
190
- * any Error and IntermediateValue generics. Signer wrapper code only cares about
191
- * the Output type and the observable/cancel shape.
192
- */
193
- type DeviceAction<T> = ExecuteDeviceActionReturnType<T, any, any>;
194
- /**
195
- * DMK DeviceActionState — re-exported with permissive Error/IntermediateValue.
196
- * The real type is a discriminated union on `status`.
197
- */
198
- type DeviceActionState<T> = DeviceActionState$1<T, any, any>;
199
- /** ETH address result — re-exported from DMK for backward compatibility. */
200
- type SignerEvmAddress = Address;
201
- /** ETH signature result — re-exported from DMK for backward compatibility. */
202
- type SignerEvmSignature = Signature;
203
- /** BTC address result (WalletAddress not exported from DMK top-level). */
204
- interface SignerBtcAddress {
205
- address: string;
206
- }
207
-
208
263
  /**
209
264
  * Manages device discovery, connection, and session tracking.
210
265
  * Wraps DMK's Observable APIs into simpler imperative calls.
@@ -320,6 +375,7 @@ interface LedgerConnectorBaseOptions {
320
375
  declare class LedgerConnectorBase implements IConnector {
321
376
  private _deviceManager;
322
377
  private _signerManager;
378
+ private _deviceAppsManager;
323
379
  private _dmk;
324
380
  private readonly _eventHandlers;
325
381
  private readonly _providedDmk;
@@ -363,6 +419,7 @@ declare class LedgerConnectorBase implements IConnector {
363
419
  * enumerate() cache survives peripherals going offline.
364
420
  */
365
421
  protected _discoverDescriptors(dm: LedgerDeviceManager): Promise<DeviceDescriptor[]>;
422
+ private _assertSingleUsbDescriptor;
366
423
  searchDevices(): Promise<ConnectorDevice[]>;
367
424
  connect(deviceId?: string): Promise<ConnectorSession>;
368
425
  disconnect(sessionId: string): Promise<void>;
@@ -395,6 +452,7 @@ declare class LedgerConnectorBase implements IConnector {
395
452
  private _initManagers;
396
453
  private _getDeviceManager;
397
454
  private _getSignerManager;
455
+ private _getDeviceAppsManager;
398
456
  private _invalidateSession;
399
457
  /**
400
458
  * Replace an old session with a new one after app switch.
@@ -421,31 +479,6 @@ declare class LedgerConnectorBase implements IConnector {
421
479
  private _wrapError;
422
480
  }
423
481
 
424
- /** Optional context attached to the rejection when a canceller fires. */
425
- interface CancelReason {
426
- code?: number;
427
- tag?: string;
428
- message?: string;
429
- }
430
- /**
431
- * Convert a DMK DeviceAction (Observable-based) into a Promise.
432
- * Handles pending -> completed/error state transitions and interaction callbacks.
433
- *
434
- * Tracks the last DMK step observed (e.g. `signer.eth.steps.blindSignTransactionFallback`)
435
- * and attaches it to the rejected error as a non-enumerable `_lastStep` property,
436
- * so upstream error classifiers can distinguish failure contexts (e.g. Blind signing
437
- * disabled vs. generic Invalid data).
438
- *
439
- * @param timeoutMs Idle watchdog ms. Re-armed on each emission, paused
440
- * during interactive pending. 0 disables. Default 65s
441
- * (covers DMK's 60s + margin; we're a backstop only).
442
- * @param onRegisterCanceller Optional callback that receives a function which, when
443
- * called, unsubscribes and cancels the underlying DeviceAction
444
- * (releases DMK's IntentQueue slot). Caller is responsible
445
- * for invoking the canceller on timeout/abort scenarios.
446
- */
447
- declare function deviceActionToPromise<T>(action: DeviceAction<T>, onInteraction?: (interaction: string) => void, timeoutMs?: number, onRegisterCanceller?: (cancel: (reason?: CancelReason) => void) => void): Promise<T>;
448
-
449
482
  /**
450
483
  * Wraps Ledger's SDK signer (Observable-based DeviceActions) into
451
484
  * a simple async interface returning plain serializable data.
package/dist/index.d.ts CHANGED
@@ -6,26 +6,101 @@ import { SignerBtc as SignerBtc$1 } from '@ledgerhq/device-signer-kit-bitcoin';
6
6
  import { SignerSolana } from '@ledgerhq/device-signer-kit-solana';
7
7
  import Transport from '@ledgerhq/hw-transport';
8
8
 
9
- interface LedgerAdapterOptions {
10
- /**
11
- * `true` emit `REQUEST_SELECT_DEVICE` on multi-device discovery and await
12
- * `uiResponse({ type: RECEIVE_SELECT_DEVICE, payload: { sdkConnectId } })`.
13
- * `false` (default) — silently pick the first device.
14
- */
15
- handleSelectDevice?: boolean;
9
+ /**
10
+ * Re-export DMK types under local aliases for backward compatibility.
11
+ * These replace the previous duck-typed interfaces with the real SDK types.
12
+ */
13
+ type DmkDiscoveredDevice = DiscoveredDevice;
14
+ /**
15
+ * DMK DeviceAction — the Observable-based return type of all DMK signer methods.
16
+ *
17
+ * This is a permissive alias for `ExecuteDeviceActionReturnType` that accepts
18
+ * any Error and IntermediateValue generics. Signer wrapper code only cares about
19
+ * the Output type and the observable/cancel shape.
20
+ */
21
+ type DeviceAction<T> = ExecuteDeviceActionReturnType<T, any, any>;
22
+ /**
23
+ * DMK DeviceActionState — re-exported with permissive Error/IntermediateValue.
24
+ * The real type is a discriminated union on `status`.
25
+ */
26
+ type DeviceActionState<T> = DeviceActionState$1<T, any, any>;
27
+ /** ETH address result — re-exported from DMK for backward compatibility. */
28
+ type SignerEvmAddress = Address;
29
+ /** ETH signature result — re-exported from DMK for backward compatibility. */
30
+ type SignerEvmSignature = Signature;
31
+ /** BTC address result (WalletAddress not exported from DMK top-level). */
32
+ interface SignerBtcAddress {
33
+ address: string;
34
+ }
35
+
36
+ /** Optional context attached to the rejection when a canceller fires. */
37
+ interface CancelReason {
38
+ code?: number;
39
+ tag?: string;
40
+ message?: string;
41
+ }
42
+ /**
43
+ * Convert a DMK DeviceAction (Observable-based) into a Promise.
44
+ * Handles pending -> completed/error state transitions and interaction callbacks.
45
+ *
46
+ * Tracks the last DMK step observed (e.g. `signer.eth.steps.blindSignTransactionFallback`)
47
+ * and attaches it to the rejected error as a non-enumerable `_lastStep` property,
48
+ * so upstream error classifiers can distinguish failure contexts (e.g. Blind signing
49
+ * disabled vs. generic Invalid data).
50
+ *
51
+ * @param timeoutMs Idle watchdog ms. Re-armed on each emission, paused
52
+ * during interactive pending. 0 disables. Default 65s
53
+ * (covers DMK's 60s + margin; we're a backstop only).
54
+ * @param onRegisterCanceller Optional callback that receives a function which, when
55
+ * called, unsubscribes and cancels the underlying DeviceAction
56
+ * (releases DMK's IntentQueue slot). Caller is responsible
57
+ * for invoking the canceller on timeout/abort scenarios.
58
+ */
59
+ declare function deviceActionToPromise<T>(action: DeviceAction<T>, onInteraction?: (interaction: string) => void, timeoutMs?: number, onRegisterCanceller?: (cancel: (reason?: CancelReason) => void) => void, onIntermediate?: (intermediateValue: unknown) => void): Promise<T>;
60
+
61
+ interface AppMetadata {
62
+ versionName: string;
63
+ versionId: number;
64
+ version: string;
65
+ versionDisplayName: string | null;
66
+ description: string | null;
67
+ icon: string | null;
68
+ bytes: number | null;
69
+ currencyId: string | null;
70
+ isDevTools: boolean;
71
+ }
72
+ interface FirmwareVersion {
73
+ /** BOLOS version on the secure element — the user-facing firmware version. */
74
+ seVersion: string;
75
+ /** MCU SEPH (SE–MCU link protocol) version. */
76
+ mcuSephVersion: string;
77
+ /** MCU bootloader version. */
78
+ mcuBootloaderVersion: string;
79
+ /** Hardware revision (e.g. "00" / "01" on Nano X). */
80
+ hwVersion: string;
16
81
  }
82
+ /** Full GetOsVersionResponse projected to a plain serializable shape. */
83
+ interface LedgerDeviceInfo extends FirmwareVersion {
84
+ isBootloader: boolean;
85
+ isOsu: boolean;
86
+ targetId: number;
87
+ seTargetId?: number;
88
+ mcuTargetId?: number;
89
+ /** Secure element flags as hex string (raw bytes turned readable). */
90
+ seFlagsHex: string;
91
+ }
92
+
17
93
  declare class LedgerAdapter implements IHardwareWallet {
18
94
  readonly vendor: "ledger";
19
95
  private readonly connector;
20
96
  private readonly emitter;
21
- private readonly _handleSelectDevice;
22
97
  private _discoveredDevices;
23
98
  private _sessions;
24
99
  private readonly _uiRegistry;
25
100
  private _btcHighIndexConfirmedThisSession;
26
101
  private readonly _jobQueue;
27
102
  private _doConnectAbortController;
28
- constructor(connector: IConnector, options?: LedgerAdapterOptions);
103
+ constructor(connector: IConnector);
29
104
  get activeTransport(): TransportType | null;
30
105
  getAvailableTransports(): TransportType[];
31
106
  switchTransport(_type: TransportType): Promise<void>;
@@ -39,6 +114,9 @@ declare class LedgerAdapter implements IHardwareWallet {
39
114
  dispose(): Promise<void>;
40
115
  uiResponse(response: UiResponseEvent): void;
41
116
  searchDevices(options?: SearchDevicesOptions): Promise<DeviceInfo[]>;
117
+ /** Compact snapshot helpers for diagnostic logs. */
118
+ private _snapshotSessions;
119
+ private _snapshotDiscovered;
42
120
  private static readonly MAX_BUSINESS_RETRY_BUDGET;
43
121
  private static readonly STUCK_APP_RETRY_DELAY_MS;
44
122
  private static readonly MAX_DOCONNECT_CONFIRMS;
@@ -67,6 +145,11 @@ declare class LedgerAdapter implements IHardwareWallet {
67
145
  tronGetAddress(connectId: string, deviceId: string, params: TronGetAddressParams): Promise<Response<TronAddress>>;
68
146
  tronSignTransaction(connectId: string, deviceId: string, params: TronSignTxParams): Promise<Response<TronSignedTx>>;
69
147
  tronSignMessage(connectId: string, deviceId: string, params: TronSignMsgParams): Promise<Response<TronSignature>>;
148
+ installApp(connectId: string, appName: string): Promise<Response<void>>;
149
+ listInstalledApps(connectId: string): Promise<Response<AppMetadata[]>>;
150
+ listAvailableApps(connectId: string): Promise<Response<AppMetadata[]>>;
151
+ getLedgerFirmwareVersion(connectId: string): Promise<Response<FirmwareVersion>>;
152
+ getLedgerDeviceInfo(connectId: string): Promise<Response<LedgerDeviceInfo>>;
70
153
  on<K extends keyof HardwareEventMap>(event: K, listener: (event: HardwareEventMap[K]) => void): void;
71
154
  on(event: string, listener: DeviceEventListener): void;
72
155
  off<K extends keyof HardwareEventMap>(event: K, listener: (event: HardwareEventMap[K]) => void): void;
@@ -98,7 +181,7 @@ declare class LedgerAdapter implements IHardwareWallet {
98
181
  *
99
182
  * - If a session already exists for the given connectId, reuse it.
100
183
  * - If ANY session exists (Ledger IDs are ephemeral), reuse it.
101
- * - Otherwise: search → 1 device: auto-connect, multiple: ask user, 0: throw.
184
+ * - Otherwise: search → 1 USB device: auto-connect, multiple USB devices: throw, 0: throw.
102
185
  */
103
186
  private _connectingPromise;
104
187
  private _waitForDeviceConnect;
@@ -115,7 +198,6 @@ declare class LedgerAdapter implements IHardwareWallet {
115
198
  private _doConnect;
116
199
  private _connectFirstOrSelect;
117
200
  private _connectDeviceOrThrow;
118
- private _chooseDeviceFromList;
119
201
  /**
120
202
  * Call the connector with automatic session resolution and disconnect retry.
121
203
  *
@@ -178,33 +260,6 @@ declare class LedgerAdapter implements IHardwareWallet {
178
260
  private connectorDeviceToDeviceInfo;
179
261
  }
180
262
 
181
- /**
182
- * Re-export DMK types under local aliases for backward compatibility.
183
- * These replace the previous duck-typed interfaces with the real SDK types.
184
- */
185
- type DmkDiscoveredDevice = DiscoveredDevice;
186
- /**
187
- * DMK DeviceAction — the Observable-based return type of all DMK signer methods.
188
- *
189
- * This is a permissive alias for `ExecuteDeviceActionReturnType` that accepts
190
- * any Error and IntermediateValue generics. Signer wrapper code only cares about
191
- * the Output type and the observable/cancel shape.
192
- */
193
- type DeviceAction<T> = ExecuteDeviceActionReturnType<T, any, any>;
194
- /**
195
- * DMK DeviceActionState — re-exported with permissive Error/IntermediateValue.
196
- * The real type is a discriminated union on `status`.
197
- */
198
- type DeviceActionState<T> = DeviceActionState$1<T, any, any>;
199
- /** ETH address result — re-exported from DMK for backward compatibility. */
200
- type SignerEvmAddress = Address;
201
- /** ETH signature result — re-exported from DMK for backward compatibility. */
202
- type SignerEvmSignature = Signature;
203
- /** BTC address result (WalletAddress not exported from DMK top-level). */
204
- interface SignerBtcAddress {
205
- address: string;
206
- }
207
-
208
263
  /**
209
264
  * Manages device discovery, connection, and session tracking.
210
265
  * Wraps DMK's Observable APIs into simpler imperative calls.
@@ -320,6 +375,7 @@ interface LedgerConnectorBaseOptions {
320
375
  declare class LedgerConnectorBase implements IConnector {
321
376
  private _deviceManager;
322
377
  private _signerManager;
378
+ private _deviceAppsManager;
323
379
  private _dmk;
324
380
  private readonly _eventHandlers;
325
381
  private readonly _providedDmk;
@@ -363,6 +419,7 @@ declare class LedgerConnectorBase implements IConnector {
363
419
  * enumerate() cache survives peripherals going offline.
364
420
  */
365
421
  protected _discoverDescriptors(dm: LedgerDeviceManager): Promise<DeviceDescriptor[]>;
422
+ private _assertSingleUsbDescriptor;
366
423
  searchDevices(): Promise<ConnectorDevice[]>;
367
424
  connect(deviceId?: string): Promise<ConnectorSession>;
368
425
  disconnect(sessionId: string): Promise<void>;
@@ -395,6 +452,7 @@ declare class LedgerConnectorBase implements IConnector {
395
452
  private _initManagers;
396
453
  private _getDeviceManager;
397
454
  private _getSignerManager;
455
+ private _getDeviceAppsManager;
398
456
  private _invalidateSession;
399
457
  /**
400
458
  * Replace an old session with a new one after app switch.
@@ -421,31 +479,6 @@ declare class LedgerConnectorBase implements IConnector {
421
479
  private _wrapError;
422
480
  }
423
481
 
424
- /** Optional context attached to the rejection when a canceller fires. */
425
- interface CancelReason {
426
- code?: number;
427
- tag?: string;
428
- message?: string;
429
- }
430
- /**
431
- * Convert a DMK DeviceAction (Observable-based) into a Promise.
432
- * Handles pending -> completed/error state transitions and interaction callbacks.
433
- *
434
- * Tracks the last DMK step observed (e.g. `signer.eth.steps.blindSignTransactionFallback`)
435
- * and attaches it to the rejected error as a non-enumerable `_lastStep` property,
436
- * so upstream error classifiers can distinguish failure contexts (e.g. Blind signing
437
- * disabled vs. generic Invalid data).
438
- *
439
- * @param timeoutMs Idle watchdog ms. Re-armed on each emission, paused
440
- * during interactive pending. 0 disables. Default 65s
441
- * (covers DMK's 60s + margin; we're a backstop only).
442
- * @param onRegisterCanceller Optional callback that receives a function which, when
443
- * called, unsubscribes and cancels the underlying DeviceAction
444
- * (releases DMK's IntentQueue slot). Caller is responsible
445
- * for invoking the canceller on timeout/abort scenarios.
446
- */
447
- declare function deviceActionToPromise<T>(action: DeviceAction<T>, onInteraction?: (interaction: string) => void, timeoutMs?: number, onRegisterCanceller?: (cancel: (reason?: CancelReason) => void) => void): Promise<T>;
448
-
449
482
  /**
450
483
  * Wraps Ledger's SDK signer (Observable-based DeviceActions) into
451
484
  * a simple async interface returning plain serializable data.