Skip to content

Commit

Permalink
chore: Bump Snaps packages (#28557)
Browse files Browse the repository at this point in the history
<!--
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 support for `Address` in `Card` title
- Make `fetch` responses an instance of `Response`
- Add `isSecureContext` global
- Use `arrayBuffer` for fetching local Snaps
- Add interface persistence (unused for now)

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28557?quickstart=1)

---------

Co-authored-by: Guillaume Roux <[email protected]>
  • Loading branch information
FrederikBolding and GuillaumeRx authored Nov 20, 2024
1 parent 4cfd133 commit 220e932
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 50 deletions.
3 changes: 3 additions & 0 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,9 @@ export default class MetamaskController extends EventEmitter {
`${this.approvalController.name}:acceptRequest`,
`${this.snapController.name}:get`,
],
allowedEvents: [
'NotificationServicesController:notificationsListUpdated',
],
});

this.snapInterfaceController = new SnapInterfaceController({
Expand Down
8 changes: 4 additions & 4 deletions builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ buildTypes:
- ALLOW_LOCAL_SNAPS: false
- REQUIRE_SNAPS_ALLOWLIST: true
- REJECT_INVALID_SNAPS_PLATFORM_VERSION: true
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.9.2/index.html
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.10.0/index.html
- ACCOUNT_SNAPS_DIRECTORY_URL: https://snaps.metamask.io/account-management
# Main build uses the default browser manifest
manifestOverrides: false
Expand All @@ -48,7 +48,7 @@ buildTypes:
- ALLOW_LOCAL_SNAPS: false
- REQUIRE_SNAPS_ALLOWLIST: true
- REJECT_INVALID_SNAPS_PLATFORM_VERSION: true
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.9.2/index.html
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.10.0/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 @@ -70,7 +70,7 @@ buildTypes:
- ALLOW_LOCAL_SNAPS: true
- REQUIRE_SNAPS_ALLOWLIST: false
- REJECT_INVALID_SNAPS_PLATFORM_VERSION: false
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.9.2/index.html
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.10.0/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 @@ -94,7 +94,7 @@ buildTypes:
- ALLOW_LOCAL_SNAPS: false
- REQUIRE_SNAPS_ALLOWLIST: true
- REJECT_INVALID_SNAPS_PLATFORM_VERSION: true
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.9.2/index.html
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.10.0/index.html
- MMI_CONFIGURATION_SERVICE_URL: https://configuration.metamask-institutional.io/v2/configuration/default
- SUPPORT_LINK: https://support.metamask-institutional.io
- SUPPORT_REQUEST_LINK: https://support.metamask-institutional.io
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
"[email protected]": "^7.5.4",
"@trezor/schema-utils@npm:1.0.2": "patch:@trezor/schema-utils@npm%3A1.0.2#~/.yarn/patches/@trezor-schema-utils-npm-1.0.2-7dd48689b2.patch",
"lavamoat-core@npm:^15.1.1": "patch:lavamoat-core@npm%3A15.1.1#~/.yarn/patches/lavamoat-core-npm-15.1.1-51fbe39988.patch",
"@metamask/snaps-sdk": "^6.10.0",
"@metamask/snaps-sdk": "^6.11.0",
"@swc/[email protected]": "^0.1.6",
"@babel/core": "patch:@babel/core@npm%3A7.25.9#~/.yarn/patches/@babel-core-npm-7.25.9-4ae3bff7f3.patch",
"@babel/runtime": "patch:@babel/runtime@npm%3A7.25.9#~/.yarn/patches/@babel-runtime-npm-7.25.9-fe8c62510a.patch",
Expand Down Expand Up @@ -348,11 +348,11 @@
"@metamask/selected-network-controller": "^18.0.2",
"@metamask/signature-controller": "^21.1.0",
"@metamask/smart-transactions-controller": "^13.0.0",
"@metamask/snaps-controllers": "^9.12.0",
"@metamask/snaps-execution-environments": "^6.9.2",
"@metamask/snaps-controllers": "^9.13.0",
"@metamask/snaps-execution-environments": "^6.10.0",
"@metamask/snaps-rpc-methods": "^11.5.1",
"@metamask/snaps-sdk": "^6.10.0",
"@metamask/snaps-utils": "^8.5.2",
"@metamask/snaps-sdk": "^6.11.0",
"@metamask/snaps-utils": "^8.6.0",
"@metamask/solana-wallet-snap": "^0.1.9",
"@metamask/transaction-controller": "^38.3.0",
"@metamask/user-operation-controller": "^13.0.0",
Expand Down
4 changes: 2 additions & 2 deletions ui/components/app/snaps/snap-ui-card/snap-ui-card.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FunctionComponent } from 'react';
import React, { FunctionComponent, ReactNode } from 'react';
import {
Display,
FlexDirection,
Expand All @@ -13,7 +13,7 @@ import { SnapUIImage } from '../snap-ui-image';

export type SnapUICardProps = {
image?: string | undefined;
title: string;
title: string | ReactNode;
description?: string | undefined;
value: string;
extra?: string | undefined;
Expand Down
41 changes: 31 additions & 10 deletions ui/components/app/snaps/snap-ui-renderer/components/card.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
import { CardElement } from '@metamask/snaps-sdk/jsx';
import { mapToTemplate } from '../utils';
import { UIComponentFactory } from './types';

export const card: UIComponentFactory<CardElement> = ({ element }) => ({
element: 'SnapUICard',
props: {
image: element.props.image,
title: element.props.title,
description: element.props.description,
value: element.props.value,
extra: element.props.extra,
},
});
export const card: UIComponentFactory<CardElement> = ({
element,
...params
}) => {
if (typeof element.props.title !== 'string') {
return {
element: 'SnapUICard',
props: {
image: element.props.image,
description: element.props.description,
value: element.props.value,
extra: element.props.extra,
},
propComponents: {
title: mapToTemplate({ element: element.props.title, ...params }),
},
};
}

return {
element: 'SnapUICard',
props: {
image: element.props.image,
title: element.props.title,
description: element.props.description,
value: element.props.value,
extra: element.props.extra,
},
};
};
58 changes: 29 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6381,9 +6381,9 @@ __metadata:
linkType: hard

"@metamask/slip44@npm:^4.0.0":
version: 4.0.0
resolution: "@metamask/slip44@npm:4.0.0"
checksum: 10/3e47e8834b0fbdabe1f126fd78665767847ddc1f9ccc8defb23007dd71fcd2e4899c8ca04857491be3630668a3765bad1e40fdfca9a61ef33236d8d08e51535e
version: 4.1.0
resolution: "@metamask/slip44@npm:4.1.0"
checksum: 10/4265254a1800a24915bd1de15f86f196737132f9af2a084c2efc885decfc5dd87ad8f0687269d90b35e2ec64d3ea4fbff0caa793bcea6e585b1f3a290952b750
languageName: node
linkType: hard

Expand All @@ -6410,9 +6410,9 @@ __metadata:
languageName: node
linkType: hard

"@metamask/snaps-controllers@npm:^9.10.0, @metamask/snaps-controllers@npm:^9.12.0":
version: 9.12.0
resolution: "@metamask/snaps-controllers@npm:9.12.0"
"@metamask/snaps-controllers@npm:^9.10.0, @metamask/snaps-controllers@npm:^9.13.0":
version: 9.13.0
resolution: "@metamask/snaps-controllers@npm:9.13.0"
dependencies:
"@metamask/approval-controller": "npm:^7.1.1"
"@metamask/base-controller": "npm:^7.0.2"
Expand All @@ -6425,8 +6425,8 @@ __metadata:
"@metamask/rpc-errors": "npm:^7.0.1"
"@metamask/snaps-registry": "npm:^3.2.2"
"@metamask/snaps-rpc-methods": "npm:^11.5.1"
"@metamask/snaps-sdk": "npm:^6.10.0"
"@metamask/snaps-utils": "npm:^8.5.0"
"@metamask/snaps-sdk": "npm:^6.11.0"
"@metamask/snaps-utils": "npm:^8.6.0"
"@metamask/utils": "npm:^10.0.0"
"@xstate/fsm": "npm:^2.0.0"
browserify-zlib: "npm:^0.2.0"
Expand All @@ -6440,30 +6440,30 @@ __metadata:
semver: "npm:^7.5.4"
tar-stream: "npm:^3.1.7"
peerDependencies:
"@metamask/snaps-execution-environments": ^6.9.2
"@metamask/snaps-execution-environments": ^6.10.0
peerDependenciesMeta:
"@metamask/snaps-execution-environments":
optional: true
checksum: 10/8d411ff2cfd43e62fe780092e935a1d977379488407b56cca1390edfa9408871cbaf3599f6e6ee999340d46fd3650f225a3270ceec9492c6f2dc4d93538c25ae
checksum: 10/bcf60b61de067f89439cb15acbdf6f808b4bcda8e1cbc9debd693ca2c545c9d38c4e6f380191c4703bd9d28d7dd41e4ce5111664d7b474d5e86e460bcefc3637
languageName: node
linkType: hard

"@metamask/snaps-execution-environments@npm:^6.9.2":
version: 6.9.2
resolution: "@metamask/snaps-execution-environments@npm:6.9.2"
"@metamask/snaps-execution-environments@npm:^6.10.0":
version: 6.10.0
resolution: "@metamask/snaps-execution-environments@npm:6.10.0"
dependencies:
"@metamask/json-rpc-engine": "npm:^10.0.1"
"@metamask/object-multiplex": "npm:^2.0.0"
"@metamask/post-message-stream": "npm:^8.1.1"
"@metamask/providers": "npm:^18.1.1"
"@metamask/rpc-errors": "npm:^7.0.1"
"@metamask/snaps-sdk": "npm:^6.10.0"
"@metamask/snaps-utils": "npm:^8.5.0"
"@metamask/snaps-sdk": "npm:^6.11.0"
"@metamask/snaps-utils": "npm:^8.6.0"
"@metamask/superstruct": "npm:^3.1.0"
"@metamask/utils": "npm:^10.0.0"
nanoid: "npm:^3.1.31"
readable-stream: "npm:^3.6.2"
checksum: 10/f81dd3728417dc63ed16b102504cdf6c815bffef7b1dad9e7b0e064618b008e1f0fe6d05c225bcafeee09fb4bc473599ee710e1a26a6f3604e965f656fce8e36
checksum: 10/a881696ec942f268d7485869fcb8c6bc0c278319bbfaf7e5c6099e86278c7f59049595f00ecfc27511d0106b5ad2f7621f734c7b17f088b835e38e638d80db01
languageName: node
linkType: hard

Expand Down Expand Up @@ -6495,16 +6495,16 @@ __metadata:
languageName: node
linkType: hard

"@metamask/snaps-sdk@npm:^6.10.0":
version: 6.10.0
resolution: "@metamask/snaps-sdk@npm:6.10.0"
"@metamask/snaps-sdk@npm:^6.11.0":
version: 6.11.0
resolution: "@metamask/snaps-sdk@npm:6.11.0"
dependencies:
"@metamask/key-tree": "npm:^9.1.2"
"@metamask/providers": "npm:^18.1.1"
"@metamask/rpc-errors": "npm:^7.0.1"
"@metamask/superstruct": "npm:^3.1.0"
"@metamask/utils": "npm:^10.0.0"
checksum: 10/02f04536328a64ff1e9e48fb6b109698d6d83f42af5666a9758ccb1e7a1e67c0c2e296ef2fef419dd3d1c8f26bbf30b9f31911a1baa66f044f21cd0ecb7a11a7
checksum: 10/0f9b507139d1544b1b3d85ff8de81b800d543012d3ee9414c607c23abe9562e0dca48de089ed94be69f5ad981730a0f443371edfe6bc2d5ffb140b28e437bfd2
languageName: node
linkType: hard

Expand Down Expand Up @@ -6539,9 +6539,9 @@ __metadata:
languageName: node
linkType: hard

"@metamask/snaps-utils@npm:^8.1.1, @metamask/snaps-utils@npm:^8.3.0, @metamask/snaps-utils@npm:^8.5.0, @metamask/snaps-utils@npm:^8.5.2":
version: 8.5.2
resolution: "@metamask/snaps-utils@npm:8.5.2"
"@metamask/snaps-utils@npm:^8.1.1, @metamask/snaps-utils@npm:^8.3.0, @metamask/snaps-utils@npm:^8.5.0, @metamask/snaps-utils@npm:^8.6.0":
version: 8.6.0
resolution: "@metamask/snaps-utils@npm:8.6.0"
dependencies:
"@babel/core": "npm:^7.23.2"
"@babel/types": "npm:^7.23.0"
Expand All @@ -6551,7 +6551,7 @@ __metadata:
"@metamask/rpc-errors": "npm:^7.0.1"
"@metamask/slip44": "npm:^4.0.0"
"@metamask/snaps-registry": "npm:^3.2.2"
"@metamask/snaps-sdk": "npm:^6.10.0"
"@metamask/snaps-sdk": "npm:^6.11.0"
"@metamask/superstruct": "npm:^3.1.0"
"@metamask/utils": "npm:^10.0.0"
"@noble/hashes": "npm:^1.3.1"
Expand All @@ -6566,7 +6566,7 @@ __metadata:
semver: "npm:^7.5.4"
ses: "npm:^1.1.0"
validate-npm-package-name: "npm:^5.0.0"
checksum: 10/e5d1344f948473e82d71007d2570272073cf070f40aa7746692a6d5e6f02cfce66a747cf50f439d32b29a3f6588486182453b26973f0d0c1d9f47914591d5790
checksum: 10/c0f538f3f95e1875f6557b6ecc32f981bc4688d581af8cdc62c6c3ab8951c138286cd0b2d1cd82f769df24fcec10f71dcda67ae9a47edcff9ff73d52672df191
languageName: node
linkType: hard

Expand Down Expand Up @@ -26806,11 +26806,11 @@ __metadata:
"@metamask/selected-network-controller": "npm:^18.0.2"
"@metamask/signature-controller": "npm:^21.1.0"
"@metamask/smart-transactions-controller": "npm:^13.0.0"
"@metamask/snaps-controllers": "npm:^9.12.0"
"@metamask/snaps-execution-environments": "npm:^6.9.2"
"@metamask/snaps-controllers": "npm:^9.13.0"
"@metamask/snaps-execution-environments": "npm:^6.10.0"
"@metamask/snaps-rpc-methods": "npm:^11.5.1"
"@metamask/snaps-sdk": "npm:^6.10.0"
"@metamask/snaps-utils": "npm:^8.5.2"
"@metamask/snaps-sdk": "npm:^6.11.0"
"@metamask/snaps-utils": "npm:^8.6.0"
"@metamask/solana-wallet-snap": "npm:^0.1.9"
"@metamask/test-bundler": "npm:^1.0.0"
"@metamask/test-dapp": "npm:8.13.0"
Expand Down

0 comments on commit 220e932

Please sign in to comment.