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

chore: Remove Snaps code fencing #25523

Merged
merged 5 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ import log from 'loglevel';
import browser from 'webextension-polyfill';
import { storeAsStream } from '@metamask/obs-store';
import { hasProperty, isObject } from '@metamask/utils';
///: BEGIN:ONLY_INCLUDE_IF(snaps)
import { ApprovalType } from '@metamask/controller-utils';
///: END:ONLY_INCLUDE_IF
import PortStream from 'extension-port-stream';

import { ethErrors } from 'eth-rpc-errors';
Expand Down Expand Up @@ -926,15 +924,13 @@ export function setupController(
Object.values(controller.approvalController.state.pendingApprovals).forEach(
({ id, type }) => {
switch (type) {
///: BEGIN:ONLY_INCLUDE_IF(snaps)
case ApprovalType.SnapDialogAlert:
case ApprovalType.SnapDialogPrompt:
controller.approvalController.accept(id, null);
break;
case ApprovalType.SnapDialogConfirmation:
controller.approvalController.accept(id, false);
break;
///: END:ONLY_INCLUDE_IF
///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
case SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountCreation:
case SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountRemoval:
Expand All @@ -953,7 +949,6 @@ export function setupController(
);
}

///: BEGIN:ONLY_INCLUDE_IF(snaps)
// Updates the snaps registry and check for newly blocked snaps to block if the user has at least one snap installed that isn't preinstalled.
if (
Object.values(controller.snapController.state.snaps).some(
Expand All @@ -962,7 +957,6 @@ export function setupController(
) {
controller.snapController.updateBlockedSnaps();
}
///: END:ONLY_INCLUDE_IF
}

//
Expand Down
2 changes: 0 additions & 2 deletions app/scripts/controllers/app-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ export default class AppStateController extends EventEmitter {
});
}

///: BEGIN:ONLY_INCLUDE_IF(snaps)
/**
* Record if popover for snaps privacy warning has been shown
* on the first install of a snap.
Expand All @@ -239,7 +238,6 @@ export default class AppStateController extends EventEmitter {
snapsInstallPrivacyWarningShown: shown,
});
}
///: END:ONLY_INCLUDE_IF

/**
* Record the timestamp of the last time the user has seen the outdated browser warning
Expand Down
6 changes: 0 additions & 6 deletions app/scripts/controllers/permissions/specifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import {
PermissionType,
SubjectType,
} from '@metamask/permission-controller';
///: BEGIN:ONLY_INCLUDE_IF(snaps)
import {
caveatSpecifications as snapsCaveatsSpecifications,
endowmentCaveatSpecifications as snapsEndowmentCaveatSpecifications,
} from '@metamask/snaps-rpc-methods';
///: END:ONLY_INCLUDE_IF
import { isValidHexAddress } from '@metamask/utils';
import {
CaveatTypes,
Expand Down Expand Up @@ -82,10 +80,8 @@ export const getCaveatSpecifications = ({
validateCaveatNetworks(caveat.value, findNetworkClientIdByChainId),
},

///: BEGIN:ONLY_INCLUDE_IF(snaps)
...snapsCaveatsSpecifications,
...snapsEndowmentCaveatSpecifications,
///: END:ONLY_INCLUDE_IF
};
};

Expand Down Expand Up @@ -399,7 +395,6 @@ export const unrestrictedMethods = Object.freeze([
'wallet_watchAsset',
'web3_clientVersion',
'web3_sha3',
///: BEGIN:ONLY_INCLUDE_IF(snaps)
'wallet_getAllSnaps',
'wallet_getSnaps',
'wallet_requestSnaps',
Expand All @@ -410,7 +405,6 @@ export const unrestrictedMethods = Object.freeze([
'snap_createInterface',
'snap_updateInterface',
'snap_getInterfaceState',
///: END:ONLY_INCLUDE_IF
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
'metamaskinstitutional_authenticate',
'metamaskinstitutional_reauthenticate',
Expand Down
Loading
Loading