Skip to content
86 changes: 0 additions & 86 deletions app/components/UI/Transactions/RetryModal/index.tsx

This file was deleted.

48 changes: 12 additions & 36 deletions app/components/UI/Transactions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import { showAlert } from '../../../actions/alert';
import ExtendedKeyringTypes from '../../../constants/keyringTypes';
import { NO_RPC_BLOCK_EXPLORER, RPC } from '../../../constants/network';
import Engine from '../../../core/Engine';
import ToastService from '../../../core/ToastService/ToastService';
import { getDeviceId } from '../../../core/Ledger/Ledger';
import { isNonEvmChainId } from '../../../core/Multichain/utils';
import NotificationManager from '../../../core/NotificationManager';
import { TransactionError } from '../../../core/Transaction/TransactionError';
import { TransactionDetailLocation } from '../../../core/Analytics/events/transactions';
import { collectibleContractsSelector } from '../../../reducers/collectibles';
import { selectSelectedInternalAccountFormattedAddress } from '../../../selectors/accountsController';
Expand Down Expand Up @@ -68,10 +68,10 @@ import PriceChartContext, {
} from '../AssetOverview/PriceChart/PriceChart.context';
import withQRHardwareAwareness from '../QRHardware/withQRHardwareAwareness';
import TransactionElement from '../TransactionElement';
import RetryModal from './RetryModal';
import TransactionsFooter from './TransactionsFooter';
import { filterDuplicateOutgoingTransactions } from './utils';
import { TabEmptyState } from '../../../component-library/components-temp/TabEmptyState';
import { getTransactionUpdateErrorToastOptions } from '../../../util/confirmation/transactions';

const createStyles = (colors) =>
StyleSheet.create({
Expand Down Expand Up @@ -215,10 +215,8 @@ class Transactions extends PureComponent {
refreshing: false,
cancelIsOpen: false,
speedUpIsOpen: false,
retryIsOpen: false,
confirmDisabled: false,
rpcBlockExplorer: undefined,
errorMsg: undefined,
isQRHardwareAccount: false,
isLedgerAccount: false,
};
Expand Down Expand Up @@ -560,20 +558,26 @@ class Transactions extends PureComponent {

handleSpeedUpTransactionFailure = (e) => {
const speedUpTxId = this.speedUpTxId;
const message = e instanceof TransactionError ? e.message : undefined;
Logger.error(e, { message: `speedUpTransaction failed `, speedUpTxId });
InteractionManager.runAfterInteractions(this.toggleRetry(message));
InteractionManager.runAfterInteractions(() => {
this.showTransactionUpdateErrorToast(e);
});
this.setState({ speedUpIsOpen: false, cancelIsOpen: false });
};

handleCancelTransactionFailure = (e) => {
const cancelTxId = this.cancelTxId;
const message = e instanceof TransactionError ? e.message : undefined;
Logger.error(e, { message: `cancelTransaction failed `, cancelTxId });
InteractionManager.runAfterInteractions(this.toggleRetry(message));
InteractionManager.runAfterInteractions(() => {
this.showTransactionUpdateErrorToast(e);
});
this.setState({ speedUpIsOpen: false, cancelIsOpen: false });
};

showTransactionUpdateErrorToast = (error) => {
ToastService.showToast(getTransactionUpdateErrorToastOptions(error));
};

speedUpTransaction = async (transactionObject) => {
try {
if (transactionObject?.error) {
Expand Down Expand Up @@ -715,28 +719,6 @@ class Transactions extends PureComponent {
/>
);

toggleRetry = (errorMsg) =>
this.setState((state) => ({ retryIsOpen: !state.retryIsOpen, errorMsg }));

retry = () => {
this.setState((state) => ({
retryIsOpen: !state.retryIsOpen,
errorMsg: undefined,
}));

//If the exitsing TX id true then it is a speed up retry
if (this.speedUpTxId) {
InteractionManager.runAfterInteractions(() => {
this.onSpeedUpAction(true, this.existingTx);
});
}
if (this.cancelTxId) {
InteractionManager.runAfterInteractions(() => {
this.onCancelAction(true, this.existingTx);
});
}
};

get footer() {
const {
chainId,
Expand Down Expand Up @@ -853,12 +835,6 @@ class Transactions extends PureComponent {
? this.renderLoader()
: this.renderList()}
</View>
<RetryModal
onCancelPress={() => this.toggleRetry(undefined)}
onConfirmPress={this.retry}
retryIsOpen={this.state.retryIsOpen}
errorMsg={this.state.errorMsg}
/>
</PriceChartProvider>
);
};
Expand Down
Loading
Loading