mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Show user the general contract interaction screen for token approvals, when the asset standard is undefined (#16765)
Co-authored-by: Jyoti Puri <jyotipuri@gmail.com>
This commit is contained in:
parent
281f8e16b9
commit
cb2f25f767
@ -16,6 +16,7 @@ import {
|
|||||||
getNativeCurrency,
|
getNativeCurrency,
|
||||||
isAddressLedger,
|
isAddressLedger,
|
||||||
} from '../../ducks/metamask/metamask';
|
} from '../../ducks/metamask/metamask';
|
||||||
|
import ConfirmContractInteraction from '../confirm-contract-interaction';
|
||||||
import {
|
import {
|
||||||
getCurrentCurrency,
|
getCurrentCurrency,
|
||||||
getSubjectMetadata,
|
getSubjectMetadata,
|
||||||
@ -166,6 +167,9 @@ export default function ConfirmApprove({
|
|||||||
if (tokenSymbol === undefined && assetName === undefined) {
|
if (tokenSymbol === undefined && assetName === undefined) {
|
||||||
return <Loading />;
|
return <Loading />;
|
||||||
}
|
}
|
||||||
|
if (assetStandard === undefined) {
|
||||||
|
return <ConfirmContractInteraction />;
|
||||||
|
}
|
||||||
if (improvedTokenAllowanceEnabled && assetStandard === ERC20) {
|
if (improvedTokenAllowanceEnabled && assetStandard === ERC20) {
|
||||||
return (
|
return (
|
||||||
<GasFeeContextProvider transaction={transaction}>
|
<GasFeeContextProvider transaction={transaction}>
|
||||||
|
@ -1165,8 +1165,21 @@ export default class ConfirmTransactionBase extends Component {
|
|||||||
requestsWaitingText,
|
requestsWaitingText,
|
||||||
} = this.getNavigateTxData();
|
} = this.getNavigateTxData();
|
||||||
|
|
||||||
|
// This `isTokenApproval` case is added to handle possible rendering of this component from
|
||||||
|
// confirm-approve.js when `assetStandard` is `undefined`. That will happen if the request to
|
||||||
|
// get the asset standard fails. In that scenario, confirm-approve.js returns the `<ConfirmContractInteraction />`
|
||||||
|
// component, which in turn returns this `<ConfirmTransactionBase />` component. We meed to prevent
|
||||||
|
// the user from editing the transaction in those cases.
|
||||||
|
|
||||||
|
const isTokenApproval =
|
||||||
|
txData.type === TRANSACTION_TYPES.TOKEN_METHOD_SET_APPROVAL_FOR_ALL ||
|
||||||
|
txData.type === TRANSACTION_TYPES.TOKEN_METHOD_APPROVE;
|
||||||
|
|
||||||
|
const isContractInteraction =
|
||||||
|
txData.type === TRANSACTION_TYPES.CONTRACT_INTERACTION;
|
||||||
|
|
||||||
const isContractInteractionFromDapp =
|
const isContractInteractionFromDapp =
|
||||||
txData.type === TRANSACTION_TYPES.CONTRACT_INTERACTION &&
|
(isTokenApproval || isContractInteraction) &&
|
||||||
txData.origin !== 'metamask';
|
txData.origin !== 'metamask';
|
||||||
let functionType;
|
let functionType;
|
||||||
if (isContractInteractionFromDapp) {
|
if (isContractInteractionFromDapp) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user