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.
feature/default_network_editable
Mark Stacey 5 years ago committed by GitHub
parent 265d253f09
commit 49a525b9f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .eslintrc
  2. 1
      ui/app/components/app/account-details/account-details.component.js
  3. 2
      ui/app/components/app/account-details/account-details.container.js
  4. 7
      ui/app/components/app/confirm-page-container/confirm-page-container.component.js
  5. 4
      ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js
  6. 19
      ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.component.js
  7. 3
      ui/app/components/app/gas-customization/gas-price-chart/tests/gas-price-chart.component.test.js
  8. 1
      ui/app/components/app/modals/notification-modal.js
  9. 2
      ui/app/components/app/transaction-breakdown/transaction-breakdown.component.js
  10. 8
      ui/app/components/ui/alert/index.js
  11. 8
      ui/app/components/ui/copyButton.js
  12. 8
      ui/app/components/ui/currency-display/currency-display.component.js
  13. 6
      ui/app/components/ui/currency-display/currency-display.container.js
  14. 1
      ui/app/components/ui/sender-to-recipient/sender-to-recipient.component.js
  15. 2
      ui/app/components/ui/token-balance/token-balance.component.js
  16. 41
      ui/app/helpers/higher-order-components/metametrics/metametrics.provider.js
  17. 1
      ui/app/pages/confirm-add-suggested-token/confirm-add-suggested-token.component.js
  18. 3
      ui/app/pages/confirm-approve/confirm-approve-content/confirm-approve-content.component.js
  19. 1
      ui/app/pages/confirm-approve/confirm-approve.component.js
  20. 10
      ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js
  21. 16
      ui/app/pages/confirm-transaction-base/confirm-transaction-base.container.js
  22. 20
      ui/app/pages/confirm-transaction-base/tests/confirm-transaction-base.container.test.js
  23. 2
      ui/app/pages/confirm-transaction-switch/confirm-transaction-switch.component.js
  24. 8
      ui/app/pages/confirm-transaction-switch/confirm-transaction-switch.container.js
  25. 4
      ui/app/pages/confirm-transaction/confirm-transaction.component.js
  26. 5
      ui/app/pages/confirm-transaction/confirm-transaction.container.js
  27. 1
      ui/app/pages/create-account/connect-hardware/account-list.js
  28. 12
      ui/app/pages/create-account/connect-hardware/index.js
  29. 1
      ui/app/pages/create-account/create-account.component.js
  30. 3
      ui/app/pages/create-account/import-account/json.js
  31. 5
      ui/app/pages/create-account/new-account.component.js
  32. 4
      ui/app/pages/create-account/new-account.container.js
  33. 4
      ui/app/pages/first-time-flow/seed-phrase/confirm-seed-phrase/confirm-seed-phrase.component.js
  34. 2
      ui/app/pages/first-time-flow/seed-phrase/confirm-seed-phrase/confirm-seed-phrase.container.js
  35. 2
      ui/app/pages/first-time-flow/seed-phrase/confirm-seed-phrase/draggable-seed.component.js
  36. 1
      ui/app/pages/first-time-flow/seed-phrase/seed-phrase.component.js
  37. 1
      ui/app/pages/first-time-flow/welcome/welcome.component.js
  38. 3
      ui/app/pages/first-time-flow/welcome/welcome.container.js
  39. 3
      ui/app/pages/keychains/restore-vault.js
  40. 2
      ui/app/pages/send/account-list-item/account-list-item.component.js
  41. 4
      ui/app/pages/send/account-list-item/account-list-item.container.js
  42. 8
      ui/app/pages/send/account-list-item/tests/account-list-item-container.test.js
  43. 4
      ui/app/pages/send/send-content/add-recipient/add-recipient.component.js
  44. 1
      ui/app/pages/send/send-content/add-recipient/ens-input.component.js
  45. 1
      ui/app/pages/send/send-content/send-amount-row/send-amount-row.component.js
  46. 2
      ui/app/pages/send/send-content/send-amount-row/send-amount-row.container.js
  47. 34
      ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-container.test.js
  48. 3
      ui/app/pages/send/send-content/send-content.component.js
  49. 6
      ui/app/pages/send/send-content/send-content.container.js
  50. 3
      ui/app/pages/send/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js
  51. 6
      ui/app/pages/send/send-content/send-gas-row/send-gas-row.component.js
  52. 3
      ui/app/pages/send/send-content/send-gas-row/send-gas-row.container.js
  53. 6
      ui/app/pages/send/send-content/send-gas-row/tests/send-gas-row-component.test.js
  54. 58
      ui/app/pages/send/send-content/send-gas-row/tests/send-gas-row-container.test.js
  55. 1
      ui/app/pages/send/send-content/send-hex-data-row/send-hex-data-row.component.js
  56. 2
      ui/app/pages/send/send-footer/send-footer.component.js
  57. 5
      ui/app/pages/send/send.component.js
  58. 2
      ui/app/pages/send/send.container.js
  59. 69
      ui/app/pages/send/tests/send-container.test.js
  60. 1
      ui/app/pages/settings/advanced-tab/advanced-tab.component.js
  61. 2
      ui/app/pages/settings/advanced-tab/advanced-tab.container.js
  62. 53
      ui/app/pages/settings/advanced-tab/tests/advanced-tab-container.test.js
  63. 2
      ui/app/pages/settings/contact-list-tab/add-contact/add-contact.component.js
  64. 1
      ui/app/pages/settings/contact-list-tab/view-contact/view-contact.component.js
  65. 9
      ui/app/pages/settings/contact-list-tab/view-contact/view-contact.container.js
  66. 12
      ui/app/pages/settings/info-tab/info-tab.component.js
  67. 3
      ui/app/pages/settings/security-tab/security-tab.component.js
  68. 4
      ui/app/pages/settings/security-tab/security-tab.container.js
  69. 2
      ui/app/pages/settings/settings-tab/settings-tab.component.js
  70. 4
      ui/app/pages/settings/settings-tab/settings-tab.container.js
  71. 2
      ui/app/pages/settings/settings.component.js

@ -153,6 +153,7 @@
"operator-linebreak": [2, "after", { "overrides": { "?": "ignore", ":": "ignore" } }],
"padded-blocks": "off",
"quotes": [2, "single", {"avoidEscape": true, "allowTemplateLiterals": true}],
"react/no-unused-prop-types": "error",
"react/no-unused-state": 2,
"react/jsx-boolean-value": 2,
"react/jsx-curly-brace-presence": [2, { "props": "never", "children": "never" }],

@ -23,7 +23,6 @@ export default class AccountDetails extends Component {
label: PropTypes.string.isRequired,
checksummedAddress: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
history: PropTypes.object.isRequired,
}
state = {

@ -1,6 +1,5 @@
import { connect } from 'react-redux'
import { compose } from 'recompose'
import { withRouter } from 'react-router-dom'
import PropTypes from 'prop-types'
import { hideSidebar, showModal } from '../../../store/actions'
import AccountDetails from './account-details.component'
@ -15,7 +14,6 @@ function mapDispatchToProps (dispatch) {
}
const AccountDetailsContainer = compose(
withRouter,
connect(null, mapDispatchToProps)
)(AccountDetails)

@ -32,13 +32,6 @@ export default class ConfirmPageContainer extends Component {
contentComponent: PropTypes.node,
errorKey: 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,
detailsComponent: PropTypes.node,
identiconAddress: PropTypes.string,

@ -12,13 +12,10 @@ export default class GasModalPageContainer extends Component {
}
static propTypes = {
hideModal: PropTypes.func,
hideBasic: PropTypes.bool,
updateCustomGasPrice: PropTypes.func,
updateCustomGasLimit: PropTypes.func,
currentTimeEstimate: PropTypes.string,
customGasPrice: PropTypes.number,
customGasLimit: PropTypes.number,
insufficientBalance: PropTypes.bool,
fetchBasicGasAndTimeEstimates: PropTypes.func,
fetchGasEstimates: PropTypes.func,
@ -35,7 +32,6 @@ export default class GasModalPageContainer extends Component {
customModalGasPriceInHex: PropTypes.string,
customModalGasLimitInHex: PropTypes.string,
cancelAndClose: PropTypes.func,
transactionFee: PropTypes.string,
blockTime: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,

@ -24,14 +24,15 @@ export default class GasPriceChart extends Component {
updateCustomGasPrice: PropTypes.func,
}
renderChart ({
currentPrice,
gasPrices,
estimatedTimes,
gasPricesMax,
estimatedTimesMax,
updateCustomGasPrice,
}) {
renderChart () {
const {
currentPrice,
gasPrices,
estimatedTimes,
gasPricesMax,
estimatedTimesMax,
updateCustomGasPrice,
} = this.props
const chart = generateChart(gasPrices, estimatedTimes, gasPricesMax, estimatedTimesMax, this.context.t)
setTimeout(function () {
setTickPosition('y', 0, -5, 8)
@ -95,7 +96,7 @@ export default class GasPriceChart extends Component {
}
componentDidMount () {
this.renderChart(this.props)
this.renderChart()
}
render () {

@ -93,11 +93,10 @@ describe('GasPriceChart Component', function () {
})
describe('componentDidMount', () => {
it('should call this.renderChart with the components props', () => {
it('should call this.renderChart', () => {
assert(GasPriceChart.prototype.renderChart.callCount, 1)
wrapper.instance().componentDidMount()
assert(GasPriceChart.prototype.renderChart.callCount, 2)
assert.deepEqual(GasPriceChart.prototype.renderChart.getCall(1).args, [{ ...testProps }])
})
})

@ -70,7 +70,6 @@ NotificationModal.propTypes = {
showCancelButton: PropTypes.bool,
showConfirmButton: PropTypes.bool,
onConfirm: PropTypes.func,
t: PropTypes.func,
}
const mapDispatchToProps = dispatch => {

@ -13,7 +13,6 @@ export default class TransactionBreakdown extends PureComponent {
}
static propTypes = {
transaction: PropTypes.object,
className: PropTypes.string,
nativeCurrency: PropTypes.string.isRequired,
showFiat: PropTypes.bool,
@ -25,7 +24,6 @@ export default class TransactionBreakdown extends PureComponent {
}
static defaultProps = {
transaction: {},
showFiat: true,
}

@ -11,15 +11,15 @@ class Alert extends Component {
UNSAFE_componentWillReceiveProps (nextProps) {
if (!this.props.visible && nextProps.visible) {
this.animateIn(nextProps)
this.animateIn(nextProps.msg)
} else if (this.props.visible && !nextProps.visible) {
this.animateOut()
}
}
animateIn (props) {
animateIn (msg) {
this.setState({
msg: props.msg,
msg: msg,
visible: true,
className: 'visible',
})
@ -51,7 +51,7 @@ class Alert extends Component {
Alert.propTypes = {
visible: PropTypes.bool.isRequired,
msg: PropTypes.string,
msg: PropTypes.string, /* eslint-disable-line react/no-unused-prop-types */
}
module.exports = Alert

@ -29,11 +29,9 @@ class CopyButton extends Component {
}
render () {
const state = this.state
const props = this.props
const value = props.value
const copied = state.copied
const message = copied ? this.context.t('copiedButton') : props.title || this.context.t('copyButton')
const { title, value } = this.props
const { copied } = this.state
const message = copied ? this.context.t('copiedButton') : title || this.context.t('copyButton')
return (
<div

@ -1,7 +1,7 @@
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
import { GWEI } from '../../../helpers/constants/common'
export default class CurrencyDisplay extends PureComponent {
static propTypes = {
@ -11,12 +11,6 @@ export default class CurrencyDisplay extends PureComponent {
prefixComponent: PropTypes.node,
style: PropTypes.object,
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,
}

@ -14,8 +14,8 @@ const mapStateToProps = state => {
}
}
const mergeProps = (stateProps, dispatchProps, ownProps) => {
const { nativeCurrency, currentCurrency, conversionRate, ...restStateProps } = stateProps
const mergeProps = (stateProps, _, ownProps) => {
const { nativeCurrency, currentCurrency, conversionRate } = stateProps
const {
value,
numberOfDecimals = 2,
@ -42,8 +42,6 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
const suffix = propsSuffix || (hideLabel ? undefined : toCurrency.toUpperCase())
return {
...restStateProps,
...dispatchProps,
...restOwnProps,
displayValue,
suffix,

@ -21,7 +21,6 @@ export default class SenderToRecipient extends PureComponent {
recipientEns: PropTypes.string,
recipientAddress: PropTypes.string,
recipientNickname: PropTypes.string,
t: PropTypes.func,
variant: PropTypes.oneOf([DEFAULT_VARIANT, CARDS_VARIANT, FLAT_VARIANT]),
addressOnly: PropTypes.bool,
assetImage: PropTypes.string,

@ -6,9 +6,7 @@ export default class TokenBalance extends PureComponent {
static propTypes = {
string: PropTypes.string,
symbol: PropTypes.string,
error: PropTypes.string,
className: PropTypes.string,
withSymbol: PropTypes.bool,
}
render () {

@ -21,13 +21,18 @@ import {
class MetaMetricsProvider extends Component {
static propTypes = {
network: PropTypes.string.isRequired,
environmentType: PropTypes.string.isRequired,
activeCurrency: PropTypes.string.isRequired,
accountType: PropTypes.string.isRequired,
metaMetricsSendCount: PropTypes.number.isRequired,
activeCurrency: PropTypes.string.isRequired,
children: PropTypes.object.isRequired,
confirmTransactionOrigin: PropTypes.string,
environmentType: PropTypes.string.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 = {
@ -51,8 +56,18 @@ class MetaMetricsProvider extends Component {
}
getChildContext () {
const props = this.props
const { pathname } = location
const {
network,
environmentType,
activeCurrency,
accountType,
confirmTransactionOrigin,
metaMetricsId,
participateInMetaMetrics,
metaMetricsSendCount,
numberOfTokens,
numberOfAccounts,
} = this.props
const { previousPath, currentPath } = this.state
return {
@ -62,14 +77,20 @@ class MetaMetricsProvider extends Component {
const { pathname: overRidePathName = '' } = overrides
const isSendFlow = Boolean(name.match(/^send|^confirm/) || overRidePathName.match(/send|confirm/))
if (props.participateInMetaMetrics || config.isOptIn) {
if (participateInMetaMetrics || config.isOptIn) {
return sendMetaMetricsEvent({
...props,
network,
environmentType,
activeCurrency,
accountType,
confirmTransactionOrigin,
metaMetricsId,
numberOfTokens,
numberOfAccounts,
...config,
previousPath,
currentPath,
pathname,
excludeMetaMetricsId: isSendFlow && !sendCountIsTrackable(props.metaMetricsSendCount + 1),
excludeMetaMetricsId: isSendFlow && !sendCountIsTrackable(metaMetricsSendCount + 1),
...overrides,
})
}

@ -12,7 +12,6 @@ export default class ConfirmAddSuggestedToken extends Component {
static propTypes = {
history: PropTypes.object,
clearPendingTokens: PropTypes.func,
addToken: PropTypes.func,
pendingTokens: PropTypes.object,
removeSuggestedTokens: PropTypes.func,

@ -13,13 +13,10 @@ export default class ConfirmApproveContent extends Component {
}
static propTypes = {
amount: PropTypes.string,
txFeeTotal: PropTypes.string,
tokenAmount: PropTypes.string,
customTokenAmount: PropTypes.string,
tokenSymbol: PropTypes.string,
siteImage: PropTypes.string,
tokenAddress: PropTypes.string,
showCustomizeGasModal: PropTypes.func,
showEditApprovalPermissionModal: PropTypes.func,
origin: PropTypes.string,

@ -84,7 +84,6 @@ export default class ConfirmApprove extends Component {
contentComponent={(
<ConfirmApproveContent
siteImage={siteImage}
tokenAddress={tokenAddress}
setCustomAmount={(newAmount) => {
this.setState({ customPermissionAmount: newAmount })
}}

@ -27,23 +27,13 @@ export default class ConfirmTransactionBase extends Component {
static propTypes = {
// react-router props
match: PropTypes.object,
history: PropTypes.object,
// Redux props
balance: PropTypes.string,
cancelTransaction: PropTypes.func,
cancelAllTransactions: PropTypes.func,
clearConfirmTransaction: PropTypes.func,
clearSend: PropTypes.func,
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,
fromName: PropTypes.string,
hexTransactionAmount: PropTypes.string,

@ -10,7 +10,6 @@ import {
import {
updateCustomNonce,
clearSend,
cancelTx,
cancelTxs,
updateAndApproveTx,
@ -56,7 +55,6 @@ const mapStateToProps = (state, ownProps) => {
conversionRate,
identities,
addressBook,
currentCurrency,
assetImages,
network,
unapprovedTxs,
@ -101,12 +99,6 @@ const mapStateToProps = (state, ownProps) => {
const transactionStatus = transaction ? transaction.status : ''
const {
ethTransactionAmount,
ethTransactionFee,
ethTransactionTotal,
fiatTransactionAmount,
fiatTransactionFee,
fiatTransactionTotal,
hexTransactionAmount,
hexTransactionFee,
hexTransactionTotal,
@ -150,12 +142,6 @@ const mapStateToProps = (state, ownProps) => {
toEns,
toName,
toNickname,
ethTransactionAmount,
ethTransactionFee,
ethTransactionTotal,
fiatTransactionAmount,
fiatTransactionFee,
fiatTransactionTotal,
hexTransactionAmount,
hexTransactionFee,
hexTransactionTotal,
@ -164,7 +150,6 @@ const mapStateToProps = (state, ownProps) => {
methodData,
tokenProps,
isTxReprice,
currentCurrency,
conversionRate,
transactionStatus,
nonce,
@ -198,7 +183,6 @@ export const mapDispatchToProps = dispatch => {
dispatch(updateCustomNonce(value))
},
clearConfirmTransaction: () => dispatch(clearConfirmTransaction()),
clearSend: () => dispatch(clearSend()),
showTransactionConfirmedModal: ({ 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 {
static propTypes = {
txData: PropTypes.object,
isEtherTransaction: PropTypes.bool,
isTokenMethod: PropTypes.bool,
}
redirectToTransaction () {

@ -1,11 +1,5 @@
import { connect } from 'react-redux'
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'
const mapStateToProps = (state, ownProps) => {
@ -23,8 +17,6 @@ const mapStateToProps = (state, ownProps) => {
return {
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 = {
history: PropTypes.object.isRequired,
totalUnapprovedCount: PropTypes.number.isRequired,
match: PropTypes.object,
send: PropTypes.object,
unconfirmedTransactions: PropTypes.array,
setTransactionToConfirm: PropTypes.func,
confirmTransaction: PropTypes.object,
clearConfirmTransaction: PropTypes.func,
fetchBasicGasAndTimeEstimates: PropTypes.func,
transaction: PropTypes.object,
@ -45,7 +42,6 @@ export default class ConfirmTransaction extends Component {
isTokenMethodAction: PropTypes.bool,
fullScreenVsPopupTestGroup: PropTypes.string,
trackABTest: PropTypes.bool,
conversionRate: PropTypes.number,
}
componentDidMount () {

@ -25,9 +25,7 @@ const mapStateToProps = (state, ownProps) => {
send,
unapprovedTxs,
abTests: { fullScreenVsPopup },
conversionRate,
},
confirmTransaction,
} = state
const { match: { params = {} } } = ownProps
const { id } = params
@ -44,17 +42,14 @@ const mapStateToProps = (state, ownProps) => {
return {
totalUnapprovedCount: totalUnconfirmed,
send,
confirmTransaction,
unapprovedTxs,
id,
paramsTransactionId: id && String(id),
transactionId: transactionId && String(transactionId),
unconfirmedTransactions,
transaction,
isTokenMethodAction: isTokenMethodAction(transactionCategory),
trackABTest,
fullScreenVsPopupTestGroup: fullScreenVsPopup,
conversionRate,
}
}

@ -191,7 +191,6 @@ AccountList.propTypes = {
getPage: PropTypes.func.isRequired,
network: PropTypes.string,
selectedAccount: PropTypes.string,
history: PropTypes.object,
onUnlockAccount: PropTypes.func,
onCancel: PropTypes.func,
onAccountRestriction: PropTypes.func,

@ -206,7 +206,6 @@ class ConnectHardwareForm extends Component {
onAccountChange={this.onAccountChange}
network={this.props.network}
getPage={this.getPage}
history={this.props.history}
onUnlockAccount={this.onUnlockAccount}
onForgetDevice={this.onForgetDevice}
onCancel={this.onCancel}
@ -226,9 +225,6 @@ class ConnectHardwareForm extends Component {
}
ConnectHardwareForm.propTypes = {
hideModal: PropTypes.func,
showImportPage: PropTypes.func,
showConnectPage: PropTypes.func,
connectHardware: PropTypes.func,
checkHardwareStatus: PropTypes.func,
forgetDevice: PropTypes.func,
@ -236,9 +232,7 @@ ConnectHardwareForm.propTypes = {
hideAlert: PropTypes.func,
unlockHardwareWalletAccount: PropTypes.func,
setHardwareWalletDefaultHdPath: PropTypes.func,
numberOfExistingAccounts: PropTypes.number,
history: PropTypes.object,
t: PropTypes.func,
network: PropTypes.string,
accounts: PropTypes.object,
address: PropTypes.string,
@ -247,10 +241,9 @@ ConnectHardwareForm.propTypes = {
const mapStateToProps = state => {
const {
metamask: { network, selectedAddress, identities = {} },
metamask: { network, selectedAddress },
} = state
const accounts = getMetaMaskAccounts(state)
const numberOfExistingAccounts = Object.keys(identities).length
const {
appState: { defaultHdPaths },
} = state
@ -259,7 +252,6 @@ const mapStateToProps = state => {
network,
accounts,
address: selectedAddress,
numberOfExistingAccounts,
defaultHdPaths,
}
}
@ -281,8 +273,6 @@ const mapDispatchToProps = dispatch => {
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)),
hideAlert: () => dispatch(actions.hideAlert()),
}

@ -71,7 +71,6 @@ export default class CreateAccountPage extends Component {
CreateAccountPage.propTypes = {
location: PropTypes.object,
history: PropTypes.object,
t: PropTypes.func,
}
CreateAccountPage.contextTypes = {

@ -123,13 +123,11 @@ class JsonImportSubview extends Component {
JsonImportSubview.propTypes = {
error: PropTypes.string,
goHome: PropTypes.func,
displayWarning: PropTypes.func,
firstAddress: PropTypes.string,
importNewJsonAccount: PropTypes.func,
history: PropTypes.object,
setSelectedAddress: PropTypes.func,
t: PropTypes.func,
}
const mapStateToProps = state => {
@ -141,7 +139,6 @@ const mapStateToProps = state => {
const mapDispatchToProps = dispatch => {
return {
goHome: () => dispatch(actions.goHome()),
displayWarning: warning => dispatch(actions.displayWarning(warning)),
importNewJsonAccount: options => dispatch(actions.importNewAccount('JSON File', options)),
setSelectedAddress: (address) => dispatch(actions.setSelectedAddress(address)),

@ -80,14 +80,9 @@ export default class NewAccountCreateForm extends Component {
}
NewAccountCreateForm.propTypes = {
hideModal: PropTypes.func,
showImportPage: PropTypes.func,
showConnectPage: PropTypes.func,
createAccount: PropTypes.func,
numberOfExistingAccounts: PropTypes.number,
newAccountNumber: PropTypes.number,
history: PropTypes.object,
t: PropTypes.func,
}
NewAccountCreateForm.contextTypes = {

@ -10,7 +10,6 @@ const mapStateToProps = state => {
return {
network,
address: selectedAddress,
numberOfExistingAccounts,
newAccountNumber,
}
}
@ -18,7 +17,6 @@ const mapStateToProps = state => {
const mapDispatchToProps = dispatch => {
return {
toCoinbase: address => dispatch(actions.buyEth({ network: '1', address, amount: 0 })),
hideModal: () => dispatch(actions.hideModal()),
createAccount: newAccountName => {
return dispatch(actions.addNewAccount())
.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 = {
hideSeedPhraseBackupAfterOnboarding: PropTypes.func,
history: PropTypes.object,
onSubmit: PropTypes.func,
seedPhrase: PropTypes.string,
selectedAddress: PropTypes.string,
initializeThreeBox: PropTypes.func,
setSeedPhraseBackedUp: PropTypes.func,
showingSeedPhraseBackupAfterOnboarding: PropTypes.bool,
@ -196,8 +194,6 @@ export default class ConfirmSeedPhrase extends PureComponent {
key={index}
seedIndex={index}
index={index}
draggingSeedIndex={this.state.draggingSeedIndex}
setDraggingSeedIndex={this.setDraggingSeedIndex}
setHoveringIndex={this.setHoveringIndex}
onDrop={this.onDrop}
className="confirm-seed-phrase__seed-word--shuffled"

@ -5,14 +5,12 @@ import {
hideSeedPhraseBackupAfterOnboarding,
initializeThreeBox,
} from '../../../../store/actions'
import { getSelectedAddress } from '../../../../selectors/selectors'
const mapStateToProps = state => {
const { appState: { showingSeedPhraseBackupAfterOnboarding } } = state
return {
showingSeedPhraseBackupAfterOnboarding,
selectedAddress: getSelectedAddress(state),
}
}

@ -16,11 +16,9 @@ class DraggableSeed extends Component {
onClick: PropTypes.func,
setHoveringIndex: PropTypes.func.isRequired,
index: PropTypes.number,
draggingSeedIndex: PropTypes.number,
word: PropTypes.string,
className: PropTypes.string,
selected: PropTypes.bool,
droppable: PropTypes.bool,
}
static defaultProps = {

@ -15,7 +15,6 @@ import MetaFoxLogo from '../../../components/ui/metafox-logo'
export default class SeedPhrase extends PureComponent {
static propTypes = {
address: PropTypes.string,
history: PropTypes.object,
seedPhrase: PropTypes.string,
verifySeedPhrase: PropTypes.func,

@ -8,7 +8,6 @@ import { INITIALIZE_CREATE_PASSWORD_ROUTE, INITIALIZE_SELECT_ACTION_ROUTE } from
export default class Welcome extends PureComponent {
static propTypes = {
history: PropTypes.object,
isInitialized: PropTypes.bool,
participateInMetaMetrics: PropTypes.bool,
welcomeScreenSeen: PropTypes.bool,
}

@ -5,11 +5,10 @@ import { closeWelcomeScreen } from '../../../store/actions'
import Welcome from './welcome.component'
const mapStateToProps = ({ metamask }) => {
const { welcomeScreenSeen, isInitialized, participateInMetaMetrics } = metamask
const { welcomeScreenSeen, participateInMetaMetrics } = metamask
return {
welcomeScreenSeen,
isInitialized,
participateInMetaMetrics,
}
}

@ -17,7 +17,6 @@ class RestoreVaultPage extends Component {
}
static propTypes = {
warning: PropTypes.string,
createNewVaultAndRestore: PropTypes.func.isRequired,
leaveImportSeedScreenState: PropTypes.func,
history: PropTypes.object,
@ -192,7 +191,7 @@ class RestoreVaultPage extends Component {
}
export default connect(
({ appState: { warning, isLoading } }) => ({ warning, isLoading }),
({ appState: { isLoading } }) => ({ isLoading }),
dispatch => ({
leaveImportSeedScreenState: () => {
dispatch(unMarkPasswordForgotten())

@ -12,8 +12,6 @@ export default class AccountListItem extends Component {
static propTypes = {
account: PropTypes.object,
className: PropTypes.string,
conversionRate: PropTypes.number,
currentCurrency: PropTypes.string,
displayAddress: PropTypes.bool,
displayBalance: PropTypes.bool,
handleClick: PropTypes.func,

@ -1,7 +1,5 @@
import { connect } from 'react-redux'
import {
getConversionRate,
getCurrentCurrency,
getNativeCurrency,
} from '../send.selectors.js'
import {
@ -18,8 +16,6 @@ function mapStateToProps (state) {
const isMainnet = getIsMainnet(state)
return {
conversionRate: getConversionRate(state),
currentCurrency: getCurrentCurrency(state),
nativeCurrency: getNativeCurrency(state),
balanceIsCached: isBalanceCached(state),
showFiat: (isMainnet || !!showFiatInTestnets),

@ -30,8 +30,6 @@ describe('account-list-item container', () => {
it('should map the correct properties to props', () => {
assert.deepEqual(mapStateToProps({ isMainnet: true, showFiatInTestnets: false }), {
conversionRate: 'mockConversionRate',
currentCurrency: 'mockCurrentCurrency',
nativeCurrency: 'mockNativeCurrency',
balanceIsCached: 'mockBalanceIsCached',
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', () => {
assert.deepEqual(mapStateToProps({ isMainnet: true, showFiatInTestnets: true }), {
conversionRate: 'mockConversionRate',
currentCurrency: 'mockCurrentCurrency',
nativeCurrency: 'mockNativeCurrency',
balanceIsCached: 'mockBalanceIsCached',
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', () => {
assert.deepEqual(mapStateToProps({ isMainnet: false, showFiatInTestnets: true }), {
conversionRate: 'mockConversionRate',
currentCurrency: 'mockCurrentCurrency',
nativeCurrency: 'mockNativeCurrency',
balanceIsCached: 'mockBalanceIsCached',
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', () => {
assert.deepEqual(mapStateToProps({ isMainnet: false, showFiatInTestnets: false }), {
conversionRate: 'mockConversionRate',
currentCurrency: 'mockCurrentCurrency',
nativeCurrency: 'mockNativeCurrency',
balanceIsCached: 'mockBalanceIsCached',
showFiat: false,

@ -11,7 +11,6 @@ import { ellipsify } from '../../send.utils'
export default class AddRecipient extends Component {
static propTypes = {
className: PropTypes.string,
query: PropTypes.string,
ownedAccounts: PropTypes.array,
addressBook: PropTypes.array,
@ -21,9 +20,6 @@ export default class AddRecipient extends Component {
toError: PropTypes.string,
toWarning: PropTypes.string,
ensResolutionError: PropTypes.string,
selectedToken: PropTypes.object,
hasHexData: PropTypes.bool,
tokens: PropTypes.array,
addressBookEntryName: PropTypes.string,
contacts: PropTypes.array,
nonContacts: PropTypes.array,

@ -26,7 +26,6 @@ export default class EnsInput extends Component {
selectedAddress: PropTypes.string,
selectedName: PropTypes.string,
onChange: PropTypes.func,
updateSendTo: PropTypes.func,
updateEnsResolution: PropTypes.func,
scanQrCode: PropTypes.func,
updateEnsResolutionError: PropTypes.func,

@ -15,7 +15,6 @@ export default class SendAmountRow extends Component {
]),
balance: PropTypes.string,
conversionRate: PropTypes.number,
convertedCurrency: PropTypes.string,
gasTotal: PropTypes.string,
inError: PropTypes.bool,
primaryCurrency: PropTypes.string,

@ -2,7 +2,6 @@ import { connect } from 'react-redux'
import {
getAmountConversionRate,
getConversionRate,
getCurrentCurrency,
getGasTotal,
getPrimaryCurrency,
getSelectedToken,
@ -31,7 +30,6 @@ function mapStateToProps (state) {
amountConversionRate: getAmountConversionRate(state),
balance: getSendFromBalance(state),
conversionRate: getConversionRate(state),
convertedCurrency: getCurrentCurrency(state),
gasTotal: getGasTotal(state),
inError: sendAmountIsInError(state),
primaryCurrency: getPrimaryCurrency(state),

@ -2,7 +2,6 @@ import assert from 'assert'
import proxyquire from 'proxyquire'
import sinon from 'sinon'
let mapStateToProps
let mapDispatchToProps
const actionSpies = {
@ -15,23 +14,11 @@ const duckActionSpies = {
proxyquire('../send-amount-row.container.js', {
'react-redux': {
connect: (ms, md) => {
mapStateToProps = ms
connect: (_, md) => {
mapDispatchToProps = md
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.utils': {
getAmountErrorObject: (mockDataObject) => ({ ...mockDataObject, mockChange: true }),
@ -43,25 +30,6 @@ proxyquire('../send-amount-row.container.js', {
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()', () => {
let dispatchSpy
let mapDispatchToPropsObject

@ -15,11 +15,8 @@ export default class SendContent extends Component {
static propTypes = {
updateGas: PropTypes.func,
scanQrCode: PropTypes.func,
showAddToAddressBookModal: PropTypes.func,
showHexData: PropTypes.bool,
ownedAccounts: PropTypes.array,
addressBook: PropTypes.array,
contact: PropTypes.object,
isOwnedAccount: PropTypes.bool,
}

@ -29,11 +29,11 @@ function mapDispatchToProps (dispatch) {
}
function mergeProps (stateProps, dispatchProps, ownProps) {
const { to, ...restStateProps } = stateProps
return {
...ownProps,
...stateProps,
...dispatchProps,
showAddToAddressBookModal: () => dispatchProps.showAddToAddressBookModal(stateProps.to),
...restStateProps,
showAddToAddressBookModal: () => dispatchProps.showAddToAddressBookModal(to),
}
}

@ -6,9 +6,6 @@ import { PRIMARY, SECONDARY } from '../../../../../helpers/constants/common'
export default class GasFeeDisplay extends Component {
static propTypes = {
conversionRate: PropTypes.number,
primaryCurrency: PropTypes.string,
convertedCurrency: PropTypes.string,
gasLoadingError: PropTypes.bool,
gasTotal: PropTypes.string,
onReset: PropTypes.func,

@ -9,8 +9,6 @@ export default class SendGasRow extends Component {
static propTypes = {
balance: PropTypes.string,
conversionRate: PropTypes.number,
convertedCurrency: PropTypes.string,
gasFeeError: PropTypes.bool,
gasLoadingError: PropTypes.bool,
gasTotal: PropTypes.string,
@ -76,8 +74,6 @@ export default class SendGasRow extends Component {
renderContent () {
const {
conversionRate,
convertedCurrency,
gasLoadingError,
gasTotal,
showCustomizeGasModal,
@ -119,8 +115,6 @@ export default class SendGasRow extends Component {
)
const gasFeeDisplay = (
<GasFeeDisplay
conversionRate={conversionRate}
convertedCurrency={convertedCurrency}
gasLoadingError={gasLoadingError}
gasTotal={gasTotal}
onReset={() => {

@ -1,7 +1,6 @@
import { connect } from 'react-redux'
import {
getConversionRate,
getCurrentCurrency,
getGasTotal,
getGasPrice,
getGasLimit,
@ -58,8 +57,6 @@ function mapStateToProps (state) {
return {
balance: getSendFromBalance(state),
conversionRate,
convertedCurrency: getCurrentCurrency(state),
gasTotal,
gasFeeError: gasFeeIsInError(state),
gasLoadingError: getGasLoadingError(state),

@ -60,16 +60,12 @@ describe('SendGasRow Component', function () {
assert(wrapper.find(SendRowWrapper).childAt(0).is(GasFeeDisplay))
})
it('should render the GasFeeDisplay with the correct props', () => {
it('should render the GasFeeDisplay', () => {
const {
conversionRate,
convertedCurrency,
gasLoadingError,
gasTotal,
onReset,
} = wrapper.find(SendRowWrapper).childAt(0).props()
assert.equal(conversionRate, 20)
assert.equal(convertedCurrency, 'mockConvertedCurrency')
assert.equal(gasLoadingError, false)
assert.equal(gasTotal, 'mockGasTotal')
assert.equal(propsMethodSpies.resetGasButtons.callCount, 0)

@ -2,7 +2,6 @@ import assert from 'assert'
import proxyquire from 'proxyquire'
import sinon from 'sinon'
let mapStateToProps
let mapDispatchToProps
let mergeProps
@ -25,28 +24,12 @@ const gasDuckSpies = {
proxyquire('../send-gas-row.container.js', {
'react-redux': {
connect: (ms, md, mp) => {
mapStateToProps = ms
connect: (_, md, mp) => {
mapDispatchToProps = md
mergeProps = mp
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': {
getMaxModeOn: (s) => `mockMaxModeOn:${s}`,
},
@ -59,52 +42,13 @@ proxyquire('../send-gas-row.container.js', {
}) => `${amount}:${gasTotal}:${balance}:${conversionRate}`,
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,
'../../../../selectors/custom-gas': {
getBasicGasEstimateLoadingStatus: (s) => `mockBasicGasEstimateLoadingStatus:${s}`,
getRenderableEstimateDataForSmallButtonsFromGWEI: (s) => `mockGasButtonInfo:${s}`,
getDefaultActiveButtonIndex: (gasButtonInfo, gasPrice) => gasButtonInfo.length + gasPrice.length,
},
'../../../../ducks/send/send.duck': sendDuckSpies,
'../../../../ducks/gas/gas.duck': gasDuckSpies,
})
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()', () => {
let dispatchSpy
let mapDispatchToPropsObject

@ -4,7 +4,6 @@ import SendRowWrapper from '../send-row-wrapper'
export default class SendHexDataRow extends Component {
static propTypes = {
data: PropTypes.string,
inError: PropTypes.bool,
updateSendHexData: PropTypes.func.isRequired,
updateGas: PropTypes.func.isRequired,

@ -10,9 +10,7 @@ export default class SendFooter extends Component {
amount: PropTypes.string,
data: PropTypes.string,
clearSend: PropTypes.func,
disabled: PropTypes.bool,
editingTransactionId: PropTypes.string,
errors: PropTypes.object,
from: PropTypes.object,
gasLimit: PropTypes.string,
gasPrice: PropTypes.string,

@ -324,13 +324,11 @@ export default class SendTransactionScreen extends PersistentForm {
}
renderAddRecipient () {
const { scanQrCode } = this.props
const { toError, toWarning } = this.state
return (
<AddRecipient
updateGas={({ to, amount, data } = {}) => this.updateGas({ to, amount, data })}
scanQrCode={scanQrCode}
query={this.state.query}
toError={toError}
toWarning={toWarning}
@ -339,13 +337,12 @@ export default class SendTransactionScreen extends PersistentForm {
}
renderSendContent () {
const { history, showHexData, scanQrCode } = this.props
const { history, showHexData } = this.props
return [
<SendContent
key="send-content"
updateGas={({ to, amount, data } = {}) => this.updateGas({ to, amount, data })}
scanQrCode={scanQrCode}
showHexData={showHexData}
/>,
<SendFooter key="send-footer" history={history} />,

@ -18,7 +18,6 @@ import {
getRecentBlocks,
getSelectedToken,
getSelectedTokenContract,
getSelectedTokenToFiatRate,
getSendAmount,
getSendEditingTransactionId,
getSendHexDataFeatureFlagState,
@ -88,7 +87,6 @@ function mapStateToProps (state) {
tokens: getTokens(state),
tokenBalance: getTokenBalance(state),
tokenContract: getSelectedTokenContract(state),
tokenToFiatRate: getSelectedTokenToFiatRate(state),
}
}

@ -2,7 +2,6 @@ import assert from 'assert'
import proxyquire from 'proxyquire'
import sinon from 'sinon'
let mapStateToProps
let mapDispatchToProps
const actionSpies = {
@ -17,45 +16,13 @@ const duckActionSpies = {
proxyquire('../send.container.js', {
'react-redux': {
connect: (ms, md) => {
mapStateToProps = ms
connect: (_, md) => {
mapDispatchToProps = md
return () => ({})
},
},
'react-router-dom': { withRouter: () => {} },
'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,
'../../ducks/send/send.duck': duckActionSpies,
'./send.utils.js': {
@ -66,40 +33,6 @@ proxyquire('../send.container.js', {
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()', () => {
let dispatchSpy
let mapDispatchToPropsObject

@ -17,7 +17,6 @@ export default class AdvancedTab extends PureComponent {
setUseNonceField: PropTypes.func,
useNonceField: PropTypes.bool,
setHexDataFeatureFlag: PropTypes.func,
setRpcTarget: PropTypes.func,
displayWarning: PropTypes.func,
showResetAccountConfirmationModal: PropTypes.func,
warning: PropTypes.string,

@ -3,7 +3,6 @@ import { compose } from 'recompose'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import {
updateAndSetCustomRpc,
displayWarning,
setFeatureFlag,
showModal,
@ -43,7 +42,6 @@ export const mapStateToProps = state => {
export const mapDispatchToProps = dispatch => {
return {
setHexDataFeatureFlag: shouldShow => dispatch(setFeatureFlag('sendHexData', shouldShow)),
setRpcTarget: (newRpc, chainId, ticker, nickname) => dispatch(updateAndSetCustomRpc(newRpc, chainId, ticker, nickname)),
displayWarning: warning => dispatch(displayWarning(warning)),
showResetAccountConfirmationModal: () => dispatch(showModal({ name: 'CONFIRM_RESET_ACCOUNT' })),
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,
history: PropTypes.object,
scanQrCode: PropTypes.func,
qrCodeData: PropTypes.object,
qrCodeData: PropTypes.object, /* eslint-disable-line react/no-unused-prop-types */
qrCodeDetected: PropTypes.func,
}

@ -16,7 +16,6 @@ export default class ViewContact extends PureComponent {
}
static propTypes = {
removeFromAddressBook: PropTypes.func,
name: PropTypes.string,
address: PropTypes.string,
history: PropTypes.object,

@ -3,7 +3,6 @@ import { compose } from 'recompose'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { getAddressBookEntry } from '../../../../selectors/selectors'
import { removeFromAddressBook } from '../../../../store/actions'
import { checksumAddress } from '../../../../helpers/utils/util'
import {
CONTACT_EDIT_ROUTE,
@ -31,13 +30,7 @@ const mapStateToProps = (state, ownProps) => {
}
}
const mapDispatchToProps = dispatch => {
return {
removeFromAddressBook: (addressToRemove) => dispatch(removeFromAddressBook(addressToRemove)),
}
}
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps)
connect(mapStateToProps)
)(ViewContact)

@ -6,18 +6,6 @@ export default class InfoTab extends PureComponent {
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 = {
t: PropTypes.func,
}

@ -11,11 +11,8 @@ export default class SecurityTab extends PureComponent {
}
static propTypes = {
displayWarning: PropTypes.func,
revealSeedConfirmation: PropTypes.func,
warning: PropTypes.string,
history: PropTypes.object,
mobileSync: PropTypes.bool,
participateInMetaMetrics: PropTypes.bool,
setParticipateInMetaMetrics: PropTypes.func,
showIncomingTransactions: PropTypes.bool,

@ -3,8 +3,6 @@ import { compose } from 'recompose'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import {
displayWarning,
revealSeedConfirmation,
setFeatureFlag,
setParticipateInMetaMetrics,
} from '../../../store/actions'
@ -27,8 +25,6 @@ const mapStateToProps = state => {
const mapDispatchToProps = dispatch => {
return {
displayWarning: warning => dispatch(displayWarning(warning)),
revealSeedConfirmation: () => dispatch(revealSeedConfirmation()),
setParticipateInMetaMetrics: (val) => dispatch(setParticipateInMetaMetrics(val)),
setShowIncomingTransactionsFeatureFlag: shouldShow => dispatch(setFeatureFlag('showIncomingTransactions', shouldShow)),
}

@ -34,9 +34,7 @@ export default class SettingsTab extends PureComponent {
static propTypes = {
setUseBlockie: PropTypes.func,
setCurrentCurrency: PropTypes.func,
displayWarning: PropTypes.func,
warning: PropTypes.string,
history: PropTypes.object,
updateCurrentLocale: PropTypes.func,
currentLocale: PropTypes.string,
useBlockie: PropTypes.bool,

@ -1,10 +1,8 @@
import SettingsTab from './settings-tab.component'
import { compose } from 'recompose'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import {
setCurrentCurrency,
displayWarning,
setUseBlockie,
updateCurrentLocale,
setUseNativeCurrencyAsPrimaryCurrencyPreference,
@ -37,7 +35,6 @@ const mapStateToProps = state => {
const mapDispatchToProps = dispatch => {
return {
setCurrentCurrency: currency => dispatch(setCurrentCurrency(currency)),
displayWarning: warning => dispatch(displayWarning(warning)),
setUseBlockie: value => dispatch(setUseBlockie(value)),
updateCurrentLocale: key => dispatch(updateCurrentLocale(key)),
setUseNativeCurrencyAsPrimaryCurrencyPreference: value => {
@ -48,6 +45,5 @@ const mapDispatchToProps = dispatch => {
}
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps)
)(SettingsTab)

@ -34,12 +34,10 @@ class SettingsPage extends PureComponent {
history: PropTypes.object,
isAddressEntryPage: PropTypes.bool,
isPopupView: PropTypes.bool,
location: PropTypes.object,
pathnameI18nKey: PropTypes.string,
initialBreadCrumbRoute: PropTypes.string,
breadCrumbTextKey: PropTypes.string,
initialBreadCrumbKey: PropTypes.string,
t: PropTypes.func,
}
static contextTypes = {

Loading…
Cancel
Save