mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add react/no-unused-prop-types
ESLint rule (#7655)
* Add `react/no-unused-prop-types` rule All detected unused prop types have been removed. I have attempted to ensure these props are no longer passed in either. * Update handling of props to avoid false positive lint errors These cases were detected by `react/no-unused-prop-types` as being unused props, even though they were used. These minor adjustments prevent them from being flagged as errors. * Update unit tests Many of these tests were just checking that specific props were passed from containers or to a child component. These were deleted, as I can't imagine how they'd be useful. * Disable `react/no-unused-prop-types` in `componentWillReceiveProps The rule `react/no-unused-prop-types` doesn't seem to be detecting props used within `UNSAFE_componentWillReceiveProps`. The two cases have been disabled temporarily until we can replace these unsafe lifecycle functions.
This commit is contained in:
parent
265d253f09
commit
49a525b9f8
@ -153,6 +153,7 @@
|
|||||||
"operator-linebreak": [2, "after", { "overrides": { "?": "ignore", ":": "ignore" } }],
|
"operator-linebreak": [2, "after", { "overrides": { "?": "ignore", ":": "ignore" } }],
|
||||||
"padded-blocks": "off",
|
"padded-blocks": "off",
|
||||||
"quotes": [2, "single", {"avoidEscape": true, "allowTemplateLiterals": true}],
|
"quotes": [2, "single", {"avoidEscape": true, "allowTemplateLiterals": true}],
|
||||||
|
"react/no-unused-prop-types": "error",
|
||||||
"react/no-unused-state": 2,
|
"react/no-unused-state": 2,
|
||||||
"react/jsx-boolean-value": 2,
|
"react/jsx-boolean-value": 2,
|
||||||
"react/jsx-curly-brace-presence": [2, { "props": "never", "children": "never" }],
|
"react/jsx-curly-brace-presence": [2, { "props": "never", "children": "never" }],
|
||||||
|
@ -23,7 +23,6 @@ export default class AccountDetails extends Component {
|
|||||||
label: PropTypes.string.isRequired,
|
label: PropTypes.string.isRequired,
|
||||||
checksummedAddress: PropTypes.string.isRequired,
|
checksummedAddress: PropTypes.string.isRequired,
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
history: PropTypes.object.isRequired,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { compose } from 'recompose'
|
import { compose } from 'recompose'
|
||||||
import { withRouter } from 'react-router-dom'
|
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { hideSidebar, showModal } from '../../../store/actions'
|
import { hideSidebar, showModal } from '../../../store/actions'
|
||||||
import AccountDetails from './account-details.component'
|
import AccountDetails from './account-details.component'
|
||||||
@ -15,7 +14,6 @@ function mapDispatchToProps (dispatch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const AccountDetailsContainer = compose(
|
const AccountDetailsContainer = compose(
|
||||||
withRouter,
|
|
||||||
connect(null, mapDispatchToProps)
|
connect(null, mapDispatchToProps)
|
||||||
)(AccountDetails)
|
)(AccountDetails)
|
||||||
|
|
||||||
|
@ -32,13 +32,6 @@ export default class ConfirmPageContainer extends Component {
|
|||||||
contentComponent: PropTypes.node,
|
contentComponent: PropTypes.node,
|
||||||
errorKey: PropTypes.string,
|
errorKey: PropTypes.string,
|
||||||
errorMessage: PropTypes.string,
|
errorMessage: PropTypes.string,
|
||||||
fiatTransactionAmount: PropTypes.string,
|
|
||||||
fiatTransactionFee: PropTypes.string,
|
|
||||||
fiatTransactionTotal: PropTypes.string,
|
|
||||||
ethTransactionAmount: PropTypes.string,
|
|
||||||
ethTransactionFee: PropTypes.string,
|
|
||||||
ethTransactionTotal: PropTypes.string,
|
|
||||||
onEditGas: PropTypes.func,
|
|
||||||
dataComponent: PropTypes.node,
|
dataComponent: PropTypes.node,
|
||||||
detailsComponent: PropTypes.node,
|
detailsComponent: PropTypes.node,
|
||||||
identiconAddress: PropTypes.string,
|
identiconAddress: PropTypes.string,
|
||||||
|
@ -12,13 +12,10 @@ export default class GasModalPageContainer extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
hideModal: PropTypes.func,
|
|
||||||
hideBasic: PropTypes.bool,
|
hideBasic: PropTypes.bool,
|
||||||
updateCustomGasPrice: PropTypes.func,
|
updateCustomGasPrice: PropTypes.func,
|
||||||
updateCustomGasLimit: PropTypes.func,
|
updateCustomGasLimit: PropTypes.func,
|
||||||
currentTimeEstimate: PropTypes.string,
|
currentTimeEstimate: PropTypes.string,
|
||||||
customGasPrice: PropTypes.number,
|
|
||||||
customGasLimit: PropTypes.number,
|
|
||||||
insufficientBalance: PropTypes.bool,
|
insufficientBalance: PropTypes.bool,
|
||||||
fetchBasicGasAndTimeEstimates: PropTypes.func,
|
fetchBasicGasAndTimeEstimates: PropTypes.func,
|
||||||
fetchGasEstimates: PropTypes.func,
|
fetchGasEstimates: PropTypes.func,
|
||||||
@ -35,7 +32,6 @@ export default class GasModalPageContainer extends Component {
|
|||||||
customModalGasPriceInHex: PropTypes.string,
|
customModalGasPriceInHex: PropTypes.string,
|
||||||
customModalGasLimitInHex: PropTypes.string,
|
customModalGasLimitInHex: PropTypes.string,
|
||||||
cancelAndClose: PropTypes.func,
|
cancelAndClose: PropTypes.func,
|
||||||
transactionFee: PropTypes.string,
|
|
||||||
blockTime: PropTypes.oneOfType([
|
blockTime: PropTypes.oneOfType([
|
||||||
PropTypes.string,
|
PropTypes.string,
|
||||||
PropTypes.number,
|
PropTypes.number,
|
||||||
|
@ -24,14 +24,15 @@ export default class GasPriceChart extends Component {
|
|||||||
updateCustomGasPrice: PropTypes.func,
|
updateCustomGasPrice: PropTypes.func,
|
||||||
}
|
}
|
||||||
|
|
||||||
renderChart ({
|
renderChart () {
|
||||||
currentPrice,
|
const {
|
||||||
gasPrices,
|
currentPrice,
|
||||||
estimatedTimes,
|
gasPrices,
|
||||||
gasPricesMax,
|
estimatedTimes,
|
||||||
estimatedTimesMax,
|
gasPricesMax,
|
||||||
updateCustomGasPrice,
|
estimatedTimesMax,
|
||||||
}) {
|
updateCustomGasPrice,
|
||||||
|
} = this.props
|
||||||
const chart = generateChart(gasPrices, estimatedTimes, gasPricesMax, estimatedTimesMax, this.context.t)
|
const chart = generateChart(gasPrices, estimatedTimes, gasPricesMax, estimatedTimesMax, this.context.t)
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
setTickPosition('y', 0, -5, 8)
|
setTickPosition('y', 0, -5, 8)
|
||||||
@ -95,7 +96,7 @@ export default class GasPriceChart extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
this.renderChart(this.props)
|
this.renderChart()
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
@ -93,11 +93,10 @@ describe('GasPriceChart Component', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('componentDidMount', () => {
|
describe('componentDidMount', () => {
|
||||||
it('should call this.renderChart with the components props', () => {
|
it('should call this.renderChart', () => {
|
||||||
assert(GasPriceChart.prototype.renderChart.callCount, 1)
|
assert(GasPriceChart.prototype.renderChart.callCount, 1)
|
||||||
wrapper.instance().componentDidMount()
|
wrapper.instance().componentDidMount()
|
||||||
assert(GasPriceChart.prototype.renderChart.callCount, 2)
|
assert(GasPriceChart.prototype.renderChart.callCount, 2)
|
||||||
assert.deepEqual(GasPriceChart.prototype.renderChart.getCall(1).args, [{ ...testProps }])
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -70,7 +70,6 @@ NotificationModal.propTypes = {
|
|||||||
showCancelButton: PropTypes.bool,
|
showCancelButton: PropTypes.bool,
|
||||||
showConfirmButton: PropTypes.bool,
|
showConfirmButton: PropTypes.bool,
|
||||||
onConfirm: PropTypes.func,
|
onConfirm: PropTypes.func,
|
||||||
t: PropTypes.func,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
|
@ -13,7 +13,6 @@ export default class TransactionBreakdown extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
transaction: PropTypes.object,
|
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
nativeCurrency: PropTypes.string.isRequired,
|
nativeCurrency: PropTypes.string.isRequired,
|
||||||
showFiat: PropTypes.bool,
|
showFiat: PropTypes.bool,
|
||||||
@ -25,7 +24,6 @@ export default class TransactionBreakdown extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
transaction: {},
|
|
||||||
showFiat: true,
|
showFiat: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,15 +11,15 @@ class Alert extends Component {
|
|||||||
|
|
||||||
UNSAFE_componentWillReceiveProps (nextProps) {
|
UNSAFE_componentWillReceiveProps (nextProps) {
|
||||||
if (!this.props.visible && nextProps.visible) {
|
if (!this.props.visible && nextProps.visible) {
|
||||||
this.animateIn(nextProps)
|
this.animateIn(nextProps.msg)
|
||||||
} else if (this.props.visible && !nextProps.visible) {
|
} else if (this.props.visible && !nextProps.visible) {
|
||||||
this.animateOut()
|
this.animateOut()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
animateIn (props) {
|
animateIn (msg) {
|
||||||
this.setState({
|
this.setState({
|
||||||
msg: props.msg,
|
msg: msg,
|
||||||
visible: true,
|
visible: true,
|
||||||
className: 'visible',
|
className: 'visible',
|
||||||
})
|
})
|
||||||
@ -51,7 +51,7 @@ class Alert extends Component {
|
|||||||
|
|
||||||
Alert.propTypes = {
|
Alert.propTypes = {
|
||||||
visible: PropTypes.bool.isRequired,
|
visible: PropTypes.bool.isRequired,
|
||||||
msg: PropTypes.string,
|
msg: PropTypes.string, /* eslint-disable-line react/no-unused-prop-types */
|
||||||
}
|
}
|
||||||
module.exports = Alert
|
module.exports = Alert
|
||||||
|
|
||||||
|
@ -29,11 +29,9 @@ class CopyButton extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const state = this.state
|
const { title, value } = this.props
|
||||||
const props = this.props
|
const { copied } = this.state
|
||||||
const value = props.value
|
const message = copied ? this.context.t('copiedButton') : title || this.context.t('copyButton')
|
||||||
const copied = state.copied
|
|
||||||
const message = copied ? this.context.t('copiedButton') : props.title || this.context.t('copyButton')
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { PureComponent } from 'react'
|
import React, { PureComponent } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import { GWEI } from '../../../helpers/constants/common'
|
|
||||||
|
|
||||||
export default class CurrencyDisplay extends PureComponent {
|
export default class CurrencyDisplay extends PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
@ -11,12 +11,6 @@ export default class CurrencyDisplay extends PureComponent {
|
|||||||
prefixComponent: PropTypes.node,
|
prefixComponent: PropTypes.node,
|
||||||
style: PropTypes.object,
|
style: PropTypes.object,
|
||||||
suffix: PropTypes.string,
|
suffix: PropTypes.string,
|
||||||
// Used in container
|
|
||||||
currency: PropTypes.string,
|
|
||||||
denomination: PropTypes.oneOf([GWEI]),
|
|
||||||
value: PropTypes.string,
|
|
||||||
numberOfDecimals: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
||||||
hideLabel: PropTypes.bool,
|
|
||||||
hideTitle: PropTypes.bool,
|
hideTitle: PropTypes.bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ const mapStateToProps = state => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mergeProps = (stateProps, dispatchProps, ownProps) => {
|
const mergeProps = (stateProps, _, ownProps) => {
|
||||||
const { nativeCurrency, currentCurrency, conversionRate, ...restStateProps } = stateProps
|
const { nativeCurrency, currentCurrency, conversionRate } = stateProps
|
||||||
const {
|
const {
|
||||||
value,
|
value,
|
||||||
numberOfDecimals = 2,
|
numberOfDecimals = 2,
|
||||||
@ -42,8 +42,6 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
|
|||||||
const suffix = propsSuffix || (hideLabel ? undefined : toCurrency.toUpperCase())
|
const suffix = propsSuffix || (hideLabel ? undefined : toCurrency.toUpperCase())
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...restStateProps,
|
|
||||||
...dispatchProps,
|
|
||||||
...restOwnProps,
|
...restOwnProps,
|
||||||
displayValue,
|
displayValue,
|
||||||
suffix,
|
suffix,
|
||||||
|
@ -21,7 +21,6 @@ export default class SenderToRecipient extends PureComponent {
|
|||||||
recipientEns: PropTypes.string,
|
recipientEns: PropTypes.string,
|
||||||
recipientAddress: PropTypes.string,
|
recipientAddress: PropTypes.string,
|
||||||
recipientNickname: PropTypes.string,
|
recipientNickname: PropTypes.string,
|
||||||
t: PropTypes.func,
|
|
||||||
variant: PropTypes.oneOf([DEFAULT_VARIANT, CARDS_VARIANT, FLAT_VARIANT]),
|
variant: PropTypes.oneOf([DEFAULT_VARIANT, CARDS_VARIANT, FLAT_VARIANT]),
|
||||||
addressOnly: PropTypes.bool,
|
addressOnly: PropTypes.bool,
|
||||||
assetImage: PropTypes.string,
|
assetImage: PropTypes.string,
|
||||||
|
@ -6,9 +6,7 @@ export default class TokenBalance extends PureComponent {
|
|||||||
static propTypes = {
|
static propTypes = {
|
||||||
string: PropTypes.string,
|
string: PropTypes.string,
|
||||||
symbol: PropTypes.string,
|
symbol: PropTypes.string,
|
||||||
error: PropTypes.string,
|
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
withSymbol: PropTypes.bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
@ -21,13 +21,18 @@ import {
|
|||||||
|
|
||||||
class MetaMetricsProvider extends Component {
|
class MetaMetricsProvider extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
network: PropTypes.string.isRequired,
|
|
||||||
environmentType: PropTypes.string.isRequired,
|
|
||||||
activeCurrency: PropTypes.string.isRequired,
|
|
||||||
accountType: PropTypes.string.isRequired,
|
accountType: PropTypes.string.isRequired,
|
||||||
metaMetricsSendCount: PropTypes.number.isRequired,
|
activeCurrency: PropTypes.string.isRequired,
|
||||||
children: PropTypes.object.isRequired,
|
children: PropTypes.object.isRequired,
|
||||||
|
confirmTransactionOrigin: PropTypes.string,
|
||||||
|
environmentType: PropTypes.string.isRequired,
|
||||||
history: PropTypes.object.isRequired,
|
history: PropTypes.object.isRequired,
|
||||||
|
metaMetricsId: PropTypes.string,
|
||||||
|
metaMetricsSendCount: PropTypes.number.isRequired,
|
||||||
|
network: PropTypes.string.isRequired,
|
||||||
|
numberOfTokens: PropTypes.number,
|
||||||
|
numberOfAccounts: PropTypes.number,
|
||||||
|
participateInMetaMetrics: PropTypes.bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
static childContextTypes = {
|
static childContextTypes = {
|
||||||
@ -51,8 +56,18 @@ class MetaMetricsProvider extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getChildContext () {
|
getChildContext () {
|
||||||
const props = this.props
|
const {
|
||||||
const { pathname } = location
|
network,
|
||||||
|
environmentType,
|
||||||
|
activeCurrency,
|
||||||
|
accountType,
|
||||||
|
confirmTransactionOrigin,
|
||||||
|
metaMetricsId,
|
||||||
|
participateInMetaMetrics,
|
||||||
|
metaMetricsSendCount,
|
||||||
|
numberOfTokens,
|
||||||
|
numberOfAccounts,
|
||||||
|
} = this.props
|
||||||
const { previousPath, currentPath } = this.state
|
const { previousPath, currentPath } = this.state
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -62,14 +77,20 @@ class MetaMetricsProvider extends Component {
|
|||||||
const { pathname: overRidePathName = '' } = overrides
|
const { pathname: overRidePathName = '' } = overrides
|
||||||
const isSendFlow = Boolean(name.match(/^send|^confirm/) || overRidePathName.match(/send|confirm/))
|
const isSendFlow = Boolean(name.match(/^send|^confirm/) || overRidePathName.match(/send|confirm/))
|
||||||
|
|
||||||
if (props.participateInMetaMetrics || config.isOptIn) {
|
if (participateInMetaMetrics || config.isOptIn) {
|
||||||
return sendMetaMetricsEvent({
|
return sendMetaMetricsEvent({
|
||||||
...props,
|
network,
|
||||||
|
environmentType,
|
||||||
|
activeCurrency,
|
||||||
|
accountType,
|
||||||
|
confirmTransactionOrigin,
|
||||||
|
metaMetricsId,
|
||||||
|
numberOfTokens,
|
||||||
|
numberOfAccounts,
|
||||||
...config,
|
...config,
|
||||||
previousPath,
|
previousPath,
|
||||||
currentPath,
|
currentPath,
|
||||||
pathname,
|
excludeMetaMetricsId: isSendFlow && !sendCountIsTrackable(metaMetricsSendCount + 1),
|
||||||
excludeMetaMetricsId: isSendFlow && !sendCountIsTrackable(props.metaMetricsSendCount + 1),
|
|
||||||
...overrides,
|
...overrides,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ export default class ConfirmAddSuggestedToken extends Component {
|
|||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
clearPendingTokens: PropTypes.func,
|
|
||||||
addToken: PropTypes.func,
|
addToken: PropTypes.func,
|
||||||
pendingTokens: PropTypes.object,
|
pendingTokens: PropTypes.object,
|
||||||
removeSuggestedTokens: PropTypes.func,
|
removeSuggestedTokens: PropTypes.func,
|
||||||
|
@ -13,13 +13,10 @@ export default class ConfirmApproveContent extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
amount: PropTypes.string,
|
|
||||||
txFeeTotal: PropTypes.string,
|
|
||||||
tokenAmount: PropTypes.string,
|
tokenAmount: PropTypes.string,
|
||||||
customTokenAmount: PropTypes.string,
|
customTokenAmount: PropTypes.string,
|
||||||
tokenSymbol: PropTypes.string,
|
tokenSymbol: PropTypes.string,
|
||||||
siteImage: PropTypes.string,
|
siteImage: PropTypes.string,
|
||||||
tokenAddress: PropTypes.string,
|
|
||||||
showCustomizeGasModal: PropTypes.func,
|
showCustomizeGasModal: PropTypes.func,
|
||||||
showEditApprovalPermissionModal: PropTypes.func,
|
showEditApprovalPermissionModal: PropTypes.func,
|
||||||
origin: PropTypes.string,
|
origin: PropTypes.string,
|
||||||
|
@ -84,7 +84,6 @@ export default class ConfirmApprove extends Component {
|
|||||||
contentComponent={(
|
contentComponent={(
|
||||||
<ConfirmApproveContent
|
<ConfirmApproveContent
|
||||||
siteImage={siteImage}
|
siteImage={siteImage}
|
||||||
tokenAddress={tokenAddress}
|
|
||||||
setCustomAmount={(newAmount) => {
|
setCustomAmount={(newAmount) => {
|
||||||
this.setState({ customPermissionAmount: newAmount })
|
this.setState({ customPermissionAmount: newAmount })
|
||||||
}}
|
}}
|
||||||
|
@ -27,23 +27,13 @@ export default class ConfirmTransactionBase extends Component {
|
|||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
// react-router props
|
// react-router props
|
||||||
match: PropTypes.object,
|
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
// Redux props
|
// Redux props
|
||||||
balance: PropTypes.string,
|
balance: PropTypes.string,
|
||||||
cancelTransaction: PropTypes.func,
|
cancelTransaction: PropTypes.func,
|
||||||
cancelAllTransactions: PropTypes.func,
|
cancelAllTransactions: PropTypes.func,
|
||||||
clearConfirmTransaction: PropTypes.func,
|
clearConfirmTransaction: PropTypes.func,
|
||||||
clearSend: PropTypes.func,
|
|
||||||
conversionRate: PropTypes.number,
|
conversionRate: PropTypes.number,
|
||||||
currentCurrency: PropTypes.string,
|
|
||||||
editTransaction: PropTypes.func,
|
|
||||||
ethTransactionAmount: PropTypes.string,
|
|
||||||
ethTransactionFee: PropTypes.string,
|
|
||||||
ethTransactionTotal: PropTypes.string,
|
|
||||||
fiatTransactionAmount: PropTypes.string,
|
|
||||||
fiatTransactionFee: PropTypes.string,
|
|
||||||
fiatTransactionTotal: PropTypes.string,
|
|
||||||
fromAddress: PropTypes.string,
|
fromAddress: PropTypes.string,
|
||||||
fromName: PropTypes.string,
|
fromName: PropTypes.string,
|
||||||
hexTransactionAmount: PropTypes.string,
|
hexTransactionAmount: PropTypes.string,
|
||||||
|
@ -10,7 +10,6 @@ import {
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
updateCustomNonce,
|
updateCustomNonce,
|
||||||
clearSend,
|
|
||||||
cancelTx,
|
cancelTx,
|
||||||
cancelTxs,
|
cancelTxs,
|
||||||
updateAndApproveTx,
|
updateAndApproveTx,
|
||||||
@ -56,7 +55,6 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
conversionRate,
|
conversionRate,
|
||||||
identities,
|
identities,
|
||||||
addressBook,
|
addressBook,
|
||||||
currentCurrency,
|
|
||||||
assetImages,
|
assetImages,
|
||||||
network,
|
network,
|
||||||
unapprovedTxs,
|
unapprovedTxs,
|
||||||
@ -101,12 +99,6 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
const transactionStatus = transaction ? transaction.status : ''
|
const transactionStatus = transaction ? transaction.status : ''
|
||||||
|
|
||||||
const {
|
const {
|
||||||
ethTransactionAmount,
|
|
||||||
ethTransactionFee,
|
|
||||||
ethTransactionTotal,
|
|
||||||
fiatTransactionAmount,
|
|
||||||
fiatTransactionFee,
|
|
||||||
fiatTransactionTotal,
|
|
||||||
hexTransactionAmount,
|
hexTransactionAmount,
|
||||||
hexTransactionFee,
|
hexTransactionFee,
|
||||||
hexTransactionTotal,
|
hexTransactionTotal,
|
||||||
@ -150,12 +142,6 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
toEns,
|
toEns,
|
||||||
toName,
|
toName,
|
||||||
toNickname,
|
toNickname,
|
||||||
ethTransactionAmount,
|
|
||||||
ethTransactionFee,
|
|
||||||
ethTransactionTotal,
|
|
||||||
fiatTransactionAmount,
|
|
||||||
fiatTransactionFee,
|
|
||||||
fiatTransactionTotal,
|
|
||||||
hexTransactionAmount,
|
hexTransactionAmount,
|
||||||
hexTransactionFee,
|
hexTransactionFee,
|
||||||
hexTransactionTotal,
|
hexTransactionTotal,
|
||||||
@ -164,7 +150,6 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
methodData,
|
methodData,
|
||||||
tokenProps,
|
tokenProps,
|
||||||
isTxReprice,
|
isTxReprice,
|
||||||
currentCurrency,
|
|
||||||
conversionRate,
|
conversionRate,
|
||||||
transactionStatus,
|
transactionStatus,
|
||||||
nonce,
|
nonce,
|
||||||
@ -198,7 +183,6 @@ export const mapDispatchToProps = dispatch => {
|
|||||||
dispatch(updateCustomNonce(value))
|
dispatch(updateCustomNonce(value))
|
||||||
},
|
},
|
||||||
clearConfirmTransaction: () => dispatch(clearConfirmTransaction()),
|
clearConfirmTransaction: () => dispatch(clearConfirmTransaction()),
|
||||||
clearSend: () => dispatch(clearSend()),
|
|
||||||
showTransactionConfirmedModal: ({ onSubmit }) => {
|
showTransactionConfirmedModal: ({ onSubmit }) => {
|
||||||
return dispatch(showModal({ name: 'TRANSACTION_CONFIRMED', onSubmit }))
|
return dispatch(showModal({ name: 'TRANSACTION_CONFIRMED', onSubmit }))
|
||||||
},
|
},
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
import assert from 'assert'
|
|
||||||
import { mapDispatchToProps } from '../confirm-transaction-base.container'
|
|
||||||
|
|
||||||
describe('Confirm Transaction Base Container', () => {
|
|
||||||
it('should map dispatch to props correctly', () => {
|
|
||||||
const props = mapDispatchToProps(() => 'mockDispatch')
|
|
||||||
|
|
||||||
assert.ok(typeof props.updateCustomNonce === 'function')
|
|
||||||
assert.ok(typeof props.clearConfirmTransaction === 'function')
|
|
||||||
assert.ok(typeof props.clearSend === 'function')
|
|
||||||
assert.ok(typeof props.showTransactionConfirmedModal === 'function')
|
|
||||||
assert.ok(typeof props.showCustomizeGasModal === 'function')
|
|
||||||
assert.ok(typeof props.updateGasAndCalculate === 'function')
|
|
||||||
assert.ok(typeof props.showRejectTransactionsConfirmationModal === 'function')
|
|
||||||
assert.ok(typeof props.cancelTransaction === 'function')
|
|
||||||
assert.ok(typeof props.cancelAllTransactions === 'function')
|
|
||||||
assert.ok(typeof props.sendTransaction === 'function')
|
|
||||||
assert.ok(typeof props.setMetaMetricsSendCount === 'function')
|
|
||||||
})
|
|
||||||
})
|
|
@ -23,8 +23,6 @@ import {
|
|||||||
export default class ConfirmTransactionSwitch extends Component {
|
export default class ConfirmTransactionSwitch extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
txData: PropTypes.object,
|
txData: PropTypes.object,
|
||||||
isEtherTransaction: PropTypes.bool,
|
|
||||||
isTokenMethod: PropTypes.bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
redirectToTransaction () {
|
redirectToTransaction () {
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import ConfirmTransactionSwitch from './confirm-transaction-switch.component'
|
import ConfirmTransactionSwitch from './confirm-transaction-switch.component'
|
||||||
import {
|
|
||||||
TOKEN_METHOD_TRANSFER,
|
|
||||||
TOKEN_METHOD_APPROVE,
|
|
||||||
TOKEN_METHOD_TRANSFER_FROM,
|
|
||||||
SEND_ETHER_ACTION_KEY,
|
|
||||||
} from '../../helpers/constants/transactions'
|
|
||||||
import { unconfirmedTransactionsListSelector } from '../../selectors/confirm-transaction'
|
import { unconfirmedTransactionsListSelector } from '../../selectors/confirm-transaction'
|
||||||
|
|
||||||
const mapStateToProps = (state, ownProps) => {
|
const mapStateToProps = (state, ownProps) => {
|
||||||
@ -23,8 +17,6 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
txData: transaction,
|
txData: transaction,
|
||||||
isEtherTransaction: transaction && transaction.transactionCategory === SEND_ETHER_ACTION_KEY,
|
|
||||||
isTokenMethod: [TOKEN_METHOD_APPROVE, TOKEN_METHOD_TRANSFER, TOKEN_METHOD_TRANSFER_FROM].includes(transaction && transaction.transactionCategory && transaction.transactionCategory.toLowerCase()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,11 +30,8 @@ export default class ConfirmTransaction extends Component {
|
|||||||
static propTypes = {
|
static propTypes = {
|
||||||
history: PropTypes.object.isRequired,
|
history: PropTypes.object.isRequired,
|
||||||
totalUnapprovedCount: PropTypes.number.isRequired,
|
totalUnapprovedCount: PropTypes.number.isRequired,
|
||||||
match: PropTypes.object,
|
|
||||||
send: PropTypes.object,
|
send: PropTypes.object,
|
||||||
unconfirmedTransactions: PropTypes.array,
|
|
||||||
setTransactionToConfirm: PropTypes.func,
|
setTransactionToConfirm: PropTypes.func,
|
||||||
confirmTransaction: PropTypes.object,
|
|
||||||
clearConfirmTransaction: PropTypes.func,
|
clearConfirmTransaction: PropTypes.func,
|
||||||
fetchBasicGasAndTimeEstimates: PropTypes.func,
|
fetchBasicGasAndTimeEstimates: PropTypes.func,
|
||||||
transaction: PropTypes.object,
|
transaction: PropTypes.object,
|
||||||
@ -45,7 +42,6 @@ export default class ConfirmTransaction extends Component {
|
|||||||
isTokenMethodAction: PropTypes.bool,
|
isTokenMethodAction: PropTypes.bool,
|
||||||
fullScreenVsPopupTestGroup: PropTypes.string,
|
fullScreenVsPopupTestGroup: PropTypes.string,
|
||||||
trackABTest: PropTypes.bool,
|
trackABTest: PropTypes.bool,
|
||||||
conversionRate: PropTypes.number,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
|
@ -25,9 +25,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
send,
|
send,
|
||||||
unapprovedTxs,
|
unapprovedTxs,
|
||||||
abTests: { fullScreenVsPopup },
|
abTests: { fullScreenVsPopup },
|
||||||
conversionRate,
|
|
||||||
},
|
},
|
||||||
confirmTransaction,
|
|
||||||
} = state
|
} = state
|
||||||
const { match: { params = {} } } = ownProps
|
const { match: { params = {} } } = ownProps
|
||||||
const { id } = params
|
const { id } = params
|
||||||
@ -44,17 +42,14 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
return {
|
return {
|
||||||
totalUnapprovedCount: totalUnconfirmed,
|
totalUnapprovedCount: totalUnconfirmed,
|
||||||
send,
|
send,
|
||||||
confirmTransaction,
|
|
||||||
unapprovedTxs,
|
unapprovedTxs,
|
||||||
id,
|
id,
|
||||||
paramsTransactionId: id && String(id),
|
paramsTransactionId: id && String(id),
|
||||||
transactionId: transactionId && String(transactionId),
|
transactionId: transactionId && String(transactionId),
|
||||||
unconfirmedTransactions,
|
|
||||||
transaction,
|
transaction,
|
||||||
isTokenMethodAction: isTokenMethodAction(transactionCategory),
|
isTokenMethodAction: isTokenMethodAction(transactionCategory),
|
||||||
trackABTest,
|
trackABTest,
|
||||||
fullScreenVsPopupTestGroup: fullScreenVsPopup,
|
fullScreenVsPopupTestGroup: fullScreenVsPopup,
|
||||||
conversionRate,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,6 @@ AccountList.propTypes = {
|
|||||||
getPage: PropTypes.func.isRequired,
|
getPage: PropTypes.func.isRequired,
|
||||||
network: PropTypes.string,
|
network: PropTypes.string,
|
||||||
selectedAccount: PropTypes.string,
|
selectedAccount: PropTypes.string,
|
||||||
history: PropTypes.object,
|
|
||||||
onUnlockAccount: PropTypes.func,
|
onUnlockAccount: PropTypes.func,
|
||||||
onCancel: PropTypes.func,
|
onCancel: PropTypes.func,
|
||||||
onAccountRestriction: PropTypes.func,
|
onAccountRestriction: PropTypes.func,
|
||||||
|
@ -206,7 +206,6 @@ class ConnectHardwareForm extends Component {
|
|||||||
onAccountChange={this.onAccountChange}
|
onAccountChange={this.onAccountChange}
|
||||||
network={this.props.network}
|
network={this.props.network}
|
||||||
getPage={this.getPage}
|
getPage={this.getPage}
|
||||||
history={this.props.history}
|
|
||||||
onUnlockAccount={this.onUnlockAccount}
|
onUnlockAccount={this.onUnlockAccount}
|
||||||
onForgetDevice={this.onForgetDevice}
|
onForgetDevice={this.onForgetDevice}
|
||||||
onCancel={this.onCancel}
|
onCancel={this.onCancel}
|
||||||
@ -226,9 +225,6 @@ class ConnectHardwareForm extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ConnectHardwareForm.propTypes = {
|
ConnectHardwareForm.propTypes = {
|
||||||
hideModal: PropTypes.func,
|
|
||||||
showImportPage: PropTypes.func,
|
|
||||||
showConnectPage: PropTypes.func,
|
|
||||||
connectHardware: PropTypes.func,
|
connectHardware: PropTypes.func,
|
||||||
checkHardwareStatus: PropTypes.func,
|
checkHardwareStatus: PropTypes.func,
|
||||||
forgetDevice: PropTypes.func,
|
forgetDevice: PropTypes.func,
|
||||||
@ -236,9 +232,7 @@ ConnectHardwareForm.propTypes = {
|
|||||||
hideAlert: PropTypes.func,
|
hideAlert: PropTypes.func,
|
||||||
unlockHardwareWalletAccount: PropTypes.func,
|
unlockHardwareWalletAccount: PropTypes.func,
|
||||||
setHardwareWalletDefaultHdPath: PropTypes.func,
|
setHardwareWalletDefaultHdPath: PropTypes.func,
|
||||||
numberOfExistingAccounts: PropTypes.number,
|
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
t: PropTypes.func,
|
|
||||||
network: PropTypes.string,
|
network: PropTypes.string,
|
||||||
accounts: PropTypes.object,
|
accounts: PropTypes.object,
|
||||||
address: PropTypes.string,
|
address: PropTypes.string,
|
||||||
@ -247,10 +241,9 @@ ConnectHardwareForm.propTypes = {
|
|||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
const {
|
const {
|
||||||
metamask: { network, selectedAddress, identities = {} },
|
metamask: { network, selectedAddress },
|
||||||
} = state
|
} = state
|
||||||
const accounts = getMetaMaskAccounts(state)
|
const accounts = getMetaMaskAccounts(state)
|
||||||
const numberOfExistingAccounts = Object.keys(identities).length
|
|
||||||
const {
|
const {
|
||||||
appState: { defaultHdPaths },
|
appState: { defaultHdPaths },
|
||||||
} = state
|
} = state
|
||||||
@ -259,7 +252,6 @@ const mapStateToProps = state => {
|
|||||||
network,
|
network,
|
||||||
accounts,
|
accounts,
|
||||||
address: selectedAddress,
|
address: selectedAddress,
|
||||||
numberOfExistingAccounts,
|
|
||||||
defaultHdPaths,
|
defaultHdPaths,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,8 +273,6 @@ const mapDispatchToProps = dispatch => {
|
|||||||
unlockHardwareWalletAccount: (index, deviceName, hdPath) => {
|
unlockHardwareWalletAccount: (index, deviceName, hdPath) => {
|
||||||
return dispatch(actions.unlockHardwareWalletAccount(index, deviceName, hdPath))
|
return dispatch(actions.unlockHardwareWalletAccount(index, deviceName, hdPath))
|
||||||
},
|
},
|
||||||
showImportPage: () => dispatch(actions.showImportPage()),
|
|
||||||
showConnectPage: () => dispatch(actions.showConnectPage()),
|
|
||||||
showAlert: (msg) => dispatch(actions.showAlert(msg)),
|
showAlert: (msg) => dispatch(actions.showAlert(msg)),
|
||||||
hideAlert: () => dispatch(actions.hideAlert()),
|
hideAlert: () => dispatch(actions.hideAlert()),
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,6 @@ export default class CreateAccountPage extends Component {
|
|||||||
CreateAccountPage.propTypes = {
|
CreateAccountPage.propTypes = {
|
||||||
location: PropTypes.object,
|
location: PropTypes.object,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
t: PropTypes.func,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateAccountPage.contextTypes = {
|
CreateAccountPage.contextTypes = {
|
||||||
|
@ -123,13 +123,11 @@ class JsonImportSubview extends Component {
|
|||||||
|
|
||||||
JsonImportSubview.propTypes = {
|
JsonImportSubview.propTypes = {
|
||||||
error: PropTypes.string,
|
error: PropTypes.string,
|
||||||
goHome: PropTypes.func,
|
|
||||||
displayWarning: PropTypes.func,
|
displayWarning: PropTypes.func,
|
||||||
firstAddress: PropTypes.string,
|
firstAddress: PropTypes.string,
|
||||||
importNewJsonAccount: PropTypes.func,
|
importNewJsonAccount: PropTypes.func,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
setSelectedAddress: PropTypes.func,
|
setSelectedAddress: PropTypes.func,
|
||||||
t: PropTypes.func,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
@ -141,7 +139,6 @@ const mapStateToProps = state => {
|
|||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
return {
|
return {
|
||||||
goHome: () => dispatch(actions.goHome()),
|
|
||||||
displayWarning: warning => dispatch(actions.displayWarning(warning)),
|
displayWarning: warning => dispatch(actions.displayWarning(warning)),
|
||||||
importNewJsonAccount: options => dispatch(actions.importNewAccount('JSON File', options)),
|
importNewJsonAccount: options => dispatch(actions.importNewAccount('JSON File', options)),
|
||||||
setSelectedAddress: (address) => dispatch(actions.setSelectedAddress(address)),
|
setSelectedAddress: (address) => dispatch(actions.setSelectedAddress(address)),
|
||||||
|
@ -80,14 +80,9 @@ export default class NewAccountCreateForm extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NewAccountCreateForm.propTypes = {
|
NewAccountCreateForm.propTypes = {
|
||||||
hideModal: PropTypes.func,
|
|
||||||
showImportPage: PropTypes.func,
|
|
||||||
showConnectPage: PropTypes.func,
|
|
||||||
createAccount: PropTypes.func,
|
createAccount: PropTypes.func,
|
||||||
numberOfExistingAccounts: PropTypes.number,
|
|
||||||
newAccountNumber: PropTypes.number,
|
newAccountNumber: PropTypes.number,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
t: PropTypes.func,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NewAccountCreateForm.contextTypes = {
|
NewAccountCreateForm.contextTypes = {
|
||||||
|
@ -10,7 +10,6 @@ const mapStateToProps = state => {
|
|||||||
return {
|
return {
|
||||||
network,
|
network,
|
||||||
address: selectedAddress,
|
address: selectedAddress,
|
||||||
numberOfExistingAccounts,
|
|
||||||
newAccountNumber,
|
newAccountNumber,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -18,7 +17,6 @@ const mapStateToProps = state => {
|
|||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
return {
|
return {
|
||||||
toCoinbase: address => dispatch(actions.buyEth({ network: '1', address, amount: 0 })),
|
toCoinbase: address => dispatch(actions.buyEth({ network: '1', address, amount: 0 })),
|
||||||
hideModal: () => dispatch(actions.hideModal()),
|
|
||||||
createAccount: newAccountName => {
|
createAccount: newAccountName => {
|
||||||
return dispatch(actions.addNewAccount())
|
return dispatch(actions.addNewAccount())
|
||||||
.then(newAccountAddress => {
|
.then(newAccountAddress => {
|
||||||
@ -27,8 +25,6 @@ const mapDispatchToProps = dispatch => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
showImportPage: () => dispatch(actions.showImportPage()),
|
|
||||||
showConnectPage: () => dispatch(actions.showConnectPage()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,9 +26,7 @@ export default class ConfirmSeedPhrase extends PureComponent {
|
|||||||
static propTypes = {
|
static propTypes = {
|
||||||
hideSeedPhraseBackupAfterOnboarding: PropTypes.func,
|
hideSeedPhraseBackupAfterOnboarding: PropTypes.func,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
onSubmit: PropTypes.func,
|
|
||||||
seedPhrase: PropTypes.string,
|
seedPhrase: PropTypes.string,
|
||||||
selectedAddress: PropTypes.string,
|
|
||||||
initializeThreeBox: PropTypes.func,
|
initializeThreeBox: PropTypes.func,
|
||||||
setSeedPhraseBackedUp: PropTypes.func,
|
setSeedPhraseBackedUp: PropTypes.func,
|
||||||
showingSeedPhraseBackupAfterOnboarding: PropTypes.bool,
|
showingSeedPhraseBackupAfterOnboarding: PropTypes.bool,
|
||||||
@ -196,8 +194,6 @@ export default class ConfirmSeedPhrase extends PureComponent {
|
|||||||
key={index}
|
key={index}
|
||||||
seedIndex={index}
|
seedIndex={index}
|
||||||
index={index}
|
index={index}
|
||||||
draggingSeedIndex={this.state.draggingSeedIndex}
|
|
||||||
setDraggingSeedIndex={this.setDraggingSeedIndex}
|
|
||||||
setHoveringIndex={this.setHoveringIndex}
|
setHoveringIndex={this.setHoveringIndex}
|
||||||
onDrop={this.onDrop}
|
onDrop={this.onDrop}
|
||||||
className="confirm-seed-phrase__seed-word--shuffled"
|
className="confirm-seed-phrase__seed-word--shuffled"
|
||||||
|
@ -5,14 +5,12 @@ import {
|
|||||||
hideSeedPhraseBackupAfterOnboarding,
|
hideSeedPhraseBackupAfterOnboarding,
|
||||||
initializeThreeBox,
|
initializeThreeBox,
|
||||||
} from '../../../../store/actions'
|
} from '../../../../store/actions'
|
||||||
import { getSelectedAddress } from '../../../../selectors/selectors'
|
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
const { appState: { showingSeedPhraseBackupAfterOnboarding } } = state
|
const { appState: { showingSeedPhraseBackupAfterOnboarding } } = state
|
||||||
|
|
||||||
return {
|
return {
|
||||||
showingSeedPhraseBackupAfterOnboarding,
|
showingSeedPhraseBackupAfterOnboarding,
|
||||||
selectedAddress: getSelectedAddress(state),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,11 +16,9 @@ class DraggableSeed extends Component {
|
|||||||
onClick: PropTypes.func,
|
onClick: PropTypes.func,
|
||||||
setHoveringIndex: PropTypes.func.isRequired,
|
setHoveringIndex: PropTypes.func.isRequired,
|
||||||
index: PropTypes.number,
|
index: PropTypes.number,
|
||||||
draggingSeedIndex: PropTypes.number,
|
|
||||||
word: PropTypes.string,
|
word: PropTypes.string,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
selected: PropTypes.bool,
|
selected: PropTypes.bool,
|
||||||
droppable: PropTypes.bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
@ -15,7 +15,6 @@ import MetaFoxLogo from '../../../components/ui/metafox-logo'
|
|||||||
|
|
||||||
export default class SeedPhrase extends PureComponent {
|
export default class SeedPhrase extends PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
address: PropTypes.string,
|
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
seedPhrase: PropTypes.string,
|
seedPhrase: PropTypes.string,
|
||||||
verifySeedPhrase: PropTypes.func,
|
verifySeedPhrase: PropTypes.func,
|
||||||
|
@ -8,7 +8,6 @@ import { INITIALIZE_CREATE_PASSWORD_ROUTE, INITIALIZE_SELECT_ACTION_ROUTE } from
|
|||||||
export default class Welcome extends PureComponent {
|
export default class Welcome extends PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
isInitialized: PropTypes.bool,
|
|
||||||
participateInMetaMetrics: PropTypes.bool,
|
participateInMetaMetrics: PropTypes.bool,
|
||||||
welcomeScreenSeen: PropTypes.bool,
|
welcomeScreenSeen: PropTypes.bool,
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,10 @@ import { closeWelcomeScreen } from '../../../store/actions'
|
|||||||
import Welcome from './welcome.component'
|
import Welcome from './welcome.component'
|
||||||
|
|
||||||
const mapStateToProps = ({ metamask }) => {
|
const mapStateToProps = ({ metamask }) => {
|
||||||
const { welcomeScreenSeen, isInitialized, participateInMetaMetrics } = metamask
|
const { welcomeScreenSeen, participateInMetaMetrics } = metamask
|
||||||
|
|
||||||
return {
|
return {
|
||||||
welcomeScreenSeen,
|
welcomeScreenSeen,
|
||||||
isInitialized,
|
|
||||||
participateInMetaMetrics,
|
participateInMetaMetrics,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ class RestoreVaultPage extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
warning: PropTypes.string,
|
|
||||||
createNewVaultAndRestore: PropTypes.func.isRequired,
|
createNewVaultAndRestore: PropTypes.func.isRequired,
|
||||||
leaveImportSeedScreenState: PropTypes.func,
|
leaveImportSeedScreenState: PropTypes.func,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
@ -192,7 +191,7 @@ class RestoreVaultPage extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
({ appState: { warning, isLoading } }) => ({ warning, isLoading }),
|
({ appState: { isLoading } }) => ({ isLoading }),
|
||||||
dispatch => ({
|
dispatch => ({
|
||||||
leaveImportSeedScreenState: () => {
|
leaveImportSeedScreenState: () => {
|
||||||
dispatch(unMarkPasswordForgotten())
|
dispatch(unMarkPasswordForgotten())
|
||||||
|
@ -12,8 +12,6 @@ export default class AccountListItem extends Component {
|
|||||||
static propTypes = {
|
static propTypes = {
|
||||||
account: PropTypes.object,
|
account: PropTypes.object,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
conversionRate: PropTypes.number,
|
|
||||||
currentCurrency: PropTypes.string,
|
|
||||||
displayAddress: PropTypes.bool,
|
displayAddress: PropTypes.bool,
|
||||||
displayBalance: PropTypes.bool,
|
displayBalance: PropTypes.bool,
|
||||||
handleClick: PropTypes.func,
|
handleClick: PropTypes.func,
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import {
|
import {
|
||||||
getConversionRate,
|
|
||||||
getCurrentCurrency,
|
|
||||||
getNativeCurrency,
|
getNativeCurrency,
|
||||||
} from '../send.selectors.js'
|
} from '../send.selectors.js'
|
||||||
import {
|
import {
|
||||||
@ -18,8 +16,6 @@ function mapStateToProps (state) {
|
|||||||
const isMainnet = getIsMainnet(state)
|
const isMainnet = getIsMainnet(state)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
conversionRate: getConversionRate(state),
|
|
||||||
currentCurrency: getCurrentCurrency(state),
|
|
||||||
nativeCurrency: getNativeCurrency(state),
|
nativeCurrency: getNativeCurrency(state),
|
||||||
balanceIsCached: isBalanceCached(state),
|
balanceIsCached: isBalanceCached(state),
|
||||||
showFiat: (isMainnet || !!showFiatInTestnets),
|
showFiat: (isMainnet || !!showFiatInTestnets),
|
||||||
|
@ -30,8 +30,6 @@ describe('account-list-item container', () => {
|
|||||||
|
|
||||||
it('should map the correct properties to props', () => {
|
it('should map the correct properties to props', () => {
|
||||||
assert.deepEqual(mapStateToProps({ isMainnet: true, showFiatInTestnets: false }), {
|
assert.deepEqual(mapStateToProps({ isMainnet: true, showFiatInTestnets: false }), {
|
||||||
conversionRate: 'mockConversionRate',
|
|
||||||
currentCurrency: 'mockCurrentCurrency',
|
|
||||||
nativeCurrency: 'mockNativeCurrency',
|
nativeCurrency: 'mockNativeCurrency',
|
||||||
balanceIsCached: 'mockBalanceIsCached',
|
balanceIsCached: 'mockBalanceIsCached',
|
||||||
showFiat: true,
|
showFiat: true,
|
||||||
@ -40,8 +38,6 @@ describe('account-list-item container', () => {
|
|||||||
|
|
||||||
it('should map the correct properties to props when in mainnet and showFiatInTestnet is true', () => {
|
it('should map the correct properties to props when in mainnet and showFiatInTestnet is true', () => {
|
||||||
assert.deepEqual(mapStateToProps({ isMainnet: true, showFiatInTestnets: true }), {
|
assert.deepEqual(mapStateToProps({ isMainnet: true, showFiatInTestnets: true }), {
|
||||||
conversionRate: 'mockConversionRate',
|
|
||||||
currentCurrency: 'mockCurrentCurrency',
|
|
||||||
nativeCurrency: 'mockNativeCurrency',
|
nativeCurrency: 'mockNativeCurrency',
|
||||||
balanceIsCached: 'mockBalanceIsCached',
|
balanceIsCached: 'mockBalanceIsCached',
|
||||||
showFiat: true,
|
showFiat: true,
|
||||||
@ -50,8 +46,6 @@ describe('account-list-item container', () => {
|
|||||||
|
|
||||||
it('should map the correct properties to props when not in mainnet and showFiatInTestnet is true', () => {
|
it('should map the correct properties to props when not in mainnet and showFiatInTestnet is true', () => {
|
||||||
assert.deepEqual(mapStateToProps({ isMainnet: false, showFiatInTestnets: true }), {
|
assert.deepEqual(mapStateToProps({ isMainnet: false, showFiatInTestnets: true }), {
|
||||||
conversionRate: 'mockConversionRate',
|
|
||||||
currentCurrency: 'mockCurrentCurrency',
|
|
||||||
nativeCurrency: 'mockNativeCurrency',
|
nativeCurrency: 'mockNativeCurrency',
|
||||||
balanceIsCached: 'mockBalanceIsCached',
|
balanceIsCached: 'mockBalanceIsCached',
|
||||||
showFiat: true,
|
showFiat: true,
|
||||||
@ -60,8 +54,6 @@ describe('account-list-item container', () => {
|
|||||||
|
|
||||||
it('should map the correct properties to props when not in mainnet and showFiatInTestnet is false', () => {
|
it('should map the correct properties to props when not in mainnet and showFiatInTestnet is false', () => {
|
||||||
assert.deepEqual(mapStateToProps({ isMainnet: false, showFiatInTestnets: false }), {
|
assert.deepEqual(mapStateToProps({ isMainnet: false, showFiatInTestnets: false }), {
|
||||||
conversionRate: 'mockConversionRate',
|
|
||||||
currentCurrency: 'mockCurrentCurrency',
|
|
||||||
nativeCurrency: 'mockNativeCurrency',
|
nativeCurrency: 'mockNativeCurrency',
|
||||||
balanceIsCached: 'mockBalanceIsCached',
|
balanceIsCached: 'mockBalanceIsCached',
|
||||||
showFiat: false,
|
showFiat: false,
|
||||||
|
@ -11,7 +11,6 @@ import { ellipsify } from '../../send.utils'
|
|||||||
export default class AddRecipient extends Component {
|
export default class AddRecipient extends Component {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
className: PropTypes.string,
|
|
||||||
query: PropTypes.string,
|
query: PropTypes.string,
|
||||||
ownedAccounts: PropTypes.array,
|
ownedAccounts: PropTypes.array,
|
||||||
addressBook: PropTypes.array,
|
addressBook: PropTypes.array,
|
||||||
@ -21,9 +20,6 @@ export default class AddRecipient extends Component {
|
|||||||
toError: PropTypes.string,
|
toError: PropTypes.string,
|
||||||
toWarning: PropTypes.string,
|
toWarning: PropTypes.string,
|
||||||
ensResolutionError: PropTypes.string,
|
ensResolutionError: PropTypes.string,
|
||||||
selectedToken: PropTypes.object,
|
|
||||||
hasHexData: PropTypes.bool,
|
|
||||||
tokens: PropTypes.array,
|
|
||||||
addressBookEntryName: PropTypes.string,
|
addressBookEntryName: PropTypes.string,
|
||||||
contacts: PropTypes.array,
|
contacts: PropTypes.array,
|
||||||
nonContacts: PropTypes.array,
|
nonContacts: PropTypes.array,
|
||||||
|
@ -26,7 +26,6 @@ export default class EnsInput extends Component {
|
|||||||
selectedAddress: PropTypes.string,
|
selectedAddress: PropTypes.string,
|
||||||
selectedName: PropTypes.string,
|
selectedName: PropTypes.string,
|
||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
updateSendTo: PropTypes.func,
|
|
||||||
updateEnsResolution: PropTypes.func,
|
updateEnsResolution: PropTypes.func,
|
||||||
scanQrCode: PropTypes.func,
|
scanQrCode: PropTypes.func,
|
||||||
updateEnsResolutionError: PropTypes.func,
|
updateEnsResolutionError: PropTypes.func,
|
||||||
|
@ -15,7 +15,6 @@ export default class SendAmountRow extends Component {
|
|||||||
]),
|
]),
|
||||||
balance: PropTypes.string,
|
balance: PropTypes.string,
|
||||||
conversionRate: PropTypes.number,
|
conversionRate: PropTypes.number,
|
||||||
convertedCurrency: PropTypes.string,
|
|
||||||
gasTotal: PropTypes.string,
|
gasTotal: PropTypes.string,
|
||||||
inError: PropTypes.bool,
|
inError: PropTypes.bool,
|
||||||
primaryCurrency: PropTypes.string,
|
primaryCurrency: PropTypes.string,
|
||||||
|
@ -2,7 +2,6 @@ import { connect } from 'react-redux'
|
|||||||
import {
|
import {
|
||||||
getAmountConversionRate,
|
getAmountConversionRate,
|
||||||
getConversionRate,
|
getConversionRate,
|
||||||
getCurrentCurrency,
|
|
||||||
getGasTotal,
|
getGasTotal,
|
||||||
getPrimaryCurrency,
|
getPrimaryCurrency,
|
||||||
getSelectedToken,
|
getSelectedToken,
|
||||||
@ -31,7 +30,6 @@ function mapStateToProps (state) {
|
|||||||
amountConversionRate: getAmountConversionRate(state),
|
amountConversionRate: getAmountConversionRate(state),
|
||||||
balance: getSendFromBalance(state),
|
balance: getSendFromBalance(state),
|
||||||
conversionRate: getConversionRate(state),
|
conversionRate: getConversionRate(state),
|
||||||
convertedCurrency: getCurrentCurrency(state),
|
|
||||||
gasTotal: getGasTotal(state),
|
gasTotal: getGasTotal(state),
|
||||||
inError: sendAmountIsInError(state),
|
inError: sendAmountIsInError(state),
|
||||||
primaryCurrency: getPrimaryCurrency(state),
|
primaryCurrency: getPrimaryCurrency(state),
|
||||||
|
@ -2,7 +2,6 @@ import assert from 'assert'
|
|||||||
import proxyquire from 'proxyquire'
|
import proxyquire from 'proxyquire'
|
||||||
import sinon from 'sinon'
|
import sinon from 'sinon'
|
||||||
|
|
||||||
let mapStateToProps
|
|
||||||
let mapDispatchToProps
|
let mapDispatchToProps
|
||||||
|
|
||||||
const actionSpies = {
|
const actionSpies = {
|
||||||
@ -15,23 +14,11 @@ const duckActionSpies = {
|
|||||||
|
|
||||||
proxyquire('../send-amount-row.container.js', {
|
proxyquire('../send-amount-row.container.js', {
|
||||||
'react-redux': {
|
'react-redux': {
|
||||||
connect: (ms, md) => {
|
connect: (_, md) => {
|
||||||
mapStateToProps = ms
|
|
||||||
mapDispatchToProps = md
|
mapDispatchToProps = md
|
||||||
return () => ({})
|
return () => ({})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'../../send.selectors': {
|
|
||||||
getAmountConversionRate: (s) => `mockAmountConversionRate:${s}`,
|
|
||||||
getConversionRate: (s) => `mockConversionRate:${s}`,
|
|
||||||
getCurrentCurrency: (s) => `mockConvertedCurrency:${s}`,
|
|
||||||
getGasTotal: (s) => `mockGasTotal:${s}`,
|
|
||||||
getPrimaryCurrency: (s) => `mockPrimaryCurrency:${s}`,
|
|
||||||
getSelectedToken: (s) => `mockSelectedToken:${s}`,
|
|
||||||
getSendAmount: (s) => `mockAmount:${s}`,
|
|
||||||
getSendFromBalance: (s) => `mockBalance:${s}`,
|
|
||||||
getTokenBalance: (s) => `mockTokenBalance:${s}`,
|
|
||||||
},
|
|
||||||
'./send-amount-row.selectors': { sendAmountIsInError: (s) => `mockInError:${s}` },
|
'./send-amount-row.selectors': { sendAmountIsInError: (s) => `mockInError:${s}` },
|
||||||
'../../send.utils': {
|
'../../send.utils': {
|
||||||
getAmountErrorObject: (mockDataObject) => ({ ...mockDataObject, mockChange: true }),
|
getAmountErrorObject: (mockDataObject) => ({ ...mockDataObject, mockChange: true }),
|
||||||
@ -43,25 +30,6 @@ proxyquire('../send-amount-row.container.js', {
|
|||||||
|
|
||||||
describe('send-amount-row container', () => {
|
describe('send-amount-row container', () => {
|
||||||
|
|
||||||
describe('mapStateToProps()', () => {
|
|
||||||
|
|
||||||
it('should map the correct properties to props', () => {
|
|
||||||
assert.deepEqual(mapStateToProps('mockState'), {
|
|
||||||
amount: 'mockAmount:mockState',
|
|
||||||
amountConversionRate: 'mockAmountConversionRate:mockState',
|
|
||||||
balance: 'mockBalance:mockState',
|
|
||||||
conversionRate: 'mockConversionRate:mockState',
|
|
||||||
convertedCurrency: 'mockConvertedCurrency:mockState',
|
|
||||||
gasTotal: 'mockGasTotal:mockState',
|
|
||||||
inError: 'mockInError:mockState',
|
|
||||||
primaryCurrency: 'mockPrimaryCurrency:mockState',
|
|
||||||
selectedToken: 'mockSelectedToken:mockState',
|
|
||||||
tokenBalance: 'mockTokenBalance:mockState',
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('mapDispatchToProps()', () => {
|
describe('mapDispatchToProps()', () => {
|
||||||
let dispatchSpy
|
let dispatchSpy
|
||||||
let mapDispatchToPropsObject
|
let mapDispatchToPropsObject
|
||||||
|
@ -15,11 +15,8 @@ export default class SendContent extends Component {
|
|||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
updateGas: PropTypes.func,
|
updateGas: PropTypes.func,
|
||||||
scanQrCode: PropTypes.func,
|
|
||||||
showAddToAddressBookModal: PropTypes.func,
|
showAddToAddressBookModal: PropTypes.func,
|
||||||
showHexData: PropTypes.bool,
|
showHexData: PropTypes.bool,
|
||||||
ownedAccounts: PropTypes.array,
|
|
||||||
addressBook: PropTypes.array,
|
|
||||||
contact: PropTypes.object,
|
contact: PropTypes.object,
|
||||||
isOwnedAccount: PropTypes.bool,
|
isOwnedAccount: PropTypes.bool,
|
||||||
}
|
}
|
||||||
|
@ -29,11 +29,11 @@ function mapDispatchToProps (dispatch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mergeProps (stateProps, dispatchProps, ownProps) {
|
function mergeProps (stateProps, dispatchProps, ownProps) {
|
||||||
|
const { to, ...restStateProps } = stateProps
|
||||||
return {
|
return {
|
||||||
...ownProps,
|
...ownProps,
|
||||||
...stateProps,
|
...restStateProps,
|
||||||
...dispatchProps,
|
showAddToAddressBookModal: () => dispatchProps.showAddToAddressBookModal(to),
|
||||||
showAddToAddressBookModal: () => dispatchProps.showAddToAddressBookModal(stateProps.to),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,9 +6,6 @@ import { PRIMARY, SECONDARY } from '../../../../../helpers/constants/common'
|
|||||||
export default class GasFeeDisplay extends Component {
|
export default class GasFeeDisplay extends Component {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
conversionRate: PropTypes.number,
|
|
||||||
primaryCurrency: PropTypes.string,
|
|
||||||
convertedCurrency: PropTypes.string,
|
|
||||||
gasLoadingError: PropTypes.bool,
|
gasLoadingError: PropTypes.bool,
|
||||||
gasTotal: PropTypes.string,
|
gasTotal: PropTypes.string,
|
||||||
onReset: PropTypes.func,
|
onReset: PropTypes.func,
|
||||||
|
@ -9,8 +9,6 @@ export default class SendGasRow extends Component {
|
|||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
balance: PropTypes.string,
|
balance: PropTypes.string,
|
||||||
conversionRate: PropTypes.number,
|
|
||||||
convertedCurrency: PropTypes.string,
|
|
||||||
gasFeeError: PropTypes.bool,
|
gasFeeError: PropTypes.bool,
|
||||||
gasLoadingError: PropTypes.bool,
|
gasLoadingError: PropTypes.bool,
|
||||||
gasTotal: PropTypes.string,
|
gasTotal: PropTypes.string,
|
||||||
@ -76,8 +74,6 @@ export default class SendGasRow extends Component {
|
|||||||
|
|
||||||
renderContent () {
|
renderContent () {
|
||||||
const {
|
const {
|
||||||
conversionRate,
|
|
||||||
convertedCurrency,
|
|
||||||
gasLoadingError,
|
gasLoadingError,
|
||||||
gasTotal,
|
gasTotal,
|
||||||
showCustomizeGasModal,
|
showCustomizeGasModal,
|
||||||
@ -119,8 +115,6 @@ export default class SendGasRow extends Component {
|
|||||||
)
|
)
|
||||||
const gasFeeDisplay = (
|
const gasFeeDisplay = (
|
||||||
<GasFeeDisplay
|
<GasFeeDisplay
|
||||||
conversionRate={conversionRate}
|
|
||||||
convertedCurrency={convertedCurrency}
|
|
||||||
gasLoadingError={gasLoadingError}
|
gasLoadingError={gasLoadingError}
|
||||||
gasTotal={gasTotal}
|
gasTotal={gasTotal}
|
||||||
onReset={() => {
|
onReset={() => {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import {
|
import {
|
||||||
getConversionRate,
|
getConversionRate,
|
||||||
getCurrentCurrency,
|
|
||||||
getGasTotal,
|
getGasTotal,
|
||||||
getGasPrice,
|
getGasPrice,
|
||||||
getGasLimit,
|
getGasLimit,
|
||||||
@ -58,8 +57,6 @@ function mapStateToProps (state) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
balance: getSendFromBalance(state),
|
balance: getSendFromBalance(state),
|
||||||
conversionRate,
|
|
||||||
convertedCurrency: getCurrentCurrency(state),
|
|
||||||
gasTotal,
|
gasTotal,
|
||||||
gasFeeError: gasFeeIsInError(state),
|
gasFeeError: gasFeeIsInError(state),
|
||||||
gasLoadingError: getGasLoadingError(state),
|
gasLoadingError: getGasLoadingError(state),
|
||||||
|
@ -60,16 +60,12 @@ describe('SendGasRow Component', function () {
|
|||||||
assert(wrapper.find(SendRowWrapper).childAt(0).is(GasFeeDisplay))
|
assert(wrapper.find(SendRowWrapper).childAt(0).is(GasFeeDisplay))
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should render the GasFeeDisplay with the correct props', () => {
|
it('should render the GasFeeDisplay', () => {
|
||||||
const {
|
const {
|
||||||
conversionRate,
|
|
||||||
convertedCurrency,
|
|
||||||
gasLoadingError,
|
gasLoadingError,
|
||||||
gasTotal,
|
gasTotal,
|
||||||
onReset,
|
onReset,
|
||||||
} = wrapper.find(SendRowWrapper).childAt(0).props()
|
} = wrapper.find(SendRowWrapper).childAt(0).props()
|
||||||
assert.equal(conversionRate, 20)
|
|
||||||
assert.equal(convertedCurrency, 'mockConvertedCurrency')
|
|
||||||
assert.equal(gasLoadingError, false)
|
assert.equal(gasLoadingError, false)
|
||||||
assert.equal(gasTotal, 'mockGasTotal')
|
assert.equal(gasTotal, 'mockGasTotal')
|
||||||
assert.equal(propsMethodSpies.resetGasButtons.callCount, 0)
|
assert.equal(propsMethodSpies.resetGasButtons.callCount, 0)
|
||||||
|
@ -2,7 +2,6 @@ import assert from 'assert'
|
|||||||
import proxyquire from 'proxyquire'
|
import proxyquire from 'proxyquire'
|
||||||
import sinon from 'sinon'
|
import sinon from 'sinon'
|
||||||
|
|
||||||
let mapStateToProps
|
|
||||||
let mapDispatchToProps
|
let mapDispatchToProps
|
||||||
let mergeProps
|
let mergeProps
|
||||||
|
|
||||||
@ -25,28 +24,12 @@ const gasDuckSpies = {
|
|||||||
|
|
||||||
proxyquire('../send-gas-row.container.js', {
|
proxyquire('../send-gas-row.container.js', {
|
||||||
'react-redux': {
|
'react-redux': {
|
||||||
connect: (ms, md, mp) => {
|
connect: (_, md, mp) => {
|
||||||
mapStateToProps = ms
|
|
||||||
mapDispatchToProps = md
|
mapDispatchToProps = md
|
||||||
mergeProps = mp
|
mergeProps = mp
|
||||||
return () => ({})
|
return () => ({})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'../../../../selectors/selectors': {
|
|
||||||
getCurrentEthBalance: (s) => `mockCurrentEthBalance:${s}`,
|
|
||||||
getAdvancedInlineGasShown: (s) => `mockAdvancedInlineGasShown:${s}`,
|
|
||||||
getSelectedToken: () => false,
|
|
||||||
},
|
|
||||||
'../../send.selectors.js': {
|
|
||||||
getConversionRate: (s) => `mockConversionRate:${s}`,
|
|
||||||
getCurrentCurrency: (s) => `mockConvertedCurrency:${s}`,
|
|
||||||
getGasTotal: (s) => `mockGasTotal:${s}`,
|
|
||||||
getGasPrice: (s) => `mockGasPrice:${s}`,
|
|
||||||
getGasLimit: (s) => `mockGasLimit:${s}`,
|
|
||||||
getSendAmount: (s) => `mockSendAmount:${s}`,
|
|
||||||
getSendFromBalance: (s) => `mockBalance:${s}`,
|
|
||||||
getTokenBalance: (s) => `mockTokenBalance:${s}`,
|
|
||||||
},
|
|
||||||
'../send-amount-row/amount-max-button/amount-max-button.selectors': {
|
'../send-amount-row/amount-max-button/amount-max-button.selectors': {
|
||||||
getMaxModeOn: (s) => `mockMaxModeOn:${s}`,
|
getMaxModeOn: (s) => `mockMaxModeOn:${s}`,
|
||||||
},
|
},
|
||||||
@ -59,52 +42,13 @@ proxyquire('../send-gas-row.container.js', {
|
|||||||
}) => `${amount}:${gasTotal}:${balance}:${conversionRate}`,
|
}) => `${amount}:${gasTotal}:${balance}:${conversionRate}`,
|
||||||
calcGasTotal: (gasLimit, gasPrice) => gasLimit + gasPrice,
|
calcGasTotal: (gasLimit, gasPrice) => gasLimit + gasPrice,
|
||||||
},
|
},
|
||||||
'./send-gas-row.selectors.js': {
|
|
||||||
getGasLoadingError: (s) => `mockGasLoadingError:${s}`,
|
|
||||||
gasFeeIsInError: (s) => `mockGasFeeError:${s}`,
|
|
||||||
getGasButtonGroupShown: (s) => `mockGetGasButtonGroupShown:${s}`,
|
|
||||||
},
|
|
||||||
'../../../../store/actions': actionSpies,
|
'../../../../store/actions': actionSpies,
|
||||||
'../../../../selectors/custom-gas': {
|
|
||||||
getBasicGasEstimateLoadingStatus: (s) => `mockBasicGasEstimateLoadingStatus:${s}`,
|
|
||||||
getRenderableEstimateDataForSmallButtonsFromGWEI: (s) => `mockGasButtonInfo:${s}`,
|
|
||||||
getDefaultActiveButtonIndex: (gasButtonInfo, gasPrice) => gasButtonInfo.length + gasPrice.length,
|
|
||||||
},
|
|
||||||
'../../../../ducks/send/send.duck': sendDuckSpies,
|
'../../../../ducks/send/send.duck': sendDuckSpies,
|
||||||
'../../../../ducks/gas/gas.duck': gasDuckSpies,
|
'../../../../ducks/gas/gas.duck': gasDuckSpies,
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('send-gas-row container', () => {
|
describe('send-gas-row container', () => {
|
||||||
|
|
||||||
describe('mapStateToProps()', () => {
|
|
||||||
|
|
||||||
it('should map the correct properties to props', () => {
|
|
||||||
assert.deepEqual(mapStateToProps('mockState'), {
|
|
||||||
balance: 'mockBalance:mockState',
|
|
||||||
conversionRate: 'mockConversionRate:mockState',
|
|
||||||
convertedCurrency: 'mockConvertedCurrency:mockState',
|
|
||||||
gasTotal: 'mockGasTotal:mockState',
|
|
||||||
gasFeeError: 'mockGasFeeError:mockState',
|
|
||||||
gasLoadingError: 'mockGasLoadingError:mockState',
|
|
||||||
gasPriceButtonGroupProps: {
|
|
||||||
buttonDataLoading: `mockBasicGasEstimateLoadingStatus:mockState`,
|
|
||||||
defaultActiveButtonIndex: 1,
|
|
||||||
newActiveButtonIndex: 49,
|
|
||||||
gasButtonInfo: `mockGasButtonInfo:mockState`,
|
|
||||||
},
|
|
||||||
gasButtonGroupShown: `mockGetGasButtonGroupShown:mockState`,
|
|
||||||
advancedInlineGasShown: 'mockAdvancedInlineGasShown:mockState',
|
|
||||||
gasLimit: 'mockGasLimit:mockState',
|
|
||||||
gasPrice: 'mockGasPrice:mockState',
|
|
||||||
insufficientBalance: false,
|
|
||||||
maxModeOn: 'mockMaxModeOn:mockState',
|
|
||||||
selectedToken: false,
|
|
||||||
tokenBalance: 'mockTokenBalance:mockState',
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('mapDispatchToProps()', () => {
|
describe('mapDispatchToProps()', () => {
|
||||||
let dispatchSpy
|
let dispatchSpy
|
||||||
let mapDispatchToPropsObject
|
let mapDispatchToPropsObject
|
||||||
|
@ -4,7 +4,6 @@ import SendRowWrapper from '../send-row-wrapper'
|
|||||||
|
|
||||||
export default class SendHexDataRow extends Component {
|
export default class SendHexDataRow extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
data: PropTypes.string,
|
|
||||||
inError: PropTypes.bool,
|
inError: PropTypes.bool,
|
||||||
updateSendHexData: PropTypes.func.isRequired,
|
updateSendHexData: PropTypes.func.isRequired,
|
||||||
updateGas: PropTypes.func.isRequired,
|
updateGas: PropTypes.func.isRequired,
|
||||||
|
@ -10,9 +10,7 @@ export default class SendFooter extends Component {
|
|||||||
amount: PropTypes.string,
|
amount: PropTypes.string,
|
||||||
data: PropTypes.string,
|
data: PropTypes.string,
|
||||||
clearSend: PropTypes.func,
|
clearSend: PropTypes.func,
|
||||||
disabled: PropTypes.bool,
|
|
||||||
editingTransactionId: PropTypes.string,
|
editingTransactionId: PropTypes.string,
|
||||||
errors: PropTypes.object,
|
|
||||||
from: PropTypes.object,
|
from: PropTypes.object,
|
||||||
gasLimit: PropTypes.string,
|
gasLimit: PropTypes.string,
|
||||||
gasPrice: PropTypes.string,
|
gasPrice: PropTypes.string,
|
||||||
|
@ -324,13 +324,11 @@ export default class SendTransactionScreen extends PersistentForm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderAddRecipient () {
|
renderAddRecipient () {
|
||||||
const { scanQrCode } = this.props
|
|
||||||
const { toError, toWarning } = this.state
|
const { toError, toWarning } = this.state
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AddRecipient
|
<AddRecipient
|
||||||
updateGas={({ to, amount, data } = {}) => this.updateGas({ to, amount, data })}
|
updateGas={({ to, amount, data } = {}) => this.updateGas({ to, amount, data })}
|
||||||
scanQrCode={scanQrCode}
|
|
||||||
query={this.state.query}
|
query={this.state.query}
|
||||||
toError={toError}
|
toError={toError}
|
||||||
toWarning={toWarning}
|
toWarning={toWarning}
|
||||||
@ -339,13 +337,12 @@ export default class SendTransactionScreen extends PersistentForm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderSendContent () {
|
renderSendContent () {
|
||||||
const { history, showHexData, scanQrCode } = this.props
|
const { history, showHexData } = this.props
|
||||||
|
|
||||||
return [
|
return [
|
||||||
<SendContent
|
<SendContent
|
||||||
key="send-content"
|
key="send-content"
|
||||||
updateGas={({ to, amount, data } = {}) => this.updateGas({ to, amount, data })}
|
updateGas={({ to, amount, data } = {}) => this.updateGas({ to, amount, data })}
|
||||||
scanQrCode={scanQrCode}
|
|
||||||
showHexData={showHexData}
|
showHexData={showHexData}
|
||||||
/>,
|
/>,
|
||||||
<SendFooter key="send-footer" history={history} />,
|
<SendFooter key="send-footer" history={history} />,
|
||||||
|
@ -18,7 +18,6 @@ import {
|
|||||||
getRecentBlocks,
|
getRecentBlocks,
|
||||||
getSelectedToken,
|
getSelectedToken,
|
||||||
getSelectedTokenContract,
|
getSelectedTokenContract,
|
||||||
getSelectedTokenToFiatRate,
|
|
||||||
getSendAmount,
|
getSendAmount,
|
||||||
getSendEditingTransactionId,
|
getSendEditingTransactionId,
|
||||||
getSendHexDataFeatureFlagState,
|
getSendHexDataFeatureFlagState,
|
||||||
@ -88,7 +87,6 @@ function mapStateToProps (state) {
|
|||||||
tokens: getTokens(state),
|
tokens: getTokens(state),
|
||||||
tokenBalance: getTokenBalance(state),
|
tokenBalance: getTokenBalance(state),
|
||||||
tokenContract: getSelectedTokenContract(state),
|
tokenContract: getSelectedTokenContract(state),
|
||||||
tokenToFiatRate: getSelectedTokenToFiatRate(state),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ import assert from 'assert'
|
|||||||
import proxyquire from 'proxyquire'
|
import proxyquire from 'proxyquire'
|
||||||
import sinon from 'sinon'
|
import sinon from 'sinon'
|
||||||
|
|
||||||
let mapStateToProps
|
|
||||||
let mapDispatchToProps
|
let mapDispatchToProps
|
||||||
|
|
||||||
const actionSpies = {
|
const actionSpies = {
|
||||||
@ -17,45 +16,13 @@ const duckActionSpies = {
|
|||||||
|
|
||||||
proxyquire('../send.container.js', {
|
proxyquire('../send.container.js', {
|
||||||
'react-redux': {
|
'react-redux': {
|
||||||
connect: (ms, md) => {
|
connect: (_, md) => {
|
||||||
mapStateToProps = ms
|
|
||||||
mapDispatchToProps = md
|
mapDispatchToProps = md
|
||||||
return () => ({})
|
return () => ({})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'react-router-dom': { withRouter: () => {} },
|
'react-router-dom': { withRouter: () => {} },
|
||||||
'recompose': { compose: (_, arg2) => () => arg2() },
|
'recompose': { compose: (_, arg2) => () => arg2() },
|
||||||
'./send.selectors': {
|
|
||||||
getAmountConversionRate: (s) => `mockAmountConversionRate:${s}`,
|
|
||||||
getBlockGasLimit: (s) => `mockBlockGasLimit:${s}`,
|
|
||||||
getConversionRate: (s) => `mockConversionRate:${s}`,
|
|
||||||
getCurrentNetwork: (s) => `mockNetwork:${s}`,
|
|
||||||
getGasLimit: (s) => `mockGasLimit:${s}`,
|
|
||||||
getGasPrice: (s) => `mockGasPrice:${s}`,
|
|
||||||
getGasTotal: (s) => `mockGasTotal:${s}`,
|
|
||||||
getPrimaryCurrency: (s) => `mockPrimaryCurrency:${s}`,
|
|
||||||
getRecentBlocks: (s) => `mockRecentBlocks:${s}`,
|
|
||||||
getSelectedToken: (s) => `mockSelectedToken:${s}`,
|
|
||||||
getSelectedTokenContract: (s) => `mockTokenContract:${s}`,
|
|
||||||
getSelectedTokenToFiatRate: (s) => `mockTokenToFiatRate:${s}`,
|
|
||||||
getSendHexDataFeatureFlagState: (s) => `mockSendHexDataFeatureFlagState:${s}`,
|
|
||||||
getSendAmount: (s) => `mockAmount:${s}`,
|
|
||||||
getSendTo: (s) => `mockTo:${s}`,
|
|
||||||
getSendToNickname: (s) => `mockToNickname:${s}`,
|
|
||||||
getSendEditingTransactionId: (s) => `mockEditingTransactionId:${s}`,
|
|
||||||
getSendFromObject: (s) => `mockFrom:${s}`,
|
|
||||||
getTokenBalance: (s) => `mockTokenBalance:${s}`,
|
|
||||||
getQrCodeData: (s) => `mockQrCodeData:${s}`,
|
|
||||||
getSendEnsResolution: (s) => `mockSendEnsResolution:${s}`,
|
|
||||||
getSendEnsResolutionError: (s) => `mockSendEnsResolutionError:${s}`,
|
|
||||||
},
|
|
||||||
'./send-content/add-recipient/add-recipient.selectors': {
|
|
||||||
getTokens: s => `mockTokens:${s}`,
|
|
||||||
},
|
|
||||||
'../../selectors/selectors': {
|
|
||||||
getAddressBook: (s) => `mockAddressBook:${s}`,
|
|
||||||
getSelectedAddress: (s) => `mockSelectedAddress:${s}`,
|
|
||||||
},
|
|
||||||
'../../store/actions': actionSpies,
|
'../../store/actions': actionSpies,
|
||||||
'../../ducks/send/send.duck': duckActionSpies,
|
'../../ducks/send/send.duck': duckActionSpies,
|
||||||
'./send.utils.js': {
|
'./send.utils.js': {
|
||||||
@ -66,40 +33,6 @@ proxyquire('../send.container.js', {
|
|||||||
|
|
||||||
describe('send container', () => {
|
describe('send container', () => {
|
||||||
|
|
||||||
describe('mapStateToProps()', () => {
|
|
||||||
|
|
||||||
it('should map the correct properties to props', () => {
|
|
||||||
assert.deepEqual(mapStateToProps('mockState'), {
|
|
||||||
amount: 'mockAmount:mockState',
|
|
||||||
amountConversionRate: 'mockAmountConversionRate:mockState',
|
|
||||||
blockGasLimit: 'mockBlockGasLimit:mockState',
|
|
||||||
conversionRate: 'mockConversionRate:mockState',
|
|
||||||
editingTransactionId: 'mockEditingTransactionId:mockState',
|
|
||||||
from: 'mockFrom:mockState',
|
|
||||||
gasLimit: 'mockGasLimit:mockState',
|
|
||||||
gasPrice: 'mockGasPrice:mockState',
|
|
||||||
gasTotal: 'mockGasTotal:mockState',
|
|
||||||
network: 'mockNetwork:mockState',
|
|
||||||
primaryCurrency: 'mockPrimaryCurrency:mockState',
|
|
||||||
recentBlocks: 'mockRecentBlocks:mockState',
|
|
||||||
selectedAddress: 'mockSelectedAddress:mockState',
|
|
||||||
selectedToken: 'mockSelectedToken:mockState',
|
|
||||||
showHexData: 'mockSendHexDataFeatureFlagState:mockState',
|
|
||||||
to: 'mockTo:mockState',
|
|
||||||
tokenBalance: 'mockTokenBalance:mockState',
|
|
||||||
tokenContract: 'mockTokenContract:mockState',
|
|
||||||
tokenToFiatRate: 'mockTokenToFiatRate:mockState',
|
|
||||||
qrCodeData: 'mockQrCodeData:mockState',
|
|
||||||
tokens: 'mockTokens:mockState',
|
|
||||||
ensResolution: 'mockSendEnsResolution:mockState',
|
|
||||||
ensResolutionError: 'mockSendEnsResolutionError:mockState',
|
|
||||||
toNickname: 'mockToNickname:mockState',
|
|
||||||
addressBook: 'mockAddressBook:mockState',
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('mapDispatchToProps()', () => {
|
describe('mapDispatchToProps()', () => {
|
||||||
let dispatchSpy
|
let dispatchSpy
|
||||||
let mapDispatchToPropsObject
|
let mapDispatchToPropsObject
|
||||||
|
@ -17,7 +17,6 @@ export default class AdvancedTab extends PureComponent {
|
|||||||
setUseNonceField: PropTypes.func,
|
setUseNonceField: PropTypes.func,
|
||||||
useNonceField: PropTypes.bool,
|
useNonceField: PropTypes.bool,
|
||||||
setHexDataFeatureFlag: PropTypes.func,
|
setHexDataFeatureFlag: PropTypes.func,
|
||||||
setRpcTarget: PropTypes.func,
|
|
||||||
displayWarning: PropTypes.func,
|
displayWarning: PropTypes.func,
|
||||||
showResetAccountConfirmationModal: PropTypes.func,
|
showResetAccountConfirmationModal: PropTypes.func,
|
||||||
warning: PropTypes.string,
|
warning: PropTypes.string,
|
||||||
|
@ -3,7 +3,6 @@ import { compose } from 'recompose'
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { withRouter } from 'react-router-dom'
|
import { withRouter } from 'react-router-dom'
|
||||||
import {
|
import {
|
||||||
updateAndSetCustomRpc,
|
|
||||||
displayWarning,
|
displayWarning,
|
||||||
setFeatureFlag,
|
setFeatureFlag,
|
||||||
showModal,
|
showModal,
|
||||||
@ -43,7 +42,6 @@ export const mapStateToProps = state => {
|
|||||||
export const mapDispatchToProps = dispatch => {
|
export const mapDispatchToProps = dispatch => {
|
||||||
return {
|
return {
|
||||||
setHexDataFeatureFlag: shouldShow => dispatch(setFeatureFlag('sendHexData', shouldShow)),
|
setHexDataFeatureFlag: shouldShow => dispatch(setFeatureFlag('sendHexData', shouldShow)),
|
||||||
setRpcTarget: (newRpc, chainId, ticker, nickname) => dispatch(updateAndSetCustomRpc(newRpc, chainId, ticker, nickname)),
|
|
||||||
displayWarning: warning => dispatch(displayWarning(warning)),
|
displayWarning: warning => dispatch(displayWarning(warning)),
|
||||||
showResetAccountConfirmationModal: () => dispatch(showModal({ name: 'CONFIRM_RESET_ACCOUNT' })),
|
showResetAccountConfirmationModal: () => dispatch(showModal({ name: 'CONFIRM_RESET_ACCOUNT' })),
|
||||||
setAdvancedInlineGasFeatureFlag: shouldShow => dispatch(setFeatureFlag('advancedInlineGas', shouldShow)),
|
setAdvancedInlineGasFeatureFlag: shouldShow => dispatch(setFeatureFlag('advancedInlineGas', shouldShow)),
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
import assert from 'assert'
|
|
||||||
import { mapStateToProps, mapDispatchToProps } from '../advanced-tab.container'
|
|
||||||
|
|
||||||
const defaultState = {
|
|
||||||
appState: {
|
|
||||||
warning: null,
|
|
||||||
},
|
|
||||||
metamask: {
|
|
||||||
featureFlags: {
|
|
||||||
sendHexData: false,
|
|
||||||
advancedInlineGas: false,
|
|
||||||
},
|
|
||||||
preferences: {
|
|
||||||
autoLogoutTimeLimit: 0,
|
|
||||||
showFiatInTestnets: false,
|
|
||||||
useNativeCurrencyAsPrimaryCurrency: true,
|
|
||||||
},
|
|
||||||
threeBoxSyncingAllowed: false,
|
|
||||||
threeBoxDisabled: false,
|
|
||||||
useNonceField: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('AdvancedTab Container', () => {
|
|
||||||
it('should map state to props correctly', () => {
|
|
||||||
const props = mapStateToProps(defaultState)
|
|
||||||
const expected = {
|
|
||||||
warning: null,
|
|
||||||
sendHexData: false,
|
|
||||||
advancedInlineGas: false,
|
|
||||||
showFiatInTestnets: false,
|
|
||||||
autoLogoutTimeLimit: 0,
|
|
||||||
threeBoxSyncingAllowed: false,
|
|
||||||
threeBoxDisabled: false,
|
|
||||||
useNonceField: false,
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.deepEqual(props, expected)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should map dispatch to props correctly', () => {
|
|
||||||
const props = mapDispatchToProps(() => 'mockDispatch')
|
|
||||||
|
|
||||||
assert.ok(typeof props.setHexDataFeatureFlag === 'function')
|
|
||||||
assert.ok(typeof props.setRpcTarget === 'function')
|
|
||||||
assert.ok(typeof props.displayWarning === 'function')
|
|
||||||
assert.ok(typeof props.showResetAccountConfirmationModal === 'function')
|
|
||||||
assert.ok(typeof props.setAdvancedInlineGasFeatureFlag === 'function')
|
|
||||||
assert.ok(typeof props.setShowFiatConversionOnTestnetsPreference === 'function')
|
|
||||||
assert.ok(typeof props.setAutoLogoutTimeLimit === 'function')
|
|
||||||
assert.ok(typeof props.setUseNonceField === 'function')
|
|
||||||
})
|
|
||||||
})
|
|
@ -18,7 +18,7 @@ export default class AddContact extends PureComponent {
|
|||||||
addToAddressBook: PropTypes.func,
|
addToAddressBook: PropTypes.func,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
scanQrCode: PropTypes.func,
|
scanQrCode: PropTypes.func,
|
||||||
qrCodeData: PropTypes.object,
|
qrCodeData: PropTypes.object, /* eslint-disable-line react/no-unused-prop-types */
|
||||||
qrCodeDetected: PropTypes.func,
|
qrCodeDetected: PropTypes.func,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ export default class ViewContact extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
removeFromAddressBook: PropTypes.func,
|
|
||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
address: PropTypes.string,
|
address: PropTypes.string,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
|
@ -3,7 +3,6 @@ import { compose } from 'recompose'
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { withRouter } from 'react-router-dom'
|
import { withRouter } from 'react-router-dom'
|
||||||
import { getAddressBookEntry } from '../../../../selectors/selectors'
|
import { getAddressBookEntry } from '../../../../selectors/selectors'
|
||||||
import { removeFromAddressBook } from '../../../../store/actions'
|
|
||||||
import { checksumAddress } from '../../../../helpers/utils/util'
|
import { checksumAddress } from '../../../../helpers/utils/util'
|
||||||
import {
|
import {
|
||||||
CONTACT_EDIT_ROUTE,
|
CONTACT_EDIT_ROUTE,
|
||||||
@ -31,13 +30,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
|
||||||
return {
|
|
||||||
removeFromAddressBook: (addressToRemove) => dispatch(removeFromAddressBook(addressToRemove)),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withRouter,
|
withRouter,
|
||||||
connect(mapStateToProps, mapDispatchToProps)
|
connect(mapStateToProps)
|
||||||
)(ViewContact)
|
)(ViewContact)
|
||||||
|
@ -6,18 +6,6 @@ export default class InfoTab extends PureComponent {
|
|||||||
version: global.platform.getVersion(),
|
version: global.platform.getVersion(),
|
||||||
}
|
}
|
||||||
|
|
||||||
static propTypes = {
|
|
||||||
tab: PropTypes.string,
|
|
||||||
metamask: PropTypes.object,
|
|
||||||
setCurrentCurrency: PropTypes.func,
|
|
||||||
setRpcTarget: PropTypes.func,
|
|
||||||
displayWarning: PropTypes.func,
|
|
||||||
revealSeedConfirmation: PropTypes.func,
|
|
||||||
warning: PropTypes.string,
|
|
||||||
location: PropTypes.object,
|
|
||||||
history: PropTypes.object,
|
|
||||||
}
|
|
||||||
|
|
||||||
static contextTypes = {
|
static contextTypes = {
|
||||||
t: PropTypes.func,
|
t: PropTypes.func,
|
||||||
}
|
}
|
||||||
|
@ -11,11 +11,8 @@ export default class SecurityTab extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
displayWarning: PropTypes.func,
|
|
||||||
revealSeedConfirmation: PropTypes.func,
|
|
||||||
warning: PropTypes.string,
|
warning: PropTypes.string,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
mobileSync: PropTypes.bool,
|
|
||||||
participateInMetaMetrics: PropTypes.bool,
|
participateInMetaMetrics: PropTypes.bool,
|
||||||
setParticipateInMetaMetrics: PropTypes.func,
|
setParticipateInMetaMetrics: PropTypes.func,
|
||||||
showIncomingTransactions: PropTypes.bool,
|
showIncomingTransactions: PropTypes.bool,
|
||||||
|
@ -3,8 +3,6 @@ import { compose } from 'recompose'
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { withRouter } from 'react-router-dom'
|
import { withRouter } from 'react-router-dom'
|
||||||
import {
|
import {
|
||||||
displayWarning,
|
|
||||||
revealSeedConfirmation,
|
|
||||||
setFeatureFlag,
|
setFeatureFlag,
|
||||||
setParticipateInMetaMetrics,
|
setParticipateInMetaMetrics,
|
||||||
} from '../../../store/actions'
|
} from '../../../store/actions'
|
||||||
@ -27,8 +25,6 @@ const mapStateToProps = state => {
|
|||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
return {
|
return {
|
||||||
displayWarning: warning => dispatch(displayWarning(warning)),
|
|
||||||
revealSeedConfirmation: () => dispatch(revealSeedConfirmation()),
|
|
||||||
setParticipateInMetaMetrics: (val) => dispatch(setParticipateInMetaMetrics(val)),
|
setParticipateInMetaMetrics: (val) => dispatch(setParticipateInMetaMetrics(val)),
|
||||||
setShowIncomingTransactionsFeatureFlag: shouldShow => dispatch(setFeatureFlag('showIncomingTransactions', shouldShow)),
|
setShowIncomingTransactionsFeatureFlag: shouldShow => dispatch(setFeatureFlag('showIncomingTransactions', shouldShow)),
|
||||||
}
|
}
|
||||||
|
@ -34,9 +34,7 @@ export default class SettingsTab extends PureComponent {
|
|||||||
static propTypes = {
|
static propTypes = {
|
||||||
setUseBlockie: PropTypes.func,
|
setUseBlockie: PropTypes.func,
|
||||||
setCurrentCurrency: PropTypes.func,
|
setCurrentCurrency: PropTypes.func,
|
||||||
displayWarning: PropTypes.func,
|
|
||||||
warning: PropTypes.string,
|
warning: PropTypes.string,
|
||||||
history: PropTypes.object,
|
|
||||||
updateCurrentLocale: PropTypes.func,
|
updateCurrentLocale: PropTypes.func,
|
||||||
currentLocale: PropTypes.string,
|
currentLocale: PropTypes.string,
|
||||||
useBlockie: PropTypes.bool,
|
useBlockie: PropTypes.bool,
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
import SettingsTab from './settings-tab.component'
|
import SettingsTab from './settings-tab.component'
|
||||||
import { compose } from 'recompose'
|
import { compose } from 'recompose'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { withRouter } from 'react-router-dom'
|
|
||||||
import {
|
import {
|
||||||
setCurrentCurrency,
|
setCurrentCurrency,
|
||||||
displayWarning,
|
|
||||||
setUseBlockie,
|
setUseBlockie,
|
||||||
updateCurrentLocale,
|
updateCurrentLocale,
|
||||||
setUseNativeCurrencyAsPrimaryCurrencyPreference,
|
setUseNativeCurrencyAsPrimaryCurrencyPreference,
|
||||||
@ -37,7 +35,6 @@ const mapStateToProps = state => {
|
|||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
return {
|
return {
|
||||||
setCurrentCurrency: currency => dispatch(setCurrentCurrency(currency)),
|
setCurrentCurrency: currency => dispatch(setCurrentCurrency(currency)),
|
||||||
displayWarning: warning => dispatch(displayWarning(warning)),
|
|
||||||
setUseBlockie: value => dispatch(setUseBlockie(value)),
|
setUseBlockie: value => dispatch(setUseBlockie(value)),
|
||||||
updateCurrentLocale: key => dispatch(updateCurrentLocale(key)),
|
updateCurrentLocale: key => dispatch(updateCurrentLocale(key)),
|
||||||
setUseNativeCurrencyAsPrimaryCurrencyPreference: value => {
|
setUseNativeCurrencyAsPrimaryCurrencyPreference: value => {
|
||||||
@ -48,6 +45,5 @@ const mapDispatchToProps = dispatch => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withRouter,
|
|
||||||
connect(mapStateToProps, mapDispatchToProps)
|
connect(mapStateToProps, mapDispatchToProps)
|
||||||
)(SettingsTab)
|
)(SettingsTab)
|
||||||
|
@ -34,12 +34,10 @@ class SettingsPage extends PureComponent {
|
|||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
isAddressEntryPage: PropTypes.bool,
|
isAddressEntryPage: PropTypes.bool,
|
||||||
isPopupView: PropTypes.bool,
|
isPopupView: PropTypes.bool,
|
||||||
location: PropTypes.object,
|
|
||||||
pathnameI18nKey: PropTypes.string,
|
pathnameI18nKey: PropTypes.string,
|
||||||
initialBreadCrumbRoute: PropTypes.string,
|
initialBreadCrumbRoute: PropTypes.string,
|
||||||
breadCrumbTextKey: PropTypes.string,
|
breadCrumbTextKey: PropTypes.string,
|
||||||
initialBreadCrumbKey: PropTypes.string,
|
initialBreadCrumbKey: PropTypes.string,
|
||||||
t: PropTypes.func,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static contextTypes = {
|
static contextTypes = {
|
||||||
|
Loading…
Reference in New Issue
Block a user