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