@@ -19,6 +19,7 @@ import {
19import { WALLET_TYPES } from 'lib/wallet';
19import { WALLET_TYPES } from 'lib/wallet';
20import useLoginView from 'lib/useLoginView';
20import useLoginView from 'lib/useLoginView';
21import useBreakpoints from 'lib/useBreakpoints';
21import useBreakpoints from 'lib/useBreakpoints';
23 composeValidator,
24 composeValidator,
24 buildCheckboxValidator,
25 buildCheckboxValidator,
@@ -31,6 +32,7 @@ import SubmitButton from 'form/SubmitButton';
31import Condition from 'form/Condition';
32import Condition from 'form/Condition';
32import { FORM_ERROR } from 'final-form';
33import { FORM_ERROR } from 'final-form';
33import { HdPathInput } from 'form/Inputs';
34import { HdPathInput } from 'form/Inputs';
35+import { getAuthToken } from 'lib/authToken';
35const PATH_OPTIONS = [
37const PATH_OPTIONS = [
36 { text: 'Ledger Live', value: LEDGER_LIVE_PATH },
38 { text: 'Ledger Live', value: LEDGER_LIVE_PATH },
@@ -45,7 +47,7 @@ const ACCOUNT_OPTIONS = times(20, i => ({
45export default function Ledger({ className, goHome }) {
47export default function Ledger({ className, goHome }) {
46 useLoginView(WALLET_TYPES.LEDGER);
48 useLoginView(WALLET_TYPES.LEDGER);
48− const { setWallet, setWalletHdPath } = useWallet();
50+ const { setWallet, setWalletHdPath, setAuthToken } = useWallet();
50 const validate = useMemo(
52 const validate = useMemo(
@@ -70,14 +72,21 @@ export default function Ledger({ className, goHome }) {
70 const chainCode = Buffer.from(info.chainCode, 'hex');
72 const chainCode = Buffer.from(info.chainCode, 'hex');
71 const pub = secp256k1.publicKeyConvert(publicKey, true);
73 const pub = secp256k1.publicKeyConvert(publicKey, true);
72 const hd = bip32.fromPublicKey(pub, chainCode);
74 const hd = bip32.fromPublicKey(pub, chainCode);
75+ const authToken = await getAuthToken({
77+ walletType: WALLET_TYPES.LEDGER,
78+ walletHdPath: addHdPrefix(values.hdpath),
81+ setAuthToken(authToken);
74 setWallet(Just(hd));
82 setWallet(Just(hd));
75 setWalletHdPath(addHdPrefix(values.hdpath));
83 setWalletHdPath(addHdPrefix(values.hdpath));
76 } catch (error) {
84 } catch (error) {
85+ console.error(error);
77 return { [FORM_ERROR]: error.message };
86 return { [FORM_ERROR]: error.message };
80− [setWallet, setWalletHdPath]
89+ [setAuthToken, setWallet, setWalletHdPath]
83 const onValues = useCallback(({ valid, values, form }) => {
92 const onValues = useCallback(({ valid, values, form }) => {
@@ -154,7 +163,8 @@ export default function Ledger({ className, goHome }) {
154 Connect and authenticate to your Ledger, and then open the "Ethereum"
163 Connect and authenticate to your Ledger, and then open the "Ethereum"
155 application. If you're running on older firmware, make sure the "browser
164 application. If you're running on older firmware, make sure the "browser
156 support" option is turned on. To sign transactions, you'll also need to
165 support" option is turned on. To sign transactions, you'll also need to
157− enable the "contract data" option.
166+ enable the "contract data" option. You will be prompted to sign a
167+ message. This allows Bridge to operate correctly.
158 </Grid.Item>
168 </Grid.Item>
160 <BridgeForm
170 <BridgeForm