mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Ensure approve button can be enabled when using ledger webhid (#12685)
This commit is contained in:
parent
39cb29d5b5
commit
caee4f288d
@ -56,7 +56,7 @@ export default class ConfirmApproveContent extends Component {
|
|||||||
showCustomizeNonceModal: PropTypes.func,
|
showCustomizeNonceModal: PropTypes.func,
|
||||||
warning: PropTypes.string,
|
warning: PropTypes.string,
|
||||||
txData: PropTypes.object,
|
txData: PropTypes.object,
|
||||||
ledgerWalletRequiredHidConnection: PropTypes.bool,
|
fromAddressIsLedger: PropTypes.bool,
|
||||||
tokenImage: PropTypes.string,
|
tokenImage: PropTypes.string,
|
||||||
chainId: PropTypes.string,
|
chainId: PropTypes.string,
|
||||||
rpcPrefs: PropTypes.object,
|
rpcPrefs: PropTypes.object,
|
||||||
@ -281,7 +281,7 @@ export default class ConfirmApproveContent extends Component {
|
|||||||
useNonceField,
|
useNonceField,
|
||||||
warning,
|
warning,
|
||||||
txData,
|
txData,
|
||||||
ledgerWalletRequiredHidConnection,
|
fromAddressIsLedger,
|
||||||
tokenImage,
|
tokenImage,
|
||||||
toAddress,
|
toAddress,
|
||||||
chainId,
|
chainId,
|
||||||
@ -479,7 +479,7 @@ export default class ConfirmApproveContent extends Component {
|
|||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{ledgerWalletRequiredHidConnection ? (
|
{fromAddressIsLedger ? (
|
||||||
<div className="confirm-approve-content__ledger-instruction-wrapper">
|
<div className="confirm-approve-content__ledger-instruction-wrapper">
|
||||||
<LedgerInstructionField
|
<LedgerInstructionField
|
||||||
showDataInstruction={Boolean(txData.txParams?.data)}
|
showDataInstruction={Boolean(txData.txParams?.data)}
|
||||||
|
@ -16,7 +16,11 @@ import {
|
|||||||
} from '../../helpers/utils/token-util';
|
} from '../../helpers/utils/token-util';
|
||||||
import { readAddressAsContract } from '../../../shared/modules/contract-utils';
|
import { readAddressAsContract } from '../../../shared/modules/contract-utils';
|
||||||
import { useTokenTracker } from '../../hooks/useTokenTracker';
|
import { useTokenTracker } from '../../hooks/useTokenTracker';
|
||||||
import { getTokens, getNativeCurrency } from '../../ducks/metamask/metamask';
|
import {
|
||||||
|
getTokens,
|
||||||
|
getNativeCurrency,
|
||||||
|
isAddressLedger,
|
||||||
|
} from '../../ducks/metamask/metamask';
|
||||||
import {
|
import {
|
||||||
transactionFeeSelector,
|
transactionFeeSelector,
|
||||||
txDataSelector,
|
txDataSelector,
|
||||||
@ -25,7 +29,6 @@ import {
|
|||||||
getUseNonceField,
|
getUseNonceField,
|
||||||
getCustomNonceValue,
|
getCustomNonceValue,
|
||||||
getNextSuggestedNonce,
|
getNextSuggestedNonce,
|
||||||
doesAddressRequireLedgerHidConnection,
|
|
||||||
getCurrentChainId,
|
getCurrentChainId,
|
||||||
getRpcPrefsForCurrentProvider,
|
getRpcPrefsForCurrentProvider,
|
||||||
} from '../../selectors';
|
} from '../../selectors';
|
||||||
@ -39,10 +42,8 @@ import { isEqualCaseInsensitive } from '../../helpers/utils/util';
|
|||||||
import { getCustomTxParamsData } from './confirm-approve.util';
|
import { getCustomTxParamsData } from './confirm-approve.util';
|
||||||
import ConfirmApproveContent from './confirm-approve-content';
|
import ConfirmApproveContent from './confirm-approve-content';
|
||||||
|
|
||||||
const doesAddressRequireLedgerHidConnectionByFromAddress = (address) => (
|
const isAddressLedgerByFromAddress = (address) => (state) => {
|
||||||
state,
|
return isAddressLedger(state, address);
|
||||||
) => {
|
|
||||||
return doesAddressRequireLedgerHidConnection(state, address);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function ConfirmApprove() {
|
export default function ConfirmApprove() {
|
||||||
@ -64,9 +65,7 @@ export default function ConfirmApprove() {
|
|||||||
const chainId = useSelector(getCurrentChainId);
|
const chainId = useSelector(getCurrentChainId);
|
||||||
const rpcPrefs = useSelector(getRpcPrefsForCurrentProvider);
|
const rpcPrefs = useSelector(getRpcPrefsForCurrentProvider);
|
||||||
|
|
||||||
const ledgerWalletRequiredHidConnection = useSelector(
|
const fromAddressIsLedger = useSelector(isAddressLedgerByFromAddress(from));
|
||||||
doesAddressRequireLedgerHidConnectionByFromAddress(from),
|
|
||||||
);
|
|
||||||
|
|
||||||
const transaction =
|
const transaction =
|
||||||
currentNetworkTxList.find(
|
currentNetworkTxList.find(
|
||||||
@ -239,9 +238,7 @@ export default function ConfirmApprove() {
|
|||||||
}
|
}
|
||||||
warning={submitWarning}
|
warning={submitWarning}
|
||||||
txData={transaction}
|
txData={transaction}
|
||||||
ledgerWalletRequiredHidConnection={
|
fromAddressIsLedger={fromAddressIsLedger}
|
||||||
ledgerWalletRequiredHidConnection
|
|
||||||
}
|
|
||||||
chainId={chainId}
|
chainId={chainId}
|
||||||
rpcPrefs={rpcPrefs}
|
rpcPrefs={rpcPrefs}
|
||||||
isContract={isContract}
|
isContract={isContract}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user