diff --git a/packages/engine/src/validators.ts b/packages/engine/src/validators.ts index c55ce3e376c..a1de7c67b20 100644 --- a/packages/engine/src/validators.ts +++ b/packages/engine/src/validators.ts @@ -6,7 +6,6 @@ import { isString } from 'lodash'; import type { Network } from '@onekeyhq/kit/src/store/typings'; import { backgroundMethod } from '@onekeyhq/shared/src/background/backgroundDecorators'; import { - IMPL_ADA, IMPL_COSMOS, IMPL_DOT, IMPL_XMR, @@ -28,7 +27,7 @@ const FEE_LIMIT_HIGH_VALUE_TIMES = 20; const FEE_PRICE_HIGH_VALUE_TIMES = 4; const FORK_CHAIN_ADDRESS_NOT_DIFFERENT = [IMPL_COSMOS, IMPL_DOT]; -const WEBVIEW_BACKED_CHAIN = platformEnv.isNative ? [IMPL_ADA, IMPL_XMR] : []; +const WEBVIEW_BACKED_CHAIN = platformEnv.isNative ? [IMPL_XMR] : []; class Validators { private _dbApi: DBAPI; @@ -106,6 +105,7 @@ class Validators { input: string, forCategories: Array = [], returnEarly = false, + skipHeavyChains = false, ): Promise> { const ret = []; const filterCategories = @@ -139,7 +139,7 @@ class Validators { for (const [impl, networks] of Object.entries( await this.engine.listEnabledNetworksGroupedByVault(), )) { - if (WEBVIEW_BACKED_CHAIN.includes(impl)) { + if (skipHeavyChains && WEBVIEW_BACKED_CHAIN.includes(impl)) { // skip webview backed chain // eslint-disable-next-line no-continue continue; @@ -181,15 +181,18 @@ class Validators { input, onlyFor, returnEarly, + skipHeavyChains, }: { input: string; onlyFor?: UserInputCategory; returnEarly?: boolean; + skipHeavyChains?: boolean; }) { return this.validateUserInput( input, onlyFor !== undefined ? [onlyFor] : [], returnEarly, + skipHeavyChains, ); } diff --git a/packages/kit-bg/src/services/ServiceHardware.ts b/packages/kit-bg/src/services/ServiceHardware.ts index 235df67e598..44d104c5767 100644 --- a/packages/kit-bg/src/services/ServiceHardware.ts +++ b/packages/kit-bg/src/services/ServiceHardware.ts @@ -376,12 +376,15 @@ class ServiceHardware extends ServiceBase { const version = settings.deviceUpdates?.[connectId][firmwareType]?.version; try { - const response = await hardwareSDK.firmwareUpdateV2(undefined, { - updateType: firmwareType, - forcedUpdateRes, - version, - platform: platformEnv.symbol ?? 'web', - }); + const response = await hardwareSDK.firmwareUpdateV2( + platformEnv.isNative ? connectId : undefined, + { + updateType: firmwareType, + forcedUpdateRes, + version, + platform: platformEnv.symbol ?? 'web', + }, + ); // update bootloader if ( @@ -850,7 +853,9 @@ class ServiceHardware extends ServiceBase { ) { const hardwareSDK = await this.getSDKInstance(); return hardwareSDK - ?.checkBootloaderRelease(undefined, { willUpdateFirmwareVersion }) + ?.checkBootloaderRelease(platformEnv.isNative ? connectId : undefined, { + willUpdateFirmwareVersion, + }) .then((response) => { if (!response.success) { return Promise.reject( @@ -862,7 +867,7 @@ class ServiceHardware extends ServiceBase { } @backgroundMethod() - async updateBootloaderForClassicAndMini() { + async updateBootloaderForClassicAndMini(connectId: string) { const { dispatch } = this.backgroundApi; dispatch(setUpdateFirmwareStep('')); const hardwareSDK = await this.getSDKInstance(); @@ -871,11 +876,14 @@ class ServiceHardware extends ServiceBase { }; hardwareSDK.on('ui-firmware-tip', listener); try { - const response = await hardwareSDK.firmwareUpdateV2(undefined, { - updateType: 'firmware', - platform: platformEnv.symbol ?? 'web', - isUpdateBootloader: true, - }); + const response = await hardwareSDK.firmwareUpdateV2( + platformEnv.isNative ? connectId : undefined, + { + updateType: 'firmware', + platform: platformEnv.symbol ?? 'web', + isUpdateBootloader: true, + }, + ); return response; } finally { hardwareSDK.off('ui-firmware-tip', listener); diff --git a/packages/kit/src/views/Hardware/UpdateFirmware/UpdatingBootloader/index.tsx b/packages/kit/src/views/Hardware/UpdateFirmware/UpdatingBootloader/index.tsx index c683c251e88..5b030ada5f8 100644 --- a/packages/kit/src/views/Hardware/UpdateFirmware/UpdatingBootloader/index.tsx +++ b/packages/kit/src/views/Hardware/UpdateFirmware/UpdatingBootloader/index.tsx @@ -386,7 +386,7 @@ const UpdatingBootloader: FC = () => { return; } serviceHardware - .updateBootloaderForClassicAndMini() + .updateBootloaderForClassicAndMini(connectId) .then(async (res) => { if (res.success) { engine.getWalletByDeviceId(device?.id ?? '').then((wallet) => { diff --git a/packages/kit/src/views/ScanQrcode/ScanQrcodeResult.tsx b/packages/kit/src/views/ScanQrcode/ScanQrcodeResult.tsx index 3f22d913aa4..ea6f50ae8fc 100644 --- a/packages/kit/src/views/ScanQrcode/ScanQrcodeResult.tsx +++ b/packages/kit/src/views/ScanQrcode/ScanQrcodeResult.tsx @@ -95,6 +95,7 @@ const ScanQrcodeResult: FC = () => { .validateCreateInput({ input: data, returnEarly: true, + skipHeavyChains: true, }) .then(([result]) => { if (result) {