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: Bump Snaps packages #26086

Merged
merged 21 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 20 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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/package.json b/package.json
index 7e70a2db3606d673d92d38a2755e155bf2af5fd3..67cff443e63bd04e5699279d8101ef4ec547e9cb 100644
index 9464ffc2614c6c648051df5cb5c9c9b9e651a831..5b1bcb34b8167cf6bbc5b2854b1f196e0fa0204f 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,7 @@
Expand Down
30 changes: 0 additions & 30 deletions .yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch

This file was deleted.

9 changes: 9 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { ApprovalType } from '@metamask/controller-utils';
import PortStream from 'extension-port-stream';

import { ethErrors } from 'eth-rpc-errors';
import { DIALOG_APPROVAL_TYPES } from '@metamask/snaps-rpc-methods';
import {
ENVIRONMENT_TYPE_POPUP,
ENVIRONMENT_TYPE_NOTIFICATION,
Expand Down Expand Up @@ -1102,6 +1103,7 @@ export function setupController(
switch (type) {
case ApprovalType.SnapDialogAlert:
case ApprovalType.SnapDialogPrompt:
case DIALOG_APPROVAL_TYPES.default:
controller.approvalController.accept(id, null);
break;
case ApprovalType.SnapDialogConfirmation:
Expand Down
1 change: 1 addition & 0 deletions app/scripts/controllers/permissions/specifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ export const unrestrictedMethods = Object.freeze([
'snap_createInterface',
'snap_updateInterface',
'snap_getInterfaceState',
'snap_resolveInterface',
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
'metamaskinstitutional_authenticate',
'metamaskinstitutional_reauthenticate',
Expand Down
24 changes: 16 additions & 8 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ import { UI_NOTIFICATIONS } from '../../shared/notifications';
import { MILLISECOND, SECOND } from '../../shared/constants/time';
import {
ORIGIN_METAMASK,
SNAP_DIALOG_TYPES,
POLLING_TOKEN_ENVIRONMENT_TYPES,
} from '../../shared/constants/app';
import {
Expand Down Expand Up @@ -1407,6 +1406,8 @@ export default class MetamaskController extends EventEmitter {
allowedActions: [
`${this.phishingController.name}:maybeUpdateState`,
`${this.phishingController.name}:testOrigin`,
`${this.approvalController.name}:hasRequest`,
`${this.approvalController.name}:acceptRequest`,
],
});

Expand Down Expand Up @@ -2560,7 +2561,11 @@ export default class MetamaskController extends EventEmitter {
...buildSnapRestrictedMethodSpecifications(
Object.keys(ExcludedSnapPermissions),
{
getLocale: this.getLocale.bind(this),
getPreferences: () => {
const locale = this.getLocale();
const currency = this.currencyRateController.state.currentCurrency;
return { locale, currency };
},
clearSnapState: this.controllerMessenger.call.bind(
this.controllerMessenger,
'SnapController:clearSnapState',
Expand All @@ -2578,12 +2583,10 @@ export default class MetamaskController extends EventEmitter {
this.controllerMessenger,
'SnapController:getSnapState',
),
showDialog: (origin, type, id, placeholder) =>
this.approvalController.addAndShowApprovalRequest({
origin,
type: SNAP_DIALOG_TYPES[type],
requestData: { id, placeholder },
}),
requestUserApproval:
this.approvalController.addAndShowApprovalRequest.bind(
this.approvalController,
),
showNativeNotification: (origin, args) =>
this.controllerMessenger.call(
'RateLimitController:call',
Expand Down Expand Up @@ -5645,6 +5648,11 @@ export default class MetamaskController extends EventEmitter {
'SnapInterfaceController:updateInterface',
origin,
),
resolveInterface: this.controllerMessenger.call.bind(
this.controllerMessenger,
'SnapInterfaceController:resolveInterface',
origin,
),
getSnap: this.controllerMessenger.call.bind(
this.controllerMessenger,
'SnapController:get',
Expand Down
5 changes: 3 additions & 2 deletions app/scripts/snaps/preinstalled-snaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import MessageSigningSnap from '@metamask/message-signing-snap/dist/preinstalled
import BitcoinWalletSnap from '@metamask/bitcoin-wallet-snap/dist/preinstalled-snap.json';
///: END:ONLY_INCLUDE_IF

// The casts here are less than ideal but we expect the SnapController to validate the inputs.
const PREINSTALLED_SNAPS: readonly PreinstalledSnap[] = Object.freeze([
MessageSigningSnap as PreinstalledSnap,
MessageSigningSnap as unknown as PreinstalledSnap,
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
BitcoinWalletSnap as PreinstalledSnap,
BitcoinWalletSnap as unknown as PreinstalledSnap,
///: END:ONLY_INCLUDE_IF
]);

Expand Down
8 changes: 4 additions & 4 deletions builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ buildTypes:
- SEGMENT_WRITE_KEY_REF: SEGMENT_PROD_WRITE_KEY
- ALLOW_LOCAL_SNAPS: false
- REQUIRE_SNAPS_ALLOWLIST: true
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.5.0/index.html
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.6.2/index.html
- ACCOUNT_SNAPS_DIRECTORY_URL: https://snaps.metamask.io/account-management
# Main build uses the default browser manifest
manifestOverrides: false
Expand All @@ -46,7 +46,7 @@ buildTypes:
- SEGMENT_WRITE_KEY_REF: SEGMENT_BETA_WRITE_KEY
- ALLOW_LOCAL_SNAPS: false
- REQUIRE_SNAPS_ALLOWLIST: true
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.5.0/index.html
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.6.2/index.html
- ACCOUNT_SNAPS_DIRECTORY_URL: https://snaps.metamask.io/account-management
# Modifies how the version is displayed.
# eg. instead of 10.25.0 -> 10.25.0-beta.2
Expand All @@ -67,7 +67,7 @@ buildTypes:
- SEGMENT_FLASK_WRITE_KEY
- ALLOW_LOCAL_SNAPS: true
- REQUIRE_SNAPS_ALLOWLIST: false
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.5.0/index.html
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.6.2/index.html
- SUPPORT_LINK: https://support.metamask.io/
- SUPPORT_REQUEST_LINK: https://support.metamask.io/
- INFURA_ENV_KEY_REF: INFURA_FLASK_PROJECT_ID
Expand All @@ -90,7 +90,7 @@ buildTypes:
- SEGMENT_WRITE_KEY_REF: SEGMENT_MMI_WRITE_KEY
- ALLOW_LOCAL_SNAPS: false
- REQUIRE_SNAPS_ALLOWLIST: true
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.5.0/index.html
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.6.2/index.html
- MMI_CONFIGURATION_SERVICE_URL: https://configuration.metamask-institutional.io/v2/configuration/default
- SUPPORT_LINK: https://mmi-support.metamask.io/hc/en-us
- SUPPORT_REQUEST_LINK: https://mmi-support.metamask.io/hc/en-us/requests/new
Expand Down
6 changes: 5 additions & 1 deletion development/build/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,11 @@ function setupBundlerDefaults(
[
babelify,
{
only: ['./**/node_modules/firebase', './**/node_modules/@firebase'],
only: [
'./**/node_modules/firebase',
'./**/node_modules/@firebase',
'./**/node_modules/marked',
],
global: true,
},
],
Expand Down
Loading
Loading