2018-06-23 08:52:45 +02:00
|
|
|
import { connect } from 'react-redux'
|
2020-02-24 23:58:26 +01:00
|
|
|
import { compose } from 'redux'
|
2018-06-23 08:52:45 +02:00
|
|
|
import { withRouter } from 'react-router-dom'
|
2019-03-22 00:03:30 +01:00
|
|
|
import { updateSend } from '../../store/actions'
|
|
|
|
import { clearConfirmTransaction } from '../../ducks/confirm-transaction/confirm-transaction.duck'
|
2018-06-23 08:52:45 +02:00
|
|
|
import ConfirmSendEther from './confirm-send-ether.component'
|
|
|
|
|
2020-02-15 21:34:12 +01:00
|
|
|
const mapStateToProps = (state) => {
|
2018-07-12 02:34:41 +02:00
|
|
|
const { confirmTransaction: { txData: { txParams } = {} } } = state
|
|
|
|
|
|
|
|
return {
|
|
|
|
txParams,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-15 21:34:12 +01:00
|
|
|
const mapDispatchToProps = (dispatch) => {
|
2018-06-23 08:52:45 +02:00
|
|
|
return {
|
2020-02-15 21:34:12 +01:00
|
|
|
editTransaction: (txData) => {
|
2018-06-23 08:52:45 +02:00
|
|
|
const { id, txParams } = txData
|
|
|
|
const {
|
2020-03-06 22:34:56 +01:00
|
|
|
from,
|
2018-06-23 08:52:45 +02:00
|
|
|
gas: gasLimit,
|
|
|
|
gasPrice,
|
|
|
|
to,
|
|
|
|
value: amount,
|
|
|
|
} = txParams
|
|
|
|
|
|
|
|
dispatch(updateSend({
|
2020-03-06 22:34:56 +01:00
|
|
|
from,
|
2018-06-23 08:52:45 +02:00
|
|
|
gasLimit,
|
|
|
|
gasPrice,
|
|
|
|
gasTotal: null,
|
|
|
|
to,
|
|
|
|
amount,
|
|
|
|
errors: { to: null, amount: null },
|
|
|
|
editingTransactionId: id && id.toString(),
|
|
|
|
}))
|
|
|
|
|
|
|
|
dispatch(clearConfirmTransaction())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default compose(
|
|
|
|
withRouter,
|
2020-07-14 17:20:41 +02:00
|
|
|
connect(mapStateToProps, mapDispatchToProps),
|
2018-06-23 08:52:45 +02:00
|
|
|
)(ConfirmSendEther)
|