1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

fix: use approvals selector fn in permission selectors (#19095)

This commit is contained in:
OGPoyraz 2023-05-11 16:40:51 +02:00 committed by GitHub
parent 37a2be0fbb
commit d859181029
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,9 @@
import { ApprovalType } from '@metamask/controller-utils';
///: BEGIN:ONLY_INCLUDE_IN(snaps) ///: BEGIN:ONLY_INCLUDE_IN(snaps)
import { WALLET_SNAP_PERMISSION_KEY } from '@metamask/rpc-methods'; import { WALLET_SNAP_PERMISSION_KEY } from '@metamask/rpc-methods';
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
import { CaveatTypes } from '../../shared/constants/permissions'; import { CaveatTypes } from '../../shared/constants/permissions';
import { getApprovalRequestsByType } from './approvals';
import { import {
getMetaMaskAccountsOrdered, getMetaMaskAccountsOrdered,
getOriginOfCurrentTab, getOriginOfCurrentTab,
@ -341,9 +343,10 @@ export function getFirstSnapInstallOrUpdateRequest(state) {
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
export function getPermissionsRequests(state) { export function getPermissionsRequests(state) {
return Object.values(state.metamask.pendingApprovals) return getApprovalRequestsByType(
.filter(({ type }) => type === 'wallet_requestPermissions') state,
.map(({ requestData }) => requestData); ApprovalType.WalletRequestPermissions,
).map(({ requestData }) => requestData);
} }
export function getFirstPermissionRequest(state) { export function getFirstPermissionRequest(state) {