Browse Source
Merge pull request #1053 from gre/fix-scan-5-first-mew-even-if-empty-in-middle
Always scan at least 5 MEW address even if user left empty accounts
master
Gaëtan Renaudeau
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
13 additions and
1 deletions
-
src/bridge/EthereumJSBridge.js
-
src/helpers/derivations.js
|
|
@ -176,6 +176,7 @@ const EthereumBridge: WalletBridge<Transaction> = { |
|
|
|
index, |
|
|
|
{ address, path: freshAddressPath, publicKey }, |
|
|
|
isStandard, |
|
|
|
mandatoryCount, |
|
|
|
): { account?: Account, complete?: boolean } { |
|
|
|
const balance = await api.getAccountBalance(address) |
|
|
|
if (finished) return { complete: true } |
|
|
@ -211,6 +212,10 @@ const EthereumBridge: WalletBridge<Transaction> = { |
|
|
|
} |
|
|
|
newAccountCount++ |
|
|
|
} |
|
|
|
|
|
|
|
if (index < mandatoryCount) { |
|
|
|
return {} |
|
|
|
} |
|
|
|
// NB for legacy addresses maybe we will continue at least for the first 10 addresses
|
|
|
|
return { complete: true } |
|
|
|
} |
|
|
@ -254,7 +259,13 @@ const EthereumBridge: WalletBridge<Transaction> = { |
|
|
|
const res = await getAddressCommand |
|
|
|
.send({ currencyId: currency.id, devicePath: deviceId, path: freshAddressPath }) |
|
|
|
.toPromise() |
|
|
|
const r = await stepAddress(index, res, isStandard) |
|
|
|
const r = await stepAddress( |
|
|
|
index, |
|
|
|
res, |
|
|
|
isStandard, |
|
|
|
// $FlowFixMe i know i know, not part of function
|
|
|
|
derivation.mandatoryCount || 0, |
|
|
|
) |
|
|
|
if (r.account) o.next(r.account) |
|
|
|
if (r.complete) { |
|
|
|
break |
|
|
|
|
|
@ -8,6 +8,7 @@ type Derivation = ({ |
|
|
|
}) => string |
|
|
|
|
|
|
|
const ethLegacyMEW: Derivation = ({ x }) => `44'/60'/0'/${x}` |
|
|
|
ethLegacyMEW.mandatoryCount = 5 |
|
|
|
|
|
|
|
const etcLegacyMEW: Derivation = ({ x }) => `44'/60'/160720'/${x}'/0` |
|
|
|
|
|
|
|