Skip to content

Commit 77b7ba4

Browse files
FrederikBoldingGuillaumeRxhmalik88david0xdMrtenz
authored
chore: Bump Snaps packages (#29693)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Bump Snaps packages and handle any required changes. Summary of Snaps changes: - Add `snap_getState`, `snap_setState`, `snap_clearState` RPC methods - Add support for non-recurring cronjobs scheduled via `snap_scheduleBackgroundEvent` - Cache snap state in memory for improved performance - Unblock `eth_signTypedData` - Add `hideBalances` property to `snap_getPreferences` - Allow usage of `Text` in `Value` props - Add `backgroundColor` property to `Container` component - Skip unnecesary provider initialization [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/29693?quickstart=1) ## **Related issues** Closes MetaMask/snaps#2977 Closes MetaMask/snaps#2906 Closes #29498 Closes #29469 --------- Co-authored-by: Guillaume Roux <[email protected]> Co-authored-by: Hassan Malik <[email protected]> Co-authored-by: David Drazic <[email protected]> Co-authored-by: Maarten Zuidhoorn <[email protected]>
1 parent 66c994a commit 77b7ba4

File tree

32 files changed

+1152
-278
lines changed

32 files changed

+1152
-278
lines changed

.yarn/patches/luxon-npm-3.2.1-56f8d97395.patch

-40
This file was deleted.

app/scripts/controllers/permissions/specifications.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,19 @@ export const unrestrictedMethods = Object.freeze([
408408
'wallet_invokeSnap',
409409
'wallet_invokeKeyring',
410410
'snap_getClientStatus',
411+
'snap_getCurrencyRate',
412+
'snap_clearState',
411413
'snap_getFile',
414+
'snap_getState',
412415
'snap_createInterface',
413416
'snap_updateInterface',
414417
'snap_getInterfaceState',
415418
'snap_getInterfaceContext',
416419
'snap_resolveInterface',
417-
'snap_getCurrencyRate',
420+
'snap_setState',
421+
'snap_scheduleBackgroundEvent',
422+
'snap_cancelBackgroundEvent',
423+
'snap_getBackgroundEvents',
418424
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
419425
'metamaskinstitutional_authenticate',
420426
'metamaskinstitutional_reauthenticate',

app/scripts/metamask-controller.js

+45-2
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,7 @@ export default class MetamaskController extends EventEmitter {
13881388
'ExecutionService:unhandledError',
13891389
'ExecutionService:outboundRequest',
13901390
'ExecutionService:outboundResponse',
1391+
'KeyringController:lock',
13911392
],
13921393
allowedActions: [
13931394
`${this.permissionController.name}:getEndowments`,
@@ -2936,6 +2937,17 @@ export default class MetamaskController extends EventEmitter {
29362937
return currentLocale;
29372938
}
29382939

2940+
/**
2941+
* Gets whether the privacy mode is enabled from the PreferencesController.
2942+
*
2943+
* @returns {boolean} Whether the privacy mode is enabled.
2944+
*/
2945+
getPrivacyMode() {
2946+
const { privacyMode } = this.preferencesController.state;
2947+
2948+
return privacyMode;
2949+
}
2950+
29392951
/**
29402952
* Constructor helper for getting Snap permission specifications.
29412953
*/
@@ -2948,7 +2960,8 @@ export default class MetamaskController extends EventEmitter {
29482960
getPreferences: () => {
29492961
const locale = this.getLocale();
29502962
const currency = this.currencyRateController.state.currentCurrency;
2951-
return { locale, currency };
2963+
const hideBalances = this.getPrivacyMode();
2964+
return { locale, currency, hideBalances };
29522965
},
29532966
clearSnapState: this.controllerMessenger.call.bind(
29542967
this.controllerMessenger,
@@ -6262,6 +6275,11 @@ export default class MetamaskController extends EventEmitter {
62626275

62636276
engine.push(
62646277
createSnapsMethodMiddleware(subjectType === SubjectType.Snap, {
6278+
clearSnapState: this.controllerMessenger.call.bind(
6279+
this.controllerMessenger,
6280+
'SnapController:clearSnapState',
6281+
origin,
6282+
),
62656283
getUnlockPromise: this.appStateController.getUnlockPromise.bind(
62666284
this.appStateController,
62676285
),
@@ -6284,6 +6302,16 @@ export default class MetamaskController extends EventEmitter {
62846302
'SnapController:getFile',
62856303
origin,
62866304
),
6305+
getSnapState: this.controllerMessenger.call.bind(
6306+
this.controllerMessenger,
6307+
'SnapController:getSnapState',
6308+
origin,
6309+
),
6310+
updateSnapState: this.controllerMessenger.call.bind(
6311+
this.controllerMessenger,
6312+
'SnapController:updateSnapState',
6313+
origin,
6314+
),
62876315
installSnaps: this.controllerMessenger.call.bind(
62886316
this.controllerMessenger,
62896317
'SnapController:install',
@@ -6345,11 +6373,26 @@ export default class MetamaskController extends EventEmitter {
63456373
currency: fiatCurrency,
63466374
};
63476375
},
6348-
///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
63496376
hasPermission: this.permissionController.hasPermission.bind(
63506377
this.permissionController,
63516378
origin,
63526379
),
6380+
scheduleBackgroundEvent: (event) =>
6381+
this.controllerMessenger.call(
6382+
'CronjobController:scheduleBackgroundEvent',
6383+
{ ...event, snapId: origin },
6384+
),
6385+
cancelBackgroundEvent: this.controllerMessenger.call.bind(
6386+
this.controllerMessenger,
6387+
'CronjobController:cancelBackgroundEvent',
6388+
origin,
6389+
),
6390+
getBackgroundEvents: this.controllerMessenger.call.bind(
6391+
this.controllerMessenger,
6392+
'CronjobController:getBackgroundEvents',
6393+
origin,
6394+
),
6395+
///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
63536396
handleSnapRpcRequest: (args) =>
63546397
this.handleSnapRequest({ ...args, origin }),
63556398
getAllowedKeyringMethods: keyringSnapPermissionsBuilder(

builds.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ buildTypes:
2727
- ALLOW_LOCAL_SNAPS: false
2828
- REQUIRE_SNAPS_ALLOWLIST: true
2929
- REJECT_INVALID_SNAPS_PLATFORM_VERSION: true
30-
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.11.0/index.html
30+
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.12.0/index.html
3131
- ACCOUNT_SNAPS_DIRECTORY_URL: https://snaps.metamask.io/account-management
3232
# Main build uses the default browser manifest
3333
manifestOverrides: false
@@ -48,7 +48,7 @@ buildTypes:
4848
- ALLOW_LOCAL_SNAPS: false
4949
- REQUIRE_SNAPS_ALLOWLIST: true
5050
- REJECT_INVALID_SNAPS_PLATFORM_VERSION: true
51-
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.11.0/index.html
51+
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.12.0/index.html
5252
- ACCOUNT_SNAPS_DIRECTORY_URL: https://snaps.metamask.io/account-management
5353
# Modifies how the version is displayed.
5454
# eg. instead of 10.25.0 -> 10.25.0-beta.2
@@ -71,7 +71,7 @@ buildTypes:
7171
- ALLOW_LOCAL_SNAPS: true
7272
- REQUIRE_SNAPS_ALLOWLIST: false
7373
- REJECT_INVALID_SNAPS_PLATFORM_VERSION: false
74-
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.11.0/index.html
74+
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.12.0/index.html
7575
- SUPPORT_LINK: https://support.metamask.io/
7676
- SUPPORT_REQUEST_LINK: https://support.metamask.io/
7777
- INFURA_ENV_KEY_REF: INFURA_FLASK_PROJECT_ID
@@ -95,7 +95,7 @@ buildTypes:
9595
- ALLOW_LOCAL_SNAPS: false
9696
- REQUIRE_SNAPS_ALLOWLIST: true
9797
- REJECT_INVALID_SNAPS_PLATFORM_VERSION: true
98-
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.11.0/index.html
98+
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.12.0/index.html
9999
- MMI_CONFIGURATION_SERVICE_URL: https://configuration.metamask-institutional.io/v2/configuration/default
100100
- SUPPORT_LINK: https://support.metamask-institutional.io
101101
- SUPPORT_REQUEST_LINK: https://support.metamask-institutional.io

0 commit comments

Comments
 (0)