mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 04:20:53 +01:00
20 lines
550 B
TypeScript
20 lines
550 B
TypeScript
import { ApprovalControllerState } from '@metamask/approval-controller';
|
|
import { ApprovalType } from '@metamask/controller-utils';
|
|
|
|
type ApprovalsMetaMaskState = {
|
|
metamask: {
|
|
pendingApprovals: ApprovalControllerState['pendingApprovals'];
|
|
};
|
|
};
|
|
|
|
export function hasPendingApprovalsSelector(
|
|
state: ApprovalsMetaMaskState,
|
|
approvalType: ApprovalType,
|
|
) {
|
|
const pendingApprovalRequests = Object.values(
|
|
state.metamask.pendingApprovals,
|
|
).filter(({ type }) => type === approvalType);
|
|
|
|
return pendingApprovalRequests.length > 0;
|
|
}
|