1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

Fix display of edit button on confirm screen when sending tx with data to contract (#15812)

This commit is contained in:
Dan J Miller 2022-09-21 13:52:36 -02:30 committed by GitHub
parent 2ba6e68c8b
commit 12c0a8d1d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 2 deletions

View File

@ -0,0 +1,34 @@
import React from 'react';
import { useDispatch } from 'react-redux';
import { useHistory } from 'react-router-dom';
import ConfirmTransactionBase from '../confirm-transaction-base';
import { SEND_ROUTE } from '../../helpers/constants/routes';
import { editExistingTransaction } from '../../ducks/send';
import { clearConfirmTransaction } from '../../ducks/confirm-transaction/confirm-transaction.duck';
import { ASSET_TYPES } from '../../../shared/constants/transaction';
export default function ConfirmContractInteraction() {
const dispatch = useDispatch();
const history = useHistory();
const handleEditTransaction = async ({ txData }) => {
const { id } = txData;
await dispatch(editExistingTransaction(ASSET_TYPES.NATIVE, id.toString()));
dispatch(clearConfirmTransaction());
};
const handleEdit = (confirmTransactionData) => {
handleEditTransaction(confirmTransactionData).then(() => {
history.push(SEND_ROUTE);
});
};
return (
<ConfirmTransactionBase
actionKey="confirm"
onEdit={(confirmTransactionData) => handleEdit(confirmTransactionData)}
/>
);
}

View File

@ -0,0 +1 @@
export { default } from './confirm-contract-interaction';

View File

@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { Switch, Route } from 'react-router-dom';
import Loading from '../../components/ui/loading-screen';
import ConfirmTransactionSwitch from '../confirm-transaction-switch';
import ConfirmTransactionBase from '../confirm-transaction-base';
import ConfirmContractInteraction from '../confirm-contract-interaction';
import ConfirmSendEther from '../confirm-send-ether';
import ConfirmDeployContract from '../confirm-deploy-contract';
import ConfirmDecryptMessage from '../confirm-decrypt-message';
@ -180,7 +180,7 @@ export default class ConfirmTransaction extends Component {
<Route
exact
path={`${CONFIRM_TRANSACTION_ROUTE}/:id?${CONFIRM_TOKEN_METHOD_PATH}`}
component={ConfirmTransactionBase}
component={ConfirmContractInteraction}
/>
<Route
exact