@onekeyfe/hd-core 0.3.24 → 0.3.25

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.
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import EventEmitter from 'events';
3
+ import { LowlevelTransportSharedPlugin } from '@onekeyfe/hd-transport';
3
4
  import { CoreMessage } from '../events';
4
5
  import type { ConnectSettings } from '../types';
5
6
  import DeviceConnector from '../device/DeviceConnector';
@@ -11,5 +12,5 @@ export default class Core extends EventEmitter {
11
12
  }
12
13
  export declare const initCore: () => Core;
13
14
  export declare const initConnector: () => DeviceConnector;
14
- export declare const init: (settings: ConnectSettings, Transport: any) => Promise<Core | undefined>;
15
+ export declare const init: (settings: ConnectSettings, Transport: any, plugin?: LowlevelTransportSharedPlugin | undefined) => Promise<Core | undefined>;
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAqBlC,OAAO,EAEL,WAAW,EAWZ,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAE7D,OAAO,eAAe,MAAM,2BAA2B,CAAC;AA4BxD,eAAO,MAAM,OAAO,YAAmB,WAAW,iBAgRjD,CAAC;AAuMF,eAAO,MAAM,MAAM,0CAkBlB,CAAC;AAoJF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,YAAY;IACtC,aAAa,CAAC,OAAO,EAAE,WAAW;IA8CxC,OAAO;CAGR;AAED,eAAO,MAAM,QAAQ,YAGpB,CAAC;AAEF,eAAO,MAAM,aAAa,uBAIzB,CAAC;AAMF,eAAO,MAAM,IAAI,aAAoB,eAAe,aAAa,GAAG,8BAmBnE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAY,6BAA6B,EAAoB,MAAM,wBAAwB,CAAC;AAoBnG,OAAO,EAEL,WAAW,EAWZ,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAE7D,OAAO,eAAe,MAAM,2BAA2B,CAAC;AA4BxD,eAAO,MAAM,OAAO,YAAmB,WAAW,iBAgRjD,CAAC;AAuMF,eAAO,MAAM,MAAM,0CAkBlB,CAAC;AAoJF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,YAAY;IACtC,aAAa,CAAC,OAAO,EAAE,WAAW;IA8CxC,OAAO;CAGR;AAED,eAAO,MAAM,QAAQ,YAGpB,CAAC;AAEF,eAAO,MAAM,aAAa,uBAIzB,CAAC;AAMF,eAAO,MAAM,IAAI,aACL,eAAe,aACd,GAAG,kFAqBf,CAAC"}
@@ -32,5 +32,6 @@ export default class DataManager {
32
32
  static getProtobufMessages(messageVersion?: MessageVersion): JSON;
33
33
  static getSettings(key?: undefined): ConnectSettings;
34
34
  static getSettings<T extends keyof ConnectSettings>(key: T): ConnectSettings[T];
35
+ static isBleConnect: (env: ConnectSettings['env']) => boolean;
35
36
  }
36
37
  //# sourceMappingURL=DataManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/DataManager.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,aAAa,EACb,QAAQ,EACR,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EAEd,MAAM,UAAU,CAAC;AAGlB,oBAAY,aAAa,GAAG,UAAU,GAAG,aAAa,GAAG,aAAa,CAAC;AAEvE,oBAAY,cAAc,GAAG,QAAQ,GAAG,IAAI,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,MAAM,CAAC,SAA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AC,kBAAkB,iBAAkB,MAAM,KAAG,gBAAgB,CAKlE;WAEW,IAAI,CAAC,QAAQ,EAAE,eAAe;WA4B9B,kBAAkB;IAQ/B,MAAM,CAAC,mBAAmB,CAAC,cAAc,GAAE,cAAyB,GAAG,IAAI;IAI3E,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,eAAe;IAEpD,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,GAAG,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;IAU/E,MAAM,CAAC,YAAY,QAAS,eAAe,CAAC,KAAK,CAAC,aACH;CAChD"}
@@ -1,4 +1,4 @@
1
- import { Transport } from '@onekeyfe/hd-transport';
1
+ import { LowlevelTransportSharedPlugin, Transport } from '@onekeyfe/hd-transport';
2
2
  import { MessageVersion } from './DataManager';
3
3
  import { Features } from '../types';
4
4
  export default class TransportManager {
@@ -7,10 +7,11 @@ export default class TransportManager {
7
7
  static currentMessages: JSON | Record<string, any>;
8
8
  static reactNativeInit: boolean;
9
9
  static messageVersion: MessageVersion;
10
+ static plugin: LowlevelTransportSharedPlugin | null;
10
11
  static load(): void;
11
12
  static configure(): Promise<void>;
12
13
  static reconfigure(features?: Features | undefined): Promise<void>;
13
- static setTransport(TransportConstructor: any): void;
14
+ static setTransport(TransportConstructor: any, plugin?: LowlevelTransportSharedPlugin): void;
14
15
  static getTransport(): Transport;
15
16
  static getDefaultMessages(): JSON | Record<string, any>;
16
17
  static getCurrentMessages(): JSON | Record<string, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"TransportManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/TransportManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAoB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAK5D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAWpC,MAAM,CAAC,OA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E,SAAS;WAiCT,WAAW,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS;IAsBxD,MAAM,CAAC,YAAY,CAAC,oBAAoB,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,6BAA6B;IAgBrF,MAAM,CAAC,YAAY;IAInB,MAAM,CAAC,kBAAkB;IAIzB,MAAM,CAAC,kBAAkB;IAIzB,MAAM,CAAC,iBAAiB;CAGzB"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import EventEmitter$1, { EventEmitter } from 'events';
2
2
  import * as _onekeyfe_hd_transport from '@onekeyfe/hd-transport';
3
- import { Messages, Success as Success$1, RecoveryDeviceType, SafetyCheckLevel, ResourceType, CipheredKeyValue as CipheredKeyValue$1, EthereumPublicKey, EthereumMessageSignature, Address, MultisigRedeemScriptType, InputScriptType, PublicKey, MessageSignature, PrevInput, TxOutputBinType, TxInput, TxOutputType, TxInputType, StarcoinAddress as StarcoinAddress$1, StarcoinPublicKey as StarcoinPublicKey$1, StarcoinMessageSignature, StarcoinSignedTx, NEMAddress as NEMAddress$1, NEMSignedTx, SolanaAddress as SolanaAddress$1, SolanaSignedTx as SolanaSignedTx$1, StellarAddress as StellarAddress$1, StellarSignedTx, TronAddress as TronAddress$1, UintType, TronResourceCode, TronSignedTx, TronMessageSignature, ConfluxAddress as ConfluxAddress$1, ConfluxMessageSignature, NearAddress as NearAddress$1, NearSignedTx, AptosAddress as AptosAddress$1, AptosMessageSignature as AptosMessageSignature$1, AptosSignedTx as AptosSignedTx$1, AlgorandAddress, AlgorandSignedTx, CosmosAddress as CosmosAddress$1, CosmosSignedTx as CosmosSignedTx$1, SuiAddress as SuiAddress$1, CardanoAddressParametersType, CardanoMessageSignature, FilecoinAddress as FilecoinAddress$1, FilecoinSignedTx as FilecoinSignedTx$1, PolkadotAddress as PolkadotAddress$1, PolkadotSignedTx as PolkadotSignedTx$1, KaspaAddress as KaspaAddress$1, OneKeyDeviceInfo, Transport, ChangeOutputScriptType } from '@onekeyfe/hd-transport';
3
+ import { Messages, LowlevelTransportSharedPlugin, Success as Success$1, RecoveryDeviceType, SafetyCheckLevel, ResourceType, CipheredKeyValue as CipheredKeyValue$1, EthereumPublicKey, EthereumMessageSignature, Address, MultisigRedeemScriptType, InputScriptType, PublicKey, MessageSignature, PrevInput, TxOutputBinType, TxInput, TxOutputType, TxInputType, StarcoinAddress as StarcoinAddress$1, StarcoinPublicKey as StarcoinPublicKey$1, StarcoinMessageSignature, StarcoinSignedTx, NEMAddress as NEMAddress$1, NEMSignedTx, SolanaAddress as SolanaAddress$1, SolanaSignedTx as SolanaSignedTx$1, StellarAddress as StellarAddress$1, StellarSignedTx, TronAddress as TronAddress$1, UintType, TronResourceCode, TronSignedTx, TronMessageSignature, ConfluxAddress as ConfluxAddress$1, ConfluxMessageSignature, NearAddress as NearAddress$1, NearSignedTx, AptosAddress as AptosAddress$1, AptosMessageSignature as AptosMessageSignature$1, AptosSignedTx as AptosSignedTx$1, AlgorandAddress, AlgorandSignedTx, CosmosAddress as CosmosAddress$1, CosmosSignedTx as CosmosSignedTx$1, SuiAddress as SuiAddress$1, CardanoAddressParametersType, CardanoMessageSignature, FilecoinAddress as FilecoinAddress$1, FilecoinSignedTx as FilecoinSignedTx$1, PolkadotAddress as PolkadotAddress$1, PolkadotSignedTx as PolkadotSignedTx$1, KaspaAddress as KaspaAddress$1, OneKeyDeviceInfo, Transport, ChangeOutputScriptType } from '@onekeyfe/hd-transport';
4
4
  export { Messages as PROTO } from '@onekeyfe/hd-transport';
5
5
  import { Deferred } from '@onekeyfe/hd-shared';
6
6
 
@@ -159,7 +159,7 @@ declare type ConnectSettings = {
159
159
  priority: number;
160
160
  trustedHost: boolean;
161
161
  supportedBrowser?: boolean;
162
- env: 'node' | 'web' | 'webextension' | 'electron' | 'react-native' | 'webusb';
162
+ env: 'node' | 'web' | 'webextension' | 'electron' | 'react-native' | 'webusb' | 'lowlevel';
163
163
  timestamp: number;
164
164
  isFrame?: boolean;
165
165
  preRelease?: boolean;
@@ -222,7 +222,7 @@ declare type RemoteConfigResponse = {
222
222
  bridge: AssetsMap['bridge'];
223
223
  } & DeviceTypeMap;
224
224
 
225
- declare function init$1(settings: Partial<ConnectSettings>, lowLevelApi?: LowLevelCoreApi): Promise<boolean>;
225
+ declare function init$1(settings: Partial<ConnectSettings>, lowLevelApi?: LowLevelCoreApi, pulgin?: LowlevelTransportSharedPlugin): Promise<boolean>;
226
226
  declare function updateSettings(settings: Partial<ConnectSettings>): Promise<boolean>;
227
227
 
228
228
  declare function getLogs(): Response<string[]>;
@@ -289,7 +289,7 @@ declare function checkBootloaderRelease(connectId?: string, params?: CommonParam
289
289
 
290
290
  declare function searchDevices(): Response<SearchDevice[]>;
291
291
 
292
- declare function getFeatures(connectId?: string): Response<Features>;
292
+ declare function getFeatures(connectId?: string, params?: CommonParams): Response<Features>;
293
293
 
294
294
  declare function getPassphraseState(connectId?: string, params?: CommonParams): Response<string>;
295
295
 
@@ -2236,7 +2236,7 @@ declare class Core extends EventEmitter$1 {
2236
2236
  handleMessage(message: CoreMessage): Promise<any>;
2237
2237
  dispose(): void;
2238
2238
  }
2239
- declare const init: (settings: ConnectSettings, Transport: any) => Promise<Core | undefined>;
2239
+ declare const init: (settings: ConnectSettings, Transport: any, plugin?: LowlevelTransportSharedPlugin | undefined) => Promise<Core | undefined>;
2240
2240
 
2241
2241
  declare const httpRequest: (url: string, type: string) => any;
2242
2242
  declare const getTimeStamp: () => number;
@@ -2282,6 +2282,7 @@ declare class DataManager {
2282
2282
  static getProtobufMessages(messageVersion?: MessageVersion): JSON;
2283
2283
  static getSettings(key?: undefined): ConnectSettings;
2284
2284
  static getSettings<T extends keyof ConnectSettings>(key: T): ConnectSettings[T];
2285
+ static isBleConnect: (env: ConnectSettings['env']) => boolean;
2285
2286
  }
2286
2287
 
2287
2288
  declare const getDeviceType: (features?: _onekeyfe_hd_transport.Features | undefined) => IDeviceType;
@@ -2334,6 +2335,7 @@ declare enum LoggerNames {
2334
2335
  HdCommonConnectSdk = "@onekey/common-connect-sdk",
2335
2336
  HdBleSdk = "@onekey/hd-ble-sdk",
2336
2337
  HdTransportHttp = "@onekey/hd-transport-http",
2338
+ HdTransportLowLevel = "@onekey/hd-transport-lowlevel",
2337
2339
  HdBleTransport = "@onekey/hd-ble-transport",
2338
2340
  Connect = "@onekey/connect",
2339
2341
  Iframe = "IFrame",
@@ -2345,6 +2347,7 @@ declare const getLogger: (key: LoggerNames) => Log;
2345
2347
  declare const getHomeScreenHex: (deviceType: IDeviceType, name: string) => any;
2346
2348
 
2347
2349
  declare const wait: (ms: number) => Promise<unknown>;
2350
+ declare const isBleConnect: (env: string) => boolean;
2348
2351
 
2349
2352
  declare const getSDKVersion: () => any;
2350
2353
 
@@ -2360,4 +2363,4 @@ declare const HardwareSdk: ({ init, call, dispose, eventEmitter, uiResponse, can
2360
2363
  declare const HardwareSDKLowLevel: ({ init, call, dispose, eventEmitter, addHardwareGlobalEventListener, uiResponse, cancel, updateSettings, }: LowLevelInjectApi) => LowLevelCoreApi;
2361
2364
  declare const HardwareTopLevelSdk: () => CoreApi;
2362
2365
 
2363
- export { AccountAddress, AccountAddresses, AlgoAddress, AlgoGetAddressParams, AlgoSignTransactionParams, AlgoSignedTx, AptosAddress, AptosGetAddressParams, AptosGetPublicKeyParams, AptosMessageSignature, AptosPublicKey, AptosSignMessageParams, AptosSignTransactionParams, AptosSignedTx, AssetsMap, BTCAddress, BTCGetAddressParams, BTCGetPublicKeyParams, BTCPublicKey, BTCSignMessageParams, BTCSignTransactionParams, BTCVerifyMessageParams, BleReleaseInfoEvent, BleReleaseInfoPayload, CORE_EVENT, CallMethod, CallMethodAnyResponse, CallMethodKeys, CallMethodPayload, CallMethodResponse, CallMethodUnion, CardanoAddress, CardanoGetAddressMethodParams, CardanoGetAddressParams, CardanoSignTransaction, CardanoSignedTxData, CipheredKeyValue, CipheredKeyValueParams, CommonParams, ConfluxAddress, ConfluxGetAddressParams, ConfluxSignMessageCIP23Params, ConfluxSignMessageParams, ConfluxSignTransactionParams, ConfluxSignedTx, ConfluxTransaction, ConnectSettings, Core, CoreApi, CoreMessage, CosmosAddress, CosmosGetAddressParams, CosmosGetPublicKeyParams, CosmosPublicKey, CosmosSignTransactionParams, CosmosSignedTx, DEFAULT_PRIORITY, DEVICE, DEVICE_EVENT, DataManager, Device$1 as Device, DeviceButtonRequest, DeviceButtonRequestPayload, DeviceChangePinParams, DeviceConnnectRequest, DeviceDisconnnectRequest, DeviceEvent, DeviceEventListenerFn, DeviceEventMessage, DeviceFeaturesPayload, DeviceFirmwareRange, DeviceFlagsParams, DeviceMode, DeviceModelToTypes, DeviceRecoveryParams, DeviceResetParams, DeviceSendFeatures, DeviceSendSupportFeatures, DeviceSettingsParams, DeviceStatus, DeviceSupportFeatures, DeviceSupportFeaturesPayload, DeviceTypeMap, DeviceTypeToModels, DeviceUploadResourceParams, DeviceVerifyParams, DeviceVerifySignature, EVMAccessList, EVMAddress, EVMGetAddressParams, EVMGetPublicKeyParams, EVMPublicKey, EVMSignMessageEIP712Params, EVMSignMessageParams, EVMSignTransactionParams, EVMSignTypedDataParams, EVMSignedTx, EVMTransaction, EVMTransactionEIP1559, EVMVerifyMessageParams, EthereumSignTypedDataMessage, EthereumSignTypedDataTypeProperty, EthereumSignTypedDataTypes, FIRMWARE, FIRMWARE_EVENT, Features, FilecoinAddress, FilecoinGetAddressParams, FilecoinSignTransactionParams, FilecoinSignedTx, FirmwareEvent, FirmwareMessage, FirmwareProgress, FirmwareRange, FirmwareRelease$1 as FirmwareRelease, FirmwareTip, FirmwareUpdateBinaryParams, FirmwareUpdateParams, HardwareSDKLowLevel, HardwareTopLevelSdk, IBLEFirmwareReleaseInfo, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, IDeviceModel, IDeviceType, IFRAME, IFirmwareReleaseInfo, IFrameBridge, IFrameCallMessage, IFrameCancelMessage, IFrameEvent, IFrameEventMessage, IFrameInit, ILocale, ITransportStatus, IVersionArray, KaspaAddress, KaspaGetAddressParams, KaspaSignInputParams, KaspaSignOutputParams, KaspaSignTransactionParams, KaspaSignature, KnownDevice, LOG, LOG_EVENT, LogEvent, LogEventMessage, LogOutput, LoggerNames, LowLevelCoreApi, LowLevelInjectApi, MajorVersion, MethodResponseMessage, NEMAddress, NEMAggregateModificationTransaction, NEMGetAddressParams, NEMImportanceTransaction, NEMMosaic, NEMMosaicCreationTransaction, NEMMultisigTransaction, NEMProvisionNamespaceTransaction, NEMSignTransactionParams, NEMSupplyChangeTransaction, NEMTransaction, NEMTransferTransaction, NearAddress, NearGetAddressParams, NearSignTransactionParams, NexaAddress, NexaGetAddressParams, NexaSignInputParams, NexaSignOutputParams, NexaSignTransactionParams, NexaSignature, Params, PolkadotAddress, PolkadotGetAddressParams, PolkadotSignTransactionParams, PolkadotSignedTx, PostMessageEvent, PreviousAddressResult, RESPONSE_EVENT, RefTransaction, ReleaseInfo, ReleaseInfoEvent, ReleaseInfoPayload, RemoteConfigResponse, Response, SearchDevice, SignedTransaction, SolanaAddress, SolanaGetAddressParams, SolanaSignTransactionParams, SolanaSignedTx, StarcoinAddress, StarcoinGetAddressParams, StarcoinGetPublicKeyParams, StarcoinPublicKey, StarcoinSignMessageParams, StarcoinSignTransactionParams, StarcoinVerifyMessageParams, StellarAddress, StellarAsset, StellarGetAddressParams, StellarOperation, StellarSignTransactionParams, StellarTransaction, StrictFeatures, Success, SuiAddress, SuiGetAddressParams, SuiGetPublicKeyParams, SuiPublicKey, SuiSignTransactionParams, SuiSignedTx, SupportFeatureType, SupportFeatures, TopLevelInjectApi, TransactionOptions, TransportReleaseStatus, TronAddress, TronDelegateResourceContract, TronFreezeBalanceV2Contract, TronGetAddressParams, TronSignMessageParams, TronSignTransactionParams, TronTransaction, TronTransactionContract, TronTransferContract, TronTriggerSmartContract, TronUnDelegateResourceContract, TronUnfreezeBalanceV2Contract, TronWithdrawBalanceContract, TronWithdrawExpireUnfreezeContract, UI_EVENT, UI_REQUEST, UI_RESPONSE, UiEvent, UiEventMessage, UiPromise, UiPromiseResponse, UiRequestButton, UiRequestDeviceAction, UiRequestPassphrase, UiRequestPassphraseOnDevice, UiRequestWithoutPayload, UiResponseEvent, UiResponseMessage, UiResponsePassphrase, UiResponsePin, UnavailableCapabilities, UnavailableCapability, Unsuccessful, VersionArray, checkNeedUpdateBootForClassicAndMini, checkNeedUpdateBootForTouch, corsValidator, createDeviceMessage, createErrorMessage, createFirmwareMessage, createIFrameMessage, createLogMessage, createResponseMessage, createUiMessage, createUiResponse, HardwareSdk as default, enableLog, getDeviceLabel, getDeviceType, getDeviceTypeByBleName, getDeviceTypeByDeviceId, getDeviceUUID, getEnv, getFirmwareUpdateField, getHDPath, getHomeScreenHex, getLog, getLogger, getOutputScriptType, getSDKVersion, getScriptType, getTimeStamp, httpRequest, init as initCore, isValidVersionArray, isValidVersionString, normalizeVersionArray, parseConnectSettings, parseMessage, patchFeatures, safeThrowError, setLoggerPostMessage, supportInputPinOnSoftware, versionCompare, versionSplit, wait };
2366
+ export { AccountAddress, AccountAddresses, AlgoAddress, AlgoGetAddressParams, AlgoSignTransactionParams, AlgoSignedTx, AptosAddress, AptosGetAddressParams, AptosGetPublicKeyParams, AptosMessageSignature, AptosPublicKey, AptosSignMessageParams, AptosSignTransactionParams, AptosSignedTx, AssetsMap, BTCAddress, BTCGetAddressParams, BTCGetPublicKeyParams, BTCPublicKey, BTCSignMessageParams, BTCSignTransactionParams, BTCVerifyMessageParams, BleReleaseInfoEvent, BleReleaseInfoPayload, CORE_EVENT, CallMethod, CallMethodAnyResponse, CallMethodKeys, CallMethodPayload, CallMethodResponse, CallMethodUnion, CardanoAddress, CardanoGetAddressMethodParams, CardanoGetAddressParams, CardanoSignTransaction, CardanoSignedTxData, CipheredKeyValue, CipheredKeyValueParams, CommonParams, ConfluxAddress, ConfluxGetAddressParams, ConfluxSignMessageCIP23Params, ConfluxSignMessageParams, ConfluxSignTransactionParams, ConfluxSignedTx, ConfluxTransaction, ConnectSettings, Core, CoreApi, CoreMessage, CosmosAddress, CosmosGetAddressParams, CosmosGetPublicKeyParams, CosmosPublicKey, CosmosSignTransactionParams, CosmosSignedTx, DEFAULT_PRIORITY, DEVICE, DEVICE_EVENT, DataManager, Device$1 as Device, DeviceButtonRequest, DeviceButtonRequestPayload, DeviceChangePinParams, DeviceConnnectRequest, DeviceDisconnnectRequest, DeviceEvent, DeviceEventListenerFn, DeviceEventMessage, DeviceFeaturesPayload, DeviceFirmwareRange, DeviceFlagsParams, DeviceMode, DeviceModelToTypes, DeviceRecoveryParams, DeviceResetParams, DeviceSendFeatures, DeviceSendSupportFeatures, DeviceSettingsParams, DeviceStatus, DeviceSupportFeatures, DeviceSupportFeaturesPayload, DeviceTypeMap, DeviceTypeToModels, DeviceUploadResourceParams, DeviceVerifyParams, DeviceVerifySignature, EVMAccessList, EVMAddress, EVMGetAddressParams, EVMGetPublicKeyParams, EVMPublicKey, EVMSignMessageEIP712Params, EVMSignMessageParams, EVMSignTransactionParams, EVMSignTypedDataParams, EVMSignedTx, EVMTransaction, EVMTransactionEIP1559, EVMVerifyMessageParams, EthereumSignTypedDataMessage, EthereumSignTypedDataTypeProperty, EthereumSignTypedDataTypes, FIRMWARE, FIRMWARE_EVENT, Features, FilecoinAddress, FilecoinGetAddressParams, FilecoinSignTransactionParams, FilecoinSignedTx, FirmwareEvent, FirmwareMessage, FirmwareProgress, FirmwareRange, FirmwareRelease$1 as FirmwareRelease, FirmwareTip, FirmwareUpdateBinaryParams, FirmwareUpdateParams, HardwareSDKLowLevel, HardwareTopLevelSdk, IBLEFirmwareReleaseInfo, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, IDeviceModel, IDeviceType, IFRAME, IFirmwareReleaseInfo, IFrameBridge, IFrameCallMessage, IFrameCancelMessage, IFrameEvent, IFrameEventMessage, IFrameInit, ILocale, ITransportStatus, IVersionArray, KaspaAddress, KaspaGetAddressParams, KaspaSignInputParams, KaspaSignOutputParams, KaspaSignTransactionParams, KaspaSignature, KnownDevice, LOG, LOG_EVENT, LogEvent, LogEventMessage, LogOutput, LoggerNames, LowLevelCoreApi, LowLevelInjectApi, MajorVersion, MethodResponseMessage, NEMAddress, NEMAggregateModificationTransaction, NEMGetAddressParams, NEMImportanceTransaction, NEMMosaic, NEMMosaicCreationTransaction, NEMMultisigTransaction, NEMProvisionNamespaceTransaction, NEMSignTransactionParams, NEMSupplyChangeTransaction, NEMTransaction, NEMTransferTransaction, NearAddress, NearGetAddressParams, NearSignTransactionParams, NexaAddress, NexaGetAddressParams, NexaSignInputParams, NexaSignOutputParams, NexaSignTransactionParams, NexaSignature, Params, PolkadotAddress, PolkadotGetAddressParams, PolkadotSignTransactionParams, PolkadotSignedTx, PostMessageEvent, PreviousAddressResult, RESPONSE_EVENT, RefTransaction, ReleaseInfo, ReleaseInfoEvent, ReleaseInfoPayload, RemoteConfigResponse, Response, SearchDevice, SignedTransaction, SolanaAddress, SolanaGetAddressParams, SolanaSignTransactionParams, SolanaSignedTx, StarcoinAddress, StarcoinGetAddressParams, StarcoinGetPublicKeyParams, StarcoinPublicKey, StarcoinSignMessageParams, StarcoinSignTransactionParams, StarcoinVerifyMessageParams, StellarAddress, StellarAsset, StellarGetAddressParams, StellarOperation, StellarSignTransactionParams, StellarTransaction, StrictFeatures, Success, SuiAddress, SuiGetAddressParams, SuiGetPublicKeyParams, SuiPublicKey, SuiSignTransactionParams, SuiSignedTx, SupportFeatureType, SupportFeatures, TopLevelInjectApi, TransactionOptions, TransportReleaseStatus, TronAddress, TronDelegateResourceContract, TronFreezeBalanceV2Contract, TronGetAddressParams, TronSignMessageParams, TronSignTransactionParams, TronTransaction, TronTransactionContract, TronTransferContract, TronTriggerSmartContract, TronUnDelegateResourceContract, TronUnfreezeBalanceV2Contract, TronWithdrawBalanceContract, TronWithdrawExpireUnfreezeContract, UI_EVENT, UI_REQUEST, UI_RESPONSE, UiEvent, UiEventMessage, UiPromise, UiPromiseResponse, UiRequestButton, UiRequestDeviceAction, UiRequestPassphrase, UiRequestPassphraseOnDevice, UiRequestWithoutPayload, UiResponseEvent, UiResponseMessage, UiResponsePassphrase, UiResponsePin, UnavailableCapabilities, UnavailableCapability, Unsuccessful, VersionArray, checkNeedUpdateBootForClassicAndMini, checkNeedUpdateBootForTouch, corsValidator, createDeviceMessage, createErrorMessage, createFirmwareMessage, createIFrameMessage, createLogMessage, createResponseMessage, createUiMessage, createUiResponse, HardwareSdk as default, enableLog, getDeviceLabel, getDeviceType, getDeviceTypeByBleName, getDeviceTypeByDeviceId, getDeviceUUID, getEnv, getFirmwareUpdateField, getHDPath, getHomeScreenHex, getLog, getLogger, getOutputScriptType, getSDKVersion, getScriptType, getTimeStamp, httpRequest, init as initCore, isBleConnect, isValidVersionArray, isValidVersionString, normalizeVersionArray, parseConnectSettings, parseMessage, patchFeatures, safeThrowError, setLoggerPostMessage, supportInputPinOnSoftware, versionCompare, versionSplit, wait };
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ const inject = ({ call, cancel, dispose, eventEmitter, init, updateSettings, uiR
44
44
  const createCoreApi = (call) => ({
45
45
  getLogs: () => call({ method: 'getLogs' }),
46
46
  searchDevices: () => call({ method: 'searchDevices' }),
47
- getFeatures: connectId => call({ connectId, method: 'getFeatures' }),
47
+ getFeatures: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'getFeatures' })),
48
48
  checkFirmwareRelease: connectId => call({ connectId, method: 'checkFirmwareRelease' }),
49
49
  checkBLEFirmwareRelease: connectId => call({ connectId, method: 'checkBLEFirmwareRelease' }),
50
50
  checkTransportRelease: () => call({ method: 'checkTransportRelease' }),
@@ -22497,6 +22497,7 @@ exports.LoggerNames = void 0;
22497
22497
  LoggerNames["HdCommonConnectSdk"] = "@onekey/common-connect-sdk";
22498
22498
  LoggerNames["HdBleSdk"] = "@onekey/hd-ble-sdk";
22499
22499
  LoggerNames["HdTransportHttp"] = "@onekey/hd-transport-http";
22500
+ LoggerNames["HdTransportLowLevel"] = "@onekey/hd-transport-lowlevel";
22500
22501
  LoggerNames["HdBleTransport"] = "@onekey/hd-ble-transport";
22501
22502
  LoggerNames["Connect"] = "@onekey/connect";
22502
22503
  LoggerNames["Iframe"] = "IFrame";
@@ -22514,6 +22515,7 @@ const LoggerMap = {
22514
22515
  [exports.LoggerNames.HdBleSdk]: initLog(exports.LoggerNames.HdBleSdk),
22515
22516
  [exports.LoggerNames.HdTransportHttp]: initLog(exports.LoggerNames.HdTransportHttp),
22516
22517
  [exports.LoggerNames.HdBleTransport]: initLog(exports.LoggerNames.HdBleTransport),
22518
+ [exports.LoggerNames.HdTransportLowLevel]: initLog(exports.LoggerNames.HdTransportLowLevel),
22517
22519
  [exports.LoggerNames.Connect]: initLog(exports.LoggerNames.Connect),
22518
22520
  [exports.LoggerNames.Iframe]: initLog(exports.LoggerNames.Iframe),
22519
22521
  [exports.LoggerNames.SendMessage]: initLog(exports.LoggerNames.SendMessage),
@@ -22763,6 +22765,7 @@ const getHomeScreenHex = (deviceType, name) => {
22763
22765
  const wait = (ms) => new Promise(resolve => {
22764
22766
  setTimeout(resolve, ms);
22765
22767
  });
22768
+ const isBleConnect = (env) => env === 'react-native' || env === 'lowlevel';
22766
22769
 
22767
22770
  const getReleaseStatus = (releases, currentVersion) => {
22768
22771
  const newVersions = releases.filter(r => semver__default["default"].gt(r.version.join('.'), currentVersion));
@@ -23011,6 +23014,7 @@ DataManager.getTransportStatus = (localVersion) => {
23011
23014
  const isLatest = semver__default["default"].gte(localVersion, latestTransportVersion.join('.'));
23012
23015
  return isLatest ? 'valid' : 'outdated';
23013
23016
  };
23017
+ DataManager.isBleConnect = (env) => env === 'react-native' || env === 'lowlevel';
23014
23018
 
23015
23019
  const PROTOBUF_MESSAGE_CONFIG = {
23016
23020
  model_mini: [
@@ -23542,6 +23546,7 @@ DevicePool.emitter = new events.exports();
23542
23546
  const Log$7 = getLogger(exports.LoggerNames.Transport);
23543
23547
  const BleLogger = getLogger(exports.LoggerNames.HdBleTransport);
23544
23548
  const HttpLogger = getLogger(exports.LoggerNames.HdTransportHttp);
23549
+ const LowLevelLogger = getLogger(exports.LoggerNames.HdTransportLowLevel);
23545
23550
  class TransportManager {
23546
23551
  static load() {
23547
23552
  Log$7.debug('transport manager load');
@@ -23563,6 +23568,12 @@ class TransportManager {
23563
23568
  Log$7.debug('React Native Do Not Initializing transports');
23564
23569
  }
23565
23570
  }
23571
+ else if (env === 'lowlevel') {
23572
+ if (!this.plugin) {
23573
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.TransportNotConfigured, 'Lowlevel transport mast have plugin');
23574
+ }
23575
+ yield this.transport.init(LowLevelLogger, DevicePool.emitter, this.plugin);
23576
+ }
23566
23577
  else {
23567
23578
  yield this.transport.init(HttpLogger);
23568
23579
  }
@@ -23596,7 +23607,7 @@ class TransportManager {
23596
23607
  }
23597
23608
  });
23598
23609
  }
23599
- static setTransport(TransportConstructor) {
23610
+ static setTransport(TransportConstructor, plugin) {
23600
23611
  const env = DataManager.getSettings('env');
23601
23612
  if (env === 'react-native') {
23602
23613
  this.transport = new TransportConstructor({ scanTimeout: 3000 });
@@ -23604,6 +23615,10 @@ class TransportManager {
23604
23615
  else {
23605
23616
  this.transport = new TransportConstructor();
23606
23617
  }
23618
+ if (plugin) {
23619
+ this.plugin = plugin;
23620
+ Log$7.debug('set transport plugin: ', this.plugin);
23621
+ }
23607
23622
  Log$7.debug('set transport: ', this.transport);
23608
23623
  }
23609
23624
  static getTransport() {
@@ -23621,6 +23636,7 @@ class TransportManager {
23621
23636
  }
23622
23637
  TransportManager.reactNativeInit = false;
23623
23638
  TransportManager.messageVersion = 'latest';
23639
+ TransportManager.plugin = null;
23624
23640
 
23625
23641
  const assertType = (res, resType) => {
23626
23642
  const splitResTypes = Array.isArray(resType) ? resType : resType.split('|');
@@ -23892,7 +23908,7 @@ class Device extends events.exports {
23892
23908
  return null;
23893
23909
  const env = DataManager.getSettings('env');
23894
23910
  return {
23895
- connectId: env === 'react-native' ? this.mainId || null : getDeviceUUID(this.features),
23911
+ connectId: DataManager.isBleConnect(env) ? this.mainId || null : getDeviceUUID(this.features),
23896
23912
  uuid: getDeviceUUID(this.features),
23897
23913
  deviceType: this.features.bootloader_mode
23898
23914
  ? getDeviceTypeOnBootloader(this.features)
@@ -23913,7 +23929,7 @@ class Device extends events.exports {
23913
23929
  connect() {
23914
23930
  const env = DataManager.getSettings('env');
23915
23931
  return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
23916
- if (env === 'react-native') {
23932
+ if (DataManager.isBleConnect(env)) {
23917
23933
  try {
23918
23934
  yield this.acquire();
23919
23935
  resolve(true);
@@ -23944,9 +23960,9 @@ class Device extends events.exports {
23944
23960
  var _a, _b, _c, _d;
23945
23961
  return __awaiter(this, void 0, void 0, function* () {
23946
23962
  const env = DataManager.getSettings('env');
23947
- const mainIdKey = env === 'react-native' ? 'id' : 'session';
23963
+ const mainIdKey = DataManager.isBleConnect(env) ? 'id' : 'session';
23948
23964
  try {
23949
- if (env === 'react-native') {
23965
+ if (DataManager.isBleConnect(env)) {
23950
23966
  const res = yield ((_a = this.deviceConnector) === null || _a === void 0 ? void 0 : _a.acquire(this.originalDescriptor.id));
23951
23967
  this.mainId = (_b = res.uuid) !== null && _b !== void 0 ? _b : '';
23952
23968
  Log$5.debug('Expected uuid:', this.mainId);
@@ -23977,7 +23993,7 @@ class Device extends events.exports {
23977
23993
  return __awaiter(this, void 0, void 0, function* () {
23978
23994
  const env = DataManager.getSettings('env');
23979
23995
  if ((this.isUsedHere() && !this.keepSession && this.mainId) ||
23980
- (this.mainId && env === 'react-native')) {
23996
+ (this.mainId && DataManager.isBleConnect(env))) {
23981
23997
  if (this.commands) {
23982
23998
  this.commands.dispose(false);
23983
23999
  if (this.commands.callPromise) {
@@ -24107,7 +24123,7 @@ class Device extends events.exports {
24107
24123
  }
24108
24124
  updateDescriptor(descriptor, forceUpdate = false) {
24109
24125
  const env = DataManager.getSettings('env');
24110
- if (env === 'react-native') {
24126
+ if (DataManager.isBleConnect(env)) {
24111
24127
  return;
24112
24128
  }
24113
24129
  const originalSession = this.originalDescriptor.session;
@@ -24230,7 +24246,7 @@ class Device extends events.exports {
24230
24246
  }
24231
24247
  isUsedHere() {
24232
24248
  const env = DataManager.getSettings('env');
24233
- if (env === 'react-native') {
24249
+ if (DataManager.isBleConnect(env)) {
24234
24250
  return false;
24235
24251
  }
24236
24252
  return this.isUsed() && this.originalDescriptor.session === this.mainId;
@@ -24418,7 +24434,7 @@ class SearchDevices extends BaseMethod {
24418
24434
  const deviceDiff = yield ((_a = this.connector) === null || _a === void 0 ? void 0 : _a.enumerate());
24419
24435
  const devicesDescriptor = (_b = deviceDiff === null || deviceDiff === void 0 ? void 0 : deviceDiff.descriptors) !== null && _b !== void 0 ? _b : [];
24420
24436
  const env = DataManager.getSettings('env');
24421
- if (env === 'react-native') {
24437
+ if (DataManager.isBleConnect(env)) {
24422
24438
  return devicesDescriptor.map(device => {
24423
24439
  var _a;
24424
24440
  return (Object.assign(Object.assign({}, device), { connectId: device.id, deviceType: getDeviceTypeByBleName((_a = device.name) !== null && _a !== void 0 ? _a : '') }));
@@ -25300,7 +25316,7 @@ const newTouchUpdateProcess = (updateType, postMessage, device, { payload }) =>
25300
25316
  postProgressTip(device, 'StartTransferData', postMessage);
25301
25317
  const filePath = `0:${updateType === 'ble' ? 'ble-' : ''}firmware.bin`;
25302
25318
  const env = DataManager.getSettings('env');
25303
- const perPackageSize = env === 'react-native' ? 16 : 128;
25319
+ const perPackageSize = DataManager.isBleConnect(env) ? 16 : 128;
25304
25320
  const chunkSize = 1024 * perPackageSize;
25305
25321
  const totalChunks = Math.ceil(payload.byteLength / chunkSize);
25306
25322
  let offset = 0;
@@ -25364,7 +25380,7 @@ const emmcFileWriteWithRetry = (device, filePath, chunkLength, offset, chunk, ov
25364
25380
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'emmc file write firmware error');
25365
25381
  }
25366
25382
  const env = DataManager.getSettings('env');
25367
- if (env === 'react-native') {
25383
+ if (DataManager.isBleConnect(env)) {
25368
25384
  yield wait(3000);
25369
25385
  yield ((_a = device.deviceConnector) === null || _a === void 0 ? void 0 : _a.acquire(device.originalDescriptor.id, null, true));
25370
25386
  yield device.initialize();
@@ -25639,7 +25655,7 @@ class FirmwareUpdateV2 extends BaseMethod {
25639
25655
  checkDeviceToBootloader(connectId) {
25640
25656
  this.checkPromise = hdShared.createDeferred();
25641
25657
  const env = DataManager.getSettings('env');
25642
- const isBleReconnect = connectId && env === 'react-native';
25658
+ const isBleReconnect = connectId && DataManager.isBleConnect(env);
25643
25659
  Log$3.log('FirmwareUpdateV2 [checkDeviceToBootloader] isBleReconnect: ', isBleReconnect);
25644
25660
  const intervalTimer = setInterval(() => __awaiter(this, void 0, void 0, function* () {
25645
25661
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -31466,7 +31482,7 @@ class DeviceConnector {
31466
31482
  const env = DataManager.getSettings('env');
31467
31483
  try {
31468
31484
  let res;
31469
- if (env === 'react-native') {
31485
+ if (DataManager.isBleConnect(env)) {
31470
31486
  res = yield this.transport.acquire({ uuid: path, forceCleanRunPromise });
31471
31487
  }
31472
31488
  else {
@@ -31699,7 +31715,7 @@ const callAPI = (message) => __awaiter(void 0, void 0, void 0, function* () {
31699
31715
  function initDeviceList(method) {
31700
31716
  return __awaiter(this, void 0, void 0, function* () {
31701
31717
  const env = DataManager.getSettings('env');
31702
- if (env === 'react-native' && method.connectId) {
31718
+ if (DataManager.isBleConnect(env) && method.connectId) {
31703
31719
  yield TransportManager.configure();
31704
31720
  return;
31705
31721
  }
@@ -31811,7 +31827,7 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
31811
31827
  const env = DataManager.getSettings('env');
31812
31828
  let device;
31813
31829
  try {
31814
- if (env === 'react-native') {
31830
+ if (DataManager.isBleConnect(env)) {
31815
31831
  device = initDeviceForBle(method);
31816
31832
  }
31817
31833
  else {
@@ -31821,7 +31837,7 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
31821
31837
  if (timer) {
31822
31838
  clearTimeout(timer);
31823
31839
  }
31824
- if (env === 'react-native') {
31840
+ if (DataManager.isBleConnect(env)) {
31825
31841
  bleTimeoutRetry = 0;
31826
31842
  yield connectDeviceForBle(method, device);
31827
31843
  }
@@ -31866,7 +31882,7 @@ const cancel = (connectId) => {
31866
31882
  try {
31867
31883
  if (connectId) {
31868
31884
  let device;
31869
- if (env === 'react-native') {
31885
+ if (DataManager.isBleConnect(env)) {
31870
31886
  device = initDeviceForBle({ connectId });
31871
31887
  }
31872
31888
  else {
@@ -31908,12 +31924,12 @@ const closePopup = () => {
31908
31924
  };
31909
31925
  const onDeviceConnectHandler = (device) => {
31910
31926
  const env = DataManager.getSettings('env');
31911
- const deviceObject = env === 'react-native' ? device : device.toMessageObject();
31927
+ const deviceObject = DataManager.isBleConnect(env) ? device : device.toMessageObject();
31912
31928
  postMessage(createDeviceMessage(DEVICE.CONNECT, { device: deviceObject }));
31913
31929
  };
31914
31930
  const onDeviceDisconnectHandler = (device) => {
31915
31931
  const env = DataManager.getSettings('env');
31916
- const deviceObject = env === 'react-native' ? device : device.toMessageObject();
31932
+ const deviceObject = DataManager.isBleConnect(env) ? device : device.toMessageObject();
31917
31933
  postMessage(createDeviceMessage(DEVICE.DISCONNECT, { device: deviceObject }));
31918
31934
  };
31919
31935
  const onDevicePinHandler = (...[device, type, callback]) => __awaiter(void 0, void 0, void 0, function* () {
@@ -32026,14 +32042,14 @@ const initConnector = () => {
32026
32042
  DevicePool.emitter.on(DEVICE.DISCONNECT, onDeviceDisconnectHandler);
32027
32043
  return _connector;
32028
32044
  };
32029
- const initTransport = (Transport) => {
32030
- TransportManager.setTransport(Transport);
32045
+ const initTransport = (Transport, plugin) => {
32046
+ TransportManager.setTransport(Transport, plugin);
32031
32047
  };
32032
- const init = (settings, Transport) => __awaiter(void 0, void 0, void 0, function* () {
32048
+ const init = (settings, Transport, plugin) => __awaiter(void 0, void 0, void 0, function* () {
32033
32049
  try {
32034
32050
  try {
32035
32051
  yield DataManager.load(settings);
32036
- initTransport(Transport);
32052
+ initTransport(Transport, plugin);
32037
32053
  }
32038
32054
  catch (_b) {
32039
32055
  Log.error('DataManager.load error');
@@ -32125,6 +32141,7 @@ exports.getScriptType = getScriptType;
32125
32141
  exports.getTimeStamp = getTimeStamp;
32126
32142
  exports.httpRequest = httpRequest;
32127
32143
  exports.initCore = init;
32144
+ exports.isBleConnect = isBleConnect;
32128
32145
  exports.isValidVersionArray = isValidVersionArray;
32129
32146
  exports.isValidVersionString = isValidVersionString;
32130
32147
  exports.normalizeVersionArray = normalizeVersionArray;
@@ -1,4 +1,4 @@
1
- import type { Response } from '../params';
1
+ import type { CommonParams, Response } from '../params';
2
2
  import type { Features } from '../device';
3
- export declare function getFeatures(connectId?: string): Response<Features>;
3
+ export declare function getFeatures(connectId?: string, params?: CommonParams): Response<Features>;
4
4
  //# sourceMappingURL=getFeatures.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFeatures.d.ts","sourceRoot":"","sources":["../../../src/types/api/getFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"getFeatures.d.ts","sourceRoot":"","sources":["../../../src/types/api/getFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
+ import type { LowlevelTransportSharedPlugin } from '@onekeyfe/hd-transport';
1
2
  import { LowLevelCoreApi } from '../../lowLevelInject';
2
3
  import type { ConnectSettings } from '../settings';
3
- export declare function init(settings: Partial<ConnectSettings>, lowLevelApi?: LowLevelCoreApi): Promise<boolean>;
4
+ export declare function init(settings: Partial<ConnectSettings>, lowLevelApi?: LowLevelCoreApi, pulgin?: LowlevelTransportSharedPlugin): Promise<boolean>;
4
5
  export declare function updateSettings(settings: Partial<ConnectSettings>): Promise<boolean>;
5
6
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/types/api/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,CAAC,OAAO,UAAU,IAAI,CAC1B,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,EAClC,WAAW,CAAC,EAAE,eAAe,GAC5B,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/types/api/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,CAAC,OAAO,UAAU,IAAI,CAC1B,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,EAClC,WAAW,CAAC,EAAE,eAAe,EAC7B,MAAM,CAAC,EAAE,6BAA6B,GACrC,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC"}
@@ -12,7 +12,7 @@ export declare type ConnectSettings = {
12
12
  priority: number;
13
13
  trustedHost: boolean;
14
14
  supportedBrowser?: boolean;
15
- env: 'node' | 'web' | 'webextension' | 'electron' | 'react-native' | 'webusb';
15
+ env: 'node' | 'web' | 'webextension' | 'electron' | 'react-native' | 'webusb' | 'lowlevel';
16
16
  timestamp: number;
17
17
  isFrame?: boolean;
18
18
  preRelease?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/types/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,oBAAY,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,cAAc,GAAG,UAAU,GAAG,cAAc,GAAG,QAAQ,CAAC;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,oBAAY,aAAa,GAAG,CAAC,MAAM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QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE;aACR,CAAC,IAAI,OAAO,GAAG,MAAM;SACvB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,oBAAY,oBAAoB,GAAG;IACjC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;CAC7B,GAAG,aAAa,CAAC"}
@@ -7,4 +7,5 @@ export { checkNeedUpdateBootForTouch, checkNeedUpdateBootForClassicAndMini, } fr
7
7
  export { getLogger, enableLog, LoggerNames, getLog, setLoggerPostMessage } from './logger';
8
8
  export { getHomeScreenHex } from './homescreen';
9
9
  export declare const wait: (ms: number) => Promise<unknown>;
10
+ export declare const isBleConnect: (env: string) => boolean;
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEzF,OAAO,EACL,2BAA2B,EAC3B,oCAAoC,GACrC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,eAAO,MAAM,IAAI,OAAQ,MAAM,qBAG3B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEzF,OAAO,EACL,2BAA2B,EAC3B,oCAAoC,GACrC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,eAAO,MAAM,IAAI,OAAQ,MAAM,qBAG3B,CAAC;AAEL,eAAO,MAAM,YAAY,QAAS,MAAM,YAAiD,CAAC"}
@@ -32,6 +32,7 @@ export declare enum LoggerNames {
32
32
  HdCommonConnectSdk = "@onekey/common-connect-sdk",
33
33
  HdBleSdk = "@onekey/hd-ble-sdk",
34
34
  HdTransportHttp = "@onekey/hd-transport-http",
35
+ HdTransportLowLevel = "@onekey/hd-transport-lowlevel",
35
36
  HdBleTransport = "@onekey/hd-ble-transport",
36
37
  Connect = "@onekey/connect",
37
38
  Iframe = "IFrame",
@@ -49,6 +50,7 @@ export declare const LoggerMap: {
49
50
  "@onekey/hd-ble-sdk": Log;
50
51
  "@onekey/hd-transport-http": Log;
51
52
  "@onekey/hd-ble-transport": Log;
53
+ "@onekey/hd-transport-lowlevel": Log;
52
54
  "@onekey/connect": Log;
53
55
  IFrame: Log;
54
56
  "[SendMessage]": Log;
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRo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M,WAAW;IACjB,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,kBAAkB,+BAA+B;IACjD,QAAQ,uBAAuB;IAC/B,eAAe,8BAA8B;IAC7C,mBAAmB,kCAAkC;IACrD,cAAc,6BAA6B;IAC3C,OAAO,oBAAoB;IAC3B,MAAM,WAAW;IACjB,WAAW,kBAAkB;IAC7B,MAAM,aAAa;CACpB;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;CAiBrB,CAAC;AAEF,eAAO,MAAM,SAAS,QAAS,WAAW,QAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "0.3.24",
3
+ "version": "0.3.25",
4
4
  "description": "> TODO: description",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -25,8 +25,8 @@
25
25
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@onekeyfe/hd-shared": "^0.3.24",
29
- "@onekeyfe/hd-transport": "^0.3.24",
28
+ "@onekeyfe/hd-shared": "^0.3.25",
29
+ "@onekeyfe/hd-transport": "^0.3.25",
30
30
  "axios": "^0.27.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "bytebuffer": "^5.0.1",
@@ -44,5 +44,5 @@
44
44
  "@types/semver": "^7.3.9",
45
45
  "ripple-keypairs": "^1.1.4"
46
46
  },
47
- "gitHead": "cf0501a0a46436855b6a34f23b31ee97777a644e"
47
+ "gitHead": "2d4fe6dd208db8a3fe1eb0fc35c1a916e2236590"
48
48
  }
@@ -88,7 +88,7 @@ export default class FirmwareUpdateV2 extends BaseMethod<Params> {
88
88
  checkDeviceToBootloader(connectId: string | undefined) {
89
89
  this.checkPromise = createDeferred();
90
90
  const env = DataManager.getSettings('env');
91
- const isBleReconnect = connectId && env === 'react-native';
91
+ const isBleReconnect = connectId && DataManager.isBleConnect(env);
92
92
 
93
93
  Log.log('FirmwareUpdateV2 [checkDeviceToBootloader] isBleReconnect: ', isBleReconnect);
94
94
 
@@ -25,7 +25,7 @@ export default class SearchDevices extends BaseMethod {
25
25
  * No need to call features during Bluetooth scaning
26
26
  * to avoid device pairing
27
27
  */
28
- if (env === 'react-native') {
28
+ if (DataManager.isBleConnect(env)) {
29
29
  return devicesDescriptor.map(device => ({
30
30
  ...device,
31
31
  connectId: device.id,
@@ -146,7 +146,7 @@ const newTouchUpdateProcess = async (
146
146
  // Write File
147
147
  const filePath = `0:${updateType === 'ble' ? 'ble-' : ''}firmware.bin`;
148
148
  const env = DataManager.getSettings('env');
149
- const perPackageSize = env === 'react-native' ? 16 : 128;
149
+ const perPackageSize = DataManager.isBleConnect(env) ? 16 : 128;
150
150
  const chunkSize = 1024 * perPackageSize;
151
151
  const totalChunks = Math.ceil(payload.byteLength / chunkSize);
152
152
  let offset = 0;
@@ -230,7 +230,7 @@ const emmcFileWriteWithRetry = async (
230
230
  throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'emmc file write firmware error');
231
231
  }
232
232
  const env = DataManager.getSettings('env');
233
- if (env === 'react-native') {
233
+ if (DataManager.isBleConnect(env)) {
234
234
  await wait(3000);
235
235
  await device.deviceConnector?.acquire(device.originalDescriptor.id, null, true);
236
236
  await device.initialize();
package/src/core/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import semver from 'semver';
2
2
  import EventEmitter from 'events';
3
- import { Features, OneKeyDeviceInfo } from '@onekeyfe/hd-transport';
3
+ import { Features, LowlevelTransportSharedPlugin, OneKeyDeviceInfo } from '@onekeyfe/hd-transport';
4
4
  import {
5
5
  createDeferred,
6
6
  Deferred,
@@ -341,7 +341,7 @@ export const callAPI = async (message: CoreMessage) => {
341
341
 
342
342
  async function initDeviceList(method: BaseMethod) {
343
343
  const env = DataManager.getSettings('env');
344
- if (env === 'react-native' && method.connectId) {
344
+ if (DataManager.isBleConnect(env) && method.connectId) {
345
345
  await TransportManager.configure();
346
346
  return;
347
347
  }
@@ -479,7 +479,7 @@ const ensureConnected = async (method: BaseMethod, pollingId: number) => {
479
479
  const env = DataManager.getSettings('env');
480
480
  let device: Device;
481
481
  try {
482
- if (env === 'react-native') {
482
+ if (DataManager.isBleConnect(env)) {
483
483
  device = initDeviceForBle(method);
484
484
  } else {
485
485
  device = initDevice(method);
@@ -493,7 +493,7 @@ const ensureConnected = async (method: BaseMethod, pollingId: number) => {
493
493
  /**
494
494
  * Bluetooth should call initialize here
495
495
  */
496
- if (env === 'react-native') {
496
+ if (DataManager.isBleConnect(env)) {
497
497
  bleTimeoutRetry = 0;
498
498
  await connectDeviceForBle(method, device);
499
499
  }
@@ -541,7 +541,7 @@ export const cancel = (connectId?: string) => {
541
541
  try {
542
542
  if (connectId) {
543
543
  let device;
544
- if (env === 'react-native') {
544
+ if (DataManager.isBleConnect(env)) {
545
545
  device = initDeviceForBle({ connectId } as BaseMethod);
546
546
  } else {
547
547
  device = initDevice({ connectId } as BaseMethod);
@@ -594,13 +594,13 @@ const closePopup = () => {
594
594
 
595
595
  const onDeviceConnectHandler = (device: Device) => {
596
596
  const env = DataManager.getSettings('env');
597
- const deviceObject = env === 'react-native' ? device : device.toMessageObject();
597
+ const deviceObject = DataManager.isBleConnect(env) ? device : device.toMessageObject();
598
598
  postMessage(createDeviceMessage(DEVICE.CONNECT, { device: deviceObject as KnownDevice }));
599
599
  };
600
600
 
601
601
  const onDeviceDisconnectHandler = (device: Device) => {
602
602
  const env = DataManager.getSettings('env');
603
- const deviceObject = env === 'react-native' ? device : device.toMessageObject();
603
+ const deviceObject = DataManager.isBleConnect(env) ? device : device.toMessageObject();
604
604
  postMessage(createDeviceMessage(DEVICE.DISCONNECT, { device: deviceObject as KnownDevice }));
605
605
  };
606
606
 
@@ -765,15 +765,19 @@ export const initConnector = () => {
765
765
  return _connector;
766
766
  };
767
767
 
768
- const initTransport = (Transport: any) => {
769
- TransportManager.setTransport(Transport);
768
+ const initTransport = (Transport: any, plugin?: LowlevelTransportSharedPlugin) => {
769
+ TransportManager.setTransport(Transport, plugin);
770
770
  };
771
771
 
772
- export const init = async (settings: ConnectSettings, Transport: any) => {
772
+ export const init = async (
773
+ settings: ConnectSettings,
774
+ Transport: any,
775
+ plugin?: LowlevelTransportSharedPlugin
776
+ ) => {
773
777
  try {
774
778
  try {
775
779
  await DataManager.load(settings);
776
- initTransport(Transport);
780
+ initTransport(Transport, plugin);
777
781
  } catch {
778
782
  Log.error('DataManager.load error');
779
783
  }
@@ -294,4 +294,7 @@ export default class DataManager {
294
294
  }
295
295
  return this.settings;
296
296
  }
297
+
298
+ static isBleConnect = (env: ConnectSettings['env']) =>
299
+ env === 'react-native' || env === 'lowlevel';
297
300
  }
@@ -1,4 +1,4 @@
1
- import { Transport } from '@onekeyfe/hd-transport';
1
+ import { LowlevelTransportSharedPlugin, Transport } from '@onekeyfe/hd-transport';
2
2
  import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
3
3
  import DataManager, { MessageVersion } from './DataManager';
4
4
  import { getLogger, LoggerNames } from '../utils';
@@ -10,6 +10,7 @@ import { Features } from '../types';
10
10
  const Log = getLogger(LoggerNames.Transport);
11
11
  const BleLogger = getLogger(LoggerNames.HdBleTransport);
12
12
  const HttpLogger = getLogger(LoggerNames.HdTransportHttp);
13
+ const LowLevelLogger = getLogger(LoggerNames.HdTransportLowLevel);
13
14
 
14
15
  /**
15
16
  * transport 在同一个环境中只会存在一个
@@ -27,6 +28,8 @@ export default class TransportManager {
27
28
 
28
29
  static messageVersion: MessageVersion = 'latest';
29
30
 
31
+ static plugin: LowlevelTransportSharedPlugin | null = null;
32
+
30
33
  static load() {
31
34
  Log.debug('transport manager load');
32
35
  this.defaultMessages = DataManager.getProtobufMessages();
@@ -45,6 +48,14 @@ export default class TransportManager {
45
48
  } else {
46
49
  Log.debug('React Native Do Not Initializing transports');
47
50
  }
51
+ } else if (env === 'lowlevel') {
52
+ if (!this.plugin) {
53
+ throw ERRORS.TypedError(
54
+ HardwareErrorCode.TransportNotConfigured,
55
+ 'Lowlevel transport mast have plugin'
56
+ );
57
+ }
58
+ await this.transport.init(LowLevelLogger, DevicePool.emitter, this.plugin);
48
59
  } else {
49
60
  await this.transport.init(HttpLogger);
50
61
  }
@@ -81,7 +92,7 @@ export default class TransportManager {
81
92
  }
82
93
  }
83
94
 
84
- static setTransport(TransportConstructor: any) {
95
+ static setTransport(TransportConstructor: any, plugin?: LowlevelTransportSharedPlugin) {
85
96
  const env = DataManager.getSettings('env');
86
97
  if (env === 'react-native') {
87
98
  /** Actually initializes the ReactNativeTransport */
@@ -90,6 +101,10 @@ export default class TransportManager {
90
101
  /** Actually initializes the HttpTransport */
91
102
  this.transport = new TransportConstructor() as unknown as Transport;
92
103
  }
104
+ if (plugin) {
105
+ this.plugin = plugin;
106
+ Log.debug('set transport plugin: ', this.plugin);
107
+ }
93
108
  Log.debug('set transport: ', this.transport);
94
109
  }
95
110
 
@@ -136,7 +136,7 @@ export class Device extends EventEmitter {
136
136
 
137
137
  return {
138
138
  /** Android uses Mac address, iOS uses uuid, USB uses uuid */
139
- connectId: env === 'react-native' ? this.mainId || null : getDeviceUUID(this.features),
139
+ connectId: DataManager.isBleConnect(env) ? this.mainId || null : getDeviceUUID(this.features),
140
140
  /** Hardware ID, will not change at any time */
141
141
  uuid: getDeviceUUID(this.features),
142
142
  deviceType: this.features.bootloader_mode
@@ -166,7 +166,7 @@ export class Device extends EventEmitter {
166
166
  const env = DataManager.getSettings('env');
167
167
  // eslint-disable-next-line no-async-promise-executor
168
168
  return new Promise<boolean>(async resolve => {
169
- if (env === 'react-native') {
169
+ if (DataManager.isBleConnect(env)) {
170
170
  try {
171
171
  await this.acquire();
172
172
  resolve(true);
@@ -195,9 +195,9 @@ export class Device extends EventEmitter {
195
195
 
196
196
  async acquire() {
197
197
  const env = DataManager.getSettings('env');
198
- const mainIdKey = env === 'react-native' ? 'id' : 'session';
198
+ const mainIdKey = DataManager.isBleConnect(env) ? 'id' : 'session';
199
199
  try {
200
- if (env === 'react-native') {
200
+ if (DataManager.isBleConnect(env)) {
201
201
  const res = await this.deviceConnector?.acquire(this.originalDescriptor.id);
202
202
  this.mainId = (res as unknown as any).uuid ?? '';
203
203
  Log.debug('Expected uuid:', this.mainId);
@@ -228,7 +228,7 @@ export class Device extends EventEmitter {
228
228
  const env = DataManager.getSettings('env');
229
229
  if (
230
230
  (this.isUsedHere() && !this.keepSession && this.mainId) ||
231
- (this.mainId && env === 'react-native')
231
+ (this.mainId && DataManager.isBleConnect(env))
232
232
  ) {
233
233
  if (this.commands) {
234
234
  this.commands.dispose(false);
@@ -389,7 +389,7 @@ export class Device extends EventEmitter {
389
389
  */
390
390
  updateDescriptor(descriptor: DeviceDescriptor, forceUpdate = false) {
391
391
  const env = DataManager.getSettings('env');
392
- if (env === 'react-native') {
392
+ if (DataManager.isBleConnect(env)) {
393
393
  return;
394
394
  }
395
395
  const originalSession = this.originalDescriptor.session;
@@ -523,7 +523,7 @@ export class Device extends EventEmitter {
523
523
 
524
524
  isUsedHere() {
525
525
  const env = DataManager.getSettings('env');
526
- if (env === 'react-native') {
526
+ if (DataManager.isBleConnect(env)) {
527
527
  return false;
528
528
  }
529
529
  return this.isUsed() && this.originalDescriptor.session === this.mainId;
@@ -78,7 +78,7 @@ export default class DeviceConnector {
78
78
  const env = DataManager.getSettings('env');
79
79
  try {
80
80
  let res;
81
- if (env === 'react-native') {
81
+ if (DataManager.isBleConnect(env)) {
82
82
  res = await this.transport.acquire({ uuid: path, forceCleanRunPromise });
83
83
  } else {
84
84
  res = await this.transport.acquire({ path, previous: session ?? null });
package/src/inject.ts CHANGED
@@ -77,7 +77,7 @@ export const createCoreApi = (
77
77
  /**
78
78
  * 获取设备信息
79
79
  */
80
- getFeatures: connectId => call({ connectId, method: 'getFeatures' }),
80
+ getFeatures: (connectId, params) => call({ ...params, connectId, method: 'getFeatures' }),
81
81
 
82
82
  /**
83
83
  * 检查固件版本
@@ -1,4 +1,4 @@
1
- import type { Response } from '../params';
1
+ import type { CommonParams, Response } from '../params';
2
2
  import type { Features } from '../device';
3
3
 
4
- export declare function getFeatures(connectId?: string): Response<Features>;
4
+ export declare function getFeatures(connectId?: string, params?: CommonParams): Response<Features>;
@@ -1,9 +1,11 @@
1
+ import type { LowlevelTransportSharedPlugin } from '@onekeyfe/hd-transport';
1
2
  import { LowLevelCoreApi } from '../../lowLevelInject';
2
3
  import type { ConnectSettings } from '../settings';
3
4
 
4
5
  export declare function init(
5
6
  settings: Partial<ConnectSettings>,
6
- lowLevelApi?: LowLevelCoreApi
7
+ lowLevelApi?: LowLevelCoreApi,
8
+ pulgin?: LowlevelTransportSharedPlugin
7
9
  ): Promise<boolean>;
8
10
 
9
11
  export declare function updateSettings(settings: Partial<ConnectSettings>): Promise<boolean>;
@@ -14,7 +14,7 @@ export type ConnectSettings = {
14
14
  priority: number;
15
15
  trustedHost: boolean;
16
16
  supportedBrowser?: boolean;
17
- env: 'node' | 'web' | 'webextension' | 'electron' | 'react-native' | 'webusb';
17
+ env: 'node' | 'web' | 'webextension' | 'electron' | 'react-native' | 'webusb' | 'lowlevel';
18
18
  timestamp: number;
19
19
  isFrame?: boolean;
20
20
  preRelease?: boolean;
@@ -25,3 +25,5 @@ export const wait = (ms: number) =>
25
25
  new Promise(resolve => {
26
26
  setTimeout(resolve, ms);
27
27
  });
28
+
29
+ export const isBleConnect = (env: string) => env === 'react-native' || env === 'lowlevel';
@@ -155,6 +155,7 @@ export enum LoggerNames {
155
155
  HdCommonConnectSdk = '@onekey/common-connect-sdk',
156
156
  HdBleSdk = '@onekey/hd-ble-sdk',
157
157
  HdTransportHttp = '@onekey/hd-transport-http',
158
+ HdTransportLowLevel = '@onekey/hd-transport-lowlevel',
158
159
  HdBleTransport = '@onekey/hd-ble-transport',
159
160
  Connect = '@onekey/connect',
160
161
  Iframe = 'IFrame',
@@ -173,6 +174,7 @@ export const LoggerMap = {
173
174
  [LoggerNames.HdBleSdk]: initLog(LoggerNames.HdBleSdk),
174
175
  [LoggerNames.HdTransportHttp]: initLog(LoggerNames.HdTransportHttp),
175
176
  [LoggerNames.HdBleTransport]: initLog(LoggerNames.HdBleTransport),
177
+ [LoggerNames.HdTransportLowLevel]: initLog(LoggerNames.HdTransportLowLevel),
176
178
  [LoggerNames.Connect]: initLog(LoggerNames.Connect),
177
179
  [LoggerNames.Iframe]: initLog(LoggerNames.Iframe),
178
180
  [LoggerNames.SendMessage]: initLog(LoggerNames.SendMessage),