Browse Source

Merge branch 'develop' into bignumber.js

master
Gaëtan Renaudeau 7 years ago
committed by GitHub
parent
commit
cf45b6e7cf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. BIN
      build/icon.icns
  2. 4
      package.json
  3. 21
      src/bridge/EthereumJSBridge.js
  4. 2
      src/components/Onboarding/OnboardingBreadcrumb.js
  5. 4
      src/components/base/Chart/handleMouseEvents.js
  6. 18
      src/helpers/derivations.js
  7. 2
      src/logger/logger-storybook.js
  8. 8
      src/logger/logger.js
  9. 1
      src/styles/reset.js
  10. 3
      static/i18n/en/app.json
  11. 8
      static/i18n/en/errors.json
  12. 6
      yarn.lock

BIN
build/icon.icns

Binary file not shown.

4
package.json

@ -15,7 +15,7 @@
"compile": "bash ./scripts/compile.sh",
"lint": "eslint src webpack .storybook",
"flow": "flow",
"prettier": "prettier --write \"{src,webpack,.storybook,static/i18n}/**/*.{js,json}\"",
"prettier": "prettier --write \"{src,webpack,.storybook}/**/*.{js,json}\"",
"ci": "yarn lint && yarn flow && yarn prettier",
"storybook": "NODE_ENV=development STORYBOOK_ENV=1 start-storybook -s ./static -p 4444",
"publish-storybook": "bash ./scripts/legacy/publish-storybook.sh",
@ -36,7 +36,7 @@
"@ledgerhq/hw-app-xrp": "^4.13.0",
"@ledgerhq/hw-transport": "^4.13.0",
"@ledgerhq/hw-transport-node-hid": "^4.13.0",
"@ledgerhq/ledger-core": "2.0.0-rc.4",
"@ledgerhq/ledger-core": "2.0.0-rc.5",
"@ledgerhq/live-common": "3.0.0-beta.2",
"animated": "^0.2.2",
"async": "^2.6.1",

21
src/bridge/EthereumJSBridge.js

@ -1,6 +1,7 @@
// @flow
import { Observable } from 'rxjs'
import { BigNumber } from 'bignumber.js'
import logger from 'logger'
import React from 'react'
import FeesField from 'components/FeesField/EthereumKind'
import AdvancedOptions from 'components/AdvancedOptions/EthereumKind'
@ -184,7 +185,7 @@ const EthereumBridge: WalletBridge<Transaction> = {
index,
{ address, path: freshAddressPath, publicKey },
isStandard,
mandatoryCount,
shouldSkipEmpty,
): { account?: Account, complete?: boolean } {
const balance = await api.getAccountBalance(address)
if (finished) return { complete: true }
@ -221,7 +222,7 @@ const EthereumBridge: WalletBridge<Transaction> = {
newAccountCount++
}
if (index < mandatoryCount) {
if (shouldSkipEmpty) {
return {}
}
// NB for legacy addresses maybe we will continue at least for the first 10 addresses
@ -262,6 +263,8 @@ const EthereumBridge: WalletBridge<Transaction> = {
const last = derivations[derivations.length - 1]
for (const derivation of derivations) {
const isStandard = last === derivation
let emptyCount = 0
const mandatoryEmptyAccountSkip = derivation.mandatoryEmptyAccountSkip || 0
for (let index = 0; index < 255; index++) {
const freshAddressPath = derivation({ currency, x: index, segwit: false })
const res = await getAddressCommand
@ -271,10 +274,18 @@ const EthereumBridge: WalletBridge<Transaction> = {
index,
res,
isStandard,
// $FlowFixMe i know i know, not part of function
derivation.mandatoryCount || 0,
emptyCount < mandatoryEmptyAccountSkip,
)
if (r.account) o.next(r.account)
logger.log(
`scanning ${currency.id} at ${freshAddressPath}: ${res.address} resulted of ${
r.account ? `Account with ${r.account.operations.length} txs` : 'no account'
}. ${r.complete ? 'ALL SCANNED' : ''}`,
)
if (r.account) {
o.next(r.account)
} else {
emptyCount++
}
if (r.complete) {
break
}

2
src/components/Onboarding/OnboardingBreadcrumb.js

@ -51,7 +51,7 @@ function OnboardingBreadcrumb(props: Props) {
return (
<Breadcrumb
stepsErrors={genuine.isGenuineFail ? [genuineStepIndex] : undefined}
stepsErrors={genuine.displayErrorScreen ? [genuineStepIndex] : undefined}
currentStep={stepIndex}
items={filteredSteps}
/>

4
src/components/base/Chart/handleMouseEvents.js

@ -65,7 +65,7 @@ export default function handleMouseEvents({
NODES.tooltip
.style('transition', '100ms cubic-bezier(.61,1,.53,1) opacity')
.style('opacity', 1)
.style('transform', `translate3d(${MARGINS.left + x(d.parsedDate)}px, 0, 0)`)
.style('left', `${Math.floor(MARGINS.left + x(d.parsedDate))}px`)
NODES.focus.style('opacity', 1)
NODES.xBar.style('opacity', 1)
}
@ -102,7 +102,7 @@ export default function handleMouseEvents({
</Provider>,
),
)
.style('transform', `translate3d(${MARGINS.left + x(d.parsedDate)}px, 0, 0)`)
.style('left', `${Math.floor(MARGINS.left + x(d.parsedDate))}px`)
NODES.xBar
.attr('x1', x(d.parsedDate))
.attr('x2', x(d.parsedDate))

18
src/helpers/derivations.js

@ -1,17 +1,21 @@
// @flow
import type { CryptoCurrency } from '@ledgerhq/live-common/lib/types'
type Derivation = ({
currency: CryptoCurrency,
segwit: boolean,
x: number,
}) => string
type Derivation = {
({
currency: CryptoCurrency,
segwit: boolean,
x: number,
}): string,
mandatoryEmptyAccountSkip?: number,
}
const ethLegacyMEW: Derivation = ({ x }) => `44'/60'/0'/${x}`
ethLegacyMEW.mandatoryCount = 5
ethLegacyMEW.mandatoryEmptyAccountSkip = 10
const etcLegacyMEW: Derivation = ({ x }) => `44'/60'/160720'/${x}'/0`
etcLegacyMEW.mandatoryCount = 5
etcLegacyMEW.mandatoryEmptyAccountSkip = 10
const rippleLegacy: Derivation = ({ x }) => `44'/144'/0'/${x}'`

2
src/logger/logger-storybook.js

@ -16,6 +16,8 @@ module.exports = {
analyticsTrack: noop,
analyticsPage: noop,
log: noop,
info: noop,
debug: noop,
warn: noop,
error: noop,
critical: noop,

8
src/logger/logger.js

@ -350,6 +350,14 @@ export default {
// General functions in case the hooks don't apply
debug: (...args: any) => {
logger.log('debug', ...args)
},
info: (...args: any) => {
logger.log('info', ...args)
},
log: (...args: any) => {
logger.log('info', ...args)
},

1
src/styles/reset.js

@ -1,5 +1,6 @@
module.exports = `* {
-webkit-font-smoothing: antialiased;
backface-visibility: hidden;
box-sizing: border-box;
margin: 0;
padding: 0;

3
static/i18n/en/app.json

@ -323,6 +323,9 @@
"title": "Transaction sent",
"text": "The transaction has been signed and sent to the network. Your account balance will update once the blockchain has confirmed the transaction.",
"cta": "View operation details"
},
"pending": {
"title": "Broadcasting transaction..."
}
}
}

8
static/i18n/en/errors.json

@ -37,7 +37,7 @@
},
"EnpointConfig": {
"title": "Invalid endpoint",
"description": "Please provide with a valid endpoint"
"description": "Please provide a valid endpoint"
},
"FeeEstimationFailed": {
"title": "Sorry, fee estimation failed",
@ -116,11 +116,11 @@
"description": "It took too long for the server to respond."
},
"TransportError": {
"title": "Something went wrong. Please replug your device.",
"title": "Something went wrong. Please reconnect your device.",
"description": "{{message}}"
},
"TransportStatusError": {
"title": "Something went wrong. Please replug your device.",
"title": "Something went wrong. Please reconnect your device.",
"description": "{{message}}"
},
"UserRefusedFirmwareUpdate": {
@ -154,4 +154,4 @@
"InvalidAddress": {
"title": "This is not a valid {{currencyName}} address"
}
}
}

6
yarn.lock

@ -1521,9 +1521,9 @@
dependencies:
events "^2.0.0"
"@ledgerhq/ledger-core@2.0.0-rc.4":
version "2.0.0-rc.4"
resolved "https://registry.yarnpkg.com/@ledgerhq/ledger-core/-/ledger-core-2.0.0-rc.4.tgz#0ec80a763c666658bea94bd38b86aa90d5a24906"
"@ledgerhq/ledger-core@2.0.0-rc.5":
version "2.0.0-rc.5"
resolved "https://registry.yarnpkg.com/@ledgerhq/ledger-core/-/ledger-core-2.0.0-rc.5.tgz#ec42f6c3cc265fc5ca82e01d27df38357642d3ed"
dependencies:
"@ledgerhq/hw-app-btc" "^4.7.3"
"@ledgerhq/hw-transport-node-hid" "^4.7.6"

Loading…
Cancel
Save