-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Expand file tree
/
Copy patheth-overview.js
More file actions
51 lines (46 loc) · 1.62 KB
/
eth-overview.js
File metadata and controls
51 lines (46 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React from 'react';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import { EthMethod } from '@metamask/keyring-api';
import { isEqual } from 'lodash';
import { getCurrentChainId } from '../../../../shared/modules/selectors/networks';
import {
isBalanceCached,
getIsSwapsChain,
getSelectedInternalAccount,
getSelectedAccountCachedBalance,
getIsBridgeChain,
} from '../../../selectors';
import { getIsNativeTokenBuyable } from '../../../ducks/ramps';
import { CoinOverview } from './coin-overview';
const EthOverview = ({ className }) => {
const isBridgeChain = useSelector(getIsBridgeChain);
const isBuyableChain = useSelector(getIsNativeTokenBuyable);
const balanceIsCached = useSelector(isBalanceCached);
const chainId = useSelector(getCurrentChainId);
const balance = useSelector(getSelectedAccountCachedBalance);
// FIXME: This causes re-renders, so use isEqual to avoid this
const account = useSelector(getSelectedInternalAccount, isEqual);
const isSwapsChain = useSelector(getIsSwapsChain);
const isSigningEnabled =
account.methods.includes(EthMethod.SignTransaction) ||
account.methods.includes(EthMethod.SignUserOperation);
return (
<CoinOverview
account={account}
balance={balance}
balanceIsCached={balanceIsCached}
className={className}
classPrefix="eth"
chainId={chainId}
isSigningEnabled={isSigningEnabled}
isSwapsChain={isSwapsChain}
isBridgeChain={isBridgeChain}
isBuyableChain={isBuyableChain}
/>
);
};
EthOverview.propTypes = {
className: PropTypes.string,
};
export default EthOverview;