1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

Reorganize selectors directory (#8497)

This commit is contained in:
Erik Marks 2020-05-02 12:41:17 -07:00 committed by GitHub
parent 11aa4029e8
commit 786e82791e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
85 changed files with 360 additions and 367 deletions

View File

@ -1,4 +1,4 @@
import { getMetaMetricState } from '../../../ui/app/selectors/selectors'
import { getMetaMetricState } from '../../../ui/app/selectors'
import { sendMetaMetricsEvent } from '../../../ui/app/helpers/utils/metametrics.util'
const inDevelopment = process.env.NODE_ENV === 'development'

View File

@ -1,5 +1,5 @@
import assert from 'assert'
import * as selectors from '../../../../ui/app/selectors/selectors'
import * as selectors from '../../../../ui/app/selectors'
import mockState from '../../../data/mock-state.json'
import Eth from 'ethjs'
import { createTestProviderTools } from '../../../stub/provider'
@ -120,11 +120,6 @@ describe('Selectors', function () {
assert.equal(currentCurrency, 'usd')
})
it('#getSelectedTokenToFiatRate', function () {
const selectedTokenToFiatRate = selectors.getSelectedTokenToFiatRate(mockState)
assert.equal(selectedTokenToFiatRate, '0.21880988420033492152')
})
it('#getSelectedTokenContract', function () {
global.eth = new Eth(provider)
const selectedTokenContract = selectors.getSelectedTokenContract(mockState)

View File

@ -15,7 +15,7 @@ import {
getMetaMaskKeyrings,
getOriginOfCurrentTab,
getSelectedAddress,
} from '../../../selectors/selectors'
} from '../../../selectors'
import AccountMenu from './account-menu.component'
/**

View File

@ -3,7 +3,7 @@ import { withRouter } from 'react-router-dom'
import { compose } from 'redux'
import AssetList from './asset-list.component'
import { setSelectedToken } from '../../../store/actions'
import { getSelectedAccount } from '../../../selectors/selectors'
import { getSelectedAccount } from '../../../selectors'
function mapStateToProps (state) {
return {

View File

@ -10,7 +10,7 @@ import {
getAddressConnectedDomainMap,
getOriginOfCurrentTab,
getSelectedAddress,
} from '../../../selectors/selectors'
} from '../../../selectors'
const mapStateToProps = (state) => {

View File

@ -3,7 +3,7 @@ import { withRouter } from 'react-router-dom'
import { connect } from 'react-redux'
import AccountDetailsDropdown from './account-details-dropdown.component'
import * as actions from '../../../../store/actions'
import { getSelectedIdentity, getRpcPrefsForCurrentProvider } from '../../../../selectors/selectors'
import { getSelectedIdentity, getRpcPrefsForCurrentProvider } from '../../../../selectors'
import genAccountLink from '../../../../../lib/account-link.js'
function mapStateToProps (state) {

View File

@ -31,8 +31,6 @@ import {
getSelectedToken,
isEthereumNetwork,
preferencesSelector,
} from '../../../../selectors/selectors.js'
import {
getBasicGasEstimateLoadingStatus,
getGasEstimatesLoadingStatus,
getCustomGasLimit,
@ -42,11 +40,9 @@ import {
getEstimatedGasTimes,
getRenderableBasicEstimateData,
getBasicGasEstimateBlockTime,
isCustomPriceSafe,
} from '../../../../selectors/custom-gas'
import {
getTxParams,
} from '../../../../selectors/transactions'
isCustomPriceSafe,
} from '../../../../selectors'
import {
getTokenBalance,
} from '../../../../pages/send/send.selectors'

View File

@ -35,19 +35,17 @@ proxyquire('../gas-modal-page-container.container.js', {
return () => ({})
},
},
'../../../../selectors/custom-gas': {
'../../../../selectors/': {
getBasicGasEstimateLoadingStatus: (s) => `mockBasicGasEstimateLoadingStatus:${Object.keys(s).length}`,
getRenderableBasicEstimateData: (s) => `mockRenderableBasicEstimateData:${Object.keys(s).length}`,
getDefaultActiveButtonIndex: (a, b) => a + b,
getCurrentEthBalance: (state) => state.metamask.balance || '0x0',
getSelectedToken: () => null,
},
'../../../../store/actions': actionSpies,
'../../../../ducks/gas/gas.duck': gasActionSpies,
'../../../../ducks/confirm-transaction/confirm-transaction.duck': confirmTransactionActionSpies,
'../../../../ducks/send/send.duck': sendActionSpies,
'../../../../selectors/selectors.js': {
getCurrentEthBalance: (state) => state.metamask.balance || '0x0',
getSelectedToken: () => null,
},
'../../../../pages/send/send.selectors': {
getTokenBalance: (state) => state.metamask.send.tokenBalance || '0x0',
},

View File

@ -1,7 +1,7 @@
import { connect } from 'react-redux'
import LoadingNetworkScreen from './loading-network-screen.component'
import * as actions from '../../../store/actions'
import { getNetworkIdentifier } from '../../../selectors/selectors'
import { getNetworkIdentifier } from '../../../selectors'
const mapStateToProps = (state) => {
const {

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import { showModal, setAccountLabel } from '../../../../store/actions'
import { getSelectedIdentity, getRpcPrefsForCurrentProvider } from '../../../../selectors/selectors'
import { getSelectedIdentity, getRpcPrefsForCurrentProvider } from '../../../../selectors'
import AccountDetailsModal from './account-details-modal.component'
const mapStateToProps = (state) => {

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import { hideModal } from '../../../../store/actions'
import { getSelectedIdentity } from '../../../../selectors/selectors'
import { getSelectedIdentity } from '../../../../selectors'
import AccountModalContainer from './account-modal-container.component'
function mapStateToProps (state, ownProps) {

View File

@ -2,7 +2,7 @@ import { connect } from 'react-redux'
import { compose } from 'redux'
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'
import EditApprovalPermission from './edit-approval-permission.component'
import { getSelectedIdentity } from '../../../../selectors/selectors'
import { getSelectedIdentity } from '../../../../selectors'
const mapStateToProps = (state) => {
const modalStateProps = state.appState.modal.modalState.props || {}

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import { exportAccount, hideWarning, showModal, hideModal } from '../../../../store/actions'
import { getSelectedIdentity } from '../../../../selectors/selectors'
import { getSelectedIdentity } from '../../../../selectors'
import ExportPrivateKeyModal from './export-private-key-modal.component'
function mapStateToPropsFactory () {

View File

@ -4,7 +4,7 @@ import {
getPermissionsDescriptions,
getTargetDomainMetadata,
getMetaMaskIdentities,
} from '../../../selectors/selectors'
} from '../../../selectors'
const mapStateToProps = (state, ownProps) => {
const { request, cachedOrigin, selectedIdentities } = ownProps

View File

@ -1,7 +1,7 @@
import { connect } from 'react-redux'
import SelectedAccount from './selected-account.component'
import { getSelectedIdentity } from '../../../selectors/selectors'
import { getSelectedIdentity } from '../../../selectors'
const mapStateToProps = (state) => {
return {

View File

@ -6,7 +6,7 @@ import { goHome } from '../../../store/actions'
import {
accountsWithSendEtherInfoSelector,
conversionRateSelector,
} from '../../../selectors/selectors.js'
} from '../../../selectors'
import { getAccountByAddress } from '../../../helpers/utils/util'
import { clearConfirmTransaction } from '../../../ducks/confirm-transaction/confirm-transaction.duck'
import SignatureRequestOriginal from './signature-request-original.component'

View File

@ -3,7 +3,7 @@ import SignatureRequest from './signature-request.component'
import { clearConfirmTransaction } from '../../../ducks/confirm-transaction/confirm-transaction.duck'
import {
accountsWithSendEtherInfoSelector,
} from '../../../selectors/selectors.js'
} from '../../../selectors'
import { getAccountByAddress } from '../../../helpers/utils/util'
function mapStateToProps (state) {

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import TokenCell from './token-cell.component'
import { getSelectedAddress } from '../../../selectors/selectors'
import { getSelectedAddress } from '../../../selectors'
function mapStateToProps (state) {
return {

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import { getSelectedAddress } from '../../../selectors/selectors'
import { getSelectedAddress } from '../../../selectors'
import TokenList from './token-list.component'
function mapStateToProps (state) {

View File

@ -1,7 +1,7 @@
import { connect } from 'react-redux'
import R from 'ramda'
import TransactionActivityLog from './transaction-activity-log.component'
import { conversionRateSelector, getNativeCurrency } from '../../../selectors/selectors'
import { conversionRateSelector, getNativeCurrency } from '../../../selectors'
import { combineTransactionHistories } from './transaction-activity-log.util'
import {
TRANSACTION_RESUBMITTED_EVENT,

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import TransactionBreakdown from './transaction-breakdown.component'
import { getIsMainnet, getNativeCurrency, preferencesSelector } from '../../../selectors/selectors'
import { getIsMainnet, getNativeCurrency, preferencesSelector } from '../../../selectors'
import { getHexGasTotal } from '../../../helpers/utils/confirm-tx.util'
import { sumHexes } from '../../../helpers/utils/transactions.util'

View File

@ -2,7 +2,7 @@ import { connect } from 'react-redux'
import TransactionListItemDetails from './transaction-list-item-details.component'
import { checksumAddress } from '../../../helpers/utils/util'
import { tryReverseResolveAddress } from '../../../store/actions'
import { getAddressBook } from '../../../selectors/selectors'
import { getAddressBook } from '../../../selectors'
const mapStateToProps = (state, ownProps) => {
const { metamask } = state

View File

@ -20,7 +20,7 @@ import {
conversionRateSelector,
getKnownMethodData,
getFeatureFlags,
} from '../../../selectors/selectors'
} from '../../../selectors'
import { isBalanceSufficient } from '../../../pages/send/send.utils'
const mapStateToProps = (state, ownProps) => {

View File

@ -2,11 +2,13 @@ import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import TransactionList from './transaction-list.component'
import {
getAssetImages,
getFeatureFlags,
getSelectedAddress,
selectedTokenSelector,
nonceSortedCompletedTransactionsSelector,
nonceSortedPendingTransactionsSelector,
} from '../../../selectors/transactions'
import { getSelectedAddress, getAssetImages, getFeatureFlags } from '../../../selectors/selectors'
import { selectedTokenSelector } from '../../../selectors/tokens'
} from '../../../selectors'
import { fetchBasicGasAndTimeEstimates, fetchGasEstimates } from '../../../ducks/gas/gas.duck'
const mapStateToProps = (state) => {

View File

@ -1,12 +1,10 @@
import { connect } from 'react-redux'
import TransactionTimeRemaining from './transaction-time-remaining.component'
import {
getTxParams,
} from '../../../selectors/transactions'
import {
getEstimatedGasPrices,
getEstimatedGasTimes,
} from '../../../selectors/custom-gas'
getTxParams,
} from '../../../selectors'
import { getRawTimeEstimateData } from '../../../helpers/utils/gas-time-estimates.util'
import { hexWEIToDecGWEI } from '../../../helpers/utils/conversions.util'

View File

@ -11,7 +11,7 @@ import {
isBalanceCached,
preferencesSelector,
getIsMainnet,
} from '../../../selectors/selectors'
} from '../../../selectors'
import { showModal } from '../../../store/actions'
const mapStateToProps = (state) => {

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import UserPreferencedCurrencyDisplay from './user-preferenced-currency-display.component'
import { preferencesSelector, getIsMainnet } from '../../../selectors/selectors'
import { preferencesSelector, getIsMainnet } from '../../../selectors'
import { ETH, PRIMARY, SECONDARY } from '../../../helpers/constants/common'
const mapStateToProps = (state) => {

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import UserPreferencedCurrencyInput from './user-preferenced-currency-input.component'
import { preferencesSelector } from '../../../selectors/selectors'
import { preferencesSelector } from '../../../selectors'
const mapStateToProps = (state) => {
const { useNativeCurrencyAsPrimaryCurrency } = preferencesSelector(state)

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import UserPreferencedTokenInput from './user-preferenced-token-input.component'
import { preferencesSelector } from '../../../selectors/selectors'
import { preferencesSelector } from '../../../selectors'
const mapStateToProps = (state) => {
const { useNativeCurrencyAsPrimaryCurrency } = preferencesSelector(state)

View File

@ -2,7 +2,7 @@ import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { compose } from 'redux'
import WalletView from './wallet-view.component'
import { getSelectedAddress } from '../../../selectors/selectors'
import { getSelectedAddress } from '../../../selectors'
function mapStateToProps (state) {
return {

View File

@ -8,7 +8,7 @@ import {
getMetaMaskAccounts,
getIsMainnet,
preferencesSelector,
} from '../../../selectors/selectors'
} from '../../../selectors'
const mapStateToProps = (state) => {
const { showFiatInTestnets } = preferencesSelector(state)

View File

@ -2,7 +2,7 @@ import { connect } from 'react-redux'
import CurrencyInput from './currency-input.component'
import { ETH } from '../../../helpers/constants/common'
import { getMaxModeOn } from '../../../pages/send/send-content/send-amount-row/amount-max-button/amount-max-button.selectors'
import { getIsMainnet, preferencesSelector } from '../../../selectors/selectors'
import { getIsMainnet, preferencesSelector } from '../../../selectors'
const mapStateToProps = (state) => {
const { metamask: { nativeCurrency, currentCurrency, conversionRate } } = state

View File

@ -2,7 +2,7 @@ import { connect } from 'react-redux'
import { compose } from 'redux'
import withTokenTracker from '../../../helpers/higher-order-components/with-token-tracker'
import TokenBalance from './token-balance.component'
import { getSelectedAddress } from '../../../selectors/selectors'
import { getSelectedAddress } from '../../../selectors'
const mapStateToProps = (state) => {
return {

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import TokenInput from './token-input.component'
import { getIsMainnet, getSelectedToken, getSelectedTokenExchangeRate, preferencesSelector } from '../../../selectors/selectors'
import { getIsMainnet, getSelectedToken, getSelectedTokenExchangeRate, preferencesSelector } from '../../../selectors'
const mapStateToProps = (state) => {
const { metamask: { currentCurrency } } = state

View File

@ -3,7 +3,7 @@ import { captureException } from '@sentry/browser'
import actionConstants from '../../store/actionConstants'
import { addPermittedAccount } from '../../store/actions'
import { getOriginOfCurrentTab, getSelectedAddress } from '../../selectors/selectors'
import { getOriginOfCurrentTab, getSelectedAddress } from '../../selectors'
// Constants

View File

@ -3,7 +3,7 @@ import {
currentCurrencySelector,
unconfirmedTransactionsHashSelector,
getNativeCurrency,
} from '../../selectors/confirm-transaction'
} from '../../selectors'
import {
getValueFromWeiHex,

View File

@ -9,7 +9,7 @@ import {
} from '../../helpers/utils/conversions.util'
import {
isEthereumNetwork,
} from '../../selectors/selectors'
} from '../../selectors'
// Actions
const BASIC_GAS_ESTIMATE_LOADING_FINISHED = 'metamask/gas/BASIC_GAS_ESTIMATE_LOADING_FINISHED'

View File

@ -9,10 +9,10 @@ import {
getAccountType,
getNumberOfAccounts,
getNumberOfTokens,
} from '../../../selectors/selectors'
import {
txDataSelector,
} from '../../../selectors/confirm-transaction'
} from '../../../selectors'
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
import {
sendMetaMetricsEvent,

View File

@ -10,7 +10,7 @@ import {
conversionGreaterThan,
} from './conversion-util'
import { unconfirmedTransactionsCountSelector } from '../../selectors/confirm-transaction'
import { unconfirmedTransactionsCountSelector } from '../../selectors'
export function increaseLastGasPrice (lastGasPrice) {
return ethUtil.addHexPrefix(multiplyCurrencies(lastGasPrice || '0x0', 1.1, {

View File

@ -3,10 +3,10 @@ import { compose } from 'redux'
import { withRouter } from 'react-router-dom'
import {
contractExchangeRateSelector,
tokenSelector,
transactionFeeSelector,
} from '../../selectors/confirm-transaction'
} from '../../selectors'
import { showModal } from '../../store/actions'
import { tokenSelector } from '../../selectors/tokens'
import {
getTokenData,
} from '../../helpers/utils/transactions.util'

View File

@ -11,7 +11,7 @@ import {
import {
getTargetAccountWithSendEtherInfo,
conversionRateSelector,
} from '../../selectors/selectors'
} from '../../selectors'
import { clearConfirmTransaction } from '../../ducks/confirm-transaction/confirm-transaction.duck'
import ConfirmDecryptMessage from './confirm-decrypt-message.component'

View File

@ -11,7 +11,7 @@ import {
import {
conversionRateSelector,
getTargetAccountWithSendEtherInfo,
} from '../../selectors/selectors'
} from '../../selectors'
import { clearConfirmTransaction } from '../../ducks/confirm-transaction/confirm-transaction.duck'
import ConfirmEncryptionPublicKey from './confirm-encryption-public-key.component'

View File

@ -5,7 +5,7 @@ import ConfirmSendToken from './confirm-send-token.component'
import { clearConfirmTransaction } from '../../ducks/confirm-transaction/confirm-transaction.duck'
import { setSelectedToken, updateSend, showSendTokenPage } from '../../store/actions'
import { conversionUtil } from '../../helpers/utils/conversion-util'
import { sendTokenTokenAmountAndToAddressSelector } from '../../selectors/confirm-transaction'
import { sendTokenTokenAmountAndToAddressSelector } from '../../selectors'
const mapStateToProps = (state) => {
const { tokenAmount } = sendTokenTokenAmountAndToAddressSelector(state)

View File

@ -4,9 +4,9 @@ import { withRouter } from 'react-router-dom'
import ConfirmTokenTransactionBase from './confirm-token-transaction-base.component'
import {
contractExchangeRateSelector,
tokenSelector,
transactionFeeSelector,
} from '../../selectors/confirm-transaction'
import { tokenSelector } from '../../selectors/tokens'
} from '../../selectors'
import {
getTokenData,
} from '../../helpers/utils/transactions.util'

View File

@ -27,8 +27,16 @@ import { isBalanceSufficient, calcGasTotal } from '../send/send.utils'
import { conversionGreaterThan } from '../../helpers/utils/conversion-util'
import { MIN_GAS_LIMIT_DEC } from '../send/send.constants'
import { checksumAddress, shortenAddress, valuesFor } from '../../helpers/utils/util'
import { getMetaMaskAccounts, getCustomNonceValue, getUseNonceField, getAdvancedInlineGasShown, preferencesSelector, getIsMainnet, getKnownMethodData } from '../../selectors/selectors'
import { transactionFeeSelector } from '../../selectors/confirm-transaction'
import {
getAdvancedInlineGasShown,
getCustomNonceValue,
getIsMainnet,
getKnownMethodData,
getMetaMaskAccounts,
getUseNonceField,
preferencesSelector,
transactionFeeSelector,
} from '../../selectors'
const casedContractMap = Object.keys(contractMap).reduce((acc, base) => {
return {

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import ConfirmTransactionSwitch from './confirm-transaction-switch.component'
import { unconfirmedTransactionsListSelector } from '../../selectors/confirm-transaction'
import { unconfirmedTransactionsListSelector } from '../../selectors'
const mapStateToProps = (state, ownProps) => {
const { metamask: { unapprovedTxs } } = state

View File

@ -17,7 +17,7 @@ import {
getTokenParams,
} from '../../store/actions'
import ConfirmTransaction from './confirm-transaction.component'
import { unconfirmedTransactionsListSelector } from '../../selectors/confirm-transaction'
import { unconfirmedTransactionsListSelector } from '../../selectors'
const mapStateToProps = (state, ownProps) => {
const {

View File

@ -10,12 +10,10 @@ import {
getConnectedDomainsForSelectedAddress,
getCurrentAccountWithSendEtherInfo,
getOriginOfCurrentTab,
getSelectedAddress,
} from '../../selectors/selectors'
import {
getPermissionsDomains,
getPermissionDomains,
getPermittedAccountsByOrigin,
} from '../../selectors/permissions'
getSelectedAddress,
} from '../../selectors'
import { DEFAULT_ROUTE } from '../../helpers/constants/routes'
import { getOriginFromUrl } from '../../helpers/utils/util'
@ -42,7 +40,7 @@ const mapStateToProps = (state) => {
return {
accountLabel: getCurrentAccountWithSendEtherInfo(state).name,
connectedDomains,
domains: getPermissionsDomains(state),
domains: getPermissionDomains(state),
permittedAccountsByOrigin,
selectedAddress,
tabToConnect,

View File

@ -2,7 +2,7 @@ import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import * as actions from '../../../store/actions'
import { getMetaMaskAccounts } from '../../../selectors/selectors'
import { getMetaMaskAccounts } from '../../../selectors'
import ConnectScreen from './connect-screen'
import AccountList from './account-list'
import { DEFAULT_ROUTE } from '../../../helpers/constants/routes'

View File

@ -6,7 +6,7 @@ import { connect } from 'react-redux'
import * as actions from '../../../store/actions'
import FileInput from 'react-simple-file-input'
import { DEFAULT_ROUTE } from '../../../helpers/constants/routes'
import { getMetaMaskAccounts } from '../../../selectors/selectors'
import { getMetaMaskAccounts } from '../../../selectors'
import Button from '../../../components/ui/button'
const HELP_LINK = 'https://metamask.zendesk.com/hc/en-us/articles/360015489331-Importing-an-Account'

View File

@ -5,7 +5,7 @@ import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import * as actions from '../../../store/actions'
import { DEFAULT_ROUTE } from '../../../helpers/constants/routes'
import { getMetaMaskAccounts } from '../../../selectors/selectors'
import { getMetaMaskAccounts } from '../../../selectors'
import Button from '../../../components/ui/button'
class PrivateKeyImportView extends Component {

View File

@ -4,12 +4,12 @@ import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import {
unconfirmedTransactionsCountSelector,
} from '../../selectors/confirm-transaction'
import {
getCurrentEthBalance,
getFirstPermissionRequest,
getTotalUnapprovedCount,
} from '../../selectors/selectors'
} from '../../selectors'
import {
restoreFromThreeBox,
turnThreeBoxSyncingOn,

View File

@ -7,10 +7,10 @@ import {
getAccountsWithLabels,
getLastConnectedInfo,
getTargetDomainMetadata,
} from '../../selectors/selectors'
import {
getPermissionsDomains,
} from '../../selectors/permissions'
getPermissionDomains,
} from '../../selectors'
import { formatDate } from '../../helpers/utils/util'
import { approvePermissionsRequest, rejectPermissionsRequest, showModal, getCurrentWindowTab, getRequestAccountTabIds } from '../../store/actions'
import {
@ -63,7 +63,7 @@ const mapStateToProps = (state, ownProps) => {
newAccountNumber: accountsWithLabels.length + 1,
nativeCurrency,
addressLastConnectedMap,
domains: getPermissionsDomains(state),
domains: getPermissionDomains(state),
connectPath,
confirmPermissionPath,
page,

View File

@ -5,8 +5,8 @@ import {
getNetworkIdentifier,
hasPermissionRequests,
preferencesSelector,
} from '../../selectors/selectors'
import { submittedPendingTransactionsSelector } from '../../selectors/transactions'
submittedPendingTransactionsSelector,
} from '../../selectors'
import Routes from './routes.component'
import {
hideSidebar,

View File

@ -6,7 +6,7 @@ import {
getIsMainnet,
isBalanceCached,
preferencesSelector,
} from '../../../selectors/selectors'
} from '../../../selectors'
import AccountListItem from './account-list-item.component'
export default connect(mapStateToProps)(AccountListItem)

View File

@ -15,7 +15,7 @@ proxyquire('../account-list-item.container.js', {
getCurrentCurrency: () => `mockCurrentCurrency`,
getNativeCurrency: () => `mockNativeCurrency`,
},
'../../../selectors/selectors': {
'../../../selectors/': {
isBalanceCached: () => `mockBalanceIsCached`,
preferencesSelector: ({ showFiatInTestnets }) => ({
showFiatInTestnets,

View File

@ -7,7 +7,7 @@ import {
accountsWithSendEtherInfoSelector,
getAddressBook,
getAddressBookEntry,
} from '../../../../selectors/selectors'
} from '../../../../selectors'
import {
updateSendTo,
} from '../../../../store/actions'

View File

@ -6,7 +6,7 @@ import {
} from '../../send.selectors'
import {
getAddressBookEntry,
} from '../../../../selectors/selectors'
} from '../../../../selectors'
import { connect } from 'react-redux'

View File

@ -21,7 +21,7 @@ proxyquire('../add-recipient.container.js', {
getSendEnsResolution: (s) => `mockSendEnsResolution:${s}`,
getSendEnsResolutionError: (s) => `mockSendEnsResolutionError:${s}`,
},
'../../../../selectors/selectors': {
'../../../../selectors/': {
getAddressBook: (s) => [{ name: `mockAddressBook:${s}` }],
getAddressBookEntry: (s) => `mockAddressBookEntry:${s}`,
accountsWithSendEtherInfoSelector: (s) => `mockAccountsWithSendEtherInfoSelector:${s}`,

View File

@ -5,7 +5,7 @@ import {
getSendFromBalance,
getTokenBalance,
} from '../../../send.selectors.js'
import { getBasicGasEstimateLoadingStatus } from '../../../../../selectors/custom-gas'
import { getBasicGasEstimateLoadingStatus } from '../../../../../selectors'
import { getMaxModeOn } from './amount-max-button.selectors.js'
import { calcMaxAmount } from './amount-max-button.utils.js'
import {

View File

@ -29,7 +29,7 @@ proxyquire('../amount-max-button.container.js', {
},
'./amount-max-button.selectors.js': { getMaxModeOn: (s) => `mockMaxModeOn:${s}` },
'./amount-max-button.utils.js': { calcMaxAmount: (mockObj) => mockObj.val + 1 },
'../../../../../selectors/custom-gas': { getBasicGasEstimateLoadingStatus: (s) => `mockButtonDataLoading:${s}` },
'../../../../../selectors/': { getBasicGasEstimateLoadingStatus: (s) => `mockButtonDataLoading:${s}` },
'../../../../../store/actions': actionSpies,
'../../../../../ducks/send/send.duck': duckActionSpies,
})

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import SendAssetRow from './send-asset-row.component'
import { getMetaMaskAccounts } from '../../../../selectors/selectors'
import { getMetaMaskAccounts } from '../../../../selectors'
import { setSelectedToken } from '../../../../store/actions'
function mapStateToProps (state) {

View File

@ -6,7 +6,7 @@ import {
import {
accountsWithSendEtherInfoSelector,
getAddressBookEntry,
} from '../../../selectors/selectors'
} from '../../../selectors'
import * as actions from '../../../store/actions'
function mapStateToProps (state) {

View File

@ -16,11 +16,6 @@ import {
calcGasTotal,
} from '../../send.utils.js'
import { calcMaxAmount } from '../send-amount-row/amount-max-button/amount-max-button.utils'
import {
getBasicGasEstimateLoadingStatus,
getRenderableEstimateDataForSmallButtonsFromGWEI,
getDefaultActiveButtonIndex,
} from '../../../../selectors/custom-gas'
import {
showGasButtonGroup,
updateSendErrors,
@ -32,7 +27,14 @@ import {
} from '../../../../ducks/gas/gas.duck'
import { getGasLoadingError, gasFeeIsInError, getGasButtonGroupShown } from './send-gas-row.selectors.js'
import { showModal, setGasPrice, setGasLimit, setGasTotal, updateSendAmount } from '../../../../store/actions'
import { getAdvancedInlineGasShown, getCurrentEthBalance, getSelectedToken } from '../../../../selectors/selectors'
import {
getAdvancedInlineGasShown,
getCurrentEthBalance,
getSelectedToken,
getBasicGasEstimateLoadingStatus,
getRenderableEstimateDataForSmallButtonsFromGWEI,
getDefaultActiveButtonIndex,
} from '../../../../selectors'
import SendGasRow from './send-gas-row.component'

View File

@ -23,7 +23,6 @@ import {
getUnapprovedTxs,
getSendErrors,
} from '../send.selectors'
import { getGasIsLoading } from '../../../selectors/selectors'
import {
isSendFormInError,
} from './send-footer.selectors'
@ -33,9 +32,10 @@ import {
constructUpdatedTx,
} from './send-footer.utils'
import {
getGasIsLoading,
getRenderableEstimateDataForSmallButtonsFromGWEI,
getDefaultActiveButtonIndex,
} from '../../../selectors/custom-gas'
} from '../../../selectors'
export default connect(mapStateToProps, mapDispatchToProps)(SendFooter)

View File

@ -45,7 +45,7 @@ proxyquire('../send-footer.container.js', {
},
'./send-footer.selectors': { isSendFormInError: (s) => `mockInError:${s}` },
'./send-footer.utils': utilsStubs,
'../../../selectors/custom-gas': {
'../../../selectors/': {
getRenderableEstimateDataForSmallButtonsFromGWEI: (s) => ([{ gasEstimateType: `mockGasEstimateType:${s}` }]),
getDefaultActiveButtonIndex: () => 0,
},

View File

@ -27,7 +27,7 @@ import {
import {
getSelectedAddress,
getAddressBook,
} from '../../selectors/selectors'
} from '../../selectors'
import { getTokens } from './send-content/add-recipient/add-recipient.selectors'
import {
updateSendTo,

View File

@ -6,11 +6,9 @@ import {
getSelectedAccount,
getTargetAccount,
getSelectedAddress,
} from '../../selectors/selectors'
import { estimateGasPriceFromRecentBlocks, calcGasTotal } from './send.utils'
import {
getAveragePriceEstimateInHexWEI,
} from '../../selectors/custom-gas'
} from '../../selectors'
import { estimateGasPriceFromRecentBlocks, calcGasTotal } from './send.utils'
export function getAmountConversionRate (state) {
return getSelectedToken(state)

View File

@ -3,7 +3,7 @@ import sinon from 'sinon'
import {
accountsWithSendEtherInfoSelector,
getCurrentAccountWithSendEtherInfo,
} from '../../../selectors/selectors'
} from '../../../selectors'
import {
getBlockGasLimit,
getAmountConversionRate,

View File

@ -13,7 +13,7 @@ import {
setUseNonceField,
setIpfsGateway,
} from '../../../store/actions'
import { preferencesSelector } from '../../../selectors/selectors'
import { preferencesSelector } from '../../../selectors'
export const mapStateToProps = (state) => {
const { appState: { warning }, metamask } = state

View File

@ -2,7 +2,7 @@ import ContactListTab from './contact-list-tab.component'
import { compose } from 'redux'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { getAddressBook } from '../../../selectors/selectors'
import { getAddressBook } from '../../../selectors'
import { ENVIRONMENT_TYPE_POPUP } from '../../../../../app/scripts/lib/enums'
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'

View File

@ -2,7 +2,7 @@ import EditContact from './edit-contact.component'
import { compose } from 'redux'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { getAddressBookEntry } from '../../../../selectors/selectors'
import { getAddressBookEntry } from '../../../../selectors'
import {
CONTACT_VIEW_ROUTE,
CONTACT_MY_ACCOUNTS_ROUTE,

View File

@ -2,7 +2,7 @@ import ViewContact from './my-accounts.component'
import { compose } from 'redux'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { accountsWithSendEtherInfoSelector } from '../../../../selectors/selectors'
import { accountsWithSendEtherInfoSelector } from '../../../../selectors'
const mapStateToProps = (state,) => {
const myAccounts = accountsWithSendEtherInfoSelector(state)

View File

@ -2,7 +2,7 @@ import ViewContact from './view-contact.component'
import { compose } from 'redux'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { getAddressBookEntry } from '../../../../selectors/selectors'
import { getAddressBookEntry } from '../../../../selectors'
import { checksumAddress } from '../../../../helpers/utils/util'
import {
CONTACT_EDIT_ROUTE,

View File

@ -7,7 +7,7 @@ import {
setUseNativeCurrencyAsPrimaryCurrencyPreference,
setParticipateInMetaMetrics,
} from '../../../store/actions'
import { preferencesSelector } from '../../../selectors/selectors'
import { preferencesSelector } from '../../../selectors'
const mapStateToProps = (state) => {
const { appState: { warning }, metamask } = state

View File

@ -2,7 +2,7 @@ import Settings from './settings.component'
import { compose } from 'redux'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { getAddressBookEntryName } from '../../selectors/selectors'
import { getAddressBookEntryName } from '../../selectors'
import { isValidAddress } from '../../helpers/utils/util'
import { ENVIRONMENT_TYPE_POPUP } from '../../../../app/scripts/lib/enums'
import { getEnvironmentType } from '../../../../app/scripts/lib/util'

View File

@ -6,7 +6,7 @@ import {
} from '../helpers/utils/conversion-util'
import {
getCurrentCurrency, getIsMainnet, preferencesSelector,
} from './selectors'
} from '.'
import {
formatCurrency,
} from '../helpers/utils/confirm-tx.util'

View File

@ -0,0 +1,6 @@
export * from './confirm-transaction'
export * from './custom-gas'
export * from './permissions'
export * from './selectors'
export * from './tokens'
export * from './transactions'

View File

@ -1,3 +1,5 @@
import { forOwn } from 'lodash'
import { getOriginOfCurrentTab } from './selectors'
import {
CAVEAT_NAMES,
} from '../../../app/scripts/controllers/permissions/enums'
@ -25,7 +27,7 @@ export function getPermittedAccounts (state, origin) {
* @returns {Object} Permitted accounts by origin.
*/
export function getPermittedAccountsByOrigin (state) {
const domains = getPermissionsDomains(state)
const domains = getPermissionDomains(state)
return Object.keys(domains).reduce((acc, domainKey) => {
const accounts = getAccountsFromPermission(
getAccountsPermissionFromDomain(domains[domainKey])
@ -37,8 +39,75 @@ export function getPermittedAccountsByOrigin (state) {
}, {})
}
export function getConnectedDomainsForSelectedAddress (state) {
const {
selectedAddress,
} = state.metamask
const domains = getPermissionDomains(state)
const domainMetadata = getPermissionDomainsMetadata(state)
const connectedDomains = []
forOwn(domains, (domainValue, domainKey) => {
const exposedAccounts = getAccountsFromDomain(domainValue)
if (!exposedAccounts.includes(selectedAddress)) {
return
}
const {
extensionId,
name,
icon,
} = domainMetadata[domainKey] || {}
connectedDomains.push({
extensionId,
key: domainKey,
name,
icon,
})
})
return connectedDomains
}
export function getPermittedAccountsForCurrentTab (state) {
const permittedAccountsMap = getPermittedAccountsByOrigin(state)
const originOfCurrentTab = getOriginOfCurrentTab(state)
return permittedAccountsMap[originOfCurrentTab] || []
}
export function getAddressConnectedDomainMap (state) {
const domainMetadata = getPermissionDomainsMetadata(state)
const accountsMap = getPermittedAccountsByOrigin(state)
const addressConnectedIconMap = {}
Object.keys(accountsMap).forEach((domainKey) => {
const { icon, name } = domainMetadata[domainKey] || {}
accountsMap[domainKey].forEach((address) => {
const nameToRender = name || domainKey
addressConnectedIconMap[address] = addressConnectedIconMap[address]
? { ...addressConnectedIconMap[address], [domainKey]: { icon, name: nameToRender } }
: { [domainKey]: { icon, name: nameToRender } }
})
})
return addressConnectedIconMap
}
// selector helpers
function getAccountsFromDomain (domain) {
return getAccountsFromPermission(
getAccountsPermissionFromDomain(domain)
)
}
function getAccountsPermissionFromDomain (domain = {}) {
return (
Array.isArray(domain.permissions)
@ -67,10 +136,14 @@ function getAccountsCaveatFromPermission (accountsPermission = {}) {
)
}
export function getPermissionsDomains (state) {
export function getPermissionDomains (state) {
return state.metamask.domains || {}
}
function domainSelector (state, origin) {
return origin && state.metamask.domains && state.metamask.domains[origin]
export function getPermissionDomainsMetadata (state) {
return state.metamask.domainMetadata || {}
}
function domainSelector (state, origin) {
return origin && state.metamask?.domains[origin]
}

View File

@ -1,10 +1,8 @@
import { flatten, forOwn } from 'lodash'
import { NETWORK_TYPES } from '../helpers/constants/common'
import { stripHexPrefix, addHexPrefix } from 'ethereumjs-util'
import { createSelector } from 'reselect'
import abi from 'human-standard-token-abi'
import { multiplyCurrencies } from '../helpers/utils/conversion-util'
import {
shortenAddress,
checksumAddress,
@ -12,8 +10,6 @@ import {
getAccountByAddress,
} from '../helpers/utils/util'
import { getPermittedAccountsByOrigin } from './permissions'
export function getNetworkIdentifier (state) {
const { metamask: { provider: { type, nickname, rpcTarget } } } = state
@ -193,10 +189,6 @@ export function getTokenExchangeRate (state, address) {
return contractExchangeRates[address] || 0
}
export function conversionRateSelector (state) {
return state.metamask.conversionRate
}
export function getAddressBook (state) {
const network = state.metamask.network
if (!state.metamask.addressBook[network]) {
@ -272,23 +264,6 @@ export function getCurrentCurrency (state) {
return state.metamask.currentCurrency
}
export function getNativeCurrency (state) {
return state.metamask.nativeCurrency
}
export function getSelectedTokenToFiatRate (state) {
const selectedTokenExchangeRate = getSelectedTokenExchangeRate(state)
const conversionRate = conversionRateSelector(state)
const tokenToFiatRate = multiplyCurrencies(
conversionRate,
selectedTokenExchangeRate,
{ toNumericBase: 'dec' }
)
return tokenToFiatRate
}
export function getSelectedTokenContract (state) {
const selectedToken = getSelectedToken(state)
return selectedToken
@ -429,33 +404,6 @@ export function hasPermissionRequests (state) {
return Boolean(getFirstPermissionRequest(state))
}
export function getAddressConnectedDomainMap (state) {
const {
domainMetadata,
} = state.metamask
const accountsMap = getPermittedAccountsByOrigin(state)
const addressConnectedIconMap = {}
Object.keys(accountsMap).forEach((domainKey) => {
const { icon, name } = domainMetadata[domainKey] || {}
accountsMap[domainKey].forEach((address) => {
const nameToRender = name || domainKey
addressConnectedIconMap[address] = addressConnectedIconMap[address]
? { ...addressConnectedIconMap[address], [domainKey]: { icon, name: nameToRender } }
: { [domainKey]: { icon, name: nameToRender } }
})
})
return addressConnectedIconMap
}
export function getPermittedAccountsForCurrentTab (state) {
const permittedAccountsMap = getPermittedAccountsByOrigin(state)
const originOfCurrentTab = getOriginOfCurrentTab(state)
return permittedAccountsMap[originOfCurrentTab] || []
}
export function getOriginOfCurrentTab (state) {
const { activeTab } = state
return activeTab && activeTab.url && getOriginFromUrl(activeTab.url)
@ -476,37 +424,3 @@ export function getLastConnectedInfo (state) {
export function getIpfsGateway (state) {
return state.metamask.ipfsGateway
}
export function getConnectedDomainsForSelectedAddress (state) {
const {
domains = {},
domainMetadata,
selectedAddress,
} = state.metamask
const connectedDomains = []
forOwn(domains, (value, domain) => {
const exposedAccounts = flatten(value.permissions.map(
(p) => p.caveats?.find(({ name }) => name === 'exposedAccounts').value || []
))
if (!exposedAccounts.includes(selectedAddress)) {
return
}
const {
extensionId,
name,
icon,
} = domainMetadata[domain] || {}
connectedDomains.push({
extensionId,
key: domain,
name,
icon,
})
})
return connectedDomains
}

View File

@ -11,7 +11,7 @@ const {
getPriceAndTimeEstimates,
getRenderableBasicEstimateData,
getRenderableEstimateDataForSmallButtonsFromGWEI,
} = proxyquire('./custom-gas', {})
} = proxyquire('../custom-gas', {})
describe('custom-gas selectors', function () {

View File

@ -0,0 +1,156 @@
import assert from 'assert'
import { getConnectedDomainsForSelectedAddress } from '../permissions'
describe('selectors', function () {
describe('getConnectedDomainsForSelectedAddress', function () {
it('should return the list of connected domains when there is 1 connected account', function () {
const mockState = {
metamask: {
selectedAddress: '0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5',
domainMetadata: {
'peepeth.com': {
'icon': 'https://peepeth.com/favicon-32x32.png',
'name': 'Peepeth',
},
'remix.ethereum.org': {
'icon': 'https://remix.ethereum.org/icon.png',
'name': 'Remix - Ethereum IDE',
},
},
domains: {
'peepeth.com': {
'permissions': [
{
'@context': [
'https://github.com/MetaMask/rpc-cap',
],
'caveats': [
{
'name': 'exposedAccounts',
'type': 'filterResponse',
'value': [
'0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5',
],
},
],
'date': 1585676177970,
'id': '840d72a0-925f-449f-830a-1aa1dd5ce151',
'invoker': 'peepeth.com',
'parentCapability': 'eth_accounts',
},
],
},
'remix.ethereum.org': {
'permissions': [
{
'@context': [
'https://github.com/MetaMask/rpc-cap',
],
'caveats': [
{
'type': 'filterResponse',
'value': [
'0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5',
],
'name': 'exposedAccounts',
},
],
'date': 1585685128948,
'id': '6b9615cc-64e4-4317-afab-3c4f8ee0244a',
'invoker': 'remix.ethereum.org',
'parentCapability': 'eth_accounts',
},
],
},
},
},
}
const extensionId = undefined
assert.deepEqual(getConnectedDomainsForSelectedAddress(mockState), [{
extensionId,
icon: 'https://peepeth.com/favicon-32x32.png',
key: 'peepeth.com',
name: 'Peepeth',
}, {
extensionId,
name: 'Remix - Ethereum IDE',
icon: 'https://remix.ethereum.org/icon.png',
key: 'remix.ethereum.org',
}])
})
it('should return the list of connected domains when there are 2 connected accounts', function () {
const mockState = {
metamask: {
selectedAddress: '0x7250739de134d33ec7ab1ee592711e15098c9d2d',
domainMetadata: {
'peepeth.com': {
'icon': 'https://peepeth.com/favicon-32x32.png',
'name': 'Peepeth',
},
'remix.ethereum.org': {
'icon': 'https://remix.ethereum.org/icon.png',
'name': 'Remix - Ethereum IDE',
},
},
domains: {
'peepeth.com': {
'permissions': [
{
'@context': [
'https://github.com/MetaMask/rpc-cap',
],
'caveats': [
{
'name': 'exposedAccounts',
'type': 'filterResponse',
'value': [
'0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5',
],
},
],
'date': 1585676177970,
'id': '840d72a0-925f-449f-830a-1aa1dd5ce151',
'invoker': 'peepeth.com',
'parentCapability': 'eth_accounts',
},
],
},
'remix.ethereum.org': {
'permissions': [
{
'@context': [
'https://github.com/MetaMask/rpc-cap',
],
'caveats': [
{
'type': 'filterResponse',
'value': [
'0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5',
'0x7250739de134d33ec7ab1ee592711e15098c9d2d',
],
'name': 'exposedAccounts',
},
],
'date': 1585685128948,
'id': '6b9615cc-64e4-4317-afab-3c4f8ee0244a',
'invoker': 'remix.ethereum.org',
'parentCapability': 'eth_accounts',
},
],
},
},
},
}
const extensionId = undefined
assert.deepEqual(getConnectedDomainsForSelectedAddress(mockState), [{
extensionId,
name: 'Remix - Ethereum IDE',
icon: 'https://remix.ethereum.org/icon.png',
key: 'remix.ethereum.org',
}])
})
})
})

View File

@ -1,5 +1,5 @@
import assert from 'assert'
import { getAddressBook, getConnectedDomainsForSelectedAddress } from '../selectors.js'
import { getAddressBook } from '../selectors'
import mockState from './selectors-test-data'
describe('selectors', function () {
@ -20,155 +20,4 @@ describe('selectors', function () {
)
})
})
describe('getConnectedDomainsForSelectedAddress', function () {
it('should return the list of connected domains when there is 1 connected account', function () {
const mockState = {
metamask: {
selectedAddress: '0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5',
domainMetadata: {
'peepeth.com': {
'icon': 'https://peepeth.com/favicon-32x32.png',
'name': 'Peepeth',
},
'remix.ethereum.org': {
'icon': 'https://remix.ethereum.org/icon.png',
'name': 'Remix - Ethereum IDE',
},
},
domains: {
'peepeth.com': {
'permissions': [
{
'@context': [
'https://github.com/MetaMask/rpc-cap',
],
'caveats': [
{
'name': 'exposedAccounts',
'type': 'filterResponse',
'value': [
'0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5',
],
},
],
'date': 1585676177970,
'id': '840d72a0-925f-449f-830a-1aa1dd5ce151',
'invoker': 'peepeth.com',
'parentCapability': 'eth_accounts',
},
],
},
'remix.ethereum.org': {
'permissions': [
{
'@context': [
'https://github.com/MetaMask/rpc-cap',
],
'caveats': [
{
'type': 'filterResponse',
'value': [
'0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5',
],
'name': 'exposedAccounts',
},
],
'date': 1585685128948,
'id': '6b9615cc-64e4-4317-afab-3c4f8ee0244a',
'invoker': 'remix.ethereum.org',
'parentCapability': 'eth_accounts',
},
],
},
},
},
}
const extensionId = undefined
assert.deepEqual(getConnectedDomainsForSelectedAddress(mockState), [{
extensionId,
icon: 'https://peepeth.com/favicon-32x32.png',
key: 'peepeth.com',
name: 'Peepeth',
}, {
extensionId,
name: 'Remix - Ethereum IDE',
icon: 'https://remix.ethereum.org/icon.png',
key: 'remix.ethereum.org',
}])
})
it('should return the list of connected domains when there are 2 connected accounts', function () {
const mockState = {
metamask: {
selectedAddress: '0x7250739de134d33ec7ab1ee592711e15098c9d2d',
domainMetadata: {
'peepeth.com': {
'icon': 'https://peepeth.com/favicon-32x32.png',
'name': 'Peepeth',
},
'remix.ethereum.org': {
'icon': 'https://remix.ethereum.org/icon.png',
'name': 'Remix - Ethereum IDE',
},
},
domains: {
'peepeth.com': {
'permissions': [
{
'@context': [
'https://github.com/MetaMask/rpc-cap',
],
'caveats': [
{
'name': 'exposedAccounts',
'type': 'filterResponse',
'value': [
'0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5',
],
},
],
'date': 1585676177970,
'id': '840d72a0-925f-449f-830a-1aa1dd5ce151',
'invoker': 'peepeth.com',
'parentCapability': 'eth_accounts',
},
],
},
'remix.ethereum.org': {
'permissions': [
{
'@context': [
'https://github.com/MetaMask/rpc-cap',
],
'caveats': [
{
'type': 'filterResponse',
'value': [
'0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5',
'0x7250739de134d33ec7ab1ee592711e15098c9d2d',
],
'name': 'exposedAccounts',
},
],
'date': 1585685128948,
'id': '6b9615cc-64e4-4317-afab-3c4f8ee0244a',
'invoker': 'remix.ethereum.org',
'parentCapability': 'eth_accounts',
},
],
},
},
},
}
const extensionId = undefined
assert.deepEqual(getConnectedDomainsForSelectedAddress(mockState), [{
extensionId,
name: 'Remix - Ethereum IDE',
icon: 'https://remix.ethereum.org/icon.png',
key: 'remix.ethereum.org',
}])
})
})
})

View File

@ -15,7 +15,7 @@ import { getFastPriceEstimateInHexWEI } from './custom-gas'
import {
getSelectedToken,
getSelectedAddress,
} from './selectors'
} from '.'
import txHelper from '../../lib/tx-helper'
export const incomingTxListSelector = (state) => {

View File

@ -18,7 +18,7 @@ import actionConstants from './actionConstants'
import {
getPermittedAccountsForCurrentTab,
getSelectedAddress,
} from '../selectors/selectors'
} from '../selectors'
import { switchedToUnconnectedAccount } from '../ducks/alerts/unconnected-account'
let background = null