mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
Create function for hardware keyring checking (#12457)
This commit is contained in:
parent
0880093f40
commit
6e928c661e
@ -7,6 +7,7 @@ import QrView from '../../../ui/qr-code';
|
||||
import EditableLabel from '../../../ui/editable-label';
|
||||
import Button from '../../../ui/button';
|
||||
import { getURLHostName } from '../../../../helpers/utils/util';
|
||||
import { isHardwareKeyring } from '../../../../helpers/utils/hardware';
|
||||
|
||||
export default class AccountDetailsModal extends Component {
|
||||
static propTypes = {
|
||||
@ -40,7 +41,7 @@ export default class AccountDetailsModal extends Component {
|
||||
|
||||
let exportPrivateKeyFeatureEnabled = true;
|
||||
// This feature is disabled for hardware wallets
|
||||
if (keyring?.type?.search('Hardware') !== -1) {
|
||||
if (isHardwareKeyring(keyring?.type)) {
|
||||
exportPrivateKeyFeatureEnabled = false;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ import BuyIcon from '../../ui/icon/overview-buy-icon.component';
|
||||
import SendIcon from '../../ui/icon/overview-send-icon.component';
|
||||
import { setSwapsFromToken } from '../../../ducks/swaps/swaps';
|
||||
import IconButton from '../../ui/icon-button';
|
||||
import { isHardwareKeyring } from '../../../helpers/utils/hardware';
|
||||
import WalletOverview from './wallet-overview';
|
||||
|
||||
const EthOverview = ({ className }) => {
|
||||
@ -55,7 +56,7 @@ const EthOverview = ({ className }) => {
|
||||
});
|
||||
const history = useHistory();
|
||||
const keyring = useSelector(getCurrentKeyring);
|
||||
const usingHardwareWallet = keyring.type.search('Hardware') !== -1;
|
||||
const usingHardwareWallet = isHardwareKeyring(keyring.type);
|
||||
const balanceIsCached = useSelector(isBalanceCached);
|
||||
const showFiat = useSelector(getShouldShowFiat);
|
||||
const selectedAccount = useSelector(getSelectedAccount);
|
||||
|
@ -7,6 +7,7 @@ import Identicon from '../../ui/identicon';
|
||||
import Tooltip from '../../ui/tooltip';
|
||||
import CurrencyDisplay from '../../ui/currency-display';
|
||||
import { I18nContext } from '../../../contexts/i18n';
|
||||
import { isHardwareKeyring } from '../../../helpers/utils/hardware';
|
||||
import {
|
||||
SEND_ROUTE,
|
||||
BUILD_QUOTE_ROUTE,
|
||||
@ -42,7 +43,7 @@ const TokenOverview = ({ className, token }) => {
|
||||
});
|
||||
const history = useHistory();
|
||||
const keyring = useSelector(getCurrentKeyring);
|
||||
const usingHardwareWallet = keyring.type.search('Hardware') !== -1;
|
||||
const usingHardwareWallet = isHardwareKeyring(keyring.type);
|
||||
const { tokensWithBalances } = useTokenTracker([token]);
|
||||
const balanceToRender = tokensWithBalances[0]?.string;
|
||||
const balance = tokensWithBalances[0]?.balance;
|
||||
|
3
ui/helpers/utils/hardware.js
Normal file
3
ui/helpers/utils/hardware.js
Normal file
@ -0,0 +1,3 @@
|
||||
export function isHardwareKeyring(keyringType = '') {
|
||||
return keyringType.includes('Hardware');
|
||||
}
|
Loading…
Reference in New Issue
Block a user