2021-02-04 19:15:23 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { compose } from 'redux';
|
|
|
|
import { withRouter } from 'react-router-dom';
|
|
|
|
import { clearConfirmTransaction } from '../../ducks/confirm-transaction/confirm-transaction.duck';
|
2021-06-10 19:53:15 +02:00
|
|
|
import { showSendTokenPage } from '../../store/actions';
|
2022-07-01 15:58:35 +02:00
|
|
|
import { editExistingTransaction } from '../../ducks/send';
|
2021-02-04 19:15:23 +01:00
|
|
|
import { sendTokenTokenAmountAndToAddressSelector } from '../../selectors';
|
2023-01-18 15:47:29 +01:00
|
|
|
import { AssetType } from '../../../shared/constants/transaction';
|
2021-02-04 19:15:23 +01:00
|
|
|
import ConfirmSendToken from './confirm-send-token.component';
|
2018-06-23 08:52:45 +02:00
|
|
|
|
2020-02-15 21:34:12 +01:00
|
|
|
const mapStateToProps = (state) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { tokenAmount } = sendTokenTokenAmountAndToAddressSelector(state);
|
2018-06-23 08:52:45 +02:00
|
|
|
|
|
|
|
return {
|
2018-07-14 22:47:07 +02:00
|
|
|
tokenAmount,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
|
|
|
};
|
2018-06-23 08:52:45 +02:00
|
|
|
|
2020-02-15 21:34:12 +01:00
|
|
|
const mapDispatchToProps = (dispatch) => {
|
2018-06-23 08:52:45 +02:00
|
|
|
return {
|
2022-07-01 15:58:35 +02:00
|
|
|
editExistingTransaction: async ({ txData }) => {
|
2021-06-23 23:35:25 +02:00
|
|
|
const { id } = txData;
|
2023-01-18 15:47:29 +01:00
|
|
|
await dispatch(editExistingTransaction(AssetType.token, id.toString()));
|
2022-07-01 15:58:35 +02:00
|
|
|
await dispatch(clearConfirmTransaction());
|
|
|
|
await dispatch(showSendTokenPage());
|
2018-06-23 08:52:45 +02:00
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
|
|
|
};
|
2018-06-23 08:52:45 +02:00
|
|
|
|
|
|
|
export default compose(
|
|
|
|
withRouter,
|
2020-07-14 17:20:41 +02:00
|
|
|
connect(mapStateToProps, mapDispatchToProps),
|
2021-02-04 19:15:23 +01:00
|
|
|
)(ConfirmSendToken);
|