Create function for hardware keyring checking (#12457)

feature/default_network_editable
David Walsh 3 years ago committed by GitHub
parent 0880093f40
commit 6e928c661e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      ui/components/app/modals/account-details-modal/account-details-modal.component.js
  2. 3
      ui/components/app/wallet-overview/eth-overview.js
  3. 3
      ui/components/app/wallet-overview/token-overview.js
  4. 3
      ui/helpers/utils/hardware.js

@ -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;

@ -0,0 +1,3 @@
export function isHardwareKeyring(keyringType = '') {
return keyringType.includes('Hardware');
}
Loading…
Cancel
Save