@onekeyfe/hd-core 0.2.18 → 0.2.20
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/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/filecoin/FilecoinGetAddress.d.ts.map +1 -1
- package/dist/api/filecoin/FilecoinSignTransaction.d.ts.map +1 -1
- package/dist/api/firmware/getBinary.d.ts +2 -0
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +1 -2
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +44 -16
- package/dist/types/api/filecoinGetAddress.d.ts +1 -0
- package/dist/types/api/filecoinGetAddress.d.ts.map +1 -1
- package/dist/types/api/filecoinSignTransaction.d.ts +1 -0
- package/dist/types/api/filecoinSignTransaction.d.ts.map +1 -1
- package/dist/types/settings.d.ts +1 -0
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +1 -0
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/FirmwareUpdateV2.ts +11 -3
- package/src/api/filecoin/FilecoinGetAddress.ts +2 -0
- package/src/api/filecoin/FilecoinSignTransaction.ts +3 -1
- package/src/api/firmware/getBinary.ts +4 -11
- package/src/data/messages/messages.json +8 -0
- package/src/data-manager/DataManager.ts +8 -12
- package/src/types/api/filecoinGetAddress.ts +1 -0
- package/src/types/api/filecoinSignTransaction.ts +1 -0
- package/src/types/settings.ts +1 -0
- package/src/utils/deviceFeaturesUtils.ts +17 -0
- package/src/utils/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirmwareUpdateV2.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV2.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,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C,MAAM,CAAC;IAC9D,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAQ;IAE1C,IAAI;IAsCJ,cAAc,YAAa,MAAM,UAS/B;IAEF,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS;IA6CrD,qBAAqB,CAAC,QAAQ,EAAE,QAAQ;IAUxC,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM;IAc9D,gCAAgC,CAAC,QAAQ,CAAC,EAAE,QAAQ;IAwB9C,GAAG;CAiGV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilecoinGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/filecoin/FilecoinGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAG1F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,eAAe,EAA4B,MAAM,aAAa,CAAC;AAExE,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU,CAAC,0BAA0B,EAAE,CAAC;IACtF,SAAS,UAAS;IAElB,IAAI;
|
|
1
|
+
{"version":3,"file":"FilecoinGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/filecoin/FilecoinGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAG1F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,eAAe,EAA4B,MAAM,aAAa,CAAC;AAExE,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU,CAAC,0BAA0B,EAAE,CAAC;IACtF,SAAS,UAAS;IAElB,IAAI;IA+BJ,eAAe;;;;;;;;IAWT,GAAG;CAoBV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilecoinSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/filecoin/FilecoinSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACrF,SAAS,UAAS;IAElB,IAAI;
|
|
1
|
+
{"version":3,"file":"FilecoinSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/filecoin/FilecoinSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACrF,SAAS,UAAS;IAElB,IAAI;IAsBJ,eAAe;;;;;;;;IAWT,GAAG;;;;CAYV"}
|
|
@@ -12,6 +12,7 @@ export declare const getBinary: ({ features, updateType, version }: GetBinaryPro
|
|
|
12
12
|
url: string;
|
|
13
13
|
resource?: string | undefined;
|
|
14
14
|
fullResource?: string | undefined;
|
|
15
|
+
fullResourceRange?: string[] | undefined;
|
|
15
16
|
fingerprint: string;
|
|
16
17
|
version: import("../../types").IVersionArray;
|
|
17
18
|
changelog: {
|
|
@@ -22,5 +23,6 @@ export declare const getBinary: ({ features, updateType, version }: GetBinaryPro
|
|
|
22
23
|
export declare const getSysResourceBinary: (url: string) => Promise<{
|
|
23
24
|
binary: any;
|
|
24
25
|
}>;
|
|
26
|
+
export declare const getInfo: ({ features, updateType }: GetInfoProps) => import("../../types").IFirmwareReleaseInfo | undefined;
|
|
25
27
|
export {};
|
|
26
28
|
//# sourceMappingURL=getBinary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBinary.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/getBinary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"getBinary.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/getBinary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAMvC,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC;CAChC;AAED,UAAU,cAAe,SAAQ,YAAY;IAC3C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,sCAA6C,cAAc;;;;;;;;;;;;;EAwBhF,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAe,MAAM;;EAWrD,CAAC;AAEF,eAAO,MAAM,OAAO,6BAA8B,YAAY,2DAO7D,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConnectSettings, DeviceTypeMap, AssetsMap, Features, IDeviceFirmwareStatus, IDeviceBLEFirmwareStatus, ITransportStatus
|
|
1
|
+
import type { ConnectSettings, DeviceTypeMap, AssetsMap, Features, IDeviceFirmwareStatus, IDeviceBLEFirmwareStatus, ITransportStatus } from '../types';
|
|
2
2
|
export default class DataManager {
|
|
3
3
|
static deviceMap: DeviceTypeMap;
|
|
4
4
|
static assets: AssetsMap | null;
|
|
@@ -6,7 +6,6 @@ export default class DataManager {
|
|
|
6
6
|
static messages: {
|
|
7
7
|
default: JSON;
|
|
8
8
|
};
|
|
9
|
-
static getFirmwareUpdateField: (deviceType: IDeviceType) => "firmware" | "firmware-v2";
|
|
10
9
|
static getFirmwareStatus: (features: Features) => IDeviceFirmwareStatus;
|
|
11
10
|
static getSysResourcesLatestRelease: (features: Features, forcedUpdateRes?: boolean | undefined) => string | undefined;
|
|
12
11
|
static getSysFullResource: (features: Features) => string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/DataManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DataManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/DataManager.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,SAAS,EAET,QAAQ,EACR,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAKlB,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,MAAM,CAAC,SAAS,EAAE,aAAa,CAiB7B;IAEF,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAQ;IAEvC,MAAM,CAAC,QAAQ,EAAE,eAAe,CAAC;IAEjC,MAAM,CAAC,QAAQ,EAAE;QAAE,OAAO,EAAE,IAAI,CAAA;KAAE,CAEhC;IAEF,MAAM,CAAC,iBAAiB,aAAc,QAAQ,KAAG,qBAAqB,CAepE;IAMF,MAAM,CAAC,4BAA4B,aAAc,QAAQ,+DAgBvD;IAMF,MAAM,CAAC,kBAAkB,aAAc,QAAQ,wBAU7C;IAEF,MAAM,CAAC,oBAAoB,aAAc,QAAQ;;;QAe/C;IAEF,MAAM,CAAC,wBAAwB,aAAc,QAAQ,yDAgBnD;IAEF,MAAM,CAAC,oBAAoB,aAAc,QAAQ,KAAG,wBAAwB,CAY1E;IAEF,MAAM,CAAC,uBAAuB,aAAc,QAAQ;;;QAWlD;IAEF,MAAM,CAAC,2BAA2B,aAAc,QAAQ,4DAItD;IAEF,MAAM,CAAC,kBAAkB,iBAAkB,MAAM,KAAG,gBAAgB,CAKlE;WAEW,IAAI,CAAC,QAAQ,EAAE,eAAe;IAwB3C,MAAM,CAAC,mBAAmB;IAI1B,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;CAShF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -147,6 +147,7 @@ declare type IFirmwareReleaseInfo = {
|
|
|
147
147
|
url: string;
|
|
148
148
|
resource?: string;
|
|
149
149
|
fullResource?: string;
|
|
150
|
+
fullResourceRange?: string[];
|
|
150
151
|
fingerprint: string;
|
|
151
152
|
version: IVersionArray;
|
|
152
153
|
changelog: {
|
|
@@ -1427,6 +1428,7 @@ declare type FilecoinAddress = {
|
|
|
1427
1428
|
declare type FilecoinGetAddressParams = {
|
|
1428
1429
|
path: string | number[];
|
|
1429
1430
|
showOnOneKey?: boolean;
|
|
1431
|
+
isTestnet?: boolean;
|
|
1430
1432
|
};
|
|
1431
1433
|
declare function filecoinGetAddress(connectId: string, deviceId: string, params: CommonParams & FilecoinGetAddressParams): Response<FilecoinAddress>;
|
|
1432
1434
|
declare function filecoinGetAddress(connectId: string, deviceId: string, params: CommonParams & {
|
|
@@ -1439,6 +1441,7 @@ declare type FilecoinSignedTx = {
|
|
|
1439
1441
|
declare type FilecoinSignTransactionParams = {
|
|
1440
1442
|
path: string | number[];
|
|
1441
1443
|
rawTx?: string;
|
|
1444
|
+
isTestnet?: boolean;
|
|
1442
1445
|
};
|
|
1443
1446
|
declare function filecoinSignTransaction(connectId: string, deviceId: string, params: CommonParams & FilecoinSignTransactionParams): Response<FilecoinSignedTx>;
|
|
1444
1447
|
declare function filecoinSignTransaction(connectId: string, deviceId: string, params: CommonParams & {
|
|
@@ -2004,6 +2007,7 @@ declare const getDeviceTypeByBleName: (name?: string | undefined) => IDeviceType
|
|
|
2004
2007
|
declare const getDeviceTypeByDeviceId: (deviceId?: string | undefined) => IDeviceType;
|
|
2005
2008
|
declare const getDeviceUUID: (features: Features) => string;
|
|
2006
2009
|
declare const getDeviceLabel: (features: Features) => string;
|
|
2010
|
+
declare const getFirmwareUpdateField: (features: Features, updateType: 'firmware' | 'ble') => "firmware" | "ble" | "firmware-v2";
|
|
2007
2011
|
|
|
2008
2012
|
declare const getHDPath: (path: string) => Array<number>;
|
|
2009
2013
|
declare const getScriptType: (path: Array<number>) => InputScriptType;
|
|
@@ -2069,7 +2073,6 @@ declare class DataManager {
|
|
|
2069
2073
|
static messages: {
|
|
2070
2074
|
default: JSON;
|
|
2071
2075
|
};
|
|
2072
|
-
static getFirmwareUpdateField: (deviceType: IDeviceType) => "firmware" | "firmware-v2";
|
|
2073
2076
|
static getFirmwareStatus: (features: Features) => IDeviceFirmwareStatus;
|
|
2074
2077
|
static getSysResourcesLatestRelease: (features: Features, forcedUpdateRes?: boolean | undefined) => string | undefined;
|
|
2075
2078
|
static getSysFullResource: (features: Features) => string | undefined;
|
|
@@ -2093,4 +2096,4 @@ declare class DataManager {
|
|
|
2093
2096
|
|
|
2094
2097
|
declare const HardwareSdk: ({ init, call, dispose, eventEmitter, uiResponse, cancel, }: InjectApi) => CoreApi;
|
|
2095
2098
|
|
|
2096
|
-
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, DeviceRecoveryParams, DeviceResetParams, DeviceSendFeatures, DeviceSendSupportFeatures, DeviceSettingsParams, DeviceStatus, DeviceSupportFeatures, DeviceSupportFeaturesPayload, DeviceTypeMap, 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, IBLEFirmwareReleaseInfo, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, IDeviceModel, IDeviceType, IFRAME, IFirmwareReleaseInfo, IFrameBridge, IFrameCallMessage, IFrameCancelMessage, IFrameEvent, IFrameEventMessage, IFrameInit, ILocale, ITransportStatus, IVersionArray, KnownDevice, LOG, LOG_EVENT, LogEvent, LogEventMessage, LogOutput, LoggerNames, MajorVersion, MethodResponseMessage, NEMAddress, NEMAggregateModificationTransaction, NEMGetAddressParams, NEMImportanceTransaction, NEMMosaic, NEMMosaicCreationTransaction, NEMMultisigTransaction, NEMProvisionNamespaceTransaction, NEMSignTransactionParams, NEMSupplyChangeTransaction, NEMTransaction, NEMTransferTransaction, NearAddress, NearGetAddressParams, NearSignTransactionParams, Params, PostMessageEvent, 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, TransactionOptions, TransportReleaseStatus, TronAddress, TronGetAddressParams, TronSignMessageParams, TronSignTransactionParams, TronTransaction, TronTransactionContract, TronTransferContract, TronTriggerSmartContract, UI_EVENT, UI_REQUEST, UI_RESPONSE, UiEvent, UiEventMessage, UiPromise, UiPromiseResponse, UiRequestButton, UiRequestDeviceAction, UiRequestPassphrase, UiRequestPassphraseOnDevice, UiRequestWithoutPayload, UiResponseEvent, UiResponseMessage, UiResponsePassphrase, UiResponsePin, UnavailableCapabilities, UnavailableCapability, Unsuccessful, VersionArray, corsValidator, createDeviceMessage, createErrorMessage, createFirmwareMessage, createIFrameMessage, createLogMessage, createResponseMessage, createUiMessage, createUiResponse, HardwareSdk as default, enableLog, getDeviceLabel, getDeviceType, getDeviceTypeByBleName, getDeviceTypeByDeviceId, getDeviceUUID, getEnv, getHDPath, getHomeScreenHex, getLog, getLogger, getOutputScriptType, getSDKVersion, getScriptType, getTimeStamp, httpRequest, init as initCore, isValidVersionArray, isValidVersionString, normalizeVersionArray, parseConnectSettings, parseMessage, patchFeatures, safeThrowError, setLoggerPostMessage, versionCompare, versionSplit, wait };
|
|
2099
|
+
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, DeviceRecoveryParams, DeviceResetParams, DeviceSendFeatures, DeviceSendSupportFeatures, DeviceSettingsParams, DeviceStatus, DeviceSupportFeatures, DeviceSupportFeaturesPayload, DeviceTypeMap, 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, IBLEFirmwareReleaseInfo, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, IDeviceModel, IDeviceType, IFRAME, IFirmwareReleaseInfo, IFrameBridge, IFrameCallMessage, IFrameCancelMessage, IFrameEvent, IFrameEventMessage, IFrameInit, ILocale, ITransportStatus, IVersionArray, KnownDevice, LOG, LOG_EVENT, LogEvent, LogEventMessage, LogOutput, LoggerNames, MajorVersion, MethodResponseMessage, NEMAddress, NEMAggregateModificationTransaction, NEMGetAddressParams, NEMImportanceTransaction, NEMMosaic, NEMMosaicCreationTransaction, NEMMultisigTransaction, NEMProvisionNamespaceTransaction, NEMSignTransactionParams, NEMSupplyChangeTransaction, NEMTransaction, NEMTransferTransaction, NearAddress, NearGetAddressParams, NearSignTransactionParams, Params, PostMessageEvent, 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, TransactionOptions, TransportReleaseStatus, TronAddress, TronGetAddressParams, TronSignMessageParams, TronSignTransactionParams, TronTransaction, TronTransactionContract, TronTransferContract, TronTriggerSmartContract, UI_EVENT, UI_REQUEST, UI_RESPONSE, UiEvent, UiEventMessage, UiPromise, UiPromiseResponse, UiRequestButton, UiRequestDeviceAction, UiRequestPassphrase, UiRequestPassphraseOnDevice, UiRequestWithoutPayload, UiResponseEvent, UiResponseMessage, UiResponsePassphrase, UiResponsePin, UnavailableCapabilities, UnavailableCapability, Unsuccessful, VersionArray, 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, versionCompare, versionSplit, wait };
|
package/dist/index.js
CHANGED
|
@@ -877,6 +877,19 @@ const supportModifyHomescreen = (features) => {
|
|
|
877
877
|
}
|
|
878
878
|
return { support: semver__default["default"].gte(currentVersion, '3.4.0') };
|
|
879
879
|
};
|
|
880
|
+
const getFirmwareUpdateField = (features, updateType) => {
|
|
881
|
+
const deviceType = getDeviceType(features);
|
|
882
|
+
const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
|
|
883
|
+
if (updateType === 'ble') {
|
|
884
|
+
return 'ble';
|
|
885
|
+
}
|
|
886
|
+
if (deviceType === 'touch') {
|
|
887
|
+
if (semver__default["default"].lt(deviceFirmwareVersion.join('.'), '3.4.0'))
|
|
888
|
+
return 'firmware';
|
|
889
|
+
return 'firmware-v2';
|
|
890
|
+
}
|
|
891
|
+
return 'firmware';
|
|
892
|
+
};
|
|
880
893
|
|
|
881
894
|
var nested = {
|
|
882
895
|
AlgorandGetAddress: {
|
|
@@ -5310,6 +5323,10 @@ var nested = {
|
|
|
5310
5323
|
show_display: {
|
|
5311
5324
|
type: "bool",
|
|
5312
5325
|
id: 2
|
|
5326
|
+
},
|
|
5327
|
+
testnet: {
|
|
5328
|
+
type: "bool",
|
|
5329
|
+
id: 3
|
|
5313
5330
|
}
|
|
5314
5331
|
}
|
|
5315
5332
|
},
|
|
@@ -5335,6 +5352,10 @@ var nested = {
|
|
|
5335
5352
|
rule: "required",
|
|
5336
5353
|
type: "bytes",
|
|
5337
5354
|
id: 2
|
|
5355
|
+
},
|
|
5356
|
+
testnet: {
|
|
5357
|
+
type: "bool",
|
|
5358
|
+
id: 3
|
|
5338
5359
|
}
|
|
5339
5360
|
}
|
|
5340
5361
|
},
|
|
@@ -11162,7 +11183,6 @@ DataManager.assets = null;
|
|
|
11162
11183
|
DataManager.messages = {
|
|
11163
11184
|
default: MessagesJSON,
|
|
11164
11185
|
};
|
|
11165
|
-
DataManager.getFirmwareUpdateField = (deviceType) => deviceType === 'touch' ? 'firmware-v2' : 'firmware';
|
|
11166
11186
|
DataManager.getFirmwareStatus = (features) => {
|
|
11167
11187
|
var _b, _c;
|
|
11168
11188
|
const deviceType = getDeviceType(features);
|
|
@@ -11173,7 +11193,7 @@ DataManager.getFirmwareStatus = (features) => {
|
|
|
11173
11193
|
if (deviceType === 'classic' && features.bootloader_mode) {
|
|
11174
11194
|
return 'unknown';
|
|
11175
11195
|
}
|
|
11176
|
-
const firmwareUpdateField =
|
|
11196
|
+
const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
|
|
11177
11197
|
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
|
|
11178
11198
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
11179
11199
|
return getReleaseStatus(targetDeviceConfigList, currentVersion);
|
|
@@ -11184,7 +11204,7 @@ DataManager.getSysResourcesLatestRelease = (features, forcedUpdateRes) => {
|
|
|
11184
11204
|
const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
|
|
11185
11205
|
if (deviceType !== 'pro' && deviceType !== 'touch')
|
|
11186
11206
|
return undefined;
|
|
11187
|
-
const firmwareUpdateField =
|
|
11207
|
+
const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
|
|
11188
11208
|
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
|
|
11189
11209
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
11190
11210
|
const targetDeviceConfig = targetDeviceConfigList.filter(item => forcedUpdateRes
|
|
@@ -11197,7 +11217,7 @@ DataManager.getSysFullResource = (features) => {
|
|
|
11197
11217
|
const deviceType = getDeviceType(features);
|
|
11198
11218
|
if (deviceType !== 'pro' && deviceType !== 'touch')
|
|
11199
11219
|
return undefined;
|
|
11200
|
-
const firmwareUpdateField =
|
|
11220
|
+
const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
|
|
11201
11221
|
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
|
|
11202
11222
|
const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.fullResource);
|
|
11203
11223
|
return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.fullResource;
|
|
@@ -11210,7 +11230,7 @@ DataManager.getFirmwareChangelog = (features) => {
|
|
|
11210
11230
|
(deviceType === 'classic' && features.bootloader_mode)) {
|
|
11211
11231
|
return [];
|
|
11212
11232
|
}
|
|
11213
|
-
const firmwareUpdateField =
|
|
11233
|
+
const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
|
|
11214
11234
|
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
|
|
11215
11235
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
11216
11236
|
return getReleaseChangelog(targetDeviceConfigList, currentVersion);
|
|
@@ -11218,7 +11238,7 @@ DataManager.getFirmwareChangelog = (features) => {
|
|
|
11218
11238
|
DataManager.getFirmwareLatestRelease = (features) => {
|
|
11219
11239
|
var _b, _c;
|
|
11220
11240
|
const deviceType = getDeviceType(features);
|
|
11221
|
-
const firmwareUpdateField =
|
|
11241
|
+
const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
|
|
11222
11242
|
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
|
|
11223
11243
|
const target = findLatestRelease(targetDeviceConfigList);
|
|
11224
11244
|
if (!target)
|
|
@@ -13152,17 +13172,11 @@ const getSysResourceBinary = (url) => __awaiter(void 0, void 0, void 0, function
|
|
|
13152
13172
|
binary: fw,
|
|
13153
13173
|
};
|
|
13154
13174
|
});
|
|
13155
|
-
const getFirmwareUpdateField = (deviceType, updateType) => {
|
|
13156
|
-
if (updateType === 'ble') {
|
|
13157
|
-
return 'ble';
|
|
13158
|
-
}
|
|
13159
|
-
return deviceType === 'touch' ? 'firmware-v2' : 'firmware';
|
|
13160
|
-
};
|
|
13161
13175
|
const getInfo = ({ features, updateType }) => {
|
|
13162
13176
|
var _a, _b;
|
|
13163
13177
|
const deviceType = getDeviceType(features);
|
|
13164
13178
|
const { deviceMap } = DataManager;
|
|
13165
|
-
const firmwareUpdateField = getFirmwareUpdateField(
|
|
13179
|
+
const firmwareUpdateField = getFirmwareUpdateField(features, updateType);
|
|
13166
13180
|
const releaseInfo = (_b = (_a = deviceMap === null || deviceMap === void 0 ? void 0 : deviceMap[deviceType]) === null || _a === void 0 ? void 0 : _a[firmwareUpdateField]) !== null && _b !== void 0 ? _b : [];
|
|
13167
13181
|
return findLatestRelease(releaseInfo);
|
|
13168
13182
|
};
|
|
@@ -13466,13 +13480,22 @@ class FirmwareUpdateV2 extends BaseMethod {
|
|
|
13466
13480
|
}
|
|
13467
13481
|
checkVersionForCopyTouchResource(features) {
|
|
13468
13482
|
var _a;
|
|
13483
|
+
if (!features)
|
|
13484
|
+
return;
|
|
13469
13485
|
const deviceType = getDeviceType(features);
|
|
13470
13486
|
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
13471
13487
|
const targetVersion = (_a = this.params.version) === null || _a === void 0 ? void 0 : _a.join('.');
|
|
13472
13488
|
const { updateType } = this.params;
|
|
13489
|
+
const releaseInfo = getInfo({ features, updateType });
|
|
13490
|
+
if (!releaseInfo)
|
|
13491
|
+
return;
|
|
13492
|
+
const { fullResourceRange } = releaseInfo;
|
|
13493
|
+
if (!fullResourceRange)
|
|
13494
|
+
return;
|
|
13495
|
+
const [minVersion, limitVersion] = fullResourceRange;
|
|
13473
13496
|
if (deviceType === 'touch' && updateType === 'firmware' && targetVersion) {
|
|
13474
|
-
if (semver__default["default"].lt(currentVersion,
|
|
13475
|
-
semver__default["default"].gte(targetVersion,
|
|
13497
|
+
if (semver__default["default"].lt(currentVersion, minVersion) &&
|
|
13498
|
+
semver__default["default"].gte(targetVersion, limitVersion) &&
|
|
13476
13499
|
this.payload.platform !== 'desktop') {
|
|
13477
13500
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.UseDesktopToUpdateFirmware);
|
|
13478
13501
|
}
|
|
@@ -17691,11 +17714,13 @@ class FilecoinGetAddress extends BaseMethod {
|
|
|
17691
17714
|
validateParams(batch, [
|
|
17692
17715
|
{ name: 'path', required: true },
|
|
17693
17716
|
{ name: 'showOnOneKey', type: 'boolean' },
|
|
17717
|
+
{ name: 'isTestnet', type: 'boolean' },
|
|
17694
17718
|
]);
|
|
17695
17719
|
const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
|
|
17696
17720
|
this.params.push({
|
|
17697
17721
|
address_n: addressN,
|
|
17698
17722
|
show_display: showOnOneKey,
|
|
17723
|
+
testnet: batch.isTestnet,
|
|
17699
17724
|
});
|
|
17700
17725
|
});
|
|
17701
17726
|
}
|
|
@@ -17737,12 +17762,14 @@ class FilecoinSignTransaction extends BaseMethod {
|
|
|
17737
17762
|
validateParams(this.payload, [
|
|
17738
17763
|
{ name: 'path', required: true },
|
|
17739
17764
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
17765
|
+
{ name: 'isTestnet', type: 'boolean' },
|
|
17740
17766
|
]);
|
|
17741
|
-
const { path, rawTx } = this.payload;
|
|
17767
|
+
const { path, rawTx, isTestnet } = this.payload;
|
|
17742
17768
|
const addressN = validatePath(path, 3);
|
|
17743
17769
|
this.params = {
|
|
17744
17770
|
address_n: addressN,
|
|
17745
17771
|
raw_tx: formatAnyHex(rawTx),
|
|
17772
|
+
testnet: isTestnet,
|
|
17746
17773
|
};
|
|
17747
17774
|
}
|
|
17748
17775
|
getVersionRange() {
|
|
@@ -18547,6 +18574,7 @@ exports.getDeviceTypeByBleName = getDeviceTypeByBleName;
|
|
|
18547
18574
|
exports.getDeviceTypeByDeviceId = getDeviceTypeByDeviceId;
|
|
18548
18575
|
exports.getDeviceUUID = getDeviceUUID;
|
|
18549
18576
|
exports.getEnv = getEnv;
|
|
18577
|
+
exports.getFirmwareUpdateField = getFirmwareUpdateField;
|
|
18550
18578
|
exports.getHDPath = getHDPath;
|
|
18551
18579
|
exports.getHomeScreenHex = getHomeScreenHex;
|
|
18552
18580
|
exports.getLog = getLog;
|
|
@@ -6,6 +6,7 @@ export declare type FilecoinAddress = {
|
|
|
6
6
|
export declare type FilecoinGetAddressParams = {
|
|
7
7
|
path: string | number[];
|
|
8
8
|
showOnOneKey?: boolean;
|
|
9
|
+
isTestnet?: boolean;
|
|
9
10
|
};
|
|
10
11
|
export declare function filecoinGetAddress(connectId: string, deviceId: string, params: CommonParams & FilecoinGetAddressParams): Response<FilecoinAddress>;
|
|
11
12
|
export declare function filecoinGetAddress(connectId: string, deviceId: string, params: CommonParams & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filecoinGetAddress.d.ts","sourceRoot":"","sources":["../../../src/types/api/filecoinGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,uBAAuB,CAAC;AAE5B,oBAAY,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"filecoinGetAddress.d.ts","sourceRoot":"","sources":["../../../src/types/api/filecoinGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,uBAAuB,CAAC;AAE5B,oBAAY,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,wBAAwB,GAC9C,QAAQ,CAAC,eAAe,CAAC,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG;IAAE,MAAM,CAAC,EAAE,wBAAwB,EAAE,CAAA;CAAE,GAC7D,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC"}
|
|
@@ -6,6 +6,7 @@ export declare type FilecoinSignedTx = {
|
|
|
6
6
|
export declare type FilecoinSignTransactionParams = {
|
|
7
7
|
path: string | number[];
|
|
8
8
|
rawTx?: string;
|
|
9
|
+
isTestnet?: boolean;
|
|
9
10
|
};
|
|
10
11
|
export declare function filecoinSignTransaction(connectId: string, deviceId: string, params: CommonParams & FilecoinSignTransactionParams): Response<FilecoinSignedTx>;
|
|
11
12
|
export declare function filecoinSignTransaction(connectId: string, deviceId: string, params: CommonParams & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filecoinSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/types/api/filecoinSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,IAAI,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,wBAAwB,CAAC;AAE7B,oBAAY,6BAA6B,GAAG;IAC1C,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"filecoinSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/types/api/filecoinSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,IAAI,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,wBA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5 @@ export declare const supportNewPassphrase: (features?: import("packages/hd-trans
|
|
|
14
14
|
export declare const getPassphraseState: (features: Features, commands: DeviceCommands) => Promise<string | false>;
|
|
15
15
|
export declare const supportBatchPublicKey: (features?: import("packages/hd-transport/dist").Features | undefined) => boolean;
|
|
16
16
|
export declare const supportModifyHomescreen: (features?: import("packages/hd-transport/dist").Features | undefined) => SupportFeatureType;
|
|
17
|
+
export declare const getFirmwareUpdateField: (features: Features, updateType: 'firmware' | 'ble') => "firmware" | "ble" | "firmware-v2";
|
|
17
18
|
//# sourceMappingURL=deviceFeaturesUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceFeaturesUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACb,WAAW,EACX,YAAY,EACZ,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,cAAc,4EAA0B,YAUpD,CAAC;AAEF,eAAO,MAAM,aAAa,4EAA0B,WAUnD,CAAC;AAEF,eAAO,MAAM,yBAAyB,4EAA0B,WACvC,CAAC;AAE1B,eAAO,MAAM,sBAAsB,iCAAoB,WAAW,GAAG,IAKpE,CAAC;AAEF,eAAO,MAAM,uBAAuB,qCAAwB,WAQ3D,CAAC;AAEF,eAAO,MAAM,aAAa,aAAc,QAAQ,WAM/C,CAAC;AAEF,eAAO,MAAM,cAAc,aAAc,QAAQ,WAOhD,CAAC;AAKF,eAAO,MAAM,wBAAwB,aAAc,QAAQ,GAAG,SAAS,kBAOtE,CAAC;AAKF,eAAO,MAAM,2BAA2B,aAAc,QAAQ,KAAG,aAAa,GAAG,IAQhF,CAAC;AAEF,eAAO,MAAM,yBAAyB,aAAc,QAAQ,KAAG,kBAU9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,4EAA0B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AAQ,cAAc,UAAU,GAAG,KAAK,uCAYxF,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './assets';
|
|
2
2
|
export * from './versionUtils';
|
|
3
3
|
export * from './patch';
|
|
4
|
-
export { getDeviceType, getDeviceTypeByBleName, getDeviceTypeByDeviceId, getDeviceUUID, getDeviceLabel, } from './deviceFeaturesUtils';
|
|
4
|
+
export { getDeviceType, getDeviceTypeByBleName, getDeviceTypeByDeviceId, getDeviceUUID, getDeviceLabel, getFirmwareUpdateField, } from './deviceFeaturesUtils';
|
|
5
5
|
export { getHDPath, getScriptType, getOutputScriptType } from '../api/helpers/pathUtils';
|
|
6
6
|
export { getLogger, enableLog, LoggerNames, getLog, setLoggerPostMessage } from './logger';
|
|
7
7
|
export { getHomeScreenHex } from './homescreen';
|
|
@@ -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,
|
|
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,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEzF,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.20",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@onekeyfe/hd-shared": "^0.2.
|
|
28
|
-
"@onekeyfe/hd-transport": "^0.2.
|
|
27
|
+
"@onekeyfe/hd-shared": "^0.2.20",
|
|
28
|
+
"@onekeyfe/hd-transport": "^0.2.20",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"bignumber.js": "^9.0.2",
|
|
31
31
|
"jszip": "^3.10.1",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@types/semver": "^7.3.9",
|
|
43
43
|
"ripple-keypairs": "^1.1.4"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "268a6af24128b3db9c74c7c1da122d28845a34ef"
|
|
46
46
|
}
|
|
@@ -10,7 +10,7 @@ import { UI_REQUEST } from '../constants/ui-request';
|
|
|
10
10
|
import { BaseMethod } from './BaseMethod';
|
|
11
11
|
import { validateParams } from './helpers/paramsValidator';
|
|
12
12
|
import { DevicePool } from '../device/DevicePool';
|
|
13
|
-
import { getBinary, getSysResourceBinary } from './firmware/getBinary';
|
|
13
|
+
import { getBinary, getInfo, getSysResourceBinary } from './firmware/getBinary';
|
|
14
14
|
import { updateResources, uploadFirmware } from './firmware/uploadFirmware';
|
|
15
15
|
import { getDeviceType, getDeviceUUID, wait, getLogger, LoggerNames } from '../utils';
|
|
16
16
|
import { createUiMessage } from '../events/ui-request';
|
|
@@ -149,14 +149,22 @@ export default class FirmwareUpdateV2 extends BaseMethod<Params> {
|
|
|
149
149
|
* needs to be upgraded via the desktop
|
|
150
150
|
*/
|
|
151
151
|
checkVersionForCopyTouchResource(features?: Features) {
|
|
152
|
+
if (!features) return;
|
|
152
153
|
const deviceType = getDeviceType(features);
|
|
153
154
|
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
154
155
|
const targetVersion = this.params.version?.join('.');
|
|
155
156
|
const { updateType } = this.params;
|
|
157
|
+
|
|
158
|
+
const releaseInfo = getInfo({ features, updateType });
|
|
159
|
+
if (!releaseInfo) return;
|
|
160
|
+
const { fullResourceRange } = releaseInfo;
|
|
161
|
+
if (!fullResourceRange) return;
|
|
162
|
+
|
|
163
|
+
const [minVersion, limitVersion] = fullResourceRange;
|
|
156
164
|
if (deviceType === 'touch' && updateType === 'firmware' && targetVersion) {
|
|
157
165
|
if (
|
|
158
|
-
semver.lt(currentVersion,
|
|
159
|
-
semver.gte(targetVersion,
|
|
166
|
+
semver.lt(currentVersion, minVersion) &&
|
|
167
|
+
semver.gte(targetVersion, limitVersion) &&
|
|
160
168
|
this.payload.platform !== 'desktop'
|
|
161
169
|
) {
|
|
162
170
|
throw ERRORS.TypedError(HardwareErrorCode.UseDesktopToUpdateFirmware);
|
|
@@ -26,6 +26,7 @@ export default class FilecoinGetAddress extends BaseMethod<HardwareFilecoinGetAd
|
|
|
26
26
|
validateParams(batch, [
|
|
27
27
|
{ name: 'path', required: true },
|
|
28
28
|
{ name: 'showOnOneKey', type: 'boolean' },
|
|
29
|
+
{ name: 'isTestnet', type: 'boolean' },
|
|
29
30
|
]);
|
|
30
31
|
|
|
31
32
|
const showOnOneKey = batch.showOnOneKey ?? true;
|
|
@@ -33,6 +34,7 @@ export default class FilecoinGetAddress extends BaseMethod<HardwareFilecoinGetAd
|
|
|
33
34
|
this.params.push({
|
|
34
35
|
address_n: addressN,
|
|
35
36
|
show_display: showOnOneKey,
|
|
37
|
+
testnet: batch.isTestnet,
|
|
36
38
|
});
|
|
37
39
|
});
|
|
38
40
|
}
|
|
@@ -16,15 +16,17 @@ export default class FilecoinSignTransaction extends BaseMethod<HardwareFilecoin
|
|
|
16
16
|
validateParams(this.payload, [
|
|
17
17
|
{ name: 'path', required: true },
|
|
18
18
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
19
|
+
{ name: 'isTestnet', type: 'boolean' },
|
|
19
20
|
]);
|
|
20
21
|
|
|
21
22
|
// init params
|
|
22
|
-
const { path, rawTx } = this.payload as FilecoinSignTransactionParams;
|
|
23
|
+
const { path, rawTx, isTestnet } = this.payload as FilecoinSignTransactionParams;
|
|
23
24
|
const addressN = validatePath(path, 3);
|
|
24
25
|
|
|
25
26
|
this.params = {
|
|
26
27
|
address_n: addressN,
|
|
27
28
|
raw_tx: formatAnyHex(rawTx),
|
|
29
|
+
testnet: isTestnet,
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
32
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
3
|
-
import { Features
|
|
3
|
+
import { Features } from '../../types';
|
|
4
4
|
import { getDeviceType, httpRequest } from '../../utils';
|
|
5
5
|
import { DataManager } from '../../data-manager';
|
|
6
6
|
import { findLatestRelease } from '../../utils/release';
|
|
7
|
+
import { getFirmwareUpdateField } from '../../utils/deviceFeaturesUtils';
|
|
7
8
|
|
|
8
9
|
export interface GetInfoProps {
|
|
9
10
|
features: Features;
|
|
@@ -53,19 +54,11 @@ export const getSysResourceBinary = async (url: string) => {
|
|
|
53
54
|
};
|
|
54
55
|
};
|
|
55
56
|
|
|
56
|
-
const
|
|
57
|
-
if (updateType === 'ble') {
|
|
58
|
-
return 'ble';
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return deviceType === 'touch' ? 'firmware-v2' : 'firmware';
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const getInfo = ({ features, updateType }: GetInfoProps) => {
|
|
57
|
+
export const getInfo = ({ features, updateType }: GetInfoProps) => {
|
|
65
58
|
const deviceType = getDeviceType(features);
|
|
66
59
|
const { deviceMap } = DataManager;
|
|
67
60
|
|
|
68
|
-
const firmwareUpdateField = getFirmwareUpdateField(
|
|
61
|
+
const firmwareUpdateField = getFirmwareUpdateField(features, updateType);
|
|
69
62
|
const releaseInfo = deviceMap?.[deviceType]?.[firmwareUpdateField] ?? [];
|
|
70
63
|
return findLatestRelease(releaseInfo);
|
|
71
64
|
};
|
|
@@ -4423,6 +4423,10 @@
|
|
|
4423
4423
|
"show_display": {
|
|
4424
4424
|
"type": "bool",
|
|
4425
4425
|
"id": 2
|
|
4426
|
+
},
|
|
4427
|
+
"testnet": {
|
|
4428
|
+
"type": "bool",
|
|
4429
|
+
"id": 3
|
|
4426
4430
|
}
|
|
4427
4431
|
}
|
|
4428
4432
|
},
|
|
@@ -4448,6 +4452,10 @@
|
|
|
4448
4452
|
"rule": "required",
|
|
4449
4453
|
"type": "bytes",
|
|
4450
4454
|
"id": 2
|
|
4455
|
+
},
|
|
4456
|
+
"testnet": {
|
|
4457
|
+
"type": "bool",
|
|
4458
|
+
"id": 3
|
|
4451
4459
|
}
|
|
4452
4460
|
}
|
|
4453
4461
|
},
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
getDeviceType,
|
|
7
7
|
getDeviceFirmwareVersion,
|
|
8
8
|
getDeviceBLEFirmwareVersion,
|
|
9
|
+
getFirmwareUpdateField,
|
|
9
10
|
} from '../utils/deviceFeaturesUtils';
|
|
10
11
|
|
|
11
12
|
import type {
|
|
@@ -17,10 +18,11 @@ import type {
|
|
|
17
18
|
IDeviceFirmwareStatus,
|
|
18
19
|
IDeviceBLEFirmwareStatus,
|
|
19
20
|
ITransportStatus,
|
|
20
|
-
IDeviceType,
|
|
21
21
|
} from '../types';
|
|
22
22
|
import { getReleaseChangelog, getReleaseStatus, findLatestRelease } from '../utils/release';
|
|
23
23
|
|
|
24
|
+
type FirmwareField = 'firmware' | 'firmware-v2';
|
|
25
|
+
|
|
24
26
|
export default class DataManager {
|
|
25
27
|
static deviceMap: DeviceTypeMap = {
|
|
26
28
|
classic: {
|
|
@@ -49,12 +51,6 @@ export default class DataManager {
|
|
|
49
51
|
default: MessagesJSON as unknown as JSON,
|
|
50
52
|
};
|
|
51
53
|
|
|
52
|
-
/**
|
|
53
|
-
* Since 3.5.0, Touch uses the firmware-v2 field to get firmware release info
|
|
54
|
-
*/
|
|
55
|
-
static getFirmwareUpdateField = (deviceType: IDeviceType) =>
|
|
56
|
-
deviceType === 'touch' ? 'firmware-v2' : 'firmware';
|
|
57
|
-
|
|
58
54
|
static getFirmwareStatus = (features: Features): IDeviceFirmwareStatus => {
|
|
59
55
|
const deviceType = getDeviceType(features);
|
|
60
56
|
const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
|
|
@@ -66,7 +62,7 @@ export default class DataManager {
|
|
|
66
62
|
return 'unknown';
|
|
67
63
|
}
|
|
68
64
|
|
|
69
|
-
const firmwareUpdateField =
|
|
65
|
+
const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
|
|
70
66
|
const targetDeviceConfigList = this.deviceMap[deviceType]?.[firmwareUpdateField] ?? [];
|
|
71
67
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
72
68
|
return getReleaseStatus(targetDeviceConfigList, currentVersion);
|
|
@@ -82,7 +78,7 @@ export default class DataManager {
|
|
|
82
78
|
|
|
83
79
|
if (deviceType !== 'pro' && deviceType !== 'touch') return undefined;
|
|
84
80
|
|
|
85
|
-
const firmwareUpdateField =
|
|
81
|
+
const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware') as FirmwareField;
|
|
86
82
|
const targetDeviceConfigList = this.deviceMap[deviceType]?.[firmwareUpdateField] ?? [];
|
|
87
83
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
88
84
|
const targetDeviceConfig = targetDeviceConfigList.filter(item =>
|
|
@@ -103,7 +99,7 @@ export default class DataManager {
|
|
|
103
99
|
|
|
104
100
|
if (deviceType !== 'pro' && deviceType !== 'touch') return undefined;
|
|
105
101
|
|
|
106
|
-
const firmwareUpdateField =
|
|
102
|
+
const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware') as FirmwareField;
|
|
107
103
|
const targetDeviceConfigList = this.deviceMap[deviceType]?.[firmwareUpdateField] ?? [];
|
|
108
104
|
const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.fullResource);
|
|
109
105
|
|
|
@@ -121,7 +117,7 @@ export default class DataManager {
|
|
|
121
117
|
return [];
|
|
122
118
|
}
|
|
123
119
|
|
|
124
|
-
const firmwareUpdateField =
|
|
120
|
+
const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware') as FirmwareField;
|
|
125
121
|
const targetDeviceConfigList = this.deviceMap[deviceType]?.[firmwareUpdateField] ?? [];
|
|
126
122
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
127
123
|
return getReleaseChangelog(targetDeviceConfigList, currentVersion);
|
|
@@ -129,7 +125,7 @@ export default class DataManager {
|
|
|
129
125
|
|
|
130
126
|
static getFirmwareLatestRelease = (features: Features) => {
|
|
131
127
|
const deviceType = getDeviceType(features);
|
|
132
|
-
const firmwareUpdateField =
|
|
128
|
+
const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware') as FirmwareField;
|
|
133
129
|
const targetDeviceConfigList = this.deviceMap[deviceType]?.[firmwareUpdateField] ?? [];
|
|
134
130
|
|
|
135
131
|
const target = findLatestRelease(targetDeviceConfigList);
|
package/src/types/settings.ts
CHANGED
|
@@ -155,3 +155,20 @@ export const supportModifyHomescreen = (features?: Features): SupportFeatureType
|
|
|
155
155
|
|
|
156
156
|
return { support: semver.gte(currentVersion, '3.4.0') };
|
|
157
157
|
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Since 3.5.0, Touch uses the firmware-v2 field to get firmware release info
|
|
161
|
+
*/
|
|
162
|
+
export const getFirmwareUpdateField = (features: Features, updateType: 'firmware' | 'ble') => {
|
|
163
|
+
const deviceType = getDeviceType(features);
|
|
164
|
+
const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
|
|
165
|
+
if (updateType === 'ble') {
|
|
166
|
+
return 'ble';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (deviceType === 'touch') {
|
|
170
|
+
if (semver.lt(deviceFirmwareVersion.join('.'), '3.4.0')) return 'firmware';
|
|
171
|
+
return 'firmware-v2';
|
|
172
|
+
}
|
|
173
|
+
return 'firmware';
|
|
174
|
+
};
|