fix: dont try to pair imported accounts with used passphrase

pull/502/head
slowbackspace 5 years ago
parent 642adf45af
commit e95ebe54b6

@ -34,11 +34,7 @@ export const importAddress = (
let payload;
const index = getState().accounts.filter(
a =>
a.imported === true &&
a.network === network.shortcut &&
device &&
a.deviceState === device.state
a => a.imported === true && a.network === network.shortcut
).length;
try {

@ -48,7 +48,12 @@ export const findAccount = (
deviceState: string,
network: string
): ?Account =>
state.find(a => a.deviceState === deviceState && a.index === index && a.network === network);
state.find(
a =>
(a.deviceState === deviceState || a.imported) &&
a.index === index &&
a.network === network
);
export const findDeviceAccounts = (
state: State,
@ -56,9 +61,11 @@ export const findDeviceAccounts = (
network: string
): Array<Account> => {
if (network) {
return state.filter(addr => addr.deviceState === device.state && addr.network === network);
return state.filter(
addr => (addr.deviceState === device.state || addr.imported) && addr.network === network
);
}
return state.filter(addr => addr.deviceState === device.state);
return state.filter(addr => addr.deviceState === device.state || addr.imported);
};
const createAccount = (state: State, account: Account): State => {

@ -92,7 +92,7 @@ export const getSelectedAccount = (state: State): ?Account => {
return state.accounts.find(
a =>
a.imported === isImported &&
a.deviceState === device.state &&
(a.deviceState === device.state || a.imported) &&
a.index === index &&
a.network === locationState.network
);

Loading…
Cancel
Save