Skip to content

Commit 142f285

Browse files
feat: Conditionally disable nonce editing when smart transactions are… (#29891)
… enabled <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** We [recently enabled custom nonce editing in all redesigned flows](#29627), independently of the custom nonce editing settings toggle. This toggle was still used in the legacy flows that are no longer visible by the user, and it will be removed soon in an upcoming PR. This resulted in nonce editing being available for smart transactions which is not needed as the user should never need to manipulate nonces of smart transactions. This PR fixes this by removing that option to the user. If smart transactions are enabled but the transaction is on a chain that doesn't currently support smart transactions, the nonce is still editable. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/29891?quickstart=1) ## **Related issues** Fixes: #29841 ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
1 parent 03c215a commit 142f285

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ui/pages/confirmations/components/confirm/info/shared/advanced-details/advanced-details.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { TransactionMeta } from '@metamask/transaction-controller';
12
import React, { useEffect } from 'react';
23
import { useDispatch, useSelector } from 'react-redux';
3-
import { TransactionMeta } from '@metamask/transaction-controller';
4-
4+
import { getIsSmartTransaction } from '../../../../../../../../shared/modules/selectors';
55
import {
66
ConfirmInfoRow,
77
ConfirmInfoRowText,
@@ -17,8 +17,8 @@ import {
1717
showModal,
1818
updateCustomNonce,
1919
} from '../../../../../../../store/actions';
20-
import { selectConfirmationAdvancedDetailsOpen } from '../../../../../selectors/preferences';
2120
import { useConfirmContext } from '../../../../../context/confirm';
21+
import { selectConfirmationAdvancedDetailsOpen } from '../../../../../selectors/preferences';
2222
import { isSignatureTransactionType } from '../../../../../utils';
2323
import { TransactionData } from '../transaction-data/transaction-data';
2424

@@ -53,6 +53,7 @@ const NonceDetails = () => {
5353
);
5454

5555
const displayedNonce = customNonceValue || nextNonce;
56+
const isSmartTransactionsEnabled = useSelector(getIsSmartTransaction);
5657

5758
return (
5859
<ConfirmInfoSection data-testid="advanced-details-nonce-section">
@@ -63,7 +64,9 @@ const NonceDetails = () => {
6364
<ConfirmInfoRowText
6465
data-testid="advanced-details-displayed-nonce"
6566
text={`${displayedNonce}`}
66-
onEditClick={() => openEditNonceModal()}
67+
onEditClick={
68+
isSmartTransactionsEnabled ? undefined : () => openEditNonceModal()
69+
}
6770
editIconClassName="edit-nonce-btn"
6871
editIconDataTestId="edit-nonce-icon"
6972
/>

0 commit comments

Comments
 (0)