Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [cherrypick][V12.3.0] PermitSingle, PermitBatch, PermitTransferFrom, PermitBatchTransferFrom simulation "Spending cap" #27300

Conversation

digiwand
Copy link
Contributor

@digiwand digiwand commented Sep 20, 2024

Description

Cherry-picks #26684 into V12.3.0

resolved conflicts:

  • permit-simulation (does not have static simulation yet)
  • tests + snaps (12.3.0 does not have useConfirmContext yet)

Open in GitHub Codespaces

Related issues

Fixes: #26591 (PermitSingle)
Fixes: #26592 (PermitBatch)

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

…erFrom simulation "Spending cap" (#26684)

<!--
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.
-->

Fixes PermitSingle, PermitBatch, PermitTransferFrom,
PermitBatchTransferFrom simulation to use their respective provided
token and amount in token details.

Additionally:
- adjusts styles to have an 8px gap between each "Spending Cap" entry
and right align content
- create PermitSimulationValueDisplay component to separate individual
token contract value logic
- adds tests
- adds sentry error to capture exception in case token isn't provided
for the relevant primaryTypes

dev note: majority of the newlines come from updated and new test
snapshots

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/26684?quickstart=1)

Fixes: #26591
(PermitSingle)
Fixes: #26592
(PermitBatch)

Test PermitSingle & PermitBatch with Improved Signature setting enabled

See related issues for repro steps

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

<img width="320"
src="https://github.com/user-attachments/assets/aac7fa8c-285a-4d2b-bcec-84c7fc6245bf">
<!-- [screenshots/recordings] -->
See Issue screenshots

<!-- [screenshots/recordings] -->

![image](https://github.com/user-attachments/assets/4564530d-1c3d-430b-b821-15ed0fca6152)

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

- [ ] 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.
@digiwand digiwand added team-confirmations Push issues to confirmations team release-12.3.0 Issue or pull request that will be included in release 12.3.0 labels Sep 20, 2024
@digiwand digiwand requested review from a team as code owners September 20, 2024 10:08
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot
Copy link
Collaborator

Builds ready [ab62841]
Page Load Metrics (1800 ± 71 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint30022521646468225
domContentLoaded15872165176914168
load16032254180014771
domInteractive156134147

Copy link

codecov bot commented Sep 20, 2024

Codecov Report

Attention: Patch coverage is 81.25000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 70.13%. Comparing base (439f7d6) to head (ab62841).
Report is 16 commits behind head on Version-v12.3.0.

Files with missing lines Patch % Lines
.../permit-simulation/value-display/value-display.tsx 79.17% 5 Missing ⚠️
...typed-sign/permit-simulation/permit-simulation.tsx 80.00% 4 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           Version-v12.3.0   #27300      +/-   ##
===================================================
- Coverage            70.24%   70.13%   -0.11%     
===================================================
  Files                 1426     1432       +6     
  Lines                50239    50425     +186     
  Branches             13954    13990      +36     
===================================================
+ Hits                 35289    35365      +76     
- Misses               14950    15060     +110     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@danjm danjm merged commit 3fde91a into Version-v12.3.0 Sep 20, 2024
78 of 79 checks passed
@danjm danjm deleted the cherrypick-12.3.0-fix-permit-single-and-batch-simulation-2 branch September 20, 2024 15:07
@github-actions github-actions bot locked and limited conversation to collaborators Sep 20, 2024
@digiwand digiwand linked an issue Sep 24, 2024 that may be closed by this pull request
18 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.3.0 Issue or pull request that will be included in release 12.3.0 team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cherry-pick PRs for 12.3.0 (including formal 12.4.0 PRs)
5 participants