Browse Source

update to new errors & fix repair

gre-patch-1
Gaëtan Renaudeau 6 years ago
parent
commit
06c9904075
No known key found for this signature in database GPG Key ID: 7B66B85F042E5451
  1. 4
      package.json
  2. 2
      src/api/Ethereum.js
  3. 2
      src/api/Fees.js
  4. 2
      src/api/network.js
  5. 2
      src/bridge/EthereumJSBridge.js
  6. 2
      src/bridge/LibcoreBridge.js
  7. 2
      src/bridge/RippleJSBridge.js
  8. 2
      src/commands/libcoreGetFees.js
  9. 2
      src/commands/libcoreSignAndBroadcast.js
  10. 2
      src/components/EnsureDeviceApp.js
  11. 2
      src/components/FeesField/BitcoinKind.js
  12. 2
      src/components/FeesField/EthereumKind.js
  13. 2
      src/components/FeesField/RippleKind.js
  14. 2
      src/components/GenuineCheck.js
  15. 2
      src/components/IsUnlocked.js
  16. 2
      src/components/SettingsPage/DisablePasswordModal.js
  17. 2
      src/components/SettingsPage/PasswordForm.js
  18. 2
      src/components/SettingsPage/PasswordModal.js
  19. 19
      src/components/base/Modal/RepairModal.js
  20. 2
      src/components/modals/AccountSettingRenderBody.js
  21. 2
      src/components/modals/Receive/steps/04-step-receive-funds.js
  22. 4
      src/components/modals/Send/fields/RecipientField.js
  23. 2
      src/components/modals/Send/index.js
  24. 2
      src/helpers/db/index.js
  25. 2
      src/helpers/init-libcore.js
  26. 2
      src/helpers/ipc.js
  27. 4
      src/helpers/libcore.js
  28. 2
      src/helpers/live-common-setup-internal-hw.js
  29. 2
      src/helpers/promise.js
  30. 2
      src/helpers/reset.js
  31. 2
      src/internals/index.js
  32. 2
      src/main/bridge.js
  33. 4
      static/i18n/en/app.json
  34. 14
      yarn.lock

4
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
}
}

2
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'

2
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'

2
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 = <A>(p: Promise<A>, { url, method, startTime, ...rest }): Promise<A> =>

2
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 = {

2
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

2
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 = {

2
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

2
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'

2
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 = <IconUsb size={16} />

2
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'

2
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'

2
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'

2
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'

2
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'

2
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'

2
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'

2
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'

19
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<Props, *> {
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<Props, *> {
value={selectedOption}
onChange={this.onChange}
autoFocus
options={options}
options={forceRepairChoices}
renderOption={this.renderOption}
renderValue={this.renderValue}
/>
@ -213,11 +212,7 @@ class RepairModal extends PureComponent<Props, *> {
{error ? null : (
<>
<Button
onClick={() =>
repair(
selectedOption.value === 'generic' ? undefined : selectedOption.value,
)
}
onClick={() => repair(selectedOption.value)}
primary={!isDanger}
danger={isDanger}
isLoading={isLoading}

2
src/components/modals/AccountSettingRenderBody.js

@ -17,7 +17,7 @@ import { setDataModal } from 'reducers/modals'
import { getBridgeForCurrency } from 'bridge'
import { AccountNameRequiredError, EnpointConfigError } from '@ledgerhq/live-common/lib/errors'
import { AccountNameRequiredError, EnpointConfigError } from '@ledgerhq/errors'
import TrackPage from 'analytics/TrackPage'
import Spoiler from 'components/base/Spoiler'

2
src/components/modals/Receive/steps/04-step-receive-funds.js

@ -7,7 +7,7 @@ import TrackPage from 'analytics/TrackPage'
import getAddress from 'commands/getAddress'
import Box from 'components/base/Box'
import CurrentAddressForAccount from 'components/CurrentAddressForAccount'
import { DisconnectedDevice, WrongDeviceForAccount } from '@ledgerhq/live-common/lib/errors'
import { DisconnectedDevice, WrongDeviceForAccount } from '@ledgerhq/errors'
import type { StepProps } from '..'

4
src/components/modals/Send/fields/RecipientField.js

@ -9,8 +9,8 @@ import Box from 'components/base/Box'
import LabelWithExternalIcon from 'components/base/LabelWithExternalIcon'
import RecipientAddress from 'components/RecipientAddress'
import { track } from 'analytics/segment'
import { createCustomErrorClass } from '@ledgerhq/live-common/lib/errors/helpers'
import { CantScanQRCode } from '@ledgerhq/live-common/lib/errors'
import { createCustomErrorClass } from '@ledgerhq/errors/lib/helpers'
import { CantScanQRCode } from '@ledgerhq/errors'
type Props<Transaction> = {
t: T,

2
src/components/modals/Send/index.js

@ -20,7 +20,7 @@ import type { StepProps as DefaultStepProps } from 'components/base/Stepper'
import { getCurrentDevice } from 'reducers/devices'
import { accountsSelector } from 'reducers/accounts'
import { closeModal, openModal } from 'reducers/modals'
import { DisconnectedDevice, UserRefusedOnDevice } from '@ledgerhq/live-common/lib/errors'
import { DisconnectedDevice, UserRefusedOnDevice } from '@ledgerhq/errors'
import Modal from 'components/base/Modal'
import Stepper from 'components/base/Stepper'

2
src/helpers/db/index.js

@ -11,7 +11,7 @@ import logger from 'logger'
import { fsReadFile, fsUnlink } from 'helpers/fs'
import { promisify, debounce } from 'helpers/promise'
import { NoDBPathGiven, DBWrongPassword } from '@ledgerhq/live-common/lib/errors'
import { NoDBPathGiven, DBWrongPassword } from '@ledgerhq/errors'
type Transform = {
get: any => any,

2
src/helpers/init-libcore.js

@ -3,7 +3,7 @@
import logger from 'logger'
import invariant from 'invariant'
import network from 'api/network'
import { serializeError } from '@ledgerhq/live-common/lib/errors/helpers'
import { serializeError } from '@ledgerhq/errors/lib/helpers'
const lib = require('@ledgerhq/ledger-core')

2
src/helpers/ipc.js

@ -2,7 +2,7 @@
import logger from 'logger'
import { Observable } from 'rxjs'
import uuidv4 from 'uuid/v4'
import { deserializeError } from '@ledgerhq/live-common/lib/errors/helpers'
import { deserializeError } from '@ledgerhq/errors/lib/helpers'
export function createCommand<In, A>(id: string, impl: In => Observable<A>): Command<In, A> {
return new Command(id, impl)

4
src/helpers/libcore.js

@ -32,8 +32,8 @@ import type {
} from '@ledgerhq/live-common/lib/types'
import type { NJSAccount, NJSOperation } from '@ledgerhq/ledger-core/src/ledgercore_doc'
import { NoAddressesFound } from '@ledgerhq/live-common/lib/errors'
import { deserializeError } from '@ledgerhq/live-common/lib/errors/helpers'
import { NoAddressesFound } from '@ledgerhq/errors'
import { deserializeError } from '@ledgerhq/errors/lib/helpers'
import { timeoutTagged } from './promise'
export function isValidAddress(core: *, currency: *, address: string): boolean {

2
src/helpers/live-common-setup-internal-hw.js

@ -5,7 +5,7 @@ import { registerTransportModule } from '@ledgerhq/live-common/lib/hw'
import { addAccessHook, setErrorRemapping } from '@ledgerhq/live-common/lib/hw/deviceAccess'
import throttle from 'lodash/throttle'
import TransportNodeHid from '@ledgerhq/hw-transport-node-hid'
import { DisconnectedDevice } from '@ledgerhq/live-common/lib/errors'
import { DisconnectedDevice } from '@ledgerhq/errors'
import { retry } from './promise'
let busy = false

2
src/helpers/promise.js

@ -2,7 +2,7 @@
// small utilities for Promises
import logger from 'logger'
import { TimeoutTagged } from '@ledgerhq/live-common/lib/errors'
import { TimeoutTagged } from '@ledgerhq/errors'
export const delay = (ms: number): Promise<void> => new Promise(f => setTimeout(f, ms))

2
src/helpers/reset.js

@ -9,7 +9,7 @@ import { disable as disableDBMiddleware } from 'middlewares/db'
import db from 'helpers/db'
import { delay } from 'helpers/promise'
import killInternalProcess from 'commands/killInternalProcess'
import { DBNotReset } from '@ledgerhq/live-common/lib/errors'
import { DBNotReset } from '@ledgerhq/errors'
async function resetLibcoreDatabase() {
await killInternalProcess.send().toPromise()

2
src/internals/index.js

@ -10,7 +10,7 @@ import uuid from 'uuid/v4'
import { setImplementation } from 'api/network'
import sentry from 'sentry/node'
import { EXPERIMENTAL_HTTP_ON_RENDERER } from 'config/constants'
import { serializeError } from '@ledgerhq/live-common/lib/errors/helpers'
import { serializeError } from '@ledgerhq/errors/lib/helpers'
require('../env')

2
src/main/bridge.js

@ -11,7 +11,7 @@ import LoggerTransport from 'logger/logger-transport-main'
import sentry, { captureException } from 'sentry/node'
import user from 'helpers/user'
import { cleanUpBeforeClosingSync } from 'helpers/log'
import { deserializeError } from '@ledgerhq/live-common/lib/errors/helpers'
import { deserializeError } from '@ledgerhq/errors/lib/helpers'
import setupAutoUpdater, { quitAndInstall } from './autoUpdate'
import { setInternalProcessPID } from './terminator'

4
static/i18n/en/app.json

@ -455,8 +455,8 @@
"desc": "Please select the state of your Ledger device.",
"button": "Repair",
"generic": "Bootloader",
"0_8": "MCU not genuine",
"0_9": "Follow device repair instructions"
"mcuNotGenuine": "MCU not genuine",
"followDeviceRepair": "Follow device repair instructions"
},
"exportLogs": {
"title": "Export logs",

14
yarn.lock

@ -1677,6 +1677,11 @@
camelcase "^5.0.0"
prettier "^1.13.7"
"@ledgerhq/errors@^4.32.0":
version "4.33.7"
resolved "https://registry.yarnpkg.com/@ledgerhq/errors/-/errors-4.33.7.tgz#b78becd20e8a68f7115ad0986fa357a8adddf6b7"
integrity sha512-1vKWcttI5NHpT6rMKKuxWPAjfwDgfgUTf/AyNAT5KXHlhiLvqnA3NDCdNUVadajVNKSa/s1u1ZWKismtbfePzg==
"@ledgerhq/hw-app-btc@^4.32.0":
version "4.32.0"
resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-btc/-/hw-app-btc-4.32.0.tgz#e883dcaa3ebb4aca1e2cb27acfc47b8db4e85f3f"
@ -1725,12 +1730,13 @@
bindings "^1.3.0"
nan "^2.6.2"
"@ledgerhq/live-common@4.10.1":
version "4.10.1"
resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-4.10.1.tgz#34aa77b692a0aff268b6ef741c2e9ecc1bfcc9c0"
integrity sha512-G5oKHfb0aV+xPOC2+X6xYquvViR+u9iSRTRnC2h82koHnQujbqkI+Lt1hpeEvEwpsaunxqlT/0JV6q/ORNVbtw==
"@ledgerhq/live-common@4.10.2":
version "4.10.2"
resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-4.10.2.tgz#e0472394905c9990c970216818e6b391f3a0f9e2"
integrity sha512-m98hhSRdvzMCk/SEEsop3UJfJqWbUWdIwC4MjJFE8mBHQ82xxvp/18PpQajF/wjNldOj4gIVakKPCZDPFGlYRQ==
dependencies:
"@aeternity/ledger-app-api" "0.0.4"
"@ledgerhq/errors" "^4.32.0"
"@ledgerhq/hw-app-btc" "^4.32.0"
"@ledgerhq/hw-app-eth" "^4.32.0"
"@ledgerhq/hw-app-xrp" "^4.32.0"

Loading…
Cancel
Save