Skip to content

Commit

Permalink
Remove Snaps code fencing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrtenz committed Jun 26, 2024
1 parent 9844d1a commit bd66850
Show file tree
Hide file tree
Showing 36 changed files with 70 additions and 513 deletions.
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

0 comments on commit bd66850

Please sign in to comment.