diff --git a/.circleci/config.yml b/.circleci/config.yml index e590dbc9..79faeabd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ jobs: <<: *defaults steps: - run: sudo apt-get update - - run: sudo apt-get install -y libudev-dev + - run: sudo apt-get install -y libudev-dev libusb-1.0-0-dev - run: name: Install latest yarn command: | diff --git a/package.json b/package.json index 5a256f90..66670729 100644 --- a/package.json +++ b/package.json @@ -35,12 +35,13 @@ } }, "dependencies": { + "@ledgerhq/devices": "^4.39.0", "@ledgerhq/errors": "^4.39.0", - "@ledgerhq/hw-app-btc": "^4.35.0", - "@ledgerhq/hw-app-eth": "^4.35.0", - "@ledgerhq/hw-app-xrp": "^4.35.0", - "@ledgerhq/hw-transport": "^4.35.0", - "@ledgerhq/hw-transport-node-hid": "^4.35.0", + "@ledgerhq/hw-app-btc": "^4.39.0", + "@ledgerhq/hw-app-eth": "^4.39.0", + "@ledgerhq/hw-app-xrp": "^4.39.0", + "@ledgerhq/hw-transport": "^4.39.0", + "@ledgerhq/hw-transport-node-hid": "^4.40.0", "@ledgerhq/ledger-core": "2.0.0-rc.16", "@ledgerhq/live-common": "4.16.1", "animated": "^0.2.2", diff --git a/src/analytics/segment.js b/src/analytics/segment.js index 0d5f01e7..dacff414 100644 --- a/src/analytics/segment.js +++ b/src/analytics/segment.js @@ -3,6 +3,7 @@ import uuid from 'uuid/v4' import logger from 'logger' import invariant from 'invariant' +import { getDeviceModel } from '@ledgerhq/devices' import { getSystemLocale } from 'helpers/systemLocale' import { langAndRegionSelector, shareAnalyticsSelector } from 'reducers/settings' import { getCurrentDevice } from 'reducers/devices' @@ -34,7 +35,7 @@ const extraProperties = store => { const systemLocale = getSystemLocale() const device = getCurrentDevice(state) const deviceInfo = device && { - productId: device.productId, + productId: getDeviceModel(device.modelId).usbProductId, } return { appVersion: __APP_VERSION__, diff --git a/src/components/ManagerPage/DeviceInfos.js b/src/components/ManagerPage/DeviceInfos.js index df2c87c2..b60e5db0 100644 --- a/src/components/ManagerPage/DeviceInfos.js +++ b/src/components/ManagerPage/DeviceInfos.js @@ -5,7 +5,7 @@ import React, { PureComponent } from 'react' import Text from 'components/base/Text' import Box, { Card } from 'components/base/Box' import Button from 'components/base/Button' - +import { getDeviceModel } from '@ledgerhq/devices' import type { Device, MemoryInfos } from 'types/common' import MemInfos from './MemInfos' @@ -43,10 +43,11 @@ class DeviceInfos extends PureComponent { return {'You dont have any device connected'} } + const deviceInfos = getDeviceModel(device.modelId) + const title = ( - {device.manufacturer} - {` ${device.product}`} + {`${deviceInfos.productName}`} ) return ( diff --git a/src/components/ManagerPage/FirmwareUpdate.js b/src/components/ManagerPage/FirmwareUpdate.js index 9eb9d547..85af33fa 100644 --- a/src/components/ManagerPage/FirmwareUpdate.js +++ b/src/components/ManagerPage/FirmwareUpdate.js @@ -3,10 +3,10 @@ import React, { PureComponent, Fragment } from 'react' import { translate } from 'react-i18next' +import { getDeviceModel } from '@ledgerhq/devices' +import type { DeviceInfo, FirmwareUpdateContext } from '@ledgerhq/live-common/lib/types/manager' import type { Device, T } from 'types/common' - -import type { DeviceInfo, FirmwareUpdateContext } from '@ledgerhq/live-common/lib/types/manager' import type { StepId } from 'components/modals/UpdateFirmware' import getLatestFirmwareForDevice from 'commands/getLatestFirmwareForDevice' @@ -81,18 +81,19 @@ class FirmwareUpdate extends PureComponent { render() { const { deviceInfo, t, device } = this.props const { firmware, modal, stepId, ready } = this.state + + const deviceSpecs = getDeviceModel(device.modelId) + return ( - {device.product === 'Blue' ? : } + {deviceSpecs.id === 'blue' ? : } - {device.product === 'Blue' - ? t('manager.firmware.titleBlue') - : t('manager.firmware.titleNano')} + {deviceSpecs.productName} t('manager.yourDeviceIsGenuine')}> diff --git a/src/renderer/events.js b/src/renderer/events.js index f233913c..0ef0920c 100644 --- a/src/renderer/events.js +++ b/src/renderer/events.js @@ -51,14 +51,19 @@ export default ({ store }: { store: Object }) => { function syncDevices() { syncDeviceSub = listenDevices.send().subscribe( - ({ device, type }) => { + ({ device, deviceModel, type }) => { if (device) { + const stateDevice = { + path: device.path, + modelId: deviceModel ? deviceModel.id : 'nanoS', + type: 'hid', + } if (type === 'add') { d.device('Device - add') - store.dispatch(addDevice(device)) + store.dispatch(addDevice(stateDevice)) } else if (type === 'remove') { d.device('Device - remove') - store.dispatch(removeDevice(device)) + store.dispatch(removeDevice(stateDevice)) } } }, diff --git a/src/types/common.js b/src/types/common.js index 84ccc162..c219b115 100644 --- a/src/types/common.js +++ b/src/types/common.js @@ -1,11 +1,8 @@ // @flow export type Device = { - manufacturer: string, path: string, - product: string, - productId: string, - vendorId: string, + modelId: string, } // -------------------- Settings diff --git a/static/i18n/en/app.json b/static/i18n/en/app.json index 9aed68e6..e3dbe1b8 100644 --- a/static/i18n/en/app.json +++ b/static/i18n/en/app.json @@ -254,8 +254,6 @@ }, "firmware": { "installed": "Firmware version {{version}}", - "titleNano": "Ledger Nano S", - "titleBlue": "Ledger Blue", "update": "Update", "latest": "Firmware version {{version}} is available", "disclaimerTitle": "You are about to install <1><0>firmware version {{version}}.", @@ -933,4 +931,4 @@ "description": "Please contact Ledger Support" } } -} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 3ed0695a..57a58e38 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1677,49 +1677,60 @@ camelcase "^5.0.0" prettier "^1.13.7" +"@ledgerhq/devices@^4.39.0": + version "4.39.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/devices/-/devices-4.39.0.tgz#47d23a1a58004da162e007e0c456ab2119038c7d" + integrity sha512-2Jd7CVvMJDZxxaSpQpfOMeGWf7M0f6nZqZQWfjsUDQHw45Kunck101pXr6U/5UejJiLl/fhyLqvaXz0X0cs+1A== + dependencies: + "@ledgerhq/errors" "^4.39.0" + "@ledgerhq/errors@^4.32.0", "@ledgerhq/errors@^4.39.0": version "4.39.0" resolved "https://registry.yarnpkg.com/@ledgerhq/errors/-/errors-4.39.0.tgz#10b9889f78df94ce36a4b34d9a3a45aac77be0e9" integrity sha512-kBr2rnoYDACRCxTLtEufE4oCvYj6vx2oFWVVjwskBxYsF5LC9R8Mbg5C4GgvDweiWW4Io8HA9p9jCsOfdCDygg== -"@ledgerhq/hw-app-btc@^4.32.0", "@ledgerhq/hw-app-btc@^4.35.0": - version "4.35.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-btc/-/hw-app-btc-4.35.0.tgz#aafd655c988da39f774b0a4706e7f8897222f414" - integrity sha512-oX9YcQAuU+rOJm/lE7YF5+JXNppHcUv23ZltGz5CbWHnhm7Tqo4MOR8N5oSnHKlHW+IawfWCPN5PqdF7RGyQ5w== +"@ledgerhq/hw-app-btc@^4.32.0", "@ledgerhq/hw-app-btc@^4.39.0": + version "4.39.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-btc/-/hw-app-btc-4.39.0.tgz#5b564e683a43a50002579834ec54aa790fde35f1" + integrity sha512-xPOtoIgsErycMFTKHb0yHLqlKn0C+9msLBsA1zRPNsWMdxEEBO5pzFVmn5ha1j3q/73yeICHlcB4KZcTb7CShA== dependencies: - "@ledgerhq/hw-transport" "^4.35.0" + "@ledgerhq/hw-transport" "^4.39.0" create-hash "^1.1.3" -"@ledgerhq/hw-app-eth@^4.32.0", "@ledgerhq/hw-app-eth@^4.35.0": - version "4.35.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-eth/-/hw-app-eth-4.35.0.tgz#3a8c1b0db87224a24ff5441a0e819122e5585f2d" - integrity sha512-MSDr8+CaoXhtm64ELuI/8wpcfmrMUjzGJgASY6bnjc82vAW+6sHNZlTU0zWRTZxqQUuZ8WpuJP159cf92MWq3g== +"@ledgerhq/hw-app-eth@^4.32.0", "@ledgerhq/hw-app-eth@^4.39.0": + version "4.39.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-eth/-/hw-app-eth-4.39.0.tgz#3cbba1f1650665c4c29c7b9fa246cb2360495867" + integrity sha512-IKPcLTcGohh/S6Z1LaAfn2pGyxfT6xu958/xV+5H4a3Ej0CWKaxcno4FkhaxH4OiViF0F5SEFzxtH+UntH2jdg== dependencies: - "@ledgerhq/hw-transport" "^4.35.0" + "@ledgerhq/hw-transport" "^4.39.0" -"@ledgerhq/hw-app-xrp@^4.32.0", "@ledgerhq/hw-app-xrp@^4.35.0": - version "4.35.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-xrp/-/hw-app-xrp-4.35.0.tgz#f6aec06ae53f8732d90f745963a2de96c2ffa432" - integrity sha512-kQLdr9xrYvkFR9+QVyTNtmSGFDfrQ63ac0QhWKEoILiiQ0dxfZ7qCCp/qPJk/sx9H8dMX37X6y+xAnSU1frbfg== +"@ledgerhq/hw-app-xrp@^4.32.0", "@ledgerhq/hw-app-xrp@^4.39.0": + version "4.39.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-xrp/-/hw-app-xrp-4.39.0.tgz#cc399649f17873778e34bcde16f488faef3117e5" + integrity sha512-lbrG7AhQdJzt/zhu0G5yfC2t4zlytWuzbNLrPp/VQKJJPUKsC98H81pmfMzn1lFBdm8frmBVUW6reN5p7wDS2Q== dependencies: - "@ledgerhq/hw-transport" "^4.35.0" + "@ledgerhq/hw-transport" "^4.39.0" bip32-path "0.4.2" -"@ledgerhq/hw-transport-node-hid@^4.35.0": - version "4.35.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport-node-hid/-/hw-transport-node-hid-4.35.0.tgz#0eba08e5edd14a8c779ebaf73ec21976ee5f112e" - integrity sha512-Otnymk9B7qCEfjych/SvTvJsMM+DqyoB0saEwL80ukjuGFqMunecrG5w8nC4aCc169IVz70Spkg2uU90TBUCuw== +"@ledgerhq/hw-transport-node-hid@^4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport-node-hid/-/hw-transport-node-hid-4.40.0.tgz#7f35194f94e20374e1bd6a04e5299032c5e81b6c" + integrity sha512-Nxp2Ys5lxgWTUG/A+W7O3nemkIBigW0LSJI6QrCDdLDg7deU+Zp6QA/CDS95BLijqi5m0AqKE2U4IyQh4OFnhQ== dependencies: - "@ledgerhq/hw-transport" "^4.35.0" + "@ledgerhq/devices" "^4.39.0" + "@ledgerhq/errors" "^4.39.0" + "@ledgerhq/hw-transport" "^4.39.0" lodash "^4.17.11" - node-hid "^0.7.2" - usb "^1.3.3" + node-hid "^0.7.6" + usb "^1.5.0" -"@ledgerhq/hw-transport@^4.21.0", "@ledgerhq/hw-transport@^4.32.0", "@ledgerhq/hw-transport@^4.35.0": - version "4.35.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport/-/hw-transport-4.35.0.tgz#aa7b851111ed759cd7489fa07a7b34c1773e8314" - integrity sha512-o8ekdoCkHMvOByIKDmAMNDjm8Q5cu+sbqmebPtGrHAPbgIZBUbNA5UupY/Om+xypdxXYnuBw+MF8FyIVOjnIsg== +"@ledgerhq/hw-transport@^4.21.0", "@ledgerhq/hw-transport@^4.32.0", "@ledgerhq/hw-transport@^4.39.0": + version "4.39.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport/-/hw-transport-4.39.0.tgz#602c6ea3fef56d1df205274ea742b4cf85613f6c" + integrity sha512-XkVAy2SFRDdE3qQGGVxB7RQdsdIx1fcoRNReU7NQXK59fYqxue+ZoiGtynEoHq9RKMg8EBG2kBXSVEh1iPdOlA== dependencies: + "@ledgerhq/devices" "^4.39.0" + "@ledgerhq/errors" "^4.39.0" events "^3.0.0" "@ledgerhq/ledger-core@2.0.0-rc.16": @@ -4172,6 +4183,13 @@ bindings@^1.3.0: resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.1.tgz#21fc7c6d67c18516ec5aaa2815b145ff77b26ea5" integrity sha512-i47mqjF9UbjxJhxGf+pZ6kSxrnI3wBLlnGI2ArWJ4r0VrvDS7ZYXkprq/pLaBWYq4GM0r4zdHY+NNRqEMU7uew== +bindings@^1.3.1: + version "1.4.0" + resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.4.0.tgz#909efa49f2ebe07ecd3cb136778f665052040127" + integrity sha512-7znEVX22Djn+nYjxCWKDne0RRloa9XfYa84yk3s+HkE3LpDYZmhArYr9O9huBoHY3/oXispx5LorIX7Sl2CgSQ== + dependencies: + file-uri-to-path "1.0.0" + bip32-path@0.4.2: version "0.4.2" resolved "https://registry.yarnpkg.com/bip32-path/-/bip32-path-0.4.2.tgz#5db0416ad6822712f077836e2557b8697c0c7c99" @@ -7844,6 +7862,11 @@ file-loader@^1.1.11: loader-utils "^1.0.2" schema-utils "^0.4.5" +file-uri-to-path@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" + integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== + filename-regex@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" @@ -11330,16 +11353,21 @@ mute-stream@0.0.7: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= -nan@^2.10.0, nan@^2.8.0: - version "2.12.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.0.tgz#9d443fdb5e13a20770cc5e602eee59760a685885" - integrity sha512-zT5nC0JhbljmyEf+Z456nvm7iO7XgRV2hYxoBtPpnyp+0Q4aCoP6uWNn76v/I6k2kCYNLWqWbwBWQcjsNI/bjw== +nan@^2.12.1: + version "2.12.1" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.1.tgz#7b1aa193e9aa86057e3c7bbd0ac448e770925552" + integrity sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw== nan@^2.2.1, nan@^2.6.2, nan@^2.9.2: version "2.10.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f" integrity sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA== +nan@^2.8.0: + version "2.12.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.0.tgz#9d443fdb5e13a20770cc5e602eee59760a685885" + integrity sha512-zT5nC0JhbljmyEf+Z456nvm7iO7XgRV2hYxoBtPpnyp+0Q4aCoP6uWNn76v/I6k2kCYNLWqWbwBWQcjsNI/bjw== + nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" @@ -11417,6 +11445,13 @@ node-abi@^2.2.0: dependencies: semver "^5.4.1" +node-abi@^2.7.0: + version "2.7.1" + resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.7.1.tgz#a8997ae91176a5fbaa455b194976e32683cda643" + integrity sha512-OV8Bq1OrPh6z+Y4dqwo05HqrRL9YNF7QVMRfq1/pguwKLG+q9UB/Lk0x5qXjO23JjJg+/jqCHSTaG1P3tfKfuw== + dependencies: + semver "^5.4.1" + node-dir@0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.8.tgz#55fb8deb699070707fb67f91a460f0448294c77d" @@ -11465,14 +11500,14 @@ node-gyp@^3.6.0: tar "^2.0.0" which "1" -node-hid@^0.7.2: - version "0.7.4" - resolved "https://registry.yarnpkg.com/node-hid/-/node-hid-0.7.4.tgz#2db109acee654b56bf518ffb3fd92cf9cd0647c1" - integrity sha512-gvgNDPoszObn7avIDYMUvVv1T0xQB4/CZFJWckra/LXAc0qHYho4M1LCnCKlLIocL2R5/3qGv0J4AjRMdwgjxg== +node-hid@^0.7.6: + version "0.7.6" + resolved "https://registry.yarnpkg.com/node-hid/-/node-hid-0.7.6.tgz#61523694f1111d209fca55bb704732dad029f3bc" + integrity sha512-cjbjL1CmOpImKQrqkvQKZUWuzvofwECZQ50zoih5vtPRowIZ4TFJDTN3tJYfVhbQYM9PGqDFXLcTILjx9EPvzw== dependencies: - bindings "^1.3.0" - nan "^2.10.0" - prebuild-install "^5.2.1" + bindings "^1.3.1" + nan "^2.12.1" + prebuild-install "^5.2.2" node-int64@^0.4.0: version "0.4.0" @@ -12769,10 +12804,10 @@ prebuild-install@^2.0.0: tunnel-agent "^0.6.0" which-pm-runs "^1.0.0" -prebuild-install@^5.2.1: - version "5.2.2" - resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-5.2.2.tgz#237888f21bfda441d0ee5f5612484390bccd4046" - integrity sha512-4e8VJnP3zJdZv/uP0eNWmr2r9urp4NECw7Mt1OSAi3rcLrbBRxGiAkfUFtre2MhQ5wfREAjRV+K1gubvs/GPsA== +prebuild-install@^5.2.2: + version "5.2.4" + resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-5.2.4.tgz#8cc41a217ef778a31d3a876fe6668d05406db750" + integrity sha512-CG3JnpTZXdmr92GW4zbcba4jkDha6uHraJ7hW4Fn8j0mExxwOKK20hqho8ZuBDCKYCHYIkFM1P2jhtG+KpP4fg== dependencies: detect-libc "^1.0.3" expand-template "^2.0.3" @@ -12780,7 +12815,7 @@ prebuild-install@^5.2.1: minimist "^1.2.0" mkdirp "^0.5.1" napi-build-utils "^1.0.1" - node-abi "^2.2.0" + node-abi "^2.7.0" noop-logger "^0.1.1" npmlog "^4.0.1" os-homedir "^1.0.1" @@ -16165,7 +16200,7 @@ url@^0.11.0, url@~0.11.0: punycode "1.3.2" querystring "0.2.0" -usb@^1.3.3: +usb@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/usb/-/usb-1.5.0.tgz#3e07b23c6dacf06a7c8801ae913926702a818218" integrity sha512-/0stiQEmweuO2BKv2avzQQ8ypDUjo4Osz5sSEi+d0F4Rc+ddX1xED3uf4Tkelc1eADlfn0JQZYHP0bI7CNDA0Q==