Feat: disable revoke button while tx pending#37554
Closed
V00D00-child wants to merge 30 commits intomainfrom
Closed
Feat: disable revoke button while tx pending#37554V00D00-child wants to merge 30 commits intomainfrom
V00D00-child wants to merge 30 commits intomainfrom
Conversation
- @metamask/gator-permissios-controller - @metamask/signature-controller - @metamask/permissions-kernel-controller - @metamask/shielf-controller
<!-- 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** <!-- 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? --> [](https://codespaces.new/MetaMask/metamask-extension/pull/37540?quickstart=1) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: ## **Related issues** Fixes: ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Replace generic RPC with dedicated `checkDelegationDisabled` flow, wiring backend API and refactoring hook/tests to skip tx when delegation already disabled. > > - **Gator Permissions (backend)**: > - Add `checkDelegationDisabled` API on `MetamaskController` to query `disabledDelegations(bytes32)` via `eth_call` and decode result. > - Expose `checkDelegationDisabled` in controller API; remove generic `callRpc` exposure. > - **UI Hook**: > - `useRevokeGatorPermissions` now calls `checkDelegationDisabled` before submitting a revoke tx; if already disabled, calls `submitRevocation` and skips tx. > - Update imports and mocks from `isDelegationDisabled` → `checkDelegationDisabled`; adjust tests accordingly. > - **Controller Actions**: > - Add `checkDelegationDisabled` action delegating to background; remove manual ABI encode/decode and generic RPC usage. > - Introduce `FetchAndUpdateGatorPermissionsParams` with optional `isRevoked`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 0b78869. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
…into feat/add-revocation-flow
…rPermissions When revoking an already-disabled permission, the hook returns null and setTransactionId(null?.id) sets transactionId to undefined. The useEffect hook now checks that transactionId is defined before attempting navigation to avoid calling navigateToId(undefined).
…k/metamask-extension into feat/add-revocation-flow
Collaborator
✨ Files requiring CODEOWNER review ✨👨🔧 @MetaMask/core-extension-ux (4 files, +121 -49)
|
ui/components/multichain/pages/gator-permissions/components/review-gator-permission-item.tsx
Show resolved
Hide resolved
Collaborator
Builds ready [ca31da8]
UI Startup Metrics (1253 ± 97 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
|
Collaborator
Builds ready [d445cfc]
UI Startup Metrics (1172 ± 94 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
|
Collaborator
Builds ready [d3bc4c0]
UI Startup Metrics (1175 ± 89 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
|
Member
Author
|
Replaced with #37559 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR extends the gatar permission revocation UI to dynamically determine if the revoke CTA should be disabled when a transaction to revoke said permission is pending.
pendingRevocationsfromGatorPermissionsControllerReviewGatorPermissionItemcomponent props to includependingRevocationsvaluesReviewGatorPermissionItemlogic to render button text and determine button disabled status dynamicallyRelated issues
Relates to: #37209
Requires: MetaMask/core#7055
Screenshots/Recordings
Before
before-revoke-disabled.mov
After
after-1.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Disables the Gator permission "Revoke" button when a matching revocation transaction is pending, wiring state via a new selector and updating UI text and tests.
ReviewGatorPermissionItem: acceptspendingRevocations, computesisPendingRevocationfrompermissionResponse.context, switches label betweengatorPermissionsRevocationPending/gatorPermissionsRevoke, disables theButton, and replaces the clickabledivwith a properButton.ReviewGatorPermissionsPage: selectspendingRevocationsviagetPendingRevocationsand passes to eachReviewGatorPermissionItem.getPendingRevocationsselector to exposemetamask.pendingRevocations.gatorPermissionsRevocationPendingandgatorPermissionsRevoketoapp/_locales/en/messages.jsonandapp/_locales/en_GB/messages.json.review-gator-permission-itemtests and snapshots to passpendingRevocationsand reflect button changes.getPendingRevocationsselector.Written by Cursor Bugbot for commit d3bc4c0. This will update automatically on new commits. Configure here.