mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Ledger trezor display (#18637)
* gst * Only display ledger info on approval screen for ledger hardware wallets
This commit is contained in:
parent
599bef9dc5
commit
39f6042e65
@ -200,6 +200,7 @@ export default function ConfirmApprove({
|
||||
toAddress={toAddress}
|
||||
tokenSymbol={tokenSymbol}
|
||||
decimals={decimals}
|
||||
fromAddressIsLedger={fromAddressIsLedger}
|
||||
/>
|
||||
{showCustomizeGasPopover && !supportsEIP1559 && (
|
||||
<EditGasPopover
|
||||
|
@ -35,7 +35,6 @@ import {
|
||||
getUnapprovedTxCount,
|
||||
getUnapprovedTransactions,
|
||||
getUseCurrencyRateCheck,
|
||||
isHardwareWallet,
|
||||
} from '../../selectors';
|
||||
import { NETWORK_TO_NAME_MAP } from '../../../shared/constants/network';
|
||||
import {
|
||||
@ -95,6 +94,7 @@ export default function TokenAllowance({
|
||||
currentTokenBalance,
|
||||
toAddress,
|
||||
tokenSymbol,
|
||||
fromAddressIsLedger,
|
||||
}) {
|
||||
const t = useContext(I18nContext);
|
||||
const dispatch = useDispatch();
|
||||
@ -122,7 +122,6 @@ export default function TokenAllowance({
|
||||
const unapprovedTxCount = useSelector(getUnapprovedTxCount);
|
||||
const unapprovedTxs = useSelector(getUnapprovedTransactions);
|
||||
const useCurrencyRateCheck = useSelector(getUseCurrencyRateCheck);
|
||||
const isHardwareWalletConnected = useSelector(isHardwareWallet);
|
||||
let customTokenAmount = useSelector(getCustomTokenAmount);
|
||||
if (thisOriginIsAllowedToSkipFirstPage && dappProposedTokenAmount) {
|
||||
customTokenAmount = dappProposedTokenAmount;
|
||||
@ -516,7 +515,7 @@ export default function TokenAllowance({
|
||||
</Box>
|
||||
</Box>
|
||||
) : null}
|
||||
{!isFirstPage && isHardwareWalletConnected && (
|
||||
{!isFirstPage && fromAddressIsLedger && (
|
||||
<Box paddingLeft={2} paddingRight={2}>
|
||||
<LedgerInstructionField showDataInstruction />
|
||||
</Box>
|
||||
@ -643,4 +642,8 @@ TokenAllowance.propTypes = {
|
||||
* Symbol of the token that is waiting to be allowed
|
||||
*/
|
||||
tokenSymbol: PropTypes.string,
|
||||
/**
|
||||
* Whether the address sending the transaction is a ledger address
|
||||
*/
|
||||
fromAddressIsLedger: PropTypes.bool,
|
||||
};
|
||||
|
@ -65,10 +65,10 @@ const state = {
|
||||
},
|
||||
],
|
||||
unapprovedTxs: {},
|
||||
keyringTypes: [KeyringType.ledger],
|
||||
keyringTypes: [],
|
||||
keyrings: [
|
||||
{
|
||||
type: KeyringType.ledger,
|
||||
type: KeyringType.hdKeyTree,
|
||||
accounts: ['0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc'],
|
||||
},
|
||||
],
|
||||
@ -256,9 +256,9 @@ describe('TokenAllowancePage', () => {
|
||||
expect(gotIt).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should show hardware wallet info text', () => {
|
||||
it('should show ledger info text if the sending address is ledger', () => {
|
||||
const { queryByText, getByText, getByTestId } = renderWithProvider(
|
||||
<TokenAllowance {...props} />,
|
||||
<TokenAllowance {...props} fromAddressIsLedger />,
|
||||
store,
|
||||
);
|
||||
|
||||
@ -273,12 +273,20 @@ describe('TokenAllowancePage', () => {
|
||||
expect(queryByText('Prior to clicking confirm:')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not show hardware wallet info text', () => {
|
||||
const { queryByText } = renderWithProvider(
|
||||
<TokenAllowance {...props} />,
|
||||
it('should not show ledger info text if the sending address is not ledger', () => {
|
||||
const { queryByText, getByText, getByTestId } = renderWithProvider(
|
||||
<TokenAllowance {...props} fromAddressIsLedger={false} />,
|
||||
store,
|
||||
);
|
||||
|
||||
const textField = getByTestId('custom-spending-cap-input');
|
||||
fireEvent.change(textField, { target: { value: '1' } });
|
||||
|
||||
expect(queryByText('Prior to clicking confirm:')).toBeNull();
|
||||
|
||||
const nextButton = getByText('Next');
|
||||
fireEvent.click(nextButton);
|
||||
|
||||
expect(queryByText('Prior to clicking confirm:')).toBeNull();
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user