@onekeyfe/hwk-ledger-adapter 1.1.26 → 1.1.27-alpha.30
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 +21 -49
- package/dist/index.d.ts +21 -49
- package/dist/index.js +161 -330
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +154 -324
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { IHardwareWallet, IConnector, TransportType, UiResponseEvent,
|
|
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';
|
|
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';
|
|
5
4
|
import { SignerBtc as SignerBtc$1 } from '@ledgerhq/device-signer-kit-bitcoin';
|
|
6
5
|
import { SignerSolana } from '@ledgerhq/device-signer-kit-solana';
|
|
7
6
|
import Transport from '@ledgerhq/hw-transport';
|
|
@@ -38,9 +37,8 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
38
37
|
resetState(): void;
|
|
39
38
|
dispose(): Promise<void>;
|
|
40
39
|
uiResponse(response: UiResponseEvent): void;
|
|
41
|
-
searchDevices(
|
|
40
|
+
searchDevices(): Promise<DeviceInfo[]>;
|
|
42
41
|
private static readonly MAX_BUSINESS_RETRY_BUDGET;
|
|
43
|
-
private static readonly STUCK_APP_RETRY_DELAY_MS;
|
|
44
42
|
private static readonly MAX_DOCONNECT_CONFIRMS;
|
|
45
43
|
private _lastCancelReason;
|
|
46
44
|
private static _createDeviceBusyError;
|
|
@@ -134,16 +132,6 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
134
132
|
private static _throwIfAborted;
|
|
135
133
|
/** Actual work done under the job queue — connection, fingerprint, call, and recovery. */
|
|
136
134
|
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;
|
|
147
135
|
/**
|
|
148
136
|
* Clear stale session, reconnect, and retry the call.
|
|
149
137
|
*
|
|
@@ -256,14 +244,6 @@ declare class LedgerDeviceManager {
|
|
|
256
244
|
requestDevice(): Promise<void>;
|
|
257
245
|
/** Lookup a previously-discovered device's display name. */
|
|
258
246
|
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;
|
|
267
247
|
/** Connect to a previously discovered device. Returns sessionId. */
|
|
268
248
|
connect(deviceId: string): Promise<string>;
|
|
269
249
|
/** Disconnect a session. */
|
|
@@ -308,14 +288,7 @@ interface LedgerConnectorBaseOptions {
|
|
|
308
288
|
* Subclasses only need to:
|
|
309
289
|
* 1. Supply a transport factory via the constructor.
|
|
310
290
|
* 2. Optionally override `_resolveConnectId()` for transport-specific
|
|
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.
|
|
291
|
+
* device identity resolution (e.g. BLE hex ID extraction).
|
|
319
292
|
*/
|
|
320
293
|
declare class LedgerConnectorBase implements IConnector {
|
|
321
294
|
private _deviceManager;
|
|
@@ -325,6 +298,12 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
325
298
|
private readonly _providedDmk;
|
|
326
299
|
private readonly _createTransport;
|
|
327
300
|
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;
|
|
328
307
|
private readonly _cancellers;
|
|
329
308
|
private readonly _sessionStateSubs;
|
|
330
309
|
/**
|
|
@@ -335,10 +314,6 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
335
314
|
protected _importLedgerKit: (pkg: string) => Promise<any>;
|
|
336
315
|
/** Context object passed to per-chain handler functions. */
|
|
337
316
|
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;
|
|
342
317
|
constructor(createTransport: TransportFactory, options?: {
|
|
343
318
|
connectionType?: ConnectionType;
|
|
344
319
|
dmk?: DeviceManagementKit;
|
|
@@ -348,13 +323,11 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
348
323
|
* For Metro (React Native): pass a resolver that uses CJS paths.
|
|
349
324
|
*/
|
|
350
325
|
importLedgerKit?: (pkg: string) => Promise<any>;
|
|
351
|
-
/** Default false. RN-iOS subclass should pass `true`. */
|
|
352
|
-
requirePreFlightScan?: boolean;
|
|
353
326
|
});
|
|
354
327
|
/**
|
|
355
328
|
* Resolve the connectId for a discovered device descriptor.
|
|
356
329
|
* Default: use the DMK path (ephemeral UUID).
|
|
357
|
-
* Override in subclasses
|
|
330
|
+
* Override in subclasses to extract stable identifiers (e.g. BLE hex ID).
|
|
358
331
|
*/
|
|
359
332
|
protected _resolveConnectId(descriptor: DeviceDescriptor): string;
|
|
360
333
|
/**
|
|
@@ -398,11 +371,12 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
398
371
|
private _invalidateSession;
|
|
399
372
|
/**
|
|
400
373
|
* Replace an old session with a new one after app switch.
|
|
401
|
-
*
|
|
374
|
+
* Updates the connectId→path mapping so subsequent calls() use the new session,
|
|
375
|
+
* and emits device-connect so the adapter updates its _sessions Map.
|
|
402
376
|
*/
|
|
403
377
|
private _replaceSession;
|
|
404
378
|
/**
|
|
405
|
-
* Light reset: clear signer/session state but keep DMK alive.
|
|
379
|
+
* Light reset: clear signer/session state but keep DMK and ID mapping alive.
|
|
406
380
|
* Used by connect() retry — we want to re-discover with the same transport.
|
|
407
381
|
*
|
|
408
382
|
* Note: drops the device manager but tears down its RxJS subs first via
|
|
@@ -472,14 +446,8 @@ type SignerEthBuilderFn = (args: {
|
|
|
472
446
|
dmk: DeviceManagementKit;
|
|
473
447
|
sessionId: string;
|
|
474
448
|
}) => {
|
|
475
|
-
withContextModule?(contextModule: ContextModule): {
|
|
476
|
-
build(): SignerEth$1;
|
|
477
|
-
};
|
|
478
449
|
build(): SignerEth$1;
|
|
479
450
|
} | Promise<{
|
|
480
|
-
withContextModule?(contextModule: ContextModule): {
|
|
481
|
-
build(): SignerEth$1;
|
|
482
|
-
};
|
|
483
451
|
build(): SignerEth$1;
|
|
484
452
|
}>;
|
|
485
453
|
/**
|
|
@@ -495,8 +463,6 @@ declare class SignerManager {
|
|
|
495
463
|
invalidate(_sessionId: string): void;
|
|
496
464
|
clearAll(): void;
|
|
497
465
|
private static _defaultBuilder;
|
|
498
|
-
private static _createContextModule;
|
|
499
|
-
static wrapBlindSigningReportNonBlocking<T extends ContextModule>(contextModule: T): T;
|
|
500
466
|
}
|
|
501
467
|
|
|
502
468
|
type BtcWallet = Parameters<SignerBtc$1['getWalletAddress']>[0];
|
|
@@ -689,7 +655,12 @@ type SdkEventListener = (event: SdkEvent) => void;
|
|
|
689
655
|
declare function onSdkEvent(listener: SdkEventListener): () => void;
|
|
690
656
|
declare function offSdkEvent(listener: SdkEventListener): void;
|
|
691
657
|
|
|
692
|
-
|
|
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;
|
|
693
664
|
|
|
694
665
|
/**
|
|
695
666
|
* Ledger DMK transport identifiers that represent BLE devices.
|
|
@@ -704,5 +675,6 @@ declare function debugLog(...args: unknown[]): void;
|
|
|
704
675
|
declare function isLedgerDmkBleTransport(transport?: string): boolean;
|
|
705
676
|
declare function isLedgerBleConnectionType(connectionType?: ConnectionType): boolean;
|
|
706
677
|
declare function isLedgerBleDescriptor(connectionType: ConnectionType, descriptor: DeviceDescriptor): boolean;
|
|
678
|
+
declare function isValidLedgerBleConnectId(connectId?: string): boolean;
|
|
707
679
|
|
|
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,
|
|
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, deviceActionToPromise, extractBleHexId, isDeviceLockedError, isLedgerBleConnectionType, isLedgerBleDescriptor, isLedgerDmkBleTransport, isValidLedgerBleConnectId, ledgerFailure, mapLedgerError, offSdkEvent, onSdkEvent };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { IHardwareWallet, IConnector, TransportType, UiResponseEvent,
|
|
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';
|
|
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';
|
|
5
4
|
import { SignerBtc as SignerBtc$1 } from '@ledgerhq/device-signer-kit-bitcoin';
|
|
6
5
|
import { SignerSolana } from '@ledgerhq/device-signer-kit-solana';
|
|
7
6
|
import Transport from '@ledgerhq/hw-transport';
|
|
@@ -38,9 +37,8 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
38
37
|
resetState(): void;
|
|
39
38
|
dispose(): Promise<void>;
|
|
40
39
|
uiResponse(response: UiResponseEvent): void;
|
|
41
|
-
searchDevices(
|
|
40
|
+
searchDevices(): Promise<DeviceInfo[]>;
|
|
42
41
|
private static readonly MAX_BUSINESS_RETRY_BUDGET;
|
|
43
|
-
private static readonly STUCK_APP_RETRY_DELAY_MS;
|
|
44
42
|
private static readonly MAX_DOCONNECT_CONFIRMS;
|
|
45
43
|
private _lastCancelReason;
|
|
46
44
|
private static _createDeviceBusyError;
|
|
@@ -134,16 +132,6 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
134
132
|
private static _throwIfAborted;
|
|
135
133
|
/** Actual work done under the job queue — connection, fingerprint, call, and recovery. */
|
|
136
134
|
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;
|
|
147
135
|
/**
|
|
148
136
|
* Clear stale session, reconnect, and retry the call.
|
|
149
137
|
*
|
|
@@ -256,14 +244,6 @@ declare class LedgerDeviceManager {
|
|
|
256
244
|
requestDevice(): Promise<void>;
|
|
257
245
|
/** Lookup a previously-discovered device's display name. */
|
|
258
246
|
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;
|
|
267
247
|
/** Connect to a previously discovered device. Returns sessionId. */
|
|
268
248
|
connect(deviceId: string): Promise<string>;
|
|
269
249
|
/** Disconnect a session. */
|
|
@@ -308,14 +288,7 @@ interface LedgerConnectorBaseOptions {
|
|
|
308
288
|
* Subclasses only need to:
|
|
309
289
|
* 1. Supply a transport factory via the constructor.
|
|
310
290
|
* 2. Optionally override `_resolveConnectId()` for transport-specific
|
|
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.
|
|
291
|
+
* device identity resolution (e.g. BLE hex ID extraction).
|
|
319
292
|
*/
|
|
320
293
|
declare class LedgerConnectorBase implements IConnector {
|
|
321
294
|
private _deviceManager;
|
|
@@ -325,6 +298,12 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
325
298
|
private readonly _providedDmk;
|
|
326
299
|
private readonly _createTransport;
|
|
327
300
|
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;
|
|
328
307
|
private readonly _cancellers;
|
|
329
308
|
private readonly _sessionStateSubs;
|
|
330
309
|
/**
|
|
@@ -335,10 +314,6 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
335
314
|
protected _importLedgerKit: (pkg: string) => Promise<any>;
|
|
336
315
|
/** Context object passed to per-chain handler functions. */
|
|
337
316
|
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;
|
|
342
317
|
constructor(createTransport: TransportFactory, options?: {
|
|
343
318
|
connectionType?: ConnectionType;
|
|
344
319
|
dmk?: DeviceManagementKit;
|
|
@@ -348,13 +323,11 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
348
323
|
* For Metro (React Native): pass a resolver that uses CJS paths.
|
|
349
324
|
*/
|
|
350
325
|
importLedgerKit?: (pkg: string) => Promise<any>;
|
|
351
|
-
/** Default false. RN-iOS subclass should pass `true`. */
|
|
352
|
-
requirePreFlightScan?: boolean;
|
|
353
326
|
});
|
|
354
327
|
/**
|
|
355
328
|
* Resolve the connectId for a discovered device descriptor.
|
|
356
329
|
* Default: use the DMK path (ephemeral UUID).
|
|
357
|
-
* Override in subclasses
|
|
330
|
+
* Override in subclasses to extract stable identifiers (e.g. BLE hex ID).
|
|
358
331
|
*/
|
|
359
332
|
protected _resolveConnectId(descriptor: DeviceDescriptor): string;
|
|
360
333
|
/**
|
|
@@ -398,11 +371,12 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
398
371
|
private _invalidateSession;
|
|
399
372
|
/**
|
|
400
373
|
* Replace an old session with a new one after app switch.
|
|
401
|
-
*
|
|
374
|
+
* Updates the connectId→path mapping so subsequent calls() use the new session,
|
|
375
|
+
* and emits device-connect so the adapter updates its _sessions Map.
|
|
402
376
|
*/
|
|
403
377
|
private _replaceSession;
|
|
404
378
|
/**
|
|
405
|
-
* Light reset: clear signer/session state but keep DMK alive.
|
|
379
|
+
* Light reset: clear signer/session state but keep DMK and ID mapping alive.
|
|
406
380
|
* Used by connect() retry — we want to re-discover with the same transport.
|
|
407
381
|
*
|
|
408
382
|
* Note: drops the device manager but tears down its RxJS subs first via
|
|
@@ -472,14 +446,8 @@ type SignerEthBuilderFn = (args: {
|
|
|
472
446
|
dmk: DeviceManagementKit;
|
|
473
447
|
sessionId: string;
|
|
474
448
|
}) => {
|
|
475
|
-
withContextModule?(contextModule: ContextModule): {
|
|
476
|
-
build(): SignerEth$1;
|
|
477
|
-
};
|
|
478
449
|
build(): SignerEth$1;
|
|
479
450
|
} | Promise<{
|
|
480
|
-
withContextModule?(contextModule: ContextModule): {
|
|
481
|
-
build(): SignerEth$1;
|
|
482
|
-
};
|
|
483
451
|
build(): SignerEth$1;
|
|
484
452
|
}>;
|
|
485
453
|
/**
|
|
@@ -495,8 +463,6 @@ declare class SignerManager {
|
|
|
495
463
|
invalidate(_sessionId: string): void;
|
|
496
464
|
clearAll(): void;
|
|
497
465
|
private static _defaultBuilder;
|
|
498
|
-
private static _createContextModule;
|
|
499
|
-
static wrapBlindSigningReportNonBlocking<T extends ContextModule>(contextModule: T): T;
|
|
500
466
|
}
|
|
501
467
|
|
|
502
468
|
type BtcWallet = Parameters<SignerBtc$1['getWalletAddress']>[0];
|
|
@@ -689,7 +655,12 @@ type SdkEventListener = (event: SdkEvent) => void;
|
|
|
689
655
|
declare function onSdkEvent(listener: SdkEventListener): () => void;
|
|
690
656
|
declare function offSdkEvent(listener: SdkEventListener): void;
|
|
691
657
|
|
|
692
|
-
|
|
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;
|
|
693
664
|
|
|
694
665
|
/**
|
|
695
666
|
* Ledger DMK transport identifiers that represent BLE devices.
|
|
@@ -704,5 +675,6 @@ declare function debugLog(...args: unknown[]): void;
|
|
|
704
675
|
declare function isLedgerDmkBleTransport(transport?: string): boolean;
|
|
705
676
|
declare function isLedgerBleConnectionType(connectionType?: ConnectionType): boolean;
|
|
706
677
|
declare function isLedgerBleDescriptor(connectionType: ConnectionType, descriptor: DeviceDescriptor): boolean;
|
|
678
|
+
declare function isValidLedgerBleConnectId(connectId?: string): boolean;
|
|
707
679
|
|
|
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,
|
|
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, deviceActionToPromise, extractBleHexId, isDeviceLockedError, isLedgerBleConnectionType, isLedgerBleDescriptor, isLedgerDmkBleTransport, isValidLedgerBleConnectId, ledgerFailure, mapLedgerError, offSdkEvent, onSdkEvent };
|