mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-24 11:01:41 +01:00
df85ab6e10
A new page has been created for viewing assets. This replaces the old `selectedToken` state, which previously would augment the home page to show token-specific information. The new asset page shows the standard token overview as seen previously on the home page, plus a history filtered to show just transactions relevant to that token. The actions that were available in the old token list menu have been moved to a "Token Options" menu that mirrors the "Account Options" menu. The `selectedTokenAddress` state has been removed, as it is no longer being used for anything. `getMetaMetricState` has been renamed to `getBackgroundMetaMetricState` because its sole purpose is extracting data from the background state to send metrics from the background. It's not really a selector, but it was convenient for it to use the same selectors the UI uses to extract background data, so I left it there for now. A new Redux store has been added to track state related to browser history. The most recent "overview" page (i.e. the home page or the asset page) is currently being tracked, so that actions taken from the asset page can return the user back to the asset page when the action has finished.
70 lines
1.9 KiB
JavaScript
70 lines
1.9 KiB
JavaScript
import { connect } from 'react-redux'
|
|
import { compose } from 'redux'
|
|
import { withRouter } from 'react-router-dom'
|
|
|
|
import {
|
|
goHome,
|
|
decryptMsg,
|
|
cancelDecryptMsg,
|
|
decryptMsgInline,
|
|
} from '../../store/actions'
|
|
import {
|
|
getTargetAccountWithSendEtherInfo,
|
|
conversionRateSelector,
|
|
} from '../../selectors'
|
|
import { clearConfirmTransaction } from '../../ducks/confirm-transaction/confirm-transaction.duck'
|
|
import ConfirmDecryptMessage from './confirm-decrypt-message.component'
|
|
import { getMostRecentOverviewPage } from '../../ducks/history/history'
|
|
|
|
function mapStateToProps (state) {
|
|
const { confirmTransaction,
|
|
metamask: { domainMetadata = {} },
|
|
} = state
|
|
|
|
const {
|
|
txData = {},
|
|
} = confirmTransaction
|
|
|
|
const { msgParams: { from } } = txData
|
|
|
|
const fromAccount = getTargetAccountWithSendEtherInfo(state, from)
|
|
|
|
return {
|
|
txData: txData,
|
|
domainMetadata,
|
|
fromAccount,
|
|
requester: null,
|
|
requesterAddress: null,
|
|
conversionRate: conversionRateSelector(state),
|
|
mostRecentOverviewPage: getMostRecentOverviewPage(state),
|
|
}
|
|
}
|
|
|
|
function mapDispatchToProps (dispatch) {
|
|
return {
|
|
goHome: () => dispatch(goHome()),
|
|
clearConfirmTransaction: () => dispatch(clearConfirmTransaction()),
|
|
decryptMessage: (msgData, event) => {
|
|
const params = msgData.msgParams
|
|
params.metamaskId = msgData.id
|
|
event.stopPropagation(event)
|
|
return dispatch(decryptMsg(params))
|
|
},
|
|
cancelDecryptMessage: (msgData, event) => {
|
|
event.stopPropagation(event)
|
|
return dispatch(cancelDecryptMsg(msgData))
|
|
},
|
|
decryptMessageInline: (msgData, event) => {
|
|
const params = msgData.msgParams
|
|
params.metamaskId = msgData.id
|
|
event.stopPropagation(event)
|
|
return dispatch(decryptMsgInline(params))
|
|
},
|
|
}
|
|
}
|
|
|
|
export default compose(
|
|
withRouter,
|
|
connect(mapStateToProps, mapDispatchToProps)
|
|
)(ConfirmDecryptMessage)
|