@onekeyfe/hwk-ledger-adapter 1.1.26-alpha.12 → 1.1.26-alpha.14
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 +49 -21
- package/dist/index.d.ts +49 -21
- package/dist/index.js +327 -161
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +321 -154
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { IHardwareWallet, IConnector, TransportType, UiResponseEvent, DeviceInfo, Response, ChainCapability, EvmGetAddressParams, EvmAddress, EvmSignTxParams, EvmSignedTx, EvmSignMsgParams, EvmSignature, EvmSignTypedDataParams, BtcGetAddressParams, BtcAddress, BtcGetPublicKeyParams, BtcPublicKey, BtcSignTxParams, BtcSignedTx, BtcSignPsbtParams, BtcSignedPsbt, BtcSignMsgParams, BtcSignature, SolGetAddressParams, SolAddress, SolSignTxParams, SolSignedTx, SolSignMsgParams, SolSignature, TronGetAddressParams, TronAddress, TronSignTxParams, TronSignedTx, TronSignMsgParams, TronSignature, HardwareEventMap, DeviceEventListener, ChainForFingerprint, DeviceDescriptor, DeviceChangeEvent, ConnectionType, ConnectorDevice, ConnectorSession, ConnectorEventType, ConnectorEventMap, Failure, HardwareErrorCode } from '@onekeyfe/hwk-adapter-core';
|
|
1
|
+
import { IHardwareWallet, IConnector, TransportType, UiResponseEvent, SearchDevicesOptions, DeviceInfo, Response, ChainCapability, EvmGetAddressParams, EvmAddress, EvmSignTxParams, EvmSignedTx, EvmSignMsgParams, EvmSignature, EvmSignTypedDataParams, BtcGetAddressParams, BtcAddress, BtcGetPublicKeyParams, BtcPublicKey, BtcSignTxParams, BtcSignedTx, BtcSignPsbtParams, BtcSignedPsbt, BtcSignMsgParams, BtcSignature, SolGetAddressParams, SolAddress, SolSignTxParams, SolSignedTx, SolSignMsgParams, SolSignature, TronGetAddressParams, TronAddress, TronSignTxParams, TronSignedTx, TronSignMsgParams, TronSignature, HardwareEventMap, DeviceEventListener, ChainForFingerprint, DeviceDescriptor, DeviceChangeEvent, ConnectionType, ConnectorDevice, ConnectorSession, ConnectorEventType, ConnectorEventMap, Failure, HardwareErrorCode } from '@onekeyfe/hwk-adapter-core';
|
|
2
2
|
import { DeviceActionState as DeviceActionState$1, DiscoveredDevice, ExecuteDeviceActionReturnType, DeviceManagementKit } from '@ledgerhq/device-management-kit';
|
|
3
3
|
import { Address, Signature, SignerEth as SignerEth$1, TypedData } from '@ledgerhq/device-signer-kit-ethereum';
|
|
4
|
+
import { ContextModule } from '@ledgerhq/context-module';
|
|
4
5
|
import { SignerBtc as SignerBtc$1 } from '@ledgerhq/device-signer-kit-bitcoin';
|
|
5
6
|
import { SignerSolana } from '@ledgerhq/device-signer-kit-solana';
|
|
6
7
|
import Transport from '@ledgerhq/hw-transport';
|
|
@@ -37,8 +38,9 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
37
38
|
resetState(): void;
|
|
38
39
|
dispose(): Promise<void>;
|
|
39
40
|
uiResponse(response: UiResponseEvent): void;
|
|
40
|
-
searchDevices(): Promise<DeviceInfo[]>;
|
|
41
|
+
searchDevices(options?: SearchDevicesOptions): Promise<DeviceInfo[]>;
|
|
41
42
|
private static readonly MAX_BUSINESS_RETRY_BUDGET;
|
|
43
|
+
private static readonly STUCK_APP_RETRY_DELAY_MS;
|
|
42
44
|
private static readonly MAX_DOCONNECT_CONFIRMS;
|
|
43
45
|
private _lastCancelReason;
|
|
44
46
|
private static _createDeviceBusyError;
|
|
@@ -132,6 +134,16 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
132
134
|
private static _throwIfAborted;
|
|
133
135
|
/** Actual work done under the job queue — connection, fingerprint, call, and recovery. */
|
|
134
136
|
private _runConnectorCall;
|
|
137
|
+
/**
|
|
138
|
+
* Stuck-app recovery: pause for the device's UI transition, then retry once.
|
|
139
|
+
*
|
|
140
|
+
* Caller has already cleared the session + reset connector. We wait so Stax
|
|
141
|
+
* finishes its post-CloseApp animation, then go through ensureConnected +
|
|
142
|
+
* fingerprint check + call exactly once. Caller decides what to do on a
|
|
143
|
+
* second stuck-app hit.
|
|
144
|
+
*/
|
|
145
|
+
private _retryAfterStuckApp;
|
|
146
|
+
private _sleepAbortable;
|
|
135
147
|
/**
|
|
136
148
|
* Clear stale session, reconnect, and retry the call.
|
|
137
149
|
*
|
|
@@ -244,6 +256,14 @@ declare class LedgerDeviceManager {
|
|
|
244
256
|
requestDevice(): Promise<void>;
|
|
245
257
|
/** Lookup a previously-discovered device's display name. */
|
|
246
258
|
getDeviceName(deviceId: string): string | undefined;
|
|
259
|
+
/** Lookup minimal model/signal info from a previously-discovered device. */
|
|
260
|
+
getDiscoveredDeviceInfo(deviceId: string): {
|
|
261
|
+
model?: string;
|
|
262
|
+
modelName?: string;
|
|
263
|
+
name?: string;
|
|
264
|
+
rssi?: number | null;
|
|
265
|
+
} | undefined;
|
|
266
|
+
hasDiscoveredDevice(deviceId: string): boolean;
|
|
247
267
|
/** Connect to a previously discovered device. Returns sessionId. */
|
|
248
268
|
connect(deviceId: string): Promise<string>;
|
|
249
269
|
/** Disconnect a session. */
|
|
@@ -288,7 +308,14 @@ interface LedgerConnectorBaseOptions {
|
|
|
288
308
|
* Subclasses only need to:
|
|
289
309
|
* 1. Supply a transport factory via the constructor.
|
|
290
310
|
* 2. Optionally override `_resolveConnectId()` for transport-specific
|
|
291
|
-
* device identity resolution
|
|
311
|
+
* device identity resolution.
|
|
312
|
+
*
|
|
313
|
+
* Invariant: one instance = one transport. `connectionType` is fixed at
|
|
314
|
+
* construction. To switch transport (e.g. desktop BLE ↔ WebHID), the host
|
|
315
|
+
* must build a new connector instance and replace the old one — don't add
|
|
316
|
+
* multiple transports to a single instance. Lifting this constraint would
|
|
317
|
+
* require routing `connectionType` from `descriptor.transport` per-device
|
|
318
|
+
* and updating every `this.connectionType` branch in this file.
|
|
292
319
|
*/
|
|
293
320
|
declare class LedgerConnectorBase implements IConnector {
|
|
294
321
|
private _deviceManager;
|
|
@@ -298,12 +325,6 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
298
325
|
private readonly _providedDmk;
|
|
299
326
|
private readonly _createTransport;
|
|
300
327
|
readonly connectionType: ConnectionType;
|
|
301
|
-
private _connectIdToPath;
|
|
302
|
-
private _pathToConnectId;
|
|
303
|
-
/** Get DMK path from external connectId. Falls back to connectId itself. */
|
|
304
|
-
private _getPathForConnectId;
|
|
305
|
-
/** Get external connectId from DMK path. Falls back to path itself. */
|
|
306
|
-
private _getConnectIdForPath;
|
|
307
328
|
private readonly _cancellers;
|
|
308
329
|
private readonly _sessionStateSubs;
|
|
309
330
|
/**
|
|
@@ -314,6 +335,10 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
314
335
|
protected _importLedgerKit: (pkg: string) => Promise<any>;
|
|
315
336
|
/** Context object passed to per-chain handler functions. */
|
|
316
337
|
private readonly _ctx;
|
|
338
|
+
/** When true, BLE direct-connect throws NotAdvertising if the pre-flight
|
|
339
|
+
* scan can't see the device — guard for GATT stacks that wedge on
|
|
340
|
+
* non-advertising peripherals (iOS). */
|
|
341
|
+
private readonly _requirePreFlightScan;
|
|
317
342
|
constructor(createTransport: TransportFactory, options?: {
|
|
318
343
|
connectionType?: ConnectionType;
|
|
319
344
|
dmk?: DeviceManagementKit;
|
|
@@ -323,11 +348,13 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
323
348
|
* For Metro (React Native): pass a resolver that uses CJS paths.
|
|
324
349
|
*/
|
|
325
350
|
importLedgerKit?: (pkg: string) => Promise<any>;
|
|
351
|
+
/** Default false. RN-iOS subclass should pass `true`. */
|
|
352
|
+
requirePreFlightScan?: boolean;
|
|
326
353
|
});
|
|
327
354
|
/**
|
|
328
355
|
* Resolve the connectId for a discovered device descriptor.
|
|
329
356
|
* Default: use the DMK path (ephemeral UUID).
|
|
330
|
-
* Override in subclasses
|
|
357
|
+
* Override in subclasses only when the public connectId differs from the transport path.
|
|
331
358
|
*/
|
|
332
359
|
protected _resolveConnectId(descriptor: DeviceDescriptor): string;
|
|
333
360
|
/**
|
|
@@ -371,12 +398,11 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
371
398
|
private _invalidateSession;
|
|
372
399
|
/**
|
|
373
400
|
* Replace an old session with a new one after app switch.
|
|
374
|
-
*
|
|
375
|
-
* and emits device-connect so the adapter updates its _sessions Map.
|
|
401
|
+
* Emits device-connect so the adapter updates its _sessions Map.
|
|
376
402
|
*/
|
|
377
403
|
private _replaceSession;
|
|
378
404
|
/**
|
|
379
|
-
* Light reset: clear signer/session state but keep DMK
|
|
405
|
+
* Light reset: clear signer/session state but keep DMK alive.
|
|
380
406
|
* Used by connect() retry — we want to re-discover with the same transport.
|
|
381
407
|
*
|
|
382
408
|
* Note: drops the device manager but tears down its RxJS subs first via
|
|
@@ -446,8 +472,14 @@ type SignerEthBuilderFn = (args: {
|
|
|
446
472
|
dmk: DeviceManagementKit;
|
|
447
473
|
sessionId: string;
|
|
448
474
|
}) => {
|
|
475
|
+
withContextModule?(contextModule: ContextModule): {
|
|
476
|
+
build(): SignerEth$1;
|
|
477
|
+
};
|
|
449
478
|
build(): SignerEth$1;
|
|
450
479
|
} | Promise<{
|
|
480
|
+
withContextModule?(contextModule: ContextModule): {
|
|
481
|
+
build(): SignerEth$1;
|
|
482
|
+
};
|
|
451
483
|
build(): SignerEth$1;
|
|
452
484
|
}>;
|
|
453
485
|
/**
|
|
@@ -463,6 +495,8 @@ declare class SignerManager {
|
|
|
463
495
|
invalidate(_sessionId: string): void;
|
|
464
496
|
clearAll(): void;
|
|
465
497
|
private static _defaultBuilder;
|
|
498
|
+
private static _createContextModule;
|
|
499
|
+
static wrapBlindSigningReportNonBlocking<T extends ContextModule>(contextModule: T): T;
|
|
466
500
|
}
|
|
467
501
|
|
|
468
502
|
type BtcWallet = Parameters<SignerBtc$1['getWalletAddress']>[0];
|
|
@@ -655,12 +689,7 @@ type SdkEventListener = (event: SdkEvent) => void;
|
|
|
655
689
|
declare function onSdkEvent(listener: SdkEventListener): () => void;
|
|
656
690
|
declare function offSdkEvent(listener: SdkEventListener): void;
|
|
657
691
|
|
|
658
|
-
|
|
659
|
-
* Extract the stable 4-digit HEX identifier from a Ledger BLE device name.
|
|
660
|
-
* e.g., "Nano X 123A" -> "123A", "Ledger Nano X AB12" -> "AB12"
|
|
661
|
-
* Returns undefined if no valid HEX suffix found.
|
|
662
|
-
*/
|
|
663
|
-
declare function extractBleHexId(name?: string): string | undefined;
|
|
692
|
+
declare function debugLog(...args: unknown[]): void;
|
|
664
693
|
|
|
665
694
|
/**
|
|
666
695
|
* Ledger DMK transport identifiers that represent BLE devices.
|
|
@@ -675,6 +704,5 @@ declare function extractBleHexId(name?: string): string | undefined;
|
|
|
675
704
|
declare function isLedgerDmkBleTransport(transport?: string): boolean;
|
|
676
705
|
declare function isLedgerBleConnectionType(connectionType?: ConnectionType): boolean;
|
|
677
706
|
declare function isLedgerBleDescriptor(connectionType: ConnectionType, descriptor: DeviceDescriptor): boolean;
|
|
678
|
-
declare function isValidLedgerBleConnectId(connectId?: string): boolean;
|
|
679
707
|
|
|
680
|
-
export { AppManager, type DeviceActionState, type DmkDiscoveredDevice, DmkTransport, LedgerAdapter, LedgerConnectorBase, type LedgerConnectorBaseOptions, LedgerDeviceManager, type LedgerFailure, type SdkEvent, type SdkEventListener, type SdkLogEvent, SignerBtc, type SignerBtcAddress, SignerEth, type SignerEvmAddress, type SignerEvmSignature, SignerManager, SignerSol, type TransportFactory,
|
|
708
|
+
export { AppManager, type DeviceActionState, type DmkDiscoveredDevice, DmkTransport, LedgerAdapter, LedgerConnectorBase, type LedgerConnectorBaseOptions, LedgerDeviceManager, type LedgerFailure, type SdkEvent, type SdkEventListener, type SdkLogEvent, SignerBtc, type SignerBtcAddress, SignerEth, type SignerEvmAddress, type SignerEvmSignature, SignerManager, SignerSol, type TransportFactory, debugLog, deviceActionToPromise, isDeviceLockedError, isLedgerBleConnectionType, isLedgerBleDescriptor, isLedgerDmkBleTransport, ledgerFailure, mapLedgerError, offSdkEvent, onSdkEvent };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { IHardwareWallet, IConnector, TransportType, UiResponseEvent, DeviceInfo, Response, ChainCapability, EvmGetAddressParams, EvmAddress, EvmSignTxParams, EvmSignedTx, EvmSignMsgParams, EvmSignature, EvmSignTypedDataParams, BtcGetAddressParams, BtcAddress, BtcGetPublicKeyParams, BtcPublicKey, BtcSignTxParams, BtcSignedTx, BtcSignPsbtParams, BtcSignedPsbt, BtcSignMsgParams, BtcSignature, SolGetAddressParams, SolAddress, SolSignTxParams, SolSignedTx, SolSignMsgParams, SolSignature, TronGetAddressParams, TronAddress, TronSignTxParams, TronSignedTx, TronSignMsgParams, TronSignature, HardwareEventMap, DeviceEventListener, ChainForFingerprint, DeviceDescriptor, DeviceChangeEvent, ConnectionType, ConnectorDevice, ConnectorSession, ConnectorEventType, ConnectorEventMap, Failure, HardwareErrorCode } from '@onekeyfe/hwk-adapter-core';
|
|
1
|
+
import { IHardwareWallet, IConnector, TransportType, UiResponseEvent, SearchDevicesOptions, DeviceInfo, Response, ChainCapability, EvmGetAddressParams, EvmAddress, EvmSignTxParams, EvmSignedTx, EvmSignMsgParams, EvmSignature, EvmSignTypedDataParams, BtcGetAddressParams, BtcAddress, BtcGetPublicKeyParams, BtcPublicKey, BtcSignTxParams, BtcSignedTx, BtcSignPsbtParams, BtcSignedPsbt, BtcSignMsgParams, BtcSignature, SolGetAddressParams, SolAddress, SolSignTxParams, SolSignedTx, SolSignMsgParams, SolSignature, TronGetAddressParams, TronAddress, TronSignTxParams, TronSignedTx, TronSignMsgParams, TronSignature, HardwareEventMap, DeviceEventListener, ChainForFingerprint, DeviceDescriptor, DeviceChangeEvent, ConnectionType, ConnectorDevice, ConnectorSession, ConnectorEventType, ConnectorEventMap, Failure, HardwareErrorCode } from '@onekeyfe/hwk-adapter-core';
|
|
2
2
|
import { DeviceActionState as DeviceActionState$1, DiscoveredDevice, ExecuteDeviceActionReturnType, DeviceManagementKit } from '@ledgerhq/device-management-kit';
|
|
3
3
|
import { Address, Signature, SignerEth as SignerEth$1, TypedData } from '@ledgerhq/device-signer-kit-ethereum';
|
|
4
|
+
import { ContextModule } from '@ledgerhq/context-module';
|
|
4
5
|
import { SignerBtc as SignerBtc$1 } from '@ledgerhq/device-signer-kit-bitcoin';
|
|
5
6
|
import { SignerSolana } from '@ledgerhq/device-signer-kit-solana';
|
|
6
7
|
import Transport from '@ledgerhq/hw-transport';
|
|
@@ -37,8 +38,9 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
37
38
|
resetState(): void;
|
|
38
39
|
dispose(): Promise<void>;
|
|
39
40
|
uiResponse(response: UiResponseEvent): void;
|
|
40
|
-
searchDevices(): Promise<DeviceInfo[]>;
|
|
41
|
+
searchDevices(options?: SearchDevicesOptions): Promise<DeviceInfo[]>;
|
|
41
42
|
private static readonly MAX_BUSINESS_RETRY_BUDGET;
|
|
43
|
+
private static readonly STUCK_APP_RETRY_DELAY_MS;
|
|
42
44
|
private static readonly MAX_DOCONNECT_CONFIRMS;
|
|
43
45
|
private _lastCancelReason;
|
|
44
46
|
private static _createDeviceBusyError;
|
|
@@ -132,6 +134,16 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
132
134
|
private static _throwIfAborted;
|
|
133
135
|
/** Actual work done under the job queue — connection, fingerprint, call, and recovery. */
|
|
134
136
|
private _runConnectorCall;
|
|
137
|
+
/**
|
|
138
|
+
* Stuck-app recovery: pause for the device's UI transition, then retry once.
|
|
139
|
+
*
|
|
140
|
+
* Caller has already cleared the session + reset connector. We wait so Stax
|
|
141
|
+
* finishes its post-CloseApp animation, then go through ensureConnected +
|
|
142
|
+
* fingerprint check + call exactly once. Caller decides what to do on a
|
|
143
|
+
* second stuck-app hit.
|
|
144
|
+
*/
|
|
145
|
+
private _retryAfterStuckApp;
|
|
146
|
+
private _sleepAbortable;
|
|
135
147
|
/**
|
|
136
148
|
* Clear stale session, reconnect, and retry the call.
|
|
137
149
|
*
|
|
@@ -244,6 +256,14 @@ declare class LedgerDeviceManager {
|
|
|
244
256
|
requestDevice(): Promise<void>;
|
|
245
257
|
/** Lookup a previously-discovered device's display name. */
|
|
246
258
|
getDeviceName(deviceId: string): string | undefined;
|
|
259
|
+
/** Lookup minimal model/signal info from a previously-discovered device. */
|
|
260
|
+
getDiscoveredDeviceInfo(deviceId: string): {
|
|
261
|
+
model?: string;
|
|
262
|
+
modelName?: string;
|
|
263
|
+
name?: string;
|
|
264
|
+
rssi?: number | null;
|
|
265
|
+
} | undefined;
|
|
266
|
+
hasDiscoveredDevice(deviceId: string): boolean;
|
|
247
267
|
/** Connect to a previously discovered device. Returns sessionId. */
|
|
248
268
|
connect(deviceId: string): Promise<string>;
|
|
249
269
|
/** Disconnect a session. */
|
|
@@ -288,7 +308,14 @@ interface LedgerConnectorBaseOptions {
|
|
|
288
308
|
* Subclasses only need to:
|
|
289
309
|
* 1. Supply a transport factory via the constructor.
|
|
290
310
|
* 2. Optionally override `_resolveConnectId()` for transport-specific
|
|
291
|
-
* device identity resolution
|
|
311
|
+
* device identity resolution.
|
|
312
|
+
*
|
|
313
|
+
* Invariant: one instance = one transport. `connectionType` is fixed at
|
|
314
|
+
* construction. To switch transport (e.g. desktop BLE ↔ WebHID), the host
|
|
315
|
+
* must build a new connector instance and replace the old one — don't add
|
|
316
|
+
* multiple transports to a single instance. Lifting this constraint would
|
|
317
|
+
* require routing `connectionType` from `descriptor.transport` per-device
|
|
318
|
+
* and updating every `this.connectionType` branch in this file.
|
|
292
319
|
*/
|
|
293
320
|
declare class LedgerConnectorBase implements IConnector {
|
|
294
321
|
private _deviceManager;
|
|
@@ -298,12 +325,6 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
298
325
|
private readonly _providedDmk;
|
|
299
326
|
private readonly _createTransport;
|
|
300
327
|
readonly connectionType: ConnectionType;
|
|
301
|
-
private _connectIdToPath;
|
|
302
|
-
private _pathToConnectId;
|
|
303
|
-
/** Get DMK path from external connectId. Falls back to connectId itself. */
|
|
304
|
-
private _getPathForConnectId;
|
|
305
|
-
/** Get external connectId from DMK path. Falls back to path itself. */
|
|
306
|
-
private _getConnectIdForPath;
|
|
307
328
|
private readonly _cancellers;
|
|
308
329
|
private readonly _sessionStateSubs;
|
|
309
330
|
/**
|
|
@@ -314,6 +335,10 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
314
335
|
protected _importLedgerKit: (pkg: string) => Promise<any>;
|
|
315
336
|
/** Context object passed to per-chain handler functions. */
|
|
316
337
|
private readonly _ctx;
|
|
338
|
+
/** When true, BLE direct-connect throws NotAdvertising if the pre-flight
|
|
339
|
+
* scan can't see the device — guard for GATT stacks that wedge on
|
|
340
|
+
* non-advertising peripherals (iOS). */
|
|
341
|
+
private readonly _requirePreFlightScan;
|
|
317
342
|
constructor(createTransport: TransportFactory, options?: {
|
|
318
343
|
connectionType?: ConnectionType;
|
|
319
344
|
dmk?: DeviceManagementKit;
|
|
@@ -323,11 +348,13 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
323
348
|
* For Metro (React Native): pass a resolver that uses CJS paths.
|
|
324
349
|
*/
|
|
325
350
|
importLedgerKit?: (pkg: string) => Promise<any>;
|
|
351
|
+
/** Default false. RN-iOS subclass should pass `true`. */
|
|
352
|
+
requirePreFlightScan?: boolean;
|
|
326
353
|
});
|
|
327
354
|
/**
|
|
328
355
|
* Resolve the connectId for a discovered device descriptor.
|
|
329
356
|
* Default: use the DMK path (ephemeral UUID).
|
|
330
|
-
* Override in subclasses
|
|
357
|
+
* Override in subclasses only when the public connectId differs from the transport path.
|
|
331
358
|
*/
|
|
332
359
|
protected _resolveConnectId(descriptor: DeviceDescriptor): string;
|
|
333
360
|
/**
|
|
@@ -371,12 +398,11 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
371
398
|
private _invalidateSession;
|
|
372
399
|
/**
|
|
373
400
|
* Replace an old session with a new one after app switch.
|
|
374
|
-
*
|
|
375
|
-
* and emits device-connect so the adapter updates its _sessions Map.
|
|
401
|
+
* Emits device-connect so the adapter updates its _sessions Map.
|
|
376
402
|
*/
|
|
377
403
|
private _replaceSession;
|
|
378
404
|
/**
|
|
379
|
-
* Light reset: clear signer/session state but keep DMK
|
|
405
|
+
* Light reset: clear signer/session state but keep DMK alive.
|
|
380
406
|
* Used by connect() retry — we want to re-discover with the same transport.
|
|
381
407
|
*
|
|
382
408
|
* Note: drops the device manager but tears down its RxJS subs first via
|
|
@@ -446,8 +472,14 @@ type SignerEthBuilderFn = (args: {
|
|
|
446
472
|
dmk: DeviceManagementKit;
|
|
447
473
|
sessionId: string;
|
|
448
474
|
}) => {
|
|
475
|
+
withContextModule?(contextModule: ContextModule): {
|
|
476
|
+
build(): SignerEth$1;
|
|
477
|
+
};
|
|
449
478
|
build(): SignerEth$1;
|
|
450
479
|
} | Promise<{
|
|
480
|
+
withContextModule?(contextModule: ContextModule): {
|
|
481
|
+
build(): SignerEth$1;
|
|
482
|
+
};
|
|
451
483
|
build(): SignerEth$1;
|
|
452
484
|
}>;
|
|
453
485
|
/**
|
|
@@ -463,6 +495,8 @@ declare class SignerManager {
|
|
|
463
495
|
invalidate(_sessionId: string): void;
|
|
464
496
|
clearAll(): void;
|
|
465
497
|
private static _defaultBuilder;
|
|
498
|
+
private static _createContextModule;
|
|
499
|
+
static wrapBlindSigningReportNonBlocking<T extends ContextModule>(contextModule: T): T;
|
|
466
500
|
}
|
|
467
501
|
|
|
468
502
|
type BtcWallet = Parameters<SignerBtc$1['getWalletAddress']>[0];
|
|
@@ -655,12 +689,7 @@ type SdkEventListener = (event: SdkEvent) => void;
|
|
|
655
689
|
declare function onSdkEvent(listener: SdkEventListener): () => void;
|
|
656
690
|
declare function offSdkEvent(listener: SdkEventListener): void;
|
|
657
691
|
|
|
658
|
-
|
|
659
|
-
* Extract the stable 4-digit HEX identifier from a Ledger BLE device name.
|
|
660
|
-
* e.g., "Nano X 123A" -> "123A", "Ledger Nano X AB12" -> "AB12"
|
|
661
|
-
* Returns undefined if no valid HEX suffix found.
|
|
662
|
-
*/
|
|
663
|
-
declare function extractBleHexId(name?: string): string | undefined;
|
|
692
|
+
declare function debugLog(...args: unknown[]): void;
|
|
664
693
|
|
|
665
694
|
/**
|
|
666
695
|
* Ledger DMK transport identifiers that represent BLE devices.
|
|
@@ -675,6 +704,5 @@ declare function extractBleHexId(name?: string): string | undefined;
|
|
|
675
704
|
declare function isLedgerDmkBleTransport(transport?: string): boolean;
|
|
676
705
|
declare function isLedgerBleConnectionType(connectionType?: ConnectionType): boolean;
|
|
677
706
|
declare function isLedgerBleDescriptor(connectionType: ConnectionType, descriptor: DeviceDescriptor): boolean;
|
|
678
|
-
declare function isValidLedgerBleConnectId(connectId?: string): boolean;
|
|
679
707
|
|
|
680
|
-
export { AppManager, type DeviceActionState, type DmkDiscoveredDevice, DmkTransport, LedgerAdapter, LedgerConnectorBase, type LedgerConnectorBaseOptions, LedgerDeviceManager, type LedgerFailure, type SdkEvent, type SdkEventListener, type SdkLogEvent, SignerBtc, type SignerBtcAddress, SignerEth, type SignerEvmAddress, type SignerEvmSignature, SignerManager, SignerSol, type TransportFactory,
|
|
708
|
+
export { AppManager, type DeviceActionState, type DmkDiscoveredDevice, DmkTransport, LedgerAdapter, LedgerConnectorBase, type LedgerConnectorBaseOptions, LedgerDeviceManager, type LedgerFailure, type SdkEvent, type SdkEventListener, type SdkLogEvent, SignerBtc, type SignerBtcAddress, SignerEth, type SignerEvmAddress, type SignerEvmSignature, SignerManager, SignerSol, type TransportFactory, debugLog, deviceActionToPromise, isDeviceLockedError, isLedgerBleConnectionType, isLedgerBleDescriptor, isLedgerDmkBleTransport, ledgerFailure, mapLedgerError, offSdkEvent, onSdkEvent };
|