@onekeyfe/hwk-ledger-adapter 1.2.0-alpha.9 → 1.2.0-alpha.90
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 +28 -17
- package/dist/index.d.ts +28 -17
- package/dist/index.js +773 -286
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +699 -209
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _onekeyfe_hwk_adapter_core from '@onekeyfe/hwk-adapter-core';
|
|
2
|
+
import { IHardwareWallet, IConnector, TransportType, UiResponseEvent, SearchDevicesOptions, DeviceInfo, Response, ChainCapability, NullableCallArg, IHardwareCallParams, EvmGetAddressParams, EvmAddress, EvmSignTxLedgerParams, EvmSignedTx, EvmSignMsgParams, EvmSignature, EvmSignTypedDataParams, BtcGetAddressParams, BtcAddress, BtcGetPublicKeyParams, BtcPublicKey, BtcSignTxParams, BtcSignedTx, BtcSignPsbtParams, BtcSignedPsbt, BtcSignMsgParams, BtcSignature, IHardwareCommonCallParams, SolGetAddressParams, SolAddress, SolSignTxParams, SolSignedTx, SolSignMsgParams, SolSignature, TronGetAddressParams, TronAddress, TronSignTxParams, TronSignedTx, TronSignMsgParams, TronSignature, HardwareEventMap, DeviceEventListener, ChainForFingerprint, DeviceDescriptor, DeviceChangeEvent, ConnectionType, ConnectorDevice, ConnectorSession, ConnectorCallResult, ConnectorEventType, ConnectorEventMap, Failure, HardwareErrorCode } from '@onekeyfe/hwk-adapter-core';
|
|
2
3
|
import { DeviceActionState as DeviceActionState$1, DiscoveredDevice, ExecuteDeviceActionReturnType, DeviceManagementKit } from '@ledgerhq/device-management-kit';
|
|
3
4
|
import { Address, Signature, SignerEth as SignerEth$1, TypedData } from '@ledgerhq/device-signer-kit-ethereum';
|
|
4
5
|
import { ContextModule } from '@ledgerhq/context-module';
|
|
@@ -90,6 +91,8 @@ interface LedgerDeviceInfo extends FirmwareVersion {
|
|
|
90
91
|
seFlagsHex: string;
|
|
91
92
|
}
|
|
92
93
|
|
|
94
|
+
type LedgerCallParams<T> = NullableCallArg<IHardwareCallParams<T>>;
|
|
95
|
+
type LedgerCommonParams = NullableCallArg<IHardwareCommonCallParams>;
|
|
93
96
|
declare class LedgerAdapter implements IHardwareWallet {
|
|
94
97
|
readonly vendor: "ledger";
|
|
95
98
|
private readonly connector;
|
|
@@ -122,32 +125,40 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
122
125
|
private static readonly STUCK_APP_RETRY_DELAY_MS;
|
|
123
126
|
private static readonly MAX_DOCONNECT_CONFIRMS;
|
|
124
127
|
private _lastCancelReason;
|
|
128
|
+
private static readonly APP_INSTALL_PROGRESS_MIN_DELTA;
|
|
129
|
+
private _installProgressLastEmittedValue;
|
|
130
|
+
private _installProgressLastKey;
|
|
125
131
|
private static _createDeviceBusyError;
|
|
126
132
|
connectDevice(connectId: string): Promise<Response<string>>;
|
|
127
133
|
disconnectDevice(connectId: string): Promise<void>;
|
|
128
134
|
getDeviceInfo(connectId: string, deviceId: string): Promise<Response<DeviceInfo>>;
|
|
129
135
|
getSupportedChains(): ChainCapability[];
|
|
136
|
+
allNetworkGetAddress: (connectId: string, _deviceId: string, params: _onekeyfe_hwk_adapter_core.AllNetworkGetAddressParams) => Promise<Response<_onekeyfe_hwk_adapter_core.AllNetworkAddressResponse[]>>;
|
|
130
137
|
private callChain;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
private static normalizeCallArgs;
|
|
139
|
+
private static splitCommonParams;
|
|
140
|
+
private callChainWithMergedParams;
|
|
141
|
+
evmGetAddress(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<EvmGetAddressParams>): Promise<Response<EvmAddress>>;
|
|
142
|
+
evmSignTransaction(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<EvmSignTxLedgerParams>): Promise<Response<EvmSignedTx>>;
|
|
143
|
+
evmSignMessage(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<EvmSignMsgParams>): Promise<Response<EvmSignature>>;
|
|
144
|
+
evmSignTypedData(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<EvmSignTypedDataParams>): Promise<Response<EvmSignature>>;
|
|
145
|
+
btcGetAddress(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<BtcGetAddressParams>): Promise<Response<BtcAddress>>;
|
|
146
|
+
btcGetPublicKey(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<BtcGetPublicKeyParams>): Promise<Response<BtcPublicKey>>;
|
|
147
|
+
btcSignTransaction(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<BtcSignTxParams>): Promise<Response<BtcSignedTx>>;
|
|
148
|
+
btcSignPsbt(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<BtcSignPsbtParams>): Promise<Response<BtcSignedPsbt>>;
|
|
149
|
+
btcSignMessage(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<BtcSignMsgParams>): Promise<Response<BtcSignature>>;
|
|
150
|
+
btcGetMasterFingerprint(connectId?: string | null, deviceId?: string | null, params?: LedgerCommonParams): Promise<Response<{
|
|
141
151
|
masterFingerprint: string;
|
|
142
152
|
}>>;
|
|
143
|
-
solGetAddress(connectId
|
|
144
|
-
solSignTransaction(connectId
|
|
145
|
-
solSignMessage(connectId
|
|
146
|
-
tronGetAddress(connectId
|
|
147
|
-
tronSignTransaction(connectId
|
|
148
|
-
tronSignMessage(connectId
|
|
153
|
+
solGetAddress(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<SolGetAddressParams>): Promise<Response<SolAddress>>;
|
|
154
|
+
solSignTransaction(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<SolSignTxParams>): Promise<Response<SolSignedTx>>;
|
|
155
|
+
solSignMessage(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<SolSignMsgParams>): Promise<Response<SolSignature>>;
|
|
156
|
+
tronGetAddress(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<TronGetAddressParams>): Promise<Response<TronAddress>>;
|
|
157
|
+
tronSignTransaction(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<TronSignTxParams>): Promise<Response<TronSignedTx>>;
|
|
158
|
+
tronSignMessage(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<TronSignMsgParams>): Promise<Response<TronSignature>>;
|
|
149
159
|
installApp(connectId: string, appName: string): Promise<Response<void>>;
|
|
150
160
|
listInstalledApps(connectId: string): Promise<Response<AppMetadata[]>>;
|
|
161
|
+
listInstalledNames(connectId: string): Promise<Response<string[]>>;
|
|
151
162
|
listAvailableApps(connectId: string): Promise<Response<AppMetadata[]>>;
|
|
152
163
|
getLedgerFirmwareVersion(connectId: string): Promise<Response<FirmwareVersion>>;
|
|
153
164
|
getLedgerDeviceInfo(connectId: string): Promise<Response<LedgerDeviceInfo>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _onekeyfe_hwk_adapter_core from '@onekeyfe/hwk-adapter-core';
|
|
2
|
+
import { IHardwareWallet, IConnector, TransportType, UiResponseEvent, SearchDevicesOptions, DeviceInfo, Response, ChainCapability, NullableCallArg, IHardwareCallParams, EvmGetAddressParams, EvmAddress, EvmSignTxLedgerParams, EvmSignedTx, EvmSignMsgParams, EvmSignature, EvmSignTypedDataParams, BtcGetAddressParams, BtcAddress, BtcGetPublicKeyParams, BtcPublicKey, BtcSignTxParams, BtcSignedTx, BtcSignPsbtParams, BtcSignedPsbt, BtcSignMsgParams, BtcSignature, IHardwareCommonCallParams, SolGetAddressParams, SolAddress, SolSignTxParams, SolSignedTx, SolSignMsgParams, SolSignature, TronGetAddressParams, TronAddress, TronSignTxParams, TronSignedTx, TronSignMsgParams, TronSignature, HardwareEventMap, DeviceEventListener, ChainForFingerprint, DeviceDescriptor, DeviceChangeEvent, ConnectionType, ConnectorDevice, ConnectorSession, ConnectorCallResult, ConnectorEventType, ConnectorEventMap, Failure, HardwareErrorCode } from '@onekeyfe/hwk-adapter-core';
|
|
2
3
|
import { DeviceActionState as DeviceActionState$1, DiscoveredDevice, ExecuteDeviceActionReturnType, DeviceManagementKit } from '@ledgerhq/device-management-kit';
|
|
3
4
|
import { Address, Signature, SignerEth as SignerEth$1, TypedData } from '@ledgerhq/device-signer-kit-ethereum';
|
|
4
5
|
import { ContextModule } from '@ledgerhq/context-module';
|
|
@@ -90,6 +91,8 @@ interface LedgerDeviceInfo extends FirmwareVersion {
|
|
|
90
91
|
seFlagsHex: string;
|
|
91
92
|
}
|
|
92
93
|
|
|
94
|
+
type LedgerCallParams<T> = NullableCallArg<IHardwareCallParams<T>>;
|
|
95
|
+
type LedgerCommonParams = NullableCallArg<IHardwareCommonCallParams>;
|
|
93
96
|
declare class LedgerAdapter implements IHardwareWallet {
|
|
94
97
|
readonly vendor: "ledger";
|
|
95
98
|
private readonly connector;
|
|
@@ -122,32 +125,40 @@ declare class LedgerAdapter implements IHardwareWallet {
|
|
|
122
125
|
private static readonly STUCK_APP_RETRY_DELAY_MS;
|
|
123
126
|
private static readonly MAX_DOCONNECT_CONFIRMS;
|
|
124
127
|
private _lastCancelReason;
|
|
128
|
+
private static readonly APP_INSTALL_PROGRESS_MIN_DELTA;
|
|
129
|
+
private _installProgressLastEmittedValue;
|
|
130
|
+
private _installProgressLastKey;
|
|
125
131
|
private static _createDeviceBusyError;
|
|
126
132
|
connectDevice(connectId: string): Promise<Response<string>>;
|
|
127
133
|
disconnectDevice(connectId: string): Promise<void>;
|
|
128
134
|
getDeviceInfo(connectId: string, deviceId: string): Promise<Response<DeviceInfo>>;
|
|
129
135
|
getSupportedChains(): ChainCapability[];
|
|
136
|
+
allNetworkGetAddress: (connectId: string, _deviceId: string, params: _onekeyfe_hwk_adapter_core.AllNetworkGetAddressParams) => Promise<Response<_onekeyfe_hwk_adapter_core.AllNetworkAddressResponse[]>>;
|
|
130
137
|
private callChain;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
private static normalizeCallArgs;
|
|
139
|
+
private static splitCommonParams;
|
|
140
|
+
private callChainWithMergedParams;
|
|
141
|
+
evmGetAddress(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<EvmGetAddressParams>): Promise<Response<EvmAddress>>;
|
|
142
|
+
evmSignTransaction(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<EvmSignTxLedgerParams>): Promise<Response<EvmSignedTx>>;
|
|
143
|
+
evmSignMessage(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<EvmSignMsgParams>): Promise<Response<EvmSignature>>;
|
|
144
|
+
evmSignTypedData(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<EvmSignTypedDataParams>): Promise<Response<EvmSignature>>;
|
|
145
|
+
btcGetAddress(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<BtcGetAddressParams>): Promise<Response<BtcAddress>>;
|
|
146
|
+
btcGetPublicKey(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<BtcGetPublicKeyParams>): Promise<Response<BtcPublicKey>>;
|
|
147
|
+
btcSignTransaction(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<BtcSignTxParams>): Promise<Response<BtcSignedTx>>;
|
|
148
|
+
btcSignPsbt(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<BtcSignPsbtParams>): Promise<Response<BtcSignedPsbt>>;
|
|
149
|
+
btcSignMessage(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<BtcSignMsgParams>): Promise<Response<BtcSignature>>;
|
|
150
|
+
btcGetMasterFingerprint(connectId?: string | null, deviceId?: string | null, params?: LedgerCommonParams): Promise<Response<{
|
|
141
151
|
masterFingerprint: string;
|
|
142
152
|
}>>;
|
|
143
|
-
solGetAddress(connectId
|
|
144
|
-
solSignTransaction(connectId
|
|
145
|
-
solSignMessage(connectId
|
|
146
|
-
tronGetAddress(connectId
|
|
147
|
-
tronSignTransaction(connectId
|
|
148
|
-
tronSignMessage(connectId
|
|
153
|
+
solGetAddress(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<SolGetAddressParams>): Promise<Response<SolAddress>>;
|
|
154
|
+
solSignTransaction(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<SolSignTxParams>): Promise<Response<SolSignedTx>>;
|
|
155
|
+
solSignMessage(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<SolSignMsgParams>): Promise<Response<SolSignature>>;
|
|
156
|
+
tronGetAddress(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<TronGetAddressParams>): Promise<Response<TronAddress>>;
|
|
157
|
+
tronSignTransaction(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<TronSignTxParams>): Promise<Response<TronSignedTx>>;
|
|
158
|
+
tronSignMessage(connectId?: string | null, deviceId?: string | null, params?: LedgerCallParams<TronSignMsgParams>): Promise<Response<TronSignature>>;
|
|
149
159
|
installApp(connectId: string, appName: string): Promise<Response<void>>;
|
|
150
160
|
listInstalledApps(connectId: string): Promise<Response<AppMetadata[]>>;
|
|
161
|
+
listInstalledNames(connectId: string): Promise<Response<string[]>>;
|
|
151
162
|
listAvailableApps(connectId: string): Promise<Response<AppMetadata[]>>;
|
|
152
163
|
getLedgerFirmwareVersion(connectId: string): Promise<Response<FirmwareVersion>>;
|
|
153
164
|
getLedgerDeviceInfo(connectId: string): Promise<Response<LedgerDeviceInfo>>;
|