From 3d2b87e1ca0f6a9c7d7805adaa743b098547adb0 Mon Sep 17 00:00:00 2001
From: Niranjana Binoy <43930900+NiranjanaBinoy@users.noreply.github.com>
Date: Wed, 12 Apr 2023 18:42:24 -0400
Subject: [PATCH] removing the gas-warning and enabling the next button in the
send page
---
.../send-content/send-content.component.js | 5 ---
.../send-content.component.test.js | 36 -------------------
.../send/send-footer/send-footer.component.js | 7 ++--
3 files changed, 5 insertions(+), 43 deletions(-)
diff --git a/ui/pages/send/send-content/send-content.component.js b/ui/pages/send/send-content/send-content.component.js
index b5f1c26e81d7..b57b59a515e0 100644
--- a/ui/pages/send/send-content/send-content.component.js
+++ b/ui/pages/send/send-content/send-content.component.js
@@ -7,7 +7,6 @@ import {
ETH_GAS_PRICE_FETCH_WARNING_KEY,
GAS_PRICE_FETCH_FAILURE_ERROR_KEY,
GAS_PRICE_EXCESSIVE_ERROR_KEY,
- INSUFFICIENT_FUNDS_FOR_GAS_ERROR_KEY,
} from '../../../helpers/constants/error-keys';
import { AssetType } from '../../../../shared/constants/transaction';
import { CONTRACT_ADDRESS_LINK } from '../../../helpers/constants/common';
@@ -30,7 +29,6 @@ export default class SendContent extends Component {
isEthGasPrice: PropTypes.bool,
noGasPrice: PropTypes.bool,
networkOrAccountNotSupports1559: PropTypes.bool,
- getIsBalanceInsufficient: PropTypes.bool,
asset: PropTypes.object,
assetError: PropTypes.string,
recipient: PropTypes.object,
@@ -46,7 +44,6 @@ export default class SendContent extends Component {
isEthGasPrice,
noGasPrice,
networkOrAccountNotSupports1559,
- getIsBalanceInsufficient,
asset,
assetError,
recipient,
@@ -58,8 +55,6 @@ export default class SendContent extends Component {
gasError = GAS_PRICE_EXCESSIVE_ERROR_KEY;
} else if (noGasPrice) {
gasError = GAS_PRICE_FETCH_FAILURE_ERROR_KEY;
- } else if (getIsBalanceInsufficient) {
- gasError = INSUFFICIENT_FUNDS_FOR_GAS_ERROR_KEY;
}
const showHexData =
this.props.showHexData &&
diff --git a/ui/pages/send/send-content/send-content.component.test.js b/ui/pages/send/send-content/send-content.component.test.js
index 3868da35e804..660ecf9bbdb2 100644
--- a/ui/pages/send/send-content/send-content.component.test.js
+++ b/ui/pages/send/send-content/send-content.component.test.js
@@ -4,7 +4,6 @@ import configureMockStore from 'redux-mock-store';
import { renderWithProvider } from '../../../../test/lib/render-helpers';
import mockSendState from '../../../../test/data/mock-send-state.json';
-import { INSUFFICIENT_FUNDS_ERROR } from '../send.constants';
import SendContent from '.';
jest.mock('../../../store/actions', () => ({
@@ -148,41 +147,6 @@ describe('SendContent Component', () => {
expect(gasWarning).toBeInTheDocument();
});
});
-
- it('should show gas warning for gas error state in draft transaction', async () => {
- const props = {
- gasIsExcessive: false,
- showHexData: false,
- };
-
- const gasErrorState = {
- ...mockSendState,
- send: {
- ...mockSendState.send,
- draftTransactions: {
- '1-tx': {
- ...mockSendState.send.draftTransactions['1-tx'],
- gas: {
- error: INSUFFICIENT_FUNDS_ERROR,
- },
- },
- },
- },
- };
-
- const mockStore = configureMockStore()(gasErrorState);
-
- const { queryByTestId } = renderWithProvider(
- ,
- mockStore,
- );
-
- const gasWarning = queryByTestId('gas-warning-message');
-
- await waitFor(() => {
- expect(gasWarning).toBeInTheDocument();
- });
- });
});
describe('Recipient Warning', () => {
diff --git a/ui/pages/send/send-footer/send-footer.component.js b/ui/pages/send/send-footer/send-footer.component.js
index f16ad7e09c69..82afae25741d 100644
--- a/ui/pages/send/send-footer/send-footer.component.js
+++ b/ui/pages/send/send-footer/send-footer.component.js
@@ -8,6 +8,7 @@ import {
} from '../../../helpers/constants/routes';
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
import { SEND_STAGES } from '../../../ducks/send';
+import { INSUFFICIENT_FUNDS_ERROR } from '../send.constants';
export default class SendFooter extends Component {
static propTypes = {
@@ -92,12 +93,14 @@ export default class SendFooter extends Component {
render() {
const { t } = this.context;
- const { sendStage } = this.props;
+ const { sendStage, sendErrors } = this.props;
return (
this.onCancel()}
onSubmit={(e) => this.onSubmit(e)}
- disabled={this.props.disabled}
+ disabled={
+ this.props.disabled && sendErrors.gasFee !== INSUFFICIENT_FUNDS_ERROR
+ }
cancelText={sendStage === SEND_STAGES.EDIT ? t('reject') : t('cancel')}
/>
);