mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-24 11:01:41 +01:00
57a29668f3
* Refactoring signature-request out to a new component. Wip * Styling polish and a better message display. * Update signature request header to no longer use account dropdown mini * Clean up code and styles * Code cleanup for signature request redesign branch * Fix signature request design for full screen * Replace makenode with object.entries in signature-request-message.component.js * Remove unused accounts prop from signature-request.component.js * Use beforeunload instead of window.onbeforeunload in signature-request
77 lines
2.2 KiB
JavaScript
77 lines
2.2 KiB
JavaScript
import { connect } from 'react-redux'
|
|
import { compose } from 'recompose'
|
|
import { withRouter } from 'react-router-dom'
|
|
import {
|
|
setTransactionToConfirm,
|
|
clearConfirmTransaction,
|
|
} from '../../ducks/confirm-transaction/confirm-transaction.duck'
|
|
import {
|
|
isTokenMethodAction,
|
|
} from '../../helpers/utils/transactions.util'
|
|
import {
|
|
fetchBasicGasAndTimeEstimates,
|
|
} from '../../ducks/gas/gas.duck'
|
|
|
|
import {
|
|
getContractMethodData,
|
|
getTokenParams,
|
|
} from '../../store/actions'
|
|
import ConfirmTransaction from './confirm-transaction.component'
|
|
import { unconfirmedTransactionsListSelector } from '../../selectors/confirm-transaction'
|
|
|
|
const mapStateToProps = (state, ownProps) => {
|
|
const {
|
|
metamask: {
|
|
send,
|
|
unapprovedTxs,
|
|
abTests: { fullScreenVsPopup },
|
|
conversionRate,
|
|
},
|
|
confirmTransaction,
|
|
} = state
|
|
const { match: { params = {} } } = ownProps
|
|
const { id } = params
|
|
|
|
const unconfirmedTransactions = unconfirmedTransactionsListSelector(state)
|
|
const totalUnconfirmed = unconfirmedTransactions.length
|
|
const transaction = totalUnconfirmed
|
|
? unapprovedTxs[id] || unconfirmedTransactions[totalUnconfirmed - 1]
|
|
: {}
|
|
const { id: transactionId, transactionCategory } = transaction
|
|
|
|
const trackABTest = false
|
|
|
|
return {
|
|
totalUnapprovedCount: totalUnconfirmed,
|
|
send,
|
|
confirmTransaction,
|
|
unapprovedTxs,
|
|
id,
|
|
paramsTransactionId: id && String(id),
|
|
transactionId: transactionId && String(transactionId),
|
|
unconfirmedTransactions,
|
|
transaction,
|
|
isTokenMethodAction: isTokenMethodAction(transactionCategory),
|
|
trackABTest,
|
|
fullScreenVsPopupTestGroup: fullScreenVsPopup,
|
|
conversionRate,
|
|
}
|
|
}
|
|
|
|
const mapDispatchToProps = dispatch => {
|
|
return {
|
|
setTransactionToConfirm: transactionId => {
|
|
dispatch(setTransactionToConfirm(transactionId))
|
|
},
|
|
clearConfirmTransaction: () => dispatch(clearConfirmTransaction()),
|
|
fetchBasicGasAndTimeEstimates: () => dispatch(fetchBasicGasAndTimeEstimates()),
|
|
getContractMethodData: (data) => dispatch(getContractMethodData(data)),
|
|
getTokenParams: (tokenAddress) => dispatch(getTokenParams(tokenAddress)),
|
|
}
|
|
}
|
|
|
|
export default compose(
|
|
withRouter,
|
|
connect(mapStateToProps, mapDispatchToProps),
|
|
)(ConfirmTransaction)
|