You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
2 years ago
|
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)}
|
||
|
/>
|
||
|
);
|
||
|
}
|