Skip to content

Commit

Permalink
feat: Nonce is always editable in advanced details view (#29627)
Browse files Browse the repository at this point in the history
<!--
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**

Previously, the nonce can only be edited if the option to do it is
enabled in the corresponding settings toggle. This PR removes the link
with that toggle in the redesigned transaction screens.

<!--
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/29627?quickstart=1)

## **Related issues**

Fixes: #29512

## **Manual testing steps**

1. Go to the test dApp
2. Disable `Advanced > Customize transaction nonce` in settings
3. Create a send eth transaction
4. Toggle on advanced details
5. The edit nonce icon should be visible in the confirmation screen

## **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.
  • Loading branch information
pedronfigueiredo authored Jan 10, 2025
1 parent 5778b4a commit dd26784
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,17 @@ exports[`<ApproveInfo /> renders component for approve request 1`] = `
class="mm-box mm-box--display-flex mm-box--gap-2 mm-box--flex-wrap-wrap mm-box--align-items-center mm-box--min-width-0"
data-testid="advanced-details-displayed-nonce"
>
<button
aria-label="Edit"
class="mm-box mm-button-icon mm-button-icon--size-sm edit-nonce-btn mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-primary-default mm-box--background-color-transparent mm-box--rounded-lg"
data-testid="edit-nonce-icon"
style="margin-right: -4px;"
>
<span
class="mm-box mm-icon mm-icon--size-sm mm-box--display-inline-block mm-box--color-inherit"
style="mask-image: url('./images/icons/edit.svg');"
/>
</button>
<p
class="mm-box mm-text mm-text--body-md mm-box--color-inherit"
style="white-space: pre-wrap;"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ exports[`<AdvancedDetails /> renders component when the prop override is passed
class="mm-box mm-box--display-flex mm-box--gap-2 mm-box--flex-wrap-wrap mm-box--align-items-center mm-box--min-width-0"
data-testid="advanced-details-displayed-nonce"
>
<button
aria-label="Edit"
class="mm-box mm-button-icon mm-button-icon--size-sm edit-nonce-btn mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-primary-default mm-box--background-color-transparent mm-box--rounded-lg"
data-testid="edit-nonce-icon"
style="margin-right: -4px;"
>
<span
class="mm-box mm-icon mm-icon--size-sm mm-box--display-inline-block mm-box--color-inherit"
style="mask-image: url('./images/icons/edit.svg');"
/>
</button>
<p
class="mm-box mm-text mm-text--body-md mm-box--color-inherit"
style="white-space: pre-wrap;"
Expand Down Expand Up @@ -164,6 +175,17 @@ exports[`<AdvancedDetails /> renders component when the state property is true 1
class="mm-box mm-box--display-flex mm-box--gap-2 mm-box--flex-wrap-wrap mm-box--align-items-center mm-box--min-width-0"
data-testid="advanced-details-displayed-nonce"
>
<button
aria-label="Edit"
class="mm-box mm-button-icon mm-button-icon--size-sm edit-nonce-btn mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-primary-default mm-box--background-color-transparent mm-box--rounded-lg"
data-testid="edit-nonce-icon"
style="margin-right: -4px;"
>
<span
class="mm-box mm-icon mm-icon--size-sm mm-box--display-inline-block mm-box--color-inherit"
style="mask-image: url('./images/icons/edit.svg');"
/>
</button>
<p
class="mm-box mm-text mm-text--body-md mm-box--color-inherit"
style="white-space: pre-wrap;"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { useI18nContext } from '../../../../../../../hooks/useI18nContext';
import {
getCustomNonceValue,
getNextSuggestedNonce,
getUseNonceField,
} from '../../../../../../../selectors';
import {
getNextNonce,
Expand All @@ -37,7 +36,6 @@ const NonceDetails = () => {
}
}, [currentConfirmation, dispatch]);

const enableCustomNonce = useSelector(getUseNonceField);
const nextNonce = useSelector(getNextSuggestedNonce);
const customNonceValue = useSelector(getCustomNonceValue);

Expand Down Expand Up @@ -65,9 +63,7 @@ const NonceDetails = () => {
<ConfirmInfoRowText
data-testid="advanced-details-displayed-nonce"
text={`${displayedNonce}`}
onEditClick={
enableCustomNonce ? () => openEditNonceModal() : undefined
}
onEditClick={() => openEditNonceModal()}
editIconClassName="edit-nonce-btn"
editIconDataTestId="edit-nonce-icon"
/>
Expand Down

0 comments on commit dd26784

Please sign in to comment.