@onekeyfe/hwk-ledger-adapter 1.1.26-alpha.102 → 1.1.26-alpha.105
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 +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +188 -180
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +175 -172
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IHardwareWallet, IConnector, TransportType, IUiHandler, UiResponseEvent, DeviceInfo, Response, ChainCapability, EvmGetAddressParams, EvmAddress, ProgressCallback,
|
|
1
|
+
import { IHardwareWallet, IConnector, TransportType, IUiHandler, UiResponseEvent, DeviceInfo, Response, ChainCapability, EvmGetAddressParams, EvmAddress, ProgressCallback, 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, ConnectionType, DeviceDescriptor, ConnectorDevice, ConnectorSession, ConnectorEventType, ConnectorEventMap, DeviceChangeEvent, HardwareErrorCode } from '@onekeyfe/hwk-adapter-core';
|
|
2
2
|
import { DeviceManagementKit, DeviceActionState as DeviceActionState$1, DiscoveredDevice, ExecuteDeviceActionReturnType } from '@ledgerhq/device-management-kit';
|
|
3
3
|
import { Address, Signature, SignerEth as SignerEth$1, TypedData } from '@ledgerhq/device-signer-kit-ethereum';
|
|
4
4
|
import { SignerBtc as SignerBtc$1 } from '@ledgerhq/device-signer-kit-bitcoin';
|
|
@@ -53,13 +53,12 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
53
53
|
getSupportedChains(): ChainCapability[];
|
|
54
54
|
private callChain;
|
|
55
55
|
/**
|
|
56
|
-
* Batch version of callChain — checks permission
|
|
57
|
-
*
|
|
56
|
+
* Batch version of callChain — checks permission once,
|
|
57
|
+
* fingerprint is verified on the first call inside connectorCall.
|
|
58
58
|
*/
|
|
59
59
|
private callChainBatch;
|
|
60
60
|
evmGetAddress(connectId: string, deviceId: string, params: EvmGetAddressParams): Promise<Response<EvmAddress>>;
|
|
61
61
|
evmGetAddresses(connectId: string, deviceId: string, params: EvmGetAddressParams[], onProgress?: ProgressCallback): Promise<Response<EvmAddress[]>>;
|
|
62
|
-
evmGetPublicKey(connectId: string, deviceId: string, params: EvmGetPublicKeyParams): Promise<Response<EvmPublicKey>>;
|
|
63
62
|
evmSignTransaction(connectId: string, deviceId: string, params: EvmSignTxParams): Promise<Response<EvmSignedTx>>;
|
|
64
63
|
evmSignMessage(connectId: string, deviceId: string, params: EvmSignMsgParams): Promise<Response<EvmSignature>>;
|
|
65
64
|
evmSignTypedData(connectId: string, deviceId: string, params: EvmSignTypedDataParams): Promise<Response<EvmSignature>>;
|
|
@@ -74,7 +73,6 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
74
73
|
}>>;
|
|
75
74
|
solGetAddress(connectId: string, deviceId: string, params: SolGetAddressParams): Promise<Response<SolAddress>>;
|
|
76
75
|
solGetAddresses(connectId: string, deviceId: string, params: SolGetAddressParams[], onProgress?: ProgressCallback): Promise<Response<SolAddress[]>>;
|
|
77
|
-
solGetPublicKey(connectId: string, deviceId: string, params: SolGetPublicKeyParams): Promise<Response<SolPublicKey>>;
|
|
78
76
|
solSignTransaction(connectId: string, deviceId: string, params: SolSignTxParams): Promise<Response<SolSignedTx>>;
|
|
79
77
|
solSignMessage(connectId: string, deviceId: string, params: SolSignMsgParams): Promise<Response<SolSignature>>;
|
|
80
78
|
tronGetAddress(connectId: string, deviceId: string, params: TronGetAddressParams): Promise<Response<TronAddress>>;
|
|
@@ -88,18 +86,21 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
88
86
|
cancel(connectId: string): void;
|
|
89
87
|
getChainFingerprint(connectId: string, deviceId: string, chain: ChainForFingerprint): Promise<Response<string>>;
|
|
90
88
|
/**
|
|
91
|
-
* Verify
|
|
92
|
-
*
|
|
93
|
-
* - If deviceId is empty, verification is skipped (returns { success: true }).
|
|
94
|
-
* - deviceId is used here as the stored fingerprint to compare against.
|
|
95
|
-
* - On mismatch, returns both expected and actual fingerprints so the caller
|
|
96
|
-
* can surface an informative error (e.g. for logs / bug reports).
|
|
89
|
+
* Verify fingerprint using an existing sessionId directly.
|
|
90
|
+
* Safe to call inside connectorCall without causing queue deadlock.
|
|
97
91
|
*/
|
|
98
|
-
private
|
|
92
|
+
private _verifyDeviceFingerprintWithSession;
|
|
99
93
|
/**
|
|
100
94
|
* Derive an address at the fixed testnet path for fingerprint generation.
|
|
95
|
+
* Uses connectorCall (goes through ensureConnected). For public API use.
|
|
101
96
|
*/
|
|
102
97
|
private _deriveAddressForFingerprint;
|
|
98
|
+
/**
|
|
99
|
+
* Derive an address using an existing sessionId directly.
|
|
100
|
+
* Does NOT go through connectorCall — safe to call inside connectorCall
|
|
101
|
+
* without causing queue deadlock.
|
|
102
|
+
*/
|
|
103
|
+
private _deriveAddressWithSession;
|
|
103
104
|
/**
|
|
104
105
|
* Ensure at least one device is connected and return a valid connectId.
|
|
105
106
|
*
|
|
@@ -365,7 +366,6 @@ type BtcWallet = Parameters<SignerBtc$1['getWalletAddress']>[0];
|
|
|
365
366
|
type BtcPsbt = Parameters<SignerBtc$1['signPsbt']>[1];
|
|
366
367
|
type BtcPsbtOptions = Parameters<SignerBtc$1['signPsbt']>[2];
|
|
367
368
|
type BtcMessageOptions = Parameters<SignerBtc$1['signMessage']>[2];
|
|
368
|
-
|
|
369
369
|
/**
|
|
370
370
|
* Wraps Ledger's BTC SDK signer (Observable-based DeviceActions) into
|
|
371
371
|
* a simple async interface returning plain serializable data.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IHardwareWallet, IConnector, TransportType, IUiHandler, UiResponseEvent, DeviceInfo, Response, ChainCapability, EvmGetAddressParams, EvmAddress, ProgressCallback,
|
|
1
|
+
import { IHardwareWallet, IConnector, TransportType, IUiHandler, UiResponseEvent, DeviceInfo, Response, ChainCapability, EvmGetAddressParams, EvmAddress, ProgressCallback, 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, ConnectionType, DeviceDescriptor, ConnectorDevice, ConnectorSession, ConnectorEventType, ConnectorEventMap, DeviceChangeEvent, HardwareErrorCode } from '@onekeyfe/hwk-adapter-core';
|
|
2
2
|
import { DeviceManagementKit, DeviceActionState as DeviceActionState$1, DiscoveredDevice, ExecuteDeviceActionReturnType } from '@ledgerhq/device-management-kit';
|
|
3
3
|
import { Address, Signature, SignerEth as SignerEth$1, TypedData } from '@ledgerhq/device-signer-kit-ethereum';
|
|
4
4
|
import { SignerBtc as SignerBtc$1 } from '@ledgerhq/device-signer-kit-bitcoin';
|
|
@@ -53,13 +53,12 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
53
53
|
getSupportedChains(): ChainCapability[];
|
|
54
54
|
private callChain;
|
|
55
55
|
/**
|
|
56
|
-
* Batch version of callChain — checks permission
|
|
57
|
-
*
|
|
56
|
+
* Batch version of callChain — checks permission once,
|
|
57
|
+
* fingerprint is verified on the first call inside connectorCall.
|
|
58
58
|
*/
|
|
59
59
|
private callChainBatch;
|
|
60
60
|
evmGetAddress(connectId: string, deviceId: string, params: EvmGetAddressParams): Promise<Response<EvmAddress>>;
|
|
61
61
|
evmGetAddresses(connectId: string, deviceId: string, params: EvmGetAddressParams[], onProgress?: ProgressCallback): Promise<Response<EvmAddress[]>>;
|
|
62
|
-
evmGetPublicKey(connectId: string, deviceId: string, params: EvmGetPublicKeyParams): Promise<Response<EvmPublicKey>>;
|
|
63
62
|
evmSignTransaction(connectId: string, deviceId: string, params: EvmSignTxParams): Promise<Response<EvmSignedTx>>;
|
|
64
63
|
evmSignMessage(connectId: string, deviceId: string, params: EvmSignMsgParams): Promise<Response<EvmSignature>>;
|
|
65
64
|
evmSignTypedData(connectId: string, deviceId: string, params: EvmSignTypedDataParams): Promise<Response<EvmSignature>>;
|
|
@@ -74,7 +73,6 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
74
73
|
}>>;
|
|
75
74
|
solGetAddress(connectId: string, deviceId: string, params: SolGetAddressParams): Promise<Response<SolAddress>>;
|
|
76
75
|
solGetAddresses(connectId: string, deviceId: string, params: SolGetAddressParams[], onProgress?: ProgressCallback): Promise<Response<SolAddress[]>>;
|
|
77
|
-
solGetPublicKey(connectId: string, deviceId: string, params: SolGetPublicKeyParams): Promise<Response<SolPublicKey>>;
|
|
78
76
|
solSignTransaction(connectId: string, deviceId: string, params: SolSignTxParams): Promise<Response<SolSignedTx>>;
|
|
79
77
|
solSignMessage(connectId: string, deviceId: string, params: SolSignMsgParams): Promise<Response<SolSignature>>;
|
|
80
78
|
tronGetAddress(connectId: string, deviceId: string, params: TronGetAddressParams): Promise<Response<TronAddress>>;
|
|
@@ -88,18 +86,21 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
88
86
|
cancel(connectId: string): void;
|
|
89
87
|
getChainFingerprint(connectId: string, deviceId: string, chain: ChainForFingerprint): Promise<Response<string>>;
|
|
90
88
|
/**
|
|
91
|
-
* Verify
|
|
92
|
-
*
|
|
93
|
-
* - If deviceId is empty, verification is skipped (returns { success: true }).
|
|
94
|
-
* - deviceId is used here as the stored fingerprint to compare against.
|
|
95
|
-
* - On mismatch, returns both expected and actual fingerprints so the caller
|
|
96
|
-
* can surface an informative error (e.g. for logs / bug reports).
|
|
89
|
+
* Verify fingerprint using an existing sessionId directly.
|
|
90
|
+
* Safe to call inside connectorCall without causing queue deadlock.
|
|
97
91
|
*/
|
|
98
|
-
private
|
|
92
|
+
private _verifyDeviceFingerprintWithSession;
|
|
99
93
|
/**
|
|
100
94
|
* Derive an address at the fixed testnet path for fingerprint generation.
|
|
95
|
+
* Uses connectorCall (goes through ensureConnected). For public API use.
|
|
101
96
|
*/
|
|
102
97
|
private _deriveAddressForFingerprint;
|
|
98
|
+
/**
|
|
99
|
+
* Derive an address using an existing sessionId directly.
|
|
100
|
+
* Does NOT go through connectorCall — safe to call inside connectorCall
|
|
101
|
+
* without causing queue deadlock.
|
|
102
|
+
*/
|
|
103
|
+
private _deriveAddressWithSession;
|
|
103
104
|
/**
|
|
104
105
|
* Ensure at least one device is connected and return a valid connectId.
|
|
105
106
|
*
|
|
@@ -365,7 +366,6 @@ type BtcWallet = Parameters<SignerBtc$1['getWalletAddress']>[0];
|
|
|
365
366
|
type BtcPsbt = Parameters<SignerBtc$1['signPsbt']>[1];
|
|
366
367
|
type BtcPsbtOptions = Parameters<SignerBtc$1['signPsbt']>[2];
|
|
367
368
|
type BtcMessageOptions = Parameters<SignerBtc$1['signMessage']>[2];
|
|
368
|
-
|
|
369
369
|
/**
|
|
370
370
|
* Wraps Ledger's BTC SDK signer (Observable-based DeviceActions) into
|
|
371
371
|
* a simple async interface returning plain serializable data.
|