Browse Source

ETH: also scan for metamask accounts derivation paths

typically will allow to discover more than the first account of a metamask seed
gre-patch-1
Gaëtan Renaudeau 6 years ago
parent
commit
26d564b2de
No known key found for this signature in database GPG Key ID: 7B66B85F042E5451
  1. 38
      .eslintrc
  2. 2
      package.json
  3. 2
      src/bridge/EthereumJSBridge.js
  4. 2
      src/bridge/RippleJSBridge.js
  5. 4
      src/helpers/libcore.js
  6. 8
      yarn.lock

38
.eslintrc

@ -38,6 +38,7 @@
"jsx-a11y/label-has-for": 0,
"prefer-destructuring": 0,
"new-cap": 0,
"no-continue": 0,
"no-await-in-loop": 0,
"no-restricted-globals": 0,
"no-unused-expressions": 0,
@ -48,7 +49,10 @@
"no-shadow": 0,
"no-underscore-dangle": 0,
"no-console": 2,
"no-unused-vars": ["error", { "argsIgnorePattern": "^_", "vars": "all", "args": "after-used", "ignoreRestSiblings": true }],
"no-unused-vars": [
"error",
{ "argsIgnorePattern": "^_", "vars": "all", "args": "after-used", "ignoreRestSiblings": true }
],
"no-use-before-define": 0,
"no-restricted-syntax": 0,
"no-prototype-builtins": 0,
@ -57,31 +61,31 @@
"react/jsx-curly-brace-presence": 0,
"react/jsx-filename-extension": 0,
"react/jsx-no-target-blank": 0,
"react/jsx-no-literals": [1, {"noStrings": false}],
"react/jsx-no-literals": [1, { "noStrings": false }],
"react/prefer-stateless-function": 0,
"react/require-default-props": 0,
"react/no-multi-comp": 0,
"react/sort-comp": [1, {
order: [
'static-methods',
'lifecycle',
'everything-else',
'render'
]
}]
"react/sort-comp": [
1,
{
"order": ["static-methods", "lifecycle", "everything-else", "render"]
}
]
},
"settings": {
"import/resolver": {
"babel-module": {},
"babel-module": {}
},
"flowtype": {
"onlyFilesWithFlowAnnotation": true,
"onlyFilesWithFlowAnnotation": true
}
},
"overrides": [{
"files": [ "*stories.js" ],
"rules": {
"react/jsx-no-literals": 0
"overrides": [
{
"files": ["*stories.js"],
"rules": {
"react/jsx-no-literals": 0
}
}
}]
]
}

2
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.16",
"@ledgerhq/live-common": "4.13.0",
"@ledgerhq/live-common": "4.14.0",
"animated": "^0.2.2",
"async": "^2.6.1",
"axios": "^0.18.0",

2
src/bridge/EthereumJSBridge.js

@ -13,6 +13,7 @@ import {
getDerivationScheme,
runDerivationScheme,
isIterableDerivationMode,
derivationModeSupportsIndex,
getMandatoryEmptyAccountSkip,
} from '@ledgerhq/live-common/lib/derivation'
import {
@ -314,6 +315,7 @@ const EthereumBridge: WalletBridge<Transaction> = {
const derivationScheme = getDerivationScheme({ derivationMode, currency })
const stopAt = isIterableDerivationMode(derivationMode) ? 255 : 1
for (let index = 0; index < stopAt; index++) {
if (!derivationModeSupportsIndex(derivationMode, index)) continue
const freshAddressPath = runDerivationScheme(derivationScheme, currency, {
account: index,
})

2
src/bridge/RippleJSBridge.js

@ -12,6 +12,7 @@ import {
getDerivationScheme,
runDerivationScheme,
isIterableDerivationMode,
derivationModeSupportsIndex,
} from '@ledgerhq/live-common/lib/derivation'
import {
getAccountPlaceholderName,
@ -314,6 +315,7 @@ const RippleJSBridge: WalletBridge<Transaction> = {
const derivationScheme = getDerivationScheme({ derivationMode, currency })
const stopAt = isIterableDerivationMode(derivationMode) ? 255 : 1
for (let index = 0; index < stopAt; index++) {
if (!derivationModeSupportsIndex(derivationMode, index)) continue
const freshAddressPath = runDerivationScheme(derivationScheme, currency, {
account: index,
})

4
src/helpers/libcore.js

@ -13,6 +13,7 @@ import {
isSegwitDerivationMode,
isUnsplitDerivationMode,
isIterableDerivationMode,
derivationModeSupportsIndex,
} from '@ledgerhq/live-common/lib/derivation'
import { getCryptoCurrencyById } from '@ledgerhq/live-common/lib/currencies'
import {
@ -258,8 +259,9 @@ async function scanNextAccount(props: {
if (isUnsubscribed()) return []
const isLast = ops.length === 0 || !isIterableDerivationMode(derivationMode)
const skipIndex = !derivationModeSupportsIndex(derivationMode, accountIndex)
if (!isLast || showNewAccount) {
if ((!isLast || showNewAccount) && !skipIndex) {
onAccountScanned(account)
accounts.push(account)
}

8
yarn.lock

@ -1738,10 +1738,10 @@
bindings "^1.3.0"
nan "^2.6.2"
"@ledgerhq/live-common@4.13.0":
version "4.13.0"
resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-4.13.0.tgz#7e5eeaf8af2937cd30649b3f6e2094878980f557"
integrity sha512-DSO3CLVdZav7QC2DarbfAXW14z3omRvDFFfwF3URDwKH6nPIVJsE5WqiMpnQ1SL+a1qnevGkF5NLrvwv5bdRmQ==
"@ledgerhq/live-common@4.14.0":
version "4.14.0"
resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-4.14.0.tgz#56ecac0a21f0d77a66a57d5ce9e2159b426e0ec7"
integrity sha512-oKvb/QZrG2XzVvq/IM+73lyw33VlyDu03hmYFCR48U2DGao/SCFOH8J0vQZK/U9VTSqpnC8mEZKQhNOQkf5hoA==
dependencies:
"@aeternity/ledger-app-api" "0.0.4"
"@ledgerhq/errors" "^4.32.0"

Loading…
Cancel
Save