Browse Source

Always scan at least 5 MEW address even if user left empty accounts

master
Gaëtan Renaudeau 7 years ago
parent
commit
8cd51f0dc2
  1. 13
      src/bridge/EthereumJSBridge.js
  2. 1
      src/helpers/derivations.js

13
src/bridge/EthereumJSBridge.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

1
src/helpers/derivations.js

@ -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`

Loading…
Cancel
Save