Skip to content

Commit

Permalink
Fix display of edit button on confirm screen when sending tx with dat…
Browse files Browse the repository at this point in the history
…a to contract (#15812)
  • Loading branch information
danjm authored Sep 21, 2022
1 parent 2ba6e68 commit 12c0a8d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions ui/pages/confirm-contract-interaction/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './confirm-contract-interaction';
4 changes: 2 additions & 2 deletions ui/pages/confirm-transaction/confirm-transaction.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 12c0a8d

Please sign in to comment.