Skip to content

Commit

Permalink
removing the gas-warning and enabling the next button in the send page
Browse files Browse the repository at this point in the history
  • Loading branch information
NiranjanaBinoy committed Apr 12, 2023
1 parent 6439551 commit 3d2b87e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 43 deletions.
5 changes: 0 additions & 5 deletions ui/pages/send/send-content/send-content.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
Expand All @@ -46,7 +44,6 @@ export default class SendContent extends Component {
isEthGasPrice,
noGasPrice,
networkOrAccountNotSupports1559,
getIsBalanceInsufficient,
asset,
assetError,
recipient,
Expand All @@ -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 &&
Expand Down
36 changes: 0 additions & 36 deletions ui/pages/send/send-content/send-content.component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => ({
Expand Down Expand Up @@ -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(
<SendContent {...props} />,
mockStore,
);

const gasWarning = queryByTestId('gas-warning-message');

await waitFor(() => {
expect(gasWarning).toBeInTheDocument();
});
});
});

describe('Recipient Warning', () => {
Expand Down
7 changes: 5 additions & 2 deletions ui/pages/send/send-footer/send-footer.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 (
<PageContainerFooter
onCancel={() => 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')}
/>
);
Expand Down

0 comments on commit 3d2b87e

Please sign in to comment.