2022-09-21 18:22:36 +02:00
|
|
|
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';
|
2023-01-18 15:47:29 +01:00
|
|
|
import { AssetType } from '../../../shared/constants/transaction';
|
2022-09-21 18:22:36 +02:00
|
|
|
|
|
|
|
export default function ConfirmContractInteraction() {
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const history = useHistory();
|
|
|
|
|
|
|
|
const handleEditTransaction = async ({ txData }) => {
|
|
|
|
const { id } = txData;
|
2023-01-18 15:47:29 +01:00
|
|
|
await dispatch(editExistingTransaction(AssetType.native, id.toString()));
|
2022-09-21 18:22:36 +02:00
|
|
|
dispatch(clearConfirmTransaction());
|
|
|
|
};
|
|
|
|
|
|
|
|
const handleEdit = (confirmTransactionData) => {
|
|
|
|
handleEditTransaction(confirmTransactionData).then(() => {
|
|
|
|
history.push(SEND_ROUTE);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ConfirmTransactionBase
|
|
|
|
actionKey="confirm"
|
|
|
|
onEdit={(confirmTransactionData) => handleEdit(confirmTransactionData)}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|