From 51018abe8826bb11ffaec9bffa066274d158ce26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Mon, 14 Jan 2019 13:58:15 +0100 Subject: [PATCH 01/15] Should fixes LL-828 --- src/reducers/currenciesStatus.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/reducers/currenciesStatus.js b/src/reducers/currenciesStatus.js index 3d48f264..3e98562a 100644 --- a/src/reducers/currenciesStatus.js +++ b/src/reducers/currenciesStatus.js @@ -37,7 +37,9 @@ export const fetchCurrenciesStatus = () => async (dispatch: *) => { method: 'GET', url: process.env.LL_STATUS_ENDPOINT || urls.currenciesStatus, }) - dispatch(setCurrenciesStatus(data)) + if (Array.isArray(data)) { + dispatch(setCurrenciesStatus(data)) + } } catch (err) { logger.error(err) } From dd2ef928f9e6cc3fd221f06868bc484b41d1d6f7 Mon Sep 17 00:00:00 2001 From: meriadec Date: Tue, 15 Jan 2019 13:24:42 +0100 Subject: [PATCH 02/15] Update package.json engines field to match Node.js Carbon --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 975c4ab5..1fdb7846 100644 --- a/package.json +++ b/package.json @@ -185,8 +185,8 @@ "yaml-loader": "^0.5.0" }, "engines": { - "node": ">=8.9.0 <=8.14.0", + "node": ">=8.9.0 <=8.15.0", "yarn": "^1.10.1" }, "private": true -} \ No newline at end of file +} From 52ab6e72ba63d42c7187557e9c6655904e1242e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gast=C3=B3n=20I=2E=20Silva?= Date: Wed, 16 Jan 2019 07:36:06 -0800 Subject: [PATCH 03/15] fix typo Based on the other error strings found in the file, I believe this is the correct string. `s/Opps/Oops` --- static/i18n/en/app.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/i18n/en/app.json b/static/i18n/en/app.json index 3b57aa53..2a458bf7 100644 --- a/static/i18n/en/app.json +++ b/static/i18n/en/app.json @@ -851,7 +851,7 @@ "description": "{{message}}" }, "UnexpectedBootloader": { - "title": "Opps, your device should not be in Bootloader mode", + "title": "Oops, your device should not be in Bootloader mode", "description": "Please restart your device or contact us" }, "UserRefusedFirmwareUpdate": { @@ -904,4 +904,4 @@ "title": "Couldn’t load fee rates, please set manual fees" } } -} \ No newline at end of file +} From 0fe8d2ceb61c23c0e32b3c183f945acf6f8af708 Mon Sep 17 00:00:00 2001 From: "Valentin D. Pinkman" Date: Fri, 18 Jan 2019 18:17:04 +0100 Subject: [PATCH 04/15] repair MCU not genuine --- package.json | 2 +- src/commands/firmwareRepair.js | 7 +++- .../SettingsPage/RepairDeviceButton.js | 10 +++-- src/components/base/Modal/RepairModal.js | 41 ++++++++++++------- static/i18n/en/app.json | 6 ++- yarn.lock | 8 ++-- 6 files changed, 46 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index 975c4ab5..bc9842cb 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@ledgerhq/hw-transport": "^4.32.0", "@ledgerhq/hw-transport-node-hid": "^4.32.0", "@ledgerhq/ledger-core": "2.0.0-rc.14", - "@ledgerhq/live-common": "4.8.1", + "@ledgerhq/live-common": "4.10.0", "animated": "^0.2.2", "async": "^2.6.1", "axios": "^0.18.0", diff --git a/src/commands/firmwareRepair.js b/src/commands/firmwareRepair.js index 64009722..809e2fa5 100644 --- a/src/commands/firmwareRepair.js +++ b/src/commands/firmwareRepair.js @@ -3,12 +3,15 @@ import repair from '@ledgerhq/live-common/lib/hw/firmwareUpdate-repair' import { createCommand, Command } from 'helpers/ipc' -type Input = void +type Input = { + version: ?string, +} + type Result = { progress: number } const cmd: Command = createCommand( 'firmwareRepair', - () => repair(''), // devicePath='' HACK to not depend on a devicePath because it's dynamic + ({ version }) => repair(''), // devicePath='' HACK to not depend on a devicePath because it's dynamic ) export default cmd diff --git a/src/components/SettingsPage/RepairDeviceButton.js b/src/components/SettingsPage/RepairDeviceButton.js index 1332bf3e..c5c76d67 100644 --- a/src/components/SettingsPage/RepairDeviceButton.js +++ b/src/components/SettingsPage/RepairDeviceButton.js @@ -41,11 +41,11 @@ class RepairDeviceButton extends PureComponent { this.setState({ opened: false, isLoading: false, error: null, progress: 0 }) } - action = () => { + repair = (version = null) => { if (this.state.isLoading) return const { push } = this.props this.setState({ isLoading: true }) - this.sub = firmwareRepair.send().subscribe({ + this.sub = firmwareRepair.send({ version }).subscribe({ next: patch => { this.setState(patch) }, @@ -60,6 +60,8 @@ class RepairDeviceButton extends PureComponent { }) } + repairMcu = () => this.repair('0.8') + render() { const { t } = this.props const { opened, isLoading, error, progress } = this.state @@ -76,11 +78,11 @@ class RepairDeviceButton extends PureComponent { isOpened={opened} onClose={this.close} onReject={this.close} - onConfirm={this.action} + onRepair={this.repair} + onRepairMCU={this.repair} isLoading={isLoading} title={t('settings.repairDevice.title')} desc={t('settings.repairDevice.desc')} - confirmText={t('settings.repairDevice.button')} progress={progress} error={error} /> diff --git a/src/components/base/Modal/RepairModal.js b/src/components/base/Modal/RepairModal.js index 37d00df9..a14bfb80 100644 --- a/src/components/base/Modal/RepairModal.js +++ b/src/components/base/Modal/RepairModal.js @@ -129,7 +129,8 @@ type Props = { confirmText?: string, cancelText?: string, onReject: Function, - onConfirm: Function, + onRepair: Function, + onRepairMCU: Function, t: T, isLoading?: boolean, analyticsName: string, @@ -148,7 +149,8 @@ class RepairModal extends PureComponent { confirmText, isDanger, onReject, - onConfirm, + onRepair, + onRepairMCU, isLoading, renderIcon, t, @@ -158,8 +160,6 @@ class RepairModal extends PureComponent { ...props } = this.props - const realConfirmText = confirmText || t('common.confirm') - return ( { )} {!isLoading ? ( - - + + {error ? : null} {error ? null : ( - + <> + + + )} ) : null} diff --git a/static/i18n/en/app.json b/static/i18n/en/app.json index 3b57aa53..ddb48553 100644 --- a/static/i18n/en/app.json +++ b/static/i18n/en/app.json @@ -451,8 +451,10 @@ }, "repairDevice": { "title": "Repair your Ledger device", - "desc": "If you encountered some issue while updating your device and cannot resume the update process, you can try this option to repair your device.", - "button": "Repair" + "desc": "If you encountered some issue while updating your Ledger Nano S and cannot resume the update process, you can try this option to repair your device.", + "button": "Repair", + "repair": "Stuck in 'Bootloader'", + "mcu": "Stuck in 'MCU not genuine'" }, "exportLogs": { "title": "Export logs", diff --git a/yarn.lock b/yarn.lock index 3de0296b..21e4b288 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1725,10 +1725,10 @@ bindings "^1.3.0" nan "^2.6.2" -"@ledgerhq/live-common@4.8.1": - version "4.8.1" - resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-4.8.1.tgz#3327b438d18ab02f54fed08756439d7637a631a0" - integrity sha512-5Bw74PCPMpMny4/Ro0t/Pi6lYj5bMkcF/1tzX+l++RMkiwvE3+gP7gqW5Vk3waU7i6FOUk22aMMgFYDcQx7O+g== +"@ledgerhq/live-common@4.10.0": + version "4.10.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-4.10.0.tgz#4f34679cebf51cf98123c5b072a948e72ff4f566" + integrity sha512-ui/v3IWsNvih6BSnpL+65K+R92QVGR/myza9QGuyvCWChy79b2vWXYYQpydgyogUkUY+oyENvpvAiM+AnPV8fw== dependencies: "@aeternity/ledger-app-api" "0.0.4" "@ledgerhq/hw-app-btc" "^4.32.0" From 07b6263acff5c6c74045c1087be79f98f95b0f0f Mon Sep 17 00:00:00 2001 From: "Valentin D. Pinkman" Date: Fri, 18 Jan 2019 18:21:18 +0100 Subject: [PATCH 05/15] bump live-common --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bc9842cb..0817e1aa 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@ledgerhq/hw-transport": "^4.32.0", "@ledgerhq/hw-transport-node-hid": "^4.32.0", "@ledgerhq/ledger-core": "2.0.0-rc.14", - "@ledgerhq/live-common": "4.10.0", + "@ledgerhq/live-common": "4.10.1", "animated": "^0.2.2", "async": "^2.6.1", "axios": "^0.18.0", From 866fc5817984f3b9718e9b5b9a25d8458c1c578d Mon Sep 17 00:00:00 2001 From: "Valentin D. Pinkman" Date: Mon, 21 Jan 2019 11:33:15 +0100 Subject: [PATCH 06/15] fix infinite loop --- src/commands/firmwareRepair.js | 2 +- src/components/SettingsPage/RepairDeviceButton.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/commands/firmwareRepair.js b/src/commands/firmwareRepair.js index 809e2fa5..d990fb4b 100644 --- a/src/commands/firmwareRepair.js +++ b/src/commands/firmwareRepair.js @@ -11,7 +11,7 @@ type Result = { progress: number } const cmd: Command = createCommand( 'firmwareRepair', - ({ version }) => repair(''), // devicePath='' HACK to not depend on a devicePath because it's dynamic + ({ version }) => repair('', version), // devicePath='' HACK to not depend on a devicePath because it's dynamic ) export default cmd diff --git a/src/components/SettingsPage/RepairDeviceButton.js b/src/components/SettingsPage/RepairDeviceButton.js index c5c76d67..f29fa6f5 100644 --- a/src/components/SettingsPage/RepairDeviceButton.js +++ b/src/components/SettingsPage/RepairDeviceButton.js @@ -61,6 +61,7 @@ class RepairDeviceButton extends PureComponent { } repairMcu = () => this.repair('0.8') + repairGeneric = () => this.repair() render() { const { t } = this.props @@ -78,8 +79,8 @@ class RepairDeviceButton extends PureComponent { isOpened={opened} onClose={this.close} onReject={this.close} - onRepair={this.repair} - onRepairMCU={this.repair} + onRepair={this.repairGeneric} + onRepairMCU={this.repairMcu} isLoading={isLoading} title={t('settings.repairDevice.title')} desc={t('settings.repairDevice.desc')} From 9c57fe32ace628c3ac17af67c2159943b8413331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Mon, 21 Jan 2019 12:15:50 +0100 Subject: [PATCH 07/15] Fix repair link and add one more case --- .../SettingsPage/RepairDeviceButton.js | 6 +---- src/components/base/Modal/RepairModal.js | 23 ++++++++++++------- static/i18n/en/app.json | 7 +++--- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/components/SettingsPage/RepairDeviceButton.js b/src/components/SettingsPage/RepairDeviceButton.js index f29fa6f5..511bed6e 100644 --- a/src/components/SettingsPage/RepairDeviceButton.js +++ b/src/components/SettingsPage/RepairDeviceButton.js @@ -60,9 +60,6 @@ class RepairDeviceButton extends PureComponent { }) } - repairMcu = () => this.repair('0.8') - repairGeneric = () => this.repair() - render() { const { t } = this.props const { opened, isLoading, error, progress } = this.state @@ -79,8 +76,7 @@ class RepairDeviceButton extends PureComponent { isOpened={opened} onClose={this.close} onReject={this.close} - onRepair={this.repairGeneric} - onRepairMCU={this.repairMcu} + repair={this.repair} isLoading={isLoading} title={t('settings.repairDevice.title')} desc={t('settings.repairDevice.desc')} diff --git a/src/components/base/Modal/RepairModal.js b/src/components/base/Modal/RepairModal.js index a14bfb80..04374890 100644 --- a/src/components/base/Modal/RepairModal.js +++ b/src/components/base/Modal/RepairModal.js @@ -129,8 +129,7 @@ type Props = { confirmText?: string, cancelText?: string, onReject: Function, - onRepair: Function, - onRepairMCU: Function, + repair: ?string=>*, t: T, isLoading?: boolean, analyticsName: string, @@ -149,8 +148,7 @@ class RepairModal extends PureComponent { confirmText, isDanger, onReject, - onRepair, - onRepairMCU, + repair, isLoading, renderIcon, t, @@ -183,22 +181,31 @@ class RepairModal extends PureComponent { {error ? null : ( <> + )} diff --git a/static/i18n/en/app.json b/static/i18n/en/app.json index ddb48553..16f91e41 100644 --- a/static/i18n/en/app.json +++ b/static/i18n/en/app.json @@ -453,8 +453,9 @@ "title": "Repair your Ledger device", "desc": "If you encountered some issue while updating your Ledger Nano S and cannot resume the update process, you can try this option to repair your device.", "button": "Repair", - "repair": "Stuck in 'Bootloader'", - "mcu": "Stuck in 'MCU not genuine'" + "generic": "'Bootloader'", + "0_8": "'MCU not genuine'", + "0_9": "'follow repair instruction'" }, "exportLogs": { "title": "Export logs", @@ -906,4 +907,4 @@ "title": "Couldn’t load fee rates, please set manual fees" } } -} \ No newline at end of file +} From b2552cf7afb62881afd44d51f2c8b1168eff771f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Mon, 21 Jan 2019 12:31:05 +0100 Subject: [PATCH 08/15] More generic UI to handle more cases --- src/components/base/Modal/RepairModal.js | 62 +++++++++++++++--------- static/i18n/en/app.json | 6 +-- yarn.lock | 8 +-- 3 files changed, 46 insertions(+), 30 deletions(-) diff --git a/src/components/base/Modal/RepairModal.js b/src/components/base/Modal/RepairModal.js index 04374890..b0336340 100644 --- a/src/components/base/Modal/RepairModal.js +++ b/src/components/base/Modal/RepairModal.js @@ -11,6 +11,7 @@ import TrackPage from 'analytics/TrackPage' import Button from 'components/base/Button' import Box from 'components/base/Box' import Text from 'components/base/Text' +import Select from 'components/base/Select' import ProgressCircle from 'components/ProgressCircle' import TranslatedError from 'components/TranslatedError' import ExclamationCircleThin from 'icons/ExclamationCircleThin' @@ -129,7 +130,7 @@ type Props = { confirmText?: string, cancelText?: string, onReject: Function, - repair: ?string=>*, + repair: (?string) => *, t: T, isLoading?: boolean, analyticsName: string, @@ -138,7 +139,22 @@ type Props = { error?: Error, } -class RepairModal extends PureComponent { +const options = [{ value: 'generic' }, { value: '0_8' }, { value: '0_9' }] + +class RepairModal extends PureComponent { + state = { + selectedOption: options[0], + } + + onChange = selectedOption => { + this.setState({ selectedOption }) + } + + renderOption = option => (option && this.props.t(`settings.repairDevice.${option.value}`)) || null + + renderValue = option => + (option && this.props.t(`settings.repairDevice.${option.data.value}`)) || null + render() { const { cancellable, @@ -157,6 +173,7 @@ class RepairModal extends PureComponent { error, ...props } = this.props + const { selectedOption } = this.state return ( { )} + {!isLoading && !error ? ( + + Date: Mon, 21 Jan 2019 15:40:10 +0100 Subject: [PATCH 10/15] Wording --- src/components/SettingsPage/sections/Help.js | 2 +- static/i18n/en/app.json | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/SettingsPage/sections/Help.js b/src/components/SettingsPage/sections/Help.js index 10949ceb..d621e144 100644 --- a/src/components/SettingsPage/sections/Help.js +++ b/src/components/SettingsPage/sections/Help.js @@ -73,7 +73,7 @@ class SectionHelp extends PureComponent { > - + diff --git a/static/i18n/en/app.json b/static/i18n/en/app.json index 098da948..19cd4927 100644 --- a/static/i18n/en/app.json +++ b/static/i18n/en/app.json @@ -451,11 +451,12 @@ }, "repairDevice": { "title": "Repair your Ledger device", - "desc": "If you encountered some issue while updating your Ledger Nano S and cannot resume the update process, you can try this option to repair your device.", + "descSettings": "Use this tool to restore your Ledger device if it has become stuck during a firmware update.", + "desc": "Please select the state of your Ledger device.", "button": "Repair", - "generic": "Stuck in 'Bootloader'", - "0_8": "Stuck in 'MCU not genuine'", - "0_9": "Stuck in 'follow repair instruction'" + "generic": "Bootloader", + "0_8": "MCU not genuine", + "0_9": "Follow device repair instructions" }, "exportLogs": { "title": "Export logs", From bb775d4b6404b47b184e31989fa114abd2e0f554 Mon Sep 17 00:00:00 2001 From: "Valentin D. Pinkman" Date: Mon, 21 Jan 2019 16:38:48 +0100 Subject: [PATCH 11/15] text for UnknownMCU error --- static/i18n/en/app.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/i18n/en/app.json b/static/i18n/en/app.json index 3b57aa53..500f7ebc 100644 --- a/static/i18n/en/app.json +++ b/static/i18n/en/app.json @@ -902,6 +902,10 @@ }, "FeeNotLoaded": { "title": "Couldn’t load fee rates, please set manual fees" + }, + "UnknownMCU": { + "title": "Oops, MCU not found", + "description": "Please try again or contact us" } } } \ No newline at end of file From 06c9904075695f86ee055bcc8662a3c7a59f956d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Mon, 21 Jan 2019 17:15:11 +0100 Subject: [PATCH 12/15] update to new errors & fix repair --- package.json | 4 ++-- src/api/Ethereum.js | 2 +- src/api/Fees.js | 2 +- src/api/network.js | 2 +- src/bridge/EthereumJSBridge.js | 2 +- src/bridge/LibcoreBridge.js | 2 +- src/bridge/RippleJSBridge.js | 2 +- src/commands/libcoreGetFees.js | 2 +- src/commands/libcoreSignAndBroadcast.js | 2 +- src/components/EnsureDeviceApp.js | 2 +- src/components/FeesField/BitcoinKind.js | 2 +- src/components/FeesField/EthereumKind.js | 2 +- src/components/FeesField/RippleKind.js | 2 +- src/components/GenuineCheck.js | 2 +- src/components/IsUnlocked.js | 2 +- .../SettingsPage/DisablePasswordModal.js | 2 +- src/components/SettingsPage/PasswordForm.js | 2 +- src/components/SettingsPage/PasswordModal.js | 2 +- src/components/base/Modal/RepairModal.js | 19 +++++++------------ .../modals/AccountSettingRenderBody.js | 2 +- .../Receive/steps/04-step-receive-funds.js | 2 +- .../modals/Send/fields/RecipientField.js | 4 ++-- src/components/modals/Send/index.js | 2 +- src/helpers/db/index.js | 2 +- src/helpers/init-libcore.js | 2 +- src/helpers/ipc.js | 2 +- src/helpers/libcore.js | 4 ++-- src/helpers/live-common-setup-internal-hw.js | 2 +- src/helpers/promise.js | 2 +- src/helpers/reset.js | 2 +- src/internals/index.js | 2 +- src/main/bridge.js | 2 +- static/i18n/en/app.json | 4 ++-- yarn.lock | 14 ++++++++++---- 34 files changed, 53 insertions(+), 52 deletions(-) diff --git a/package.json b/package.json index 0817e1aa..e444a751 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@ledgerhq/hw-transport": "^4.32.0", "@ledgerhq/hw-transport-node-hid": "^4.32.0", "@ledgerhq/ledger-core": "2.0.0-rc.14", - "@ledgerhq/live-common": "4.10.1", + "@ledgerhq/live-common": "4.10.2", "animated": "^0.2.2", "async": "^2.6.1", "axios": "^0.18.0", @@ -189,4 +189,4 @@ "yarn": "^1.10.1" }, "private": true -} \ No newline at end of file +} diff --git a/src/api/Ethereum.js b/src/api/Ethereum.js index 4542ddb6..bd7b2160 100644 --- a/src/api/Ethereum.js +++ b/src/api/Ethereum.js @@ -1,7 +1,7 @@ // @flow import type { CryptoCurrency } from '@ledgerhq/live-common/lib/types' import { BigNumber } from 'bignumber.js' -import { LedgerAPINotAvailable } from '@ledgerhq/live-common/lib/errors' +import { LedgerAPINotAvailable } from '@ledgerhq/errors' import network from './network' import { blockchainBaseURL } from './Ledger' diff --git a/src/api/Fees.js b/src/api/Fees.js index 476ea5d0..84623f88 100644 --- a/src/api/Fees.js +++ b/src/api/Fees.js @@ -2,7 +2,7 @@ import invariant from 'invariant' import LRU from 'lru-cache' import type { Currency } from '@ledgerhq/live-common/lib/types' -import { FeeEstimationFailed } from '@ledgerhq/live-common/lib/errors' +import { FeeEstimationFailed } from '@ledgerhq/errors' import { blockchainBaseURL } from './Ledger' import network from './network' diff --git a/src/api/network.js b/src/api/network.js index db0a3e5d..2dfffcfb 100644 --- a/src/api/network.js +++ b/src/api/network.js @@ -7,7 +7,7 @@ import { LedgerAPIErrorWithMessage, LedgerAPIError, NetworkDown, -} from '@ledgerhq/live-common/lib/errors' +} from '@ledgerhq/errors' import anonymizer from 'helpers/anonymizer' const userFriendlyError = (p: Promise, { url, method, startTime, ...rest }): Promise => diff --git a/src/bridge/EthereumJSBridge.js b/src/bridge/EthereumJSBridge.js index a337dd85..1eeeca8f 100644 --- a/src/bridge/EthereumJSBridge.js +++ b/src/bridge/EthereumJSBridge.js @@ -25,7 +25,7 @@ import { apiForCurrency } from 'api/Ethereum' import type { Tx } from 'api/Ethereum' import getAddressCommand from 'commands/getAddress' import signTransactionCommand from 'commands/signTransaction' -import { NotEnoughBalance, FeeNotLoaded, ETHAddressNonEIP } from '@ledgerhq/live-common/lib/errors' +import { NotEnoughBalance, FeeNotLoaded, ETHAddressNonEIP } from '@ledgerhq/errors' import type { EditProps, WalletBridge } from './types' type Transaction = { diff --git a/src/bridge/LibcoreBridge.js b/src/bridge/LibcoreBridge.js index 16d52909..e9d2ce8b 100644 --- a/src/bridge/LibcoreBridge.js +++ b/src/bridge/LibcoreBridge.js @@ -11,7 +11,7 @@ import libcoreSyncAccount from 'commands/libcoreSyncAccount' import libcoreSignAndBroadcast from 'commands/libcoreSignAndBroadcast' import libcoreGetFees, { extractGetFeesInputFromAccount } from 'commands/libcoreGetFees' import libcoreValidAddress from 'commands/libcoreValidAddress' -import { NotEnoughBalance, FeeNotLoaded } from '@ledgerhq/live-common/lib/errors' +import { NotEnoughBalance, FeeNotLoaded } from '@ledgerhq/errors' import type { WalletBridge, EditProps } from './types' const NOT_ENOUGH_FUNDS = 52 diff --git a/src/bridge/RippleJSBridge.js b/src/bridge/RippleJSBridge.js index c67a5a94..88f83531 100644 --- a/src/bridge/RippleJSBridge.js +++ b/src/bridge/RippleJSBridge.js @@ -32,7 +32,7 @@ import { NotEnoughBalance, FeeNotLoaded, NotEnoughBalanceBecauseDestinationNotCreated, -} from '@ledgerhq/live-common/lib/errors' +} from '@ledgerhq/errors' import type { WalletBridge, EditProps } from './types' type Transaction = { diff --git a/src/commands/libcoreGetFees.js b/src/commands/libcoreGetFees.js index faebcdd0..fcedd03d 100644 --- a/src/commands/libcoreGetFees.js +++ b/src/commands/libcoreGetFees.js @@ -13,7 +13,7 @@ import { bigNumberToLibcoreAmount, getOrCreateWallet, } from 'helpers/libcore' -import { InvalidAddress } from '@ledgerhq/live-common/lib/errors' +import { InvalidAddress } from '@ledgerhq/errors' type BitcoinLikeTransaction = { // TODO we rename this Transaction concept into transactionInput diff --git a/src/commands/libcoreSignAndBroadcast.js b/src/commands/libcoreSignAndBroadcast.js index 30dd27ab..b683a58b 100644 --- a/src/commands/libcoreSignAndBroadcast.js +++ b/src/commands/libcoreSignAndBroadcast.js @@ -14,7 +14,7 @@ import { bigNumberToLibcoreAmount, getOrCreateWallet, } from 'helpers/libcore' -import { UpdateYourApp } from '@ledgerhq/live-common/lib/errors' +import { UpdateYourApp } from '@ledgerhq/errors' import withLibcore from 'helpers/withLibcore' import { createCommand, Command } from 'helpers/ipc' diff --git a/src/components/EnsureDeviceApp.js b/src/components/EnsureDeviceApp.js index 47f90e79..c7fc5020 100644 --- a/src/components/EnsureDeviceApp.js +++ b/src/components/EnsureDeviceApp.js @@ -27,7 +27,7 @@ import { WrongDeviceForAccount, CantOpenDevice, UpdateYourApp, -} from '@ledgerhq/live-common/lib/errors' +} from '@ledgerhq/errors' import { getCurrentDevice } from 'reducers/devices' const usbIcon = diff --git a/src/components/FeesField/BitcoinKind.js b/src/components/FeesField/BitcoinKind.js index 81c2ea9b..937e0702 100644 --- a/src/components/FeesField/BitcoinKind.js +++ b/src/components/FeesField/BitcoinKind.js @@ -8,7 +8,7 @@ import { translate } from 'react-i18next' import type { T } from 'types/common' -import { FeeNotLoaded } from '@ledgerhq/live-common/lib/errors' +import { FeeNotLoaded } from '@ledgerhq/errors' import InputCurrency from 'components/base/InputCurrency' import Select from 'components/base/Select' import type { Fees } from 'api/Fees' diff --git a/src/components/FeesField/EthereumKind.js b/src/components/FeesField/EthereumKind.js index aa02c86a..d6ef3d6d 100644 --- a/src/components/FeesField/EthereumKind.js +++ b/src/components/FeesField/EthereumKind.js @@ -4,7 +4,7 @@ import React, { Component } from 'react' import { BigNumber } from 'bignumber.js' import type { Account } from '@ledgerhq/live-common/lib/types' -import { FeeNotLoaded } from '@ledgerhq/live-common/lib/errors' +import { FeeNotLoaded } from '@ledgerhq/errors' import InputCurrency from 'components/base/InputCurrency' import type { Fees } from 'api/Fees' import WithFeesAPI from '../WithFeesAPI' diff --git a/src/components/FeesField/RippleKind.js b/src/components/FeesField/RippleKind.js index 8692cb12..acf7622e 100644 --- a/src/components/FeesField/RippleKind.js +++ b/src/components/FeesField/RippleKind.js @@ -4,7 +4,7 @@ import React, { Component } from 'react' import type { BigNumber } from 'bignumber.js' import type { Account } from '@ledgerhq/live-common/lib/types' import { apiForEndpointConfig, parseAPIValue } from 'api/Ripple' -import { FeeNotLoaded } from '@ledgerhq/live-common/lib/errors' +import { FeeNotLoaded } from '@ledgerhq/errors' import InputCurrency from 'components/base/InputCurrency' import GenericContainer from './GenericContainer' diff --git a/src/components/GenuineCheck.js b/src/components/GenuineCheck.js index 751e8720..d3487591 100644 --- a/src/components/GenuineCheck.js +++ b/src/components/GenuineCheck.js @@ -20,7 +20,7 @@ import { DeviceNotGenuineError, DeviceGenuineSocketEarlyClose, UnexpectedBootloader, -} from '@ledgerhq/live-common/lib/errors' +} from '@ledgerhq/errors' import getDeviceInfo from 'commands/getDeviceInfo' import getIsGenuine from 'commands/getIsGenuine' diff --git a/src/components/IsUnlocked.js b/src/components/IsUnlocked.js index 391599db..997ee69f 100644 --- a/src/components/IsUnlocked.js +++ b/src/components/IsUnlocked.js @@ -17,7 +17,7 @@ import { hardReset } from 'helpers/reset' import { fetchAccounts } from 'actions/accounts' import { isLocked, unlock } from 'reducers/application' -import { PasswordIncorrectError } from '@ledgerhq/live-common/lib/errors' +import { PasswordIncorrectError } from '@ledgerhq/errors' import Box from 'components/base/Box' import InputPassword from 'components/base/InputPassword' diff --git a/src/components/SettingsPage/DisablePasswordModal.js b/src/components/SettingsPage/DisablePasswordModal.js index bf5ebe61..b9613c42 100644 --- a/src/components/SettingsPage/DisablePasswordModal.js +++ b/src/components/SettingsPage/DisablePasswordModal.js @@ -1,7 +1,7 @@ // @flow import React, { PureComponent } from 'react' -import { PasswordIncorrectError } from '@ledgerhq/live-common/lib/errors' +import { PasswordIncorrectError } from '@ledgerhq/errors' import db from 'helpers/db' import Box from 'components/base/Box' diff --git a/src/components/SettingsPage/PasswordForm.js b/src/components/SettingsPage/PasswordForm.js index 396a1355..d0587fec 100644 --- a/src/components/SettingsPage/PasswordForm.js +++ b/src/components/SettingsPage/PasswordForm.js @@ -6,7 +6,7 @@ import Box from 'components/base/Box' import InputPassword from 'components/base/InputPassword' import Label from 'components/base/Label' -import { PasswordsDontMatchError } from '@ledgerhq/live-common/lib/errors' +import { PasswordsDontMatchError } from '@ledgerhq/errors' import type { T } from 'types/common' diff --git a/src/components/SettingsPage/PasswordModal.js b/src/components/SettingsPage/PasswordModal.js index 00abe296..c55e4056 100644 --- a/src/components/SettingsPage/PasswordModal.js +++ b/src/components/SettingsPage/PasswordModal.js @@ -5,7 +5,7 @@ import React, { PureComponent } from 'react' import type { T } from 'types/common' import db from 'helpers/db' -import { PasswordIncorrectError } from '@ledgerhq/live-common/lib/errors' +import { PasswordIncorrectError } from '@ledgerhq/errors' import Box from 'components/base/Box' import Button from 'components/base/Button' import { Modal, ModalContent, ModalBody, ModalTitle, ModalFooter } from 'components/base/Modal' diff --git a/src/components/base/Modal/RepairModal.js b/src/components/base/Modal/RepairModal.js index 9fd2bd2e..a69d839c 100644 --- a/src/components/base/Modal/RepairModal.js +++ b/src/components/base/Modal/RepairModal.js @@ -3,6 +3,7 @@ import React, { PureComponent } from 'react' import { translate } from 'react-i18next' import styled from 'styled-components' +import { forceRepairChoices } from '@ledgerhq/live-common/lib/hw/firmwareUpdate-repair' import type { T } from 'types/common' @@ -139,21 +140,19 @@ type Props = { error?: Error, } -const options = [{ value: 'generic' }, { value: '0_8' }, { value: '0_9' }] - class RepairModal extends PureComponent { state = { - selectedOption: options[0], + selectedOption: forceRepairChoices[0], } onChange = selectedOption => { - this.setState({ selectedOption: selectedOption || options[0] }) + this.setState({ selectedOption: selectedOption || forceRepairChoices[0] }) } - renderOption = option => (option && this.props.t(`settings.repairDevice.${option.value}`)) || null + renderOption = option => (option && this.props.t(`settings.repairDevice.${option.label}`)) || null renderValue = option => - (option && this.props.t(`settings.repairDevice.${option.data.value}`)) || null + (option && this.props.t(`settings.repairDevice.${option.data.label}`)) || null render() { const { @@ -200,7 +199,7 @@ class RepairModal extends PureComponent { value={selectedOption} onChange={this.onChange} autoFocus - options={options} + options={forceRepairChoices} renderOption={this.renderOption} renderValue={this.renderValue} /> @@ -213,11 +212,7 @@ class RepairModal extends PureComponent { {error ? null : ( <>