Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error message for user when ledger fails when attempting to sign #692

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/intl/compiled/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7057,6 +7057,44 @@
"value": "Slashing"
}
],
"prRNB6": [
{
"type": 0,
"value": "There was a problem trying to sign with your Ledger device. Please verify your Ledger device has both "
},
{
"type": 1,
"value": "blindSigning"
},
{
"type": 0,
"value": " and "
},
{
"type": 1,
"value": "debugData"
},
{
"type": 0,
"value": " set to "
},
{
"type": 1,
"value": "enabled"
},
{
"type": 0,
"value": ". These can be accessed by selecting the Ethereum application and then entering the "
},
{
"type": 1,
"value": "settings"
},
{
"type": 0,
"value": " menu."
}
],
"ps8lLk": [
{
"type": 0,
Expand Down
3 changes: 3 additions & 0 deletions src/intl/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2689,6 +2689,9 @@
"pqC+qt": {
"message": "Slashing"
},
"prRNB6": {
"message": "There was a problem trying to sign with your Ledger device. Please verify your Ledger device has both {blindSigning} and {debugData} set to {enabled}. These can be accessed by selecting the Ethereum application and then entering the {settings} menu."
},
"ps8lLk": {
"description": "{expected} shows 'This is the expected scenario' and is bolded for emphasis",
"message": "Being offline while a supermajority (2/3) of validators is still online leads to relatively small penalties as there are still enough validators online for the chain to finalize. {expected}"
Expand Down
6 changes: 5 additions & 1 deletion src/pages/Transactions/Keylist/ActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ export const ActionButton = ({
);
}

if (transactionStatus === TransactionStatus.REJECTED) {
if (
[TransactionStatus.REJECTED, TransactionStatus.LEDGER_ERROR].includes(
transactionStatus
)
) {
return (
<Container onClick={onClick}>
<ButtonText>
Expand Down
24 changes: 21 additions & 3 deletions src/pages/Transactions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@ import { AbstractConnector } from '@web3-react/abstract-connector';
import _every from 'lodash/every';
import _some from 'lodash/some';
import { DepositKeyInterface, StoreState } from '../../store/reducers';
import { Alert } from '../../components/Alert';
import { Button } from '../../components/Button';
import { Heading } from '../../components/Heading';
import { Link } from '../../components/Link';
import { Paper } from '../../components/Paper';
import { Text } from '../../components/Text';
import { Button } from '../../components/Button';
import { Link } from '../../components/Link';
import { WorkflowPageTemplate } from '../../components/WorkflowPage/WorkflowPageTemplate';
import { routesEnum } from '../../Routes';
import { KeyList } from './Keylist';
import { handleMultipleTransactions } from './transactionUtils';
import { TARGET_NETWORK_CHAIN_ID } from '../ConnectWallet/web3Utils';
import { web3ReactInterface } from '../ConnectWallet';
import { WalletDisconnected } from '../ConnectWallet/WalletDisconnected';
import { WrongNetwork } from '../ConnectWallet/WrongNetwork';
import { WorkflowPageTemplate } from '../../components/WorkflowPage/WorkflowPageTemplate';
import {
DepositStatus,
DispatchTransactionStatusUpdateType,
Expand Down Expand Up @@ -156,6 +157,23 @@ const _TransactionsPage = ({
title={formatMessage({ defaultMessage: 'Transactions' })}
>
<Paper className="mt20">
{depositKeys.find(
k => k.transactionStatus === TransactionStatus.LEDGER_ERROR
) && (
<Alert variant="error" className="mb20">
<FormattedMessage
defaultMessage="There was a problem trying to sign with your Ledger device. Please verify your Ledger
device has both {blindSigning} and {debugData} set to {enabled}. These can be accessed by selecting
the Ethereum application and then entering the {settings} menu."
values={{
blindSigning: <strong>Blind Signing</strong>,
debugData: <strong>Debug Data</strong>,
enabled: <strong>Enabled</strong>,
settings: <strong>Settings</strong>,
}}
/>
</Alert>
)}
<Heading level={3} size="small" color="blueMedium">
{depositKeys.length === 1 ? (
<FormattedMessage defaultMessage="Confirm deposit" />
Expand Down
9 changes: 8 additions & 1 deletion src/pages/Transactions/transactionUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ const isUserRejectionError = (error: any) => {
return false;
};

// Error message when rejecting from ledger or blind signing and debug not enabled
const isLedgerError = (error: any) =>
error.code === -32603 && error.message.toLowerCase().includes('ledger');

/*
Recursive func for calling each transaction in succession after
the previous one has been signed
Expand Down Expand Up @@ -79,7 +83,8 @@ export const handleMultipleTransactions = async (
const remainingTxs = depositKeys.filter(
key =>
key.transactionStatus === TransactionStatus.READY ||
key.transactionStatus === TransactionStatus.REJECTED
key.transactionStatus === TransactionStatus.REJECTED ||
key.transactionStatus === TransactionStatus.LEDGER_ERROR
);

const nextTransaction = remainingTxs.shift();
Expand Down Expand Up @@ -134,6 +139,8 @@ export const handleMultipleTransactions = async (
.on('error', (error: any) => {
if (isUserRejectionError(error)) {
updateTransactionStatus(pubkey, TransactionStatus.REJECTED);
} else if (isLedgerError(error)) {
updateTransactionStatus(pubkey, TransactionStatus.LEDGER_ERROR);
} else {
updateTransactionStatus(pubkey, TransactionStatus.FAILED);
}
Expand Down
1 change: 1 addition & 0 deletions src/store/actions/depositFileActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export enum TransactionStatus {
'STARTED',
'SUCCEEDED',
'FAILED',
'LEDGER_ERROR',
'REJECTED',
}

Expand Down