From 2ddd5df7dc950aa8f7dbea9498f63e97ab50b315 Mon Sep 17 00:00:00 2001 From: William O'Beirne Date: Mon, 16 Apr 2018 19:07:00 -0400 Subject: [PATCH] Fix Ledger DPaths, Improve Error Messaging (#1517) --- .../components/DeterministicWalletsModal.tsx | 22 ++++++---- .../WalletDecrypt/components/LedgerNano.tsx | 42 +++++++++++++++---- common/config/dpaths.ts | 4 +- common/libs/validators.ts | 12 +++++- .../config/networks/staticNetworks.ts | 9 ++-- common/sass/styles/overrides/alerts.scss | 22 ---------- common/translations/lang/en.json | 4 ++ 7 files changed, 68 insertions(+), 47 deletions(-) diff --git a/common/components/WalletDecrypt/components/DeterministicWalletsModal.tsx b/common/components/WalletDecrypt/components/DeterministicWalletsModal.tsx index 7ae8ab73..c12d6c78 100644 --- a/common/components/WalletDecrypt/components/DeterministicWalletsModal.tsx +++ b/common/components/WalletDecrypt/components/DeterministicWalletsModal.tsx @@ -199,15 +199,19 @@ class DeterministicWalletsModalClass extends React.PureComponent { private getAddresses(props: Props = this.props) { const { dPath, publicKey, chainCode, seed } = props; - if (dPath && ((publicKey && chainCode) || seed) && isValidPath(dPath)) { - this.props.getDeterministicWallets({ - seed, - dPath, - publicKey, - chainCode, - limit: WALLETS_PER_PAGE, - offset: WALLETS_PER_PAGE * this.state.page - }); + if (dPath && ((publicKey && chainCode) || seed)) { + if (isValidPath(dPath)) { + this.props.getDeterministicWallets({ + seed, + dPath, + publicKey, + chainCode, + limit: WALLETS_PER_PAGE, + offset: WALLETS_PER_PAGE * this.state.page + }); + } else { + console.error('Invalid dPath provided', dPath); + } } } diff --git a/common/components/WalletDecrypt/components/LedgerNano.tsx b/common/components/WalletDecrypt/components/LedgerNano.tsx index a46383d9..06c36e0c 100644 --- a/common/components/WalletDecrypt/components/LedgerNano.tsx +++ b/common/components/WalletDecrypt/components/LedgerNano.tsx @@ -9,6 +9,8 @@ import { connect } from 'react-redux'; import { AppState } from 'reducers'; import { SecureWalletName, ledgerReferralURL } from 'config'; import { getPaths, getSingleDPath } from 'selectors/config/wallet'; +import { getNetworkConfig } from 'selectors/config'; +import { NetworkConfig } from 'types/network'; import './LedgerNano.scss'; interface OwnProps { @@ -18,6 +20,7 @@ interface OwnProps { interface StateProps { dPath: DPath | undefined; dPaths: DPath[]; + network: NetworkConfig; } interface State { @@ -54,6 +57,7 @@ class LedgerNanoSDecryptClass extends PureComponent { } public render() { + const { network } = this.props; const { dPath, publicKey, chainCode, error, isLoading, showTip } = this.state; const showErr = error ? 'is-showing' : ''; @@ -74,12 +78,6 @@ class LedgerNanoSDecryptClass extends PureComponent { return (
- {showTip && ( -

- Tip: Make sure you're logged into the ethereum app on your hardware - wallet -

- )}