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:
parent
2ba6e68c8b
commit
12c0a8d1d5
@ -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)}
|
||||
/>
|
||||
);
|
||||
}
|
1
ui/pages/confirm-contract-interaction/index.js
Normal file
1
ui/pages/confirm-contract-interaction/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './confirm-contract-interaction';
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user