@onekeyfe/hwk-ledger-adapter 1.2.0-alpha.9 → 1.2.0-alpha.91

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
@@ -1,4 +1,5 @@
1
- import { IHardwareWallet, IConnector, TransportType, UiResponseEvent, SearchDevicesOptions, DeviceInfo, Response, ChainCapability, EvmGetAddressParams, ICommonCallParams, 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, ConnectorCallResult, ConnectorEventType, ConnectorEventMap, Failure, HardwareErrorCode } from '@onekeyfe/hwk-adapter-core';
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
- evmGetAddress(connectId: string, deviceId: string, params: EvmGetAddressParams, commonParams?: ICommonCallParams): Promise<Response<EvmAddress>>;
132
- evmSignTransaction(connectId: string, deviceId: string, params: EvmSignTxParams, commonParams?: ICommonCallParams): Promise<Response<EvmSignedTx>>;
133
- evmSignMessage(connectId: string, deviceId: string, params: EvmSignMsgParams, commonParams?: ICommonCallParams): Promise<Response<EvmSignature>>;
134
- evmSignTypedData(connectId: string, deviceId: string, params: EvmSignTypedDataParams, commonParams?: ICommonCallParams): Promise<Response<EvmSignature>>;
135
- btcGetAddress(connectId: string, deviceId: string, params: BtcGetAddressParams, commonParams?: ICommonCallParams): Promise<Response<BtcAddress>>;
136
- btcGetPublicKey(connectId: string, deviceId: string, params: BtcGetPublicKeyParams, commonParams?: ICommonCallParams): Promise<Response<BtcPublicKey>>;
137
- btcSignTransaction(connectId: string, deviceId: string, params: BtcSignTxParams, commonParams?: ICommonCallParams): Promise<Response<BtcSignedTx>>;
138
- btcSignPsbt(connectId: string, deviceId: string, params: BtcSignPsbtParams, commonParams?: ICommonCallParams): Promise<Response<BtcSignedPsbt>>;
139
- btcSignMessage(connectId: string, deviceId: string, params: BtcSignMsgParams, commonParams?: ICommonCallParams): Promise<Response<BtcSignature>>;
140
- btcGetMasterFingerprint(connectId: string, deviceId: string, commonParams?: ICommonCallParams): Promise<Response<{
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: string, deviceId: string, params: SolGetAddressParams, commonParams?: ICommonCallParams): Promise<Response<SolAddress>>;
144
- solSignTransaction(connectId: string, deviceId: string, params: SolSignTxParams, commonParams?: ICommonCallParams): Promise<Response<SolSignedTx>>;
145
- solSignMessage(connectId: string, deviceId: string, params: SolSignMsgParams, commonParams?: ICommonCallParams): Promise<Response<SolSignature>>;
146
- tronGetAddress(connectId: string, deviceId: string, params: TronGetAddressParams, commonParams?: ICommonCallParams): Promise<Response<TronAddress>>;
147
- tronSignTransaction(connectId: string, deviceId: string, params: TronSignTxParams, commonParams?: ICommonCallParams): Promise<Response<TronSignedTx>>;
148
- tronSignMessage(connectId: string, deviceId: string, params: TronSignMsgParams, commonParams?: ICommonCallParams): Promise<Response<TronSignature>>;
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 { IHardwareWallet, IConnector, TransportType, UiResponseEvent, SearchDevicesOptions, DeviceInfo, Response, ChainCapability, EvmGetAddressParams, ICommonCallParams, 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, ConnectorCallResult, ConnectorEventType, ConnectorEventMap, Failure, HardwareErrorCode } from '@onekeyfe/hwk-adapter-core';
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
- evmGetAddress(connectId: string, deviceId: string, params: EvmGetAddressParams, commonParams?: ICommonCallParams): Promise<Response<EvmAddress>>;
132
- evmSignTransaction(connectId: string, deviceId: string, params: EvmSignTxParams, commonParams?: ICommonCallParams): Promise<Response<EvmSignedTx>>;
133
- evmSignMessage(connectId: string, deviceId: string, params: EvmSignMsgParams, commonParams?: ICommonCallParams): Promise<Response<EvmSignature>>;
134
- evmSignTypedData(connectId: string, deviceId: string, params: EvmSignTypedDataParams, commonParams?: ICommonCallParams): Promise<Response<EvmSignature>>;
135
- btcGetAddress(connectId: string, deviceId: string, params: BtcGetAddressParams, commonParams?: ICommonCallParams): Promise<Response<BtcAddress>>;
136
- btcGetPublicKey(connectId: string, deviceId: string, params: BtcGetPublicKeyParams, commonParams?: ICommonCallParams): Promise<Response<BtcPublicKey>>;
137
- btcSignTransaction(connectId: string, deviceId: string, params: BtcSignTxParams, commonParams?: ICommonCallParams): Promise<Response<BtcSignedTx>>;
138
- btcSignPsbt(connectId: string, deviceId: string, params: BtcSignPsbtParams, commonParams?: ICommonCallParams): Promise<Response<BtcSignedPsbt>>;
139
- btcSignMessage(connectId: string, deviceId: string, params: BtcSignMsgParams, commonParams?: ICommonCallParams): Promise<Response<BtcSignature>>;
140
- btcGetMasterFingerprint(connectId: string, deviceId: string, commonParams?: ICommonCallParams): Promise<Response<{
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: string, deviceId: string, params: SolGetAddressParams, commonParams?: ICommonCallParams): Promise<Response<SolAddress>>;
144
- solSignTransaction(connectId: string, deviceId: string, params: SolSignTxParams, commonParams?: ICommonCallParams): Promise<Response<SolSignedTx>>;
145
- solSignMessage(connectId: string, deviceId: string, params: SolSignMsgParams, commonParams?: ICommonCallParams): Promise<Response<SolSignature>>;
146
- tronGetAddress(connectId: string, deviceId: string, params: TronGetAddressParams, commonParams?: ICommonCallParams): Promise<Response<TronAddress>>;
147
- tronSignTransaction(connectId: string, deviceId: string, params: TronSignTxParams, commonParams?: ICommonCallParams): Promise<Response<TronSignedTx>>;
148
- tronSignMessage(connectId: string, deviceId: string, params: TronSignMsgParams, commonParams?: ICommonCallParams): Promise<Response<TronSignature>>;
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>>;