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

fix: speed up process error is not displayed when using ledger #28677

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion ui/components/app/app-components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@
@import 'name/index';
@import 'name/name-details/index';
@import 'confirm/info/row/index';
// @import 'transaction-failed-modal/index';
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
@import '../institutional/interactive-replacement-token-notification/index';
@import '../institutional/confirm-remove-jwt-modal/index';
@import '../institutional/custody-confirm-link-modal/index';
@import '../institutional/transaction-failed-modal/index';
///: END:ONLY_INCLUDE_IF
@import 'snaps/snap-insight/index';
2 changes: 1 addition & 1 deletion ui/components/app/modals/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
@import 'transaction-confirmed/index';
@import 'customize-nonce/index';
@import 'convert-token-to-nft-modal/index';
@import 'transaction-failed-modal/index';
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
@import '../../institutional/confirm-remove-jwt-modal/index';
@import '../../institutional/custody-confirm-link-modal/index';
@import '../../institutional/transaction-failed-modal/index';
///: END:ONLY_INCLUDE_IF

.modal {
Expand Down
14 changes: 7 additions & 7 deletions ui/components/app/modals/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { mmiActionsFactory } from '../../../store/institutional/institution-back
import ConfirmRemoveJWT from '../../institutional/confirm-remove-jwt-modal';
import CustodyConfirmLink from '../../institutional/custody-confirm-link-modal';
import InteractiveReplacementTokenModal from '../../institutional/interactive-replacement-token-modal';
import TransactionFailed from '../../institutional/transaction-failed-modal';
///: END:ONLY_INCLUDE_IF
import TransactionFailed from './transaction-failed-modal';
import HideTokenConfirmationModal from './hide-token-confirmation-modal';
import QRScanner from './qr-scanner';

Expand Down Expand Up @@ -274,9 +274,9 @@ const MODALS = {
},
},

///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
CONFIRM_REMOVE_JWT: {
contents: <ConfirmRemoveJWT />,
TRANSACTION_FAILED: {
disableBackdropClick: true,
contents: <TransactionFailed />,
mobileModalStyle: {
...modalContainerMobileStyle,
},
Expand All @@ -288,9 +288,9 @@ const MODALS = {
},
},

TRANSACTION_FAILED: {
disableBackdropClick: true,
contents: <TransactionFailed />,
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
CONFIRM_REMOVE_JWT: {
contents: <ConfirmRemoveJWT />,
mobileModalStyle: {
...modalContainerMobileStyle,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import { screen, fireEvent } from '@testing-library/react';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { renderWithProvider } from '../../../../test/lib/render-helpers';
import testData from '../../../../.storybook/test-data';
import { renderWithProvider } from '../../../../../test/lib/render-helpers';
import testData from '../../../../../.storybook/test-data';
import TransactionFailed from '.';

const mockErrorMessage = 'Something went wrong';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React, { memo } from 'react';
import withModalProps from '../../../helpers/higher-order-components/with-modal-props';
import { useI18nContext } from '../../../hooks/useI18nContext';
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props';
import { useI18nContext } from '../../../../hooks/useI18nContext';
import {
AlignItems,
BorderRadius,
Display,
FlexDirection,
TextAlign,
TextVariant,
} from '../../../helpers/constants/design-system';
} from '../../../../helpers/constants/design-system';
import {
Icon,
IconName,
Expand All @@ -22,7 +22,7 @@ import {
ButtonSize,
ModalContent,
ModalHeader,
} from '../../component-library';
} from '../../../component-library';

type TransactionFailedModalProps = {
hideModal: () => void;
Expand Down
24 changes: 18 additions & 6 deletions ui/pages/confirmations/hooks/useTransactionFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import {
createCancelTransaction,
createSpeedUpTransaction,
showModal,
updateCustomSwapsEIP1559GasParams,
updatePreviousGasParams,
updateSwapsUserFeeLevel,
Expand Down Expand Up @@ -153,12 +154,23 @@ export const useTransactionFunctions = ({
);
}, [dispatch, estimatedBaseFee, transaction]);

const speedUpTransaction = useCallback(() => {
dispatch(
createSpeedUpTransaction(transaction.id, transaction.txParams, {
estimatedBaseFee,
}),
);
const speedUpTransaction = useCallback(async () => {
try {
await dispatch(
createSpeedUpTransaction(transaction.id, transaction.txParams, {
estimatedBaseFee,
}),
);
} catch (error) {
dispatch(
showModal({
name: 'TRANSACTION_FAILED',
errorMessage: error?.message,
closeNotification: true,
}),
);
console.log('================> error inside speedUpTransaction', error);
}
}, [dispatch, estimatedBaseFee, transaction]);

const updateTransactionToTenPercentIncreasedGasFee = useCallback(
Expand Down
Loading