Skip to content

Commit

Permalink
chore: release version 1.0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteZhang1024 committed Nov 18, 2024
1 parent 512d42c commit f36cf8e
Show file tree
Hide file tree
Showing 21 changed files with 118 additions and 75 deletions.
2 changes: 1 addition & 1 deletion packages/connect-examples/electron-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "hardware-example",
"productName": "HardwareExample",
"executableName": "onekey-hardware-example",
"version": "1.0.13",
"version": "1.0.14",
"author": "OneKey",
"description": "End-to-end encrypted workspaces for teams",
"main": "dist/index.js",
Expand Down
1 change: 1 addition & 0 deletions packages/connect-examples/expo-example/locale/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"label__retry_interval_time": "Retry Interval Time",
"label__connection_timeout": "Connection Timeout Time",
"label__init_session": "Init Session",
"label__use_empty_passphrase": "Use Empty Passphrase",
"label__default_parameters": "Default Parameters",
"label__parameters": "Parameters",
"label__enter_parameters_tip": "Enter your parameters here...",
Expand Down
1 change: 1 addition & 0 deletions packages/connect-examples/expo-example/locale/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"label__retry_interval_time": "重试间隔时间",
"label__connection_timeout": "连接超时时间",
"label__init_session": "初始化 Session",
"label__use_empty_passphrase": "使用空 Passphrase",
"label__default_parameters": "预设参数",
"label__parameters": "参数",
"label__enter_parameters_tip": "在此输入您的参数...",
Expand Down
10 changes: 5 additions & 5 deletions packages/connect-examples/expo-example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "expo-example",
"version": "1.0.13",
"version": "1.0.14",
"scripts": {
"start": "CONNECT_SRC=https://localhost:8087/ yarn expo start --dev-client",
"android": "yarn expo run:android",
Expand All @@ -19,10 +19,10 @@
"@noble/ed25519": "^2.1.0",
"@noble/hashes": "^1.3.3",
"@noble/secp256k1": "^1.7.1",
"@onekeyfe/hd-ble-sdk": "^1.0.13",
"@onekeyfe/hd-common-connect-sdk": "^1.0.13",
"@onekeyfe/hd-core": "^1.0.13",
"@onekeyfe/hd-web-sdk": "^1.0.13",
"@onekeyfe/hd-ble-sdk": "^1.0.14",
"@onekeyfe/hd-common-connect-sdk": "^1.0.14",
"@onekeyfe/hd-core": "^1.0.14",
"@onekeyfe/hd-web-sdk": "^1.0.14",
"@onekeyfe/react-native-ble-plx": "3.0.0",
"@polkadot/util-crypto": "13.1.1",
"@react-native-async-storage/async-storage": "1.21.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export default function CommonParamsView() {
value={!!commonParams.initSession}
onToggle={value => handleSetParam('initSession', value)}
/>
<SwitchInput
label={intl.formatMessage({ id: 'label__use_empty_passphrase' })}
value={!!commonParams.useEmptyPassphrase}
onToggle={value => handleSetParam('useEmptyPassphrase', value)}
/>
<SwitchInput
// TODO: i18n
label="detectBootloaderDevice"
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/hd-core",
"version": "1.0.13",
"version": "1.0.14",
"description": "> TODO: description",
"author": "OneKey",
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
Expand All @@ -25,8 +25,8 @@
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
},
"dependencies": {
"@onekeyfe/hd-shared": "^1.0.13",
"@onekeyfe/hd-transport": "^1.0.13",
"@onekeyfe/hd-shared": "^1.0.14",
"@onekeyfe/hd-transport": "^1.0.14",
"axios": "^0.27.2",
"bignumber.js": "^9.0.2",
"bytebuffer": "^5.0.1",
Expand Down
23 changes: 9 additions & 14 deletions packages/core/src/api/allnetwork/AllNetworkGetAddress.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import semver from 'semver';
import { ERRORS, HardwareError, HardwareErrorCode } from '@onekeyfe/hd-shared';
import { ERRORS, HardwareError, HardwareErrorCode, serializeError } from '@onekeyfe/hd-shared';

import { get } from 'lodash';
import { serializedPath } from '../helpers/pathUtils';
Expand Down Expand Up @@ -318,8 +318,6 @@ export default class AllNetworkGetAddress extends BaseMethod<
payload: response,
};
} catch (e: any) {
console.log('=====>>>>>>> error', e, JSON.stringify(e));

const error = handleSkippableHardwareError(e, this.device, method);

if (error) {
Expand All @@ -329,8 +327,9 @@ export default class AllNetworkGetAddress extends BaseMethod<
payload: {
error: error.message,
code: error.errorCode,
connectId: this.payload.connectId,
deviceId: this.payload.deviceId,
params: error.params,
connectId: method.connectId,
deviceId: method.deviceId,
},
};
} else {
Expand All @@ -356,7 +355,7 @@ export default class AllNetworkGetAddress extends BaseMethod<
const response = await this.callMethod(
dependOnMethod.methodName,
dependOnMethod.params,
param,
param
);
dependOnMethodResults.push(response);
}
Expand All @@ -376,7 +375,7 @@ export default class AllNetworkGetAddress extends BaseMethod<

const dependOnPayloads = dependOnMethodResults.reduce(
(acc, cur) => Object.assign(acc, get(cur, 'payload', {})),
{},
{}
);

const result: AllNetworkAddress = {
Expand All @@ -399,7 +398,7 @@ export default class AllNetworkGetAddress extends BaseMethod<
function handleSkippableHardwareError(
e: any,
device: Device,
method: BaseMethod,
method: BaseMethod
): HardwareError | undefined {
let error: HardwareError | undefined;

Expand All @@ -413,7 +412,7 @@ function handleSkippableHardwareError(
} else if (e.message?.includes('Failure_UnexpectedMessage')) {
const versionRange = getMethodVersionRange(
device.features,
type => method.getVersionRange()[type],
type => method.getVersionRange()[type]
);
const currentVersion = getDeviceFirmwareVersion(device.features).join('.');

Expand All @@ -422,11 +421,7 @@ function handleSkippableHardwareError(
semver.valid(versionRange.min) &&
semver.lt(currentVersion, versionRange.min)
) {
error = ERRORS.TypedError(
HardwareErrorCode.CallMethodNeedUpgradeFirmware,
`Device firmware version is too low, please update to ${versionRange.min}`,
{ current: currentVersion, require: versionRange.min },
);
error = ERRORS.createNeedUpgradeFirmwareHardwareError(currentVersion, versionRange.min);
} else {
error = ERRORS.TypedError(HardwareErrorCode.CallMethodNotResponse, e.message);
}
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/api/dynex/DnxGetAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ export default class DnxGetAddress extends BaseMethod<HardwareDnxGetAddress[]> {
classic: {
min: '3.8.0',
},
model_touch: {
min: '6.0.0',
},
};
}

Expand Down
26 changes: 8 additions & 18 deletions packages/core/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import EventEmitter from 'events';
import { Features, LowlevelTransportSharedPlugin, OneKeyDeviceInfo } from '@onekeyfe/hd-transport';
import {
createDeferred,
createDeprecatedHardwareError,
createNeedUpgradeFirmwareHardwareError,
createNewFirmwareForceUpdateHardwareError,
createNewFirmwareUnReleaseHardwareError,
Deferred,
ERRORS,
HardwareError,
Expand Down Expand Up @@ -175,40 +179,26 @@ export const callAPI = async (message: CoreMessage) => {
(newVersionStatus === 'required' || bleVersionStatus === 'required') &&
method.skipForceUpdateCheck === false
) {
throw ERRORS.TypedError(
HardwareErrorCode.NewFirmwareForceUpdate,
'Device firmware version is too low, please update to the latest version',
{ connectId: method.connectId, deviceId: method.deviceId }
);
throw createNewFirmwareForceUpdateHardwareError(method.connectId, method.deviceId);
}

if (versionRange) {
const currentVersion = getDeviceFirmwareVersion(device.features).join('.');
if (semver.valid(versionRange.min) && semver.lt(currentVersion, versionRange.min)) {
if (newVersionStatus === 'none' || newVersionStatus === 'valid') {
throw ERRORS.TypedError(HardwareErrorCode.NewFirmwareUnRelease);
throw createNewFirmwareUnReleaseHardwareError(currentVersion, versionRange.min);
}

return Promise.reject(
ERRORS.TypedError(
HardwareErrorCode.CallMethodNeedUpgradeFirmware,
`Device firmware version is too low, please update to ${versionRange.min}`,
{ current: currentVersion, require: versionRange.min }
)
createNeedUpgradeFirmwareHardwareError(currentVersion, versionRange.min)
);
}
if (
versionRange.max &&
semver.valid(versionRange.max) &&
semver.gte(currentVersion, versionRange.max)
) {
return Promise.reject(
ERRORS.TypedError(
HardwareErrorCode.CallMethodDeprecated,
`Device firmware version is too high, this method has been deprecated in ${versionRange.max}`,
{ current: currentVersion, deprecated: versionRange.max }
)
);
return Promise.reject(createDeprecatedHardwareError(currentVersion, versionRange.max));
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions packages/core/src/device/Device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,21 @@ export class Device extends EventEmitter {
this.runPromise.reject(e);
}

if (
e instanceof HardwareError &&
(e.errorCode === HardwareErrorCode.DeviceInitializeFailed ||
e.errorCode === HardwareErrorCode.DeviceInterruptedFromOutside ||
e.errorCode === HardwareErrorCode.DeviceInterruptedFromUser ||
e.errorCode === HardwareErrorCode.DeviceCheckPassphraseStateError ||
e.errorCode === HardwareErrorCode.ResponseUnexpectTypeError ||
e.errorCode === HardwareErrorCode.PinInvalid ||
e.errorCode === HardwareErrorCode.PinCancelled ||
e.errorCode === HardwareErrorCode.UnexpectPassphrase)
) {
await this.release();
Log.debug(`error code ${e.errorCode} release device, mainId: ${this.mainId}`);
}

this.runPromise = null;
return;
}
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/types/api/allNetworkGetAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ export type AllNetworkAddress = CommonResponseParams & {
| {
error: string;
code: number;
connectId: string;
deviceId: string;
connectId?: string;
deviceId?: string;
params: any;
};
};

Expand Down
8 changes: 4 additions & 4 deletions packages/hd-ble-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/hd-ble-sdk",
"version": "1.0.13",
"version": "1.0.14",
"author": "OneKey",
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
"license": "ISC",
Expand All @@ -20,8 +20,8 @@
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@onekeyfe/hd-core": "^1.0.13",
"@onekeyfe/hd-shared": "^1.0.13",
"@onekeyfe/hd-transport-react-native": "^1.0.13"
"@onekeyfe/hd-core": "^1.0.14",
"@onekeyfe/hd-shared": "^1.0.14",
"@onekeyfe/hd-transport-react-native": "^1.0.14"
}
}
12 changes: 6 additions & 6 deletions packages/hd-common-connect-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/hd-common-connect-sdk",
"version": "1.0.13",
"version": "1.0.14",
"author": "OneKey",
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
"license": "ISC",
Expand All @@ -20,10 +20,10 @@
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@onekeyfe/hd-core": "^1.0.13",
"@onekeyfe/hd-shared": "^1.0.13",
"@onekeyfe/hd-transport-http": "^1.0.13",
"@onekeyfe/hd-transport-lowlevel": "^1.0.13",
"@onekeyfe/hd-transport-webusb": "^1.0.13"
"@onekeyfe/hd-core": "^1.0.14",
"@onekeyfe/hd-shared": "^1.0.14",
"@onekeyfe/hd-transport-http": "^1.0.14",
"@onekeyfe/hd-transport-lowlevel": "^1.0.14",
"@onekeyfe/hd-transport-webusb": "^1.0.14"
}
}
6 changes: 3 additions & 3 deletions packages/hd-transport-http/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/hd-transport-http",
"version": "1.0.13",
"version": "1.0.14",
"description": "hardware http transport",
"author": "OneKey",
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
Expand All @@ -24,8 +24,8 @@
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
},
"dependencies": {
"@onekeyfe/hd-shared": "^1.0.13",
"@onekeyfe/hd-transport": "^1.0.13",
"@onekeyfe/hd-shared": "^1.0.14",
"@onekeyfe/hd-transport": "^1.0.14",
"axios": "^0.27.2"
}
}
6 changes: 3 additions & 3 deletions packages/hd-transport-lowlevel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/hd-transport-lowlevel",
"version": "1.0.13",
"version": "1.0.14",
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
"license": "MIT",
"main": "dist/index.js",
Expand All @@ -19,7 +19,7 @@
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@onekeyfe/hd-shared": "^1.0.13",
"@onekeyfe/hd-transport": "^1.0.13"
"@onekeyfe/hd-shared": "^1.0.14",
"@onekeyfe/hd-transport": "^1.0.14"
}
}
6 changes: 3 additions & 3 deletions packages/hd-transport-react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/hd-transport-react-native",
"version": "1.0.13",
"version": "1.0.14",
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
"license": "MIT",
"main": "dist/index.js",
Expand All @@ -19,8 +19,8 @@
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@onekeyfe/hd-shared": "^1.0.13",
"@onekeyfe/hd-transport": "^1.0.13",
"@onekeyfe/hd-shared": "^1.0.14",
"@onekeyfe/hd-transport": "^1.0.14",
"@onekeyfe/react-native-ble-plx": "3.0.1",
"react-native-ble-manager": "^8.1.0"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/hd-transport-webusb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/hd-transport-webusb",
"version": "1.0.13",
"version": "1.0.14",
"author": "OneKey",
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
"license": "MIT",
Expand All @@ -20,8 +20,8 @@
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@onekeyfe/hd-shared": "^1.0.13",
"@onekeyfe/hd-transport": "^1.0.13"
"@onekeyfe/hd-shared": "^1.0.14",
"@onekeyfe/hd-transport": "^1.0.14"
},
"devDependencies": {
"@types/w3c-web-usb": "^1.0.6"
Expand Down
2 changes: 1 addition & 1 deletion packages/hd-transport/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/hd-transport",
"version": "1.0.13",
"version": "1.0.14",
"description": "> TODO: description",
"author": "OneKey",
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
Expand Down
Loading

0 comments on commit f36cf8e

Please sign in to comment.