mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Move send selectors to selectors dir (#8505)
This commit is contained in:
parent
5b06bf795b
commit
eacdb5d920
@ -46,7 +46,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
getTokenBalance,
|
getTokenBalance,
|
||||||
getSendMaxModeState,
|
getSendMaxModeState,
|
||||||
} from '../../../../pages/send/send.selectors'
|
} from '../../../../selectors/send'
|
||||||
import {
|
import {
|
||||||
formatCurrency,
|
formatCurrency,
|
||||||
} from '../../../../helpers/utils/confirm-tx.util'
|
} from '../../../../helpers/utils/confirm-tx.util'
|
||||||
|
@ -46,7 +46,7 @@ proxyquire('../gas-modal-page-container.container.js', {
|
|||||||
'../../../../ducks/gas/gas.duck': gasActionSpies,
|
'../../../../ducks/gas/gas.duck': gasActionSpies,
|
||||||
'../../../../ducks/confirm-transaction/confirm-transaction.duck': confirmTransactionActionSpies,
|
'../../../../ducks/confirm-transaction/confirm-transaction.duck': confirmTransactionActionSpies,
|
||||||
'../../../../ducks/send/send.duck': sendActionSpies,
|
'../../../../ducks/send/send.duck': sendActionSpies,
|
||||||
'../../../../pages/send/send.selectors': {
|
'../../../../selectors/send': {
|
||||||
getTokenBalance: (state) => state.metamask.send.tokenBalance || '0x0',
|
getTokenBalance: (state) => state.metamask.send.tokenBalance || '0x0',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import CurrencyInput from './currency-input.component'
|
import CurrencyInput from './currency-input.component'
|
||||||
import { ETH } from '../../../helpers/constants/common'
|
import { ETH } from '../../../helpers/constants/common'
|
||||||
import { getSendMaxModeState } from '../../../pages/send/send.selectors'
|
import { getSendMaxModeState } from '../../../selectors/send'
|
||||||
import { getIsMainnet, preferencesSelector } from '../../../selectors'
|
import { getIsMainnet, preferencesSelector } from '../../../selectors'
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import {
|
import {
|
||||||
getNativeCurrency,
|
getNativeCurrency,
|
||||||
} from '../send.selectors.js'
|
} from '../../../selectors/send'
|
||||||
import {
|
import {
|
||||||
getIsMainnet,
|
getIsMainnet,
|
||||||
isBalanceCached,
|
isBalanceCached,
|
||||||
|
@ -10,7 +10,7 @@ proxyquire('../account-list-item.container.js', {
|
|||||||
return () => ({})
|
return () => ({})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'../send.selectors.js': {
|
'../../../selectors/send': {
|
||||||
getConversionRate: () => `mockConversionRate`,
|
getConversionRate: () => `mockConversionRate`,
|
||||||
getCurrentCurrency: () => `mockCurrentCurrency`,
|
getCurrentCurrency: () => `mockCurrentCurrency`,
|
||||||
getNativeCurrency: () => `mockNativeCurrency`,
|
getNativeCurrency: () => `mockNativeCurrency`,
|
||||||
|
@ -2,7 +2,7 @@ import { connect } from 'react-redux'
|
|||||||
import {
|
import {
|
||||||
getSendEnsResolution,
|
getSendEnsResolution,
|
||||||
getSendEnsResolutionError,
|
getSendEnsResolutionError,
|
||||||
} from '../../send.selectors.js'
|
} from '../../../../selectors/send'
|
||||||
import {
|
import {
|
||||||
accountsWithSendEtherInfoSelector,
|
accountsWithSendEtherInfoSelector,
|
||||||
getAddressBook,
|
getAddressBook,
|
||||||
|
@ -3,7 +3,7 @@ import {
|
|||||||
getCurrentNetwork,
|
getCurrentNetwork,
|
||||||
getSendTo,
|
getSendTo,
|
||||||
getSendToNickname,
|
getSendToNickname,
|
||||||
} from '../../send.selectors'
|
} from '../../../../selectors/send'
|
||||||
import {
|
import {
|
||||||
getAddressBookEntry,
|
getAddressBookEntry,
|
||||||
} from '../../../../selectors'
|
} from '../../../../selectors'
|
||||||
|
@ -17,7 +17,7 @@ proxyquire('../add-recipient.container.js', {
|
|||||||
return () => ({})
|
return () => ({})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'../../send.selectors.js': {
|
'../../../../selectors/send': {
|
||||||
getSendEnsResolution: (s) => `mockSendEnsResolution:${s}`,
|
getSendEnsResolution: (s) => `mockSendEnsResolution:${s}`,
|
||||||
getSendEnsResolutionError: (s) => `mockSendEnsResolutionError:${s}`,
|
getSendEnsResolutionError: (s) => `mockSendEnsResolutionError:${s}`,
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
getSendFromBalance,
|
getSendFromBalance,
|
||||||
getTokenBalance,
|
getTokenBalance,
|
||||||
getSendMaxModeState,
|
getSendMaxModeState,
|
||||||
} from '../../../send.selectors.js'
|
} from '../../../../../selectors/send'
|
||||||
import { getBasicGasEstimateLoadingStatus } from '../../../../../selectors'
|
import { getBasicGasEstimateLoadingStatus } from '../../../../../selectors'
|
||||||
import { calcMaxAmount } from './amount-max-button.utils.js'
|
import { calcMaxAmount } from './amount-max-button.utils.js'
|
||||||
import {
|
import {
|
||||||
|
@ -21,7 +21,7 @@ proxyquire('../amount-max-button.container.js', {
|
|||||||
return () => ({})
|
return () => ({})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'../../../send.selectors.js': {
|
'../../../../../selectors/send': {
|
||||||
getGasTotal: (s) => `mockGasTotal:${s}`,
|
getGasTotal: (s) => `mockGasTotal:${s}`,
|
||||||
getSelectedToken: (s) => `mockSelectedToken:${s}`,
|
getSelectedToken: (s) => `mockSelectedToken:${s}`,
|
||||||
getSendFromBalance: (s) => `mockBalance:${s}`,
|
getSendFromBalance: (s) => `mockBalance:${s}`,
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
getTokenBalance,
|
getTokenBalance,
|
||||||
getSendMaxModeState,
|
getSendMaxModeState,
|
||||||
sendAmountIsInError,
|
sendAmountIsInError,
|
||||||
} from '../../send.selectors'
|
} from '../../../../selectors/send'
|
||||||
import { getAmountErrorObject, getGasFeeErrorObject } from '../../send.utils'
|
import { getAmountErrorObject, getGasFeeErrorObject } from '../../send.utils'
|
||||||
import {
|
import {
|
||||||
setMaxModeTo,
|
setMaxModeTo,
|
||||||
|
@ -19,7 +19,7 @@ proxyquire('../send-amount-row.container.js', {
|
|||||||
return () => ({})
|
return () => ({})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'../../send.selectors': { sendAmountIsInError: (s) => `mockInError:${s}` },
|
'../../../../selectors/send': { sendAmountIsInError: (s) => `mockInError:${s}` },
|
||||||
'../../send.utils': {
|
'../../send.utils': {
|
||||||
getAmountErrorObject: (mockDataObject) => ({ ...mockDataObject, mockChange: true }),
|
getAmountErrorObject: (mockDataObject) => ({ ...mockDataObject, mockChange: true }),
|
||||||
getGasFeeErrorObject: (mockDataObject) => ({ ...mockDataObject, mockGasFeeErrorChange: true }),
|
getGasFeeErrorObject: (mockDataObject) => ({ ...mockDataObject, mockGasFeeErrorChange: true }),
|
||||||
|
@ -2,7 +2,7 @@ import { connect } from 'react-redux'
|
|||||||
import SendContent from './send-content.component'
|
import SendContent from './send-content.component'
|
||||||
import {
|
import {
|
||||||
getSendTo,
|
getSendTo,
|
||||||
} from '../send.selectors'
|
} from '../../../selectors/send'
|
||||||
import {
|
import {
|
||||||
accountsWithSendEtherInfoSelector,
|
accountsWithSendEtherInfoSelector,
|
||||||
getAddressBookEntry,
|
getAddressBookEntry,
|
||||||
|
@ -11,7 +11,15 @@ import {
|
|||||||
getGasLoadingError,
|
getGasLoadingError,
|
||||||
gasFeeIsInError,
|
gasFeeIsInError,
|
||||||
getGasButtonGroupShown,
|
getGasButtonGroupShown,
|
||||||
} from '../../send.selectors.js'
|
} from '../../../../selectors/send'
|
||||||
|
import {
|
||||||
|
getAdvancedInlineGasShown,
|
||||||
|
getCurrentEthBalance,
|
||||||
|
getSelectedToken,
|
||||||
|
getBasicGasEstimateLoadingStatus,
|
||||||
|
getRenderableEstimateDataForSmallButtonsFromGWEI,
|
||||||
|
getDefaultActiveButtonIndex,
|
||||||
|
} from '../../../../selectors'
|
||||||
import {
|
import {
|
||||||
isBalanceSufficient,
|
isBalanceSufficient,
|
||||||
calcGasTotal,
|
calcGasTotal,
|
||||||
@ -27,14 +35,6 @@ import {
|
|||||||
setCustomGasLimit,
|
setCustomGasLimit,
|
||||||
} from '../../../../ducks/gas/gas.duck'
|
} from '../../../../ducks/gas/gas.duck'
|
||||||
import { showModal, setGasPrice, setGasLimit, setGasTotal, updateSendAmount } from '../../../../store/actions'
|
import { showModal, setGasPrice, setGasLimit, setGasTotal, updateSendAmount } from '../../../../store/actions'
|
||||||
import {
|
|
||||||
getAdvancedInlineGasShown,
|
|
||||||
getCurrentEthBalance,
|
|
||||||
getSelectedToken,
|
|
||||||
getBasicGasEstimateLoadingStatus,
|
|
||||||
getRenderableEstimateDataForSmallButtonsFromGWEI,
|
|
||||||
getDefaultActiveButtonIndex,
|
|
||||||
} from '../../../../selectors'
|
|
||||||
import SendGasRow from './send-gas-row.component'
|
import SendGasRow from './send-gas-row.component'
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ proxyquire('../send-gas-row.container.js', {
|
|||||||
return () => ({})
|
return () => ({})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'../../send.selectors.js': {
|
'../../../../selectors/send': {
|
||||||
getSendMaxModeState: (s) => `mockMaxModeOn:${s}`,
|
getSendMaxModeState: (s) => `mockMaxModeOn:${s}`,
|
||||||
},
|
},
|
||||||
'../../send.utils.js': {
|
'../../send.utils.js': {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { getSendErrors } from '../../../send.selectors'
|
import { getSendErrors } from '../../../../../selectors/send'
|
||||||
import SendRowErrorMessage from './send-row-error-message.component'
|
import SendRowErrorMessage from './send-row-error-message.component'
|
||||||
|
|
||||||
export default connect(mapStateToProps)(SendRowErrorMessage)
|
export default connect(mapStateToProps)(SendRowErrorMessage)
|
||||||
|
@ -10,7 +10,7 @@ proxyquire('../send-row-error-message.container.js', {
|
|||||||
return () => ({})
|
return () => ({})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'../../../send.selectors': { getSendErrors: (s) => `mockErrors:${s}` },
|
'../../../../../selectors/send': { getSendErrors: (s) => `mockErrors:${s}` },
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('send-row-error-message container', function () {
|
describe('send-row-error-message container', function () {
|
||||||
|
@ -23,17 +23,17 @@ import {
|
|||||||
getUnapprovedTxs,
|
getUnapprovedTxs,
|
||||||
getSendErrors,
|
getSendErrors,
|
||||||
isSendFormInError,
|
isSendFormInError,
|
||||||
} from '../send.selectors'
|
} from '../../../selectors/send'
|
||||||
import {
|
|
||||||
addressIsNew,
|
|
||||||
constructTxParams,
|
|
||||||
constructUpdatedTx,
|
|
||||||
} from './send-footer.utils'
|
|
||||||
import {
|
import {
|
||||||
getGasIsLoading,
|
getGasIsLoading,
|
||||||
getRenderableEstimateDataForSmallButtonsFromGWEI,
|
getRenderableEstimateDataForSmallButtonsFromGWEI,
|
||||||
getDefaultActiveButtonIndex,
|
getDefaultActiveButtonIndex,
|
||||||
} from '../../../selectors'
|
} from '../../../selectors'
|
||||||
|
import {
|
||||||
|
addressIsNew,
|
||||||
|
constructTxParams,
|
||||||
|
constructUpdatedTx,
|
||||||
|
} from './send-footer.utils'
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(SendFooter)
|
export default connect(mapStateToProps, mapDispatchToProps)(SendFooter)
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ proxyquire('../send-footer.container.js', {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
'../../../store/actions': actionSpies,
|
'../../../store/actions': actionSpies,
|
||||||
'../send.selectors': {
|
'../../../selectors/send': {
|
||||||
getGasLimit: (s) => `mockGasLimit:${s}`,
|
getGasLimit: (s) => `mockGasLimit:${s}`,
|
||||||
getGasPrice: (s) => `mockGasPrice:${s}`,
|
getGasPrice: (s) => `mockGasPrice:${s}`,
|
||||||
getGasTotal: (s) => `mockGasTotal:${s}`,
|
getGasTotal: (s) => `mockGasTotal:${s}`,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { clearSend } from '../../../store/actions'
|
import { clearSend } from '../../../store/actions'
|
||||||
import SendHeader from './send-header.component'
|
import SendHeader from './send-header.component'
|
||||||
import { getTitleKey } from '../send.selectors'
|
import { getTitleKey } from '../../../selectors/send'
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(SendHeader)
|
export default connect(mapStateToProps, mapDispatchToProps)(SendHeader)
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ proxyquire('../send-header.container.js', {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
'../../../store/actions': actionSpies,
|
'../../../store/actions': actionSpies,
|
||||||
'../send.selectors': {
|
'../../../selectors/send': {
|
||||||
getTitleKey: (s) => `mockTitleKey:${s}`,
|
getTitleKey: (s) => `mockTitleKey:${s}`,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -23,7 +23,7 @@ import {
|
|||||||
getTokenBalance,
|
getTokenBalance,
|
||||||
getQrCodeData,
|
getQrCodeData,
|
||||||
getTokens,
|
getTokens,
|
||||||
} from './send.selectors'
|
} from '../../selectors/send'
|
||||||
import {
|
import {
|
||||||
getSelectedAddress,
|
getSelectedAddress,
|
||||||
getAddressBook,
|
getAddressBook,
|
||||||
|
@ -5,7 +5,7 @@ import { withRouter } from 'react-router-dom'
|
|||||||
import { addToAddressBook, showQrScanner, qrCodeDetected } from '../../../../store/actions'
|
import { addToAddressBook, showQrScanner, qrCodeDetected } from '../../../../store/actions'
|
||||||
import {
|
import {
|
||||||
getQrCodeData,
|
getQrCodeData,
|
||||||
} from '../../../send/send.selectors'
|
} from '../../../../selectors/send'
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
return {
|
return {
|
||||||
|
@ -6,8 +6,8 @@ import {
|
|||||||
getTargetAccount,
|
getTargetAccount,
|
||||||
getSelectedAddress,
|
getSelectedAddress,
|
||||||
getAveragePriceEstimateInHexWEI,
|
getAveragePriceEstimateInHexWEI,
|
||||||
} from '../../selectors'
|
} from '.'
|
||||||
import { estimateGasPriceFromRecentBlocks, calcGasTotal } from './send.utils'
|
import { estimateGasPriceFromRecentBlocks, calcGasTotal } from '../pages/send/send.utils'
|
||||||
|
|
||||||
export function getBlockGasLimit (state) {
|
export function getBlockGasLimit (state) {
|
||||||
return state.metamask.currentBlockGasLimit
|
return state.metamask.currentBlockGasLimit
|
@ -3,7 +3,7 @@ import sinon from 'sinon'
|
|||||||
import {
|
import {
|
||||||
accountsWithSendEtherInfoSelector,
|
accountsWithSendEtherInfoSelector,
|
||||||
getCurrentAccountWithSendEtherInfo,
|
getCurrentAccountWithSendEtherInfo,
|
||||||
} from '../../../selectors'
|
} from '..'
|
||||||
import {
|
import {
|
||||||
getBlockGasLimit,
|
getBlockGasLimit,
|
||||||
getConversionRate,
|
getConversionRate,
|
||||||
@ -37,7 +37,7 @@ import {
|
|||||||
getTokens,
|
getTokens,
|
||||||
getTitleKey,
|
getTitleKey,
|
||||||
isSendFormInError,
|
isSendFormInError,
|
||||||
} from '../send.selectors.js'
|
} from '../send'
|
||||||
import mockState from './send-selectors-test-data'
|
import mockState from './send-selectors-test-data'
|
||||||
|
|
||||||
describe('send selectors', function () {
|
describe('send selectors', function () {
|
Loading…
Reference in New Issue
Block a user