Commit 9e7baf9
authored
feat: Expose list of pending revocations in state (#7055)
## Explanation
Expose the list of pending revocations in the state to allow MM clients
to create custom selectors that filter on `pendingRevocations` to
determine whether the revoke CTA should show the "pending" status.
- A revocation is added to `pendingRevocations` state on calls to
`addPendingRevocation()`
- A revocation is removed from `pendingRevocations` state given a
`transactionId` when the handler's `cleanup()` function is executed.
## References
Forked from #6713
## Checklist
- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds `pendingRevocations` to controller state with lifecycle
management via `addPendingRevocation` and `submitRevocation`, updating
metadata, tests, and changelog.
>
> - **GatorPermissionsController**:
> - **State**: Add `pendingRevocations: { txId: string;
permissionContext: Hex }[]` with default `[]` and UI exposure in
metadata.
> - **API**:
> - New getter `pendingRevocations`.
> - `addPendingRevocation` now appends to state immediately and cleans
up on confirm/fail/drop/timeout by `txId`.
> - `submitRevocation` submits to Snap and removes entry by
`permissionContext` on success.
> - **Internals**: Add private helpers to add/remove pending
revocations; import `Hex` type.
> - **Tests**: Update snapshots, add coverage for pending revocations
lifecycle and getter.
> - **Docs**: Update `CHANGELOG.md` to note exposed pending revocations
and related actions.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
77e676e. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 11b7561 commit 9e7baf9
File tree
3 files changed
+105
-9
lines changed- packages/gator-permissions-controller
- src
3 files changed
+105
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
Lines changed: 37 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
| |||
454 | 455 | | |
455 | 456 | | |
456 | 457 | | |
| 458 | + | |
457 | 459 | | |
458 | 460 | | |
459 | 461 | | |
| |||
491 | 493 | | |
492 | 494 | | |
493 | 495 | | |
| 496 | + | |
494 | 497 | | |
495 | 498 | | |
496 | 499 | | |
| |||
735 | 738 | | |
736 | 739 | | |
737 | 740 | | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
738 | 747 | | |
739 | 748 | | |
740 | 749 | | |
| |||
754 | 763 | | |
755 | 764 | | |
756 | 765 | | |
| 766 | + | |
757 | 767 | | |
758 | 768 | | |
759 | 769 | | |
| |||
1038 | 1048 | | |
1039 | 1049 | | |
1040 | 1050 | | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
1041 | 1078 | | |
1042 | 1079 | | |
1043 | 1080 | | |
| |||
Lines changed: 65 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
107 | 115 | | |
108 | 116 | | |
109 | 117 | | |
| |||
132 | 140 | | |
133 | 141 | | |
134 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
135 | 149 | | |
136 | 150 | | |
137 | 151 | | |
| |||
150 | 164 | | |
151 | 165 | | |
152 | 166 | | |
| 167 | + | |
153 | 168 | | |
154 | 169 | | |
155 | 170 | | |
| |||
313 | 328 | | |
314 | 329 | | |
315 | 330 | | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
316 | 357 | | |
317 | 358 | | |
318 | 359 | | |
| |||
536 | 577 | | |
537 | 578 | | |
538 | 579 | | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
539 | 589 | | |
540 | 590 | | |
541 | 591 | | |
| |||
689 | 739 | | |
690 | 740 | | |
691 | 741 | | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
692 | 746 | | |
693 | 747 | | |
694 | 748 | | |
| |||
728 | 782 | | |
729 | 783 | | |
730 | 784 | | |
| 785 | + | |
731 | 786 | | |
732 | 787 | | |
733 | 788 | | |
| |||
751 | 806 | | |
752 | 807 | | |
753 | 808 | | |
754 | | - | |
| 809 | + | |
755 | 810 | | |
756 | 811 | | |
757 | 812 | | |
| |||
773 | 828 | | |
774 | 829 | | |
775 | 830 | | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
776 | 834 | | |
777 | 835 | | |
778 | 836 | | |
| |||
783 | 841 | | |
784 | 842 | | |
785 | 843 | | |
786 | | - | |
787 | | - | |
788 | 844 | | |
789 | 845 | | |
790 | 846 | | |
| |||
795 | 851 | | |
796 | 852 | | |
797 | 853 | | |
| 854 | + | |
| 855 | + | |
798 | 856 | | |
799 | 857 | | |
800 | 858 | | |
| |||
807 | 865 | | |
808 | 866 | | |
809 | 867 | | |
810 | | - | |
| 868 | + | |
811 | 869 | | |
812 | 870 | | |
813 | 871 | | |
| |||
819 | 877 | | |
820 | 878 | | |
821 | 879 | | |
822 | | - | |
| 880 | + | |
823 | 881 | | |
824 | 882 | | |
825 | 883 | | |
| |||
843 | 901 | | |
844 | 902 | | |
845 | 903 | | |
846 | | - | |
| 904 | + | |
847 | 905 | | |
848 | 906 | | |
849 | 907 | | |
0 commit comments