mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
repeated getSelectedAddress() func send.selectors.js removed (#6056)
This commit is contained in:
parent
7ceb1c63cc
commit
2786932576
@ -2,6 +2,10 @@ import { connect } from 'react-redux'
|
|||||||
import SendEther from './send.component'
|
import SendEther from './send.component'
|
||||||
import { withRouter } from 'react-router-dom'
|
import { withRouter } from 'react-router-dom'
|
||||||
import { compose } from 'recompose'
|
import { compose } from 'recompose'
|
||||||
|
const {
|
||||||
|
getSelectedAddress,
|
||||||
|
} = require('../../../selectors/selectors')
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getAmountConversionRate,
|
getAmountConversionRate,
|
||||||
getBlockGasLimit,
|
getBlockGasLimit,
|
||||||
@ -12,7 +16,6 @@ import {
|
|||||||
getGasTotal,
|
getGasTotal,
|
||||||
getPrimaryCurrency,
|
getPrimaryCurrency,
|
||||||
getRecentBlocks,
|
getRecentBlocks,
|
||||||
getSelectedAddress,
|
|
||||||
getSelectedToken,
|
getSelectedToken,
|
||||||
getSelectedTokenContract,
|
getSelectedTokenContract,
|
||||||
getSelectedTokenToFiatRate,
|
getSelectedTokenToFiatRate,
|
||||||
|
@ -5,6 +5,7 @@ const {
|
|||||||
} = require('../../../helpers/utils/conversion-util')
|
} = require('../../../helpers/utils/conversion-util')
|
||||||
const {
|
const {
|
||||||
getMetaMaskAccounts,
|
getMetaMaskAccounts,
|
||||||
|
getSelectedAddress,
|
||||||
} = require('../../../selectors/selectors')
|
} = require('../../../selectors/selectors')
|
||||||
const {
|
const {
|
||||||
estimateGasPriceFromRecentBlocks,
|
estimateGasPriceFromRecentBlocks,
|
||||||
@ -33,7 +34,6 @@ const selectors = {
|
|||||||
getPrimaryCurrency,
|
getPrimaryCurrency,
|
||||||
getRecentBlocks,
|
getRecentBlocks,
|
||||||
getSelectedAccount,
|
getSelectedAccount,
|
||||||
getSelectedAddress,
|
|
||||||
getSelectedIdentity,
|
getSelectedIdentity,
|
||||||
getSelectedToken,
|
getSelectedToken,
|
||||||
getSelectedTokenContract,
|
getSelectedTokenContract,
|
||||||
@ -149,12 +149,6 @@ function getSelectedAccount (state) {
|
|||||||
return accounts[selectedAddress]
|
return accounts[selectedAddress]
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSelectedAddress (state) {
|
|
||||||
const selectedAddress = state.metamask.selectedAddress || Object.keys(getMetaMaskAccounts(state))[0]
|
|
||||||
|
|
||||||
return selectedAddress
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSelectedIdentity (state) {
|
function getSelectedIdentity (state) {
|
||||||
const selectedAddress = getSelectedAddress(state)
|
const selectedAddress = getSelectedAddress(state)
|
||||||
const identities = state.metamask.identities
|
const identities = state.metamask.identities
|
||||||
|
@ -35,7 +35,6 @@ proxyquire('../send.container.js', {
|
|||||||
getGasTotal: (s) => `mockGasTotal:${s}`,
|
getGasTotal: (s) => `mockGasTotal:${s}`,
|
||||||
getPrimaryCurrency: (s) => `mockPrimaryCurrency:${s}`,
|
getPrimaryCurrency: (s) => `mockPrimaryCurrency:${s}`,
|
||||||
getRecentBlocks: (s) => `mockRecentBlocks:${s}`,
|
getRecentBlocks: (s) => `mockRecentBlocks:${s}`,
|
||||||
getSelectedAddress: (s) => `mockSelectedAddress:${s}`,
|
|
||||||
getSelectedToken: (s) => `mockSelectedToken:${s}`,
|
getSelectedToken: (s) => `mockSelectedToken:${s}`,
|
||||||
getSelectedTokenContract: (s) => `mockTokenContract:${s}`,
|
getSelectedTokenContract: (s) => `mockTokenContract:${s}`,
|
||||||
getSelectedTokenToFiatRate: (s) => `mockTokenToFiatRate:${s}`,
|
getSelectedTokenToFiatRate: (s) => `mockTokenToFiatRate:${s}`,
|
||||||
@ -47,11 +46,15 @@ proxyquire('../send.container.js', {
|
|||||||
getTokenBalance: (s) => `mockTokenBalance:${s}`,
|
getTokenBalance: (s) => `mockTokenBalance:${s}`,
|
||||||
getQrCodeData: (s) => `mockQrCodeData:${s}`,
|
getQrCodeData: (s) => `mockQrCodeData:${s}`,
|
||||||
},
|
},
|
||||||
|
'../../../selectors/selectors': {
|
||||||
|
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': {
|
||||||
calcGasTotal: (gasLimit, gasPrice) => gasLimit + gasPrice,
|
calcGasTotal: (gasLimit, gasPrice) => gasLimit + gasPrice,
|
||||||
},
|
},
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('send container', () => {
|
describe('send container', () => {
|
||||||
|
@ -20,7 +20,6 @@ const {
|
|||||||
getPrimaryCurrency,
|
getPrimaryCurrency,
|
||||||
getRecentBlocks,
|
getRecentBlocks,
|
||||||
getSelectedAccount,
|
getSelectedAccount,
|
||||||
getSelectedAddress,
|
|
||||||
getSelectedIdentity,
|
getSelectedIdentity,
|
||||||
getSelectedToken,
|
getSelectedToken,
|
||||||
getSelectedTokenContract,
|
getSelectedTokenContract,
|
||||||
@ -274,14 +273,6 @@ describe('send selectors', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('getSelectedAddress()', () => {
|
|
||||||
it('should', () => {
|
|
||||||
assert.equal(
|
|
||||||
getSelectedAddress(mockState),
|
|
||||||
'0xd85a4b6a394794842887b8284293d69163007bbb'
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('getSelectedIdentity()', () => {
|
describe('getSelectedIdentity()', () => {
|
||||||
it('should return the identity object of the currently selected address', () => {
|
it('should return the identity object of the currently selected address', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user