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

feat(snaps): Add support for custom network per Snap #26389

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Aug 13, 2024

Description

Like with websites, we want to support a custom network per Snap rather than relying on the globally selected network. For Snaps, the permission for the network to switch to is automatically granted.

Blocked by:

Todo

  • Revert execution environment URL.
  • Remove preview version for selected-network-controller.

Open in GitHub Codespaces

Manual testing steps

  1. Build the extension with CHAIN_PERMISSIONS=true.
  2. Use wallet_switchEthereumChain in a Snap.
  3. The Snap should now use the new network, without any permission requests.

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Aug 13, 2024
Copy link

socket-security bot commented Aug 13, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@types/[email protected] None 0 1.63 kB types

View full report↗︎

Copy link

socket-security bot commented Aug 13, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSourceCI
Deprecated npm/@types/[email protected]
  • Reason: This is a stub types definition. nanoid provides its own type definitions, so you do not need this installed.
⚠︎

View full report↗︎

Next steps

What is a deprecated package?

The maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.

Research the state of the package and determine if there are non-deprecated versions that can be used, or if it should be replaced with a new, supported solution.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@metamaskbot metamaskbot added the team-snaps-platform Snaps Platform team label Aug 13, 2024
@Mrtenz Mrtenz changed the title Add support for custom network per Snap feat(snaps): Add support for custom network per Snap Aug 14, 2024
@Mrtenz Mrtenz force-pushed the mrtenz/snap-networks branch from 38edd7a to 7f2494b Compare August 15, 2024 08:29
Copy link

Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity in the last 60 days. It will be closed in 14 days. Thank you for your contributions.

@github-actions github-actions bot added the stale issues and PRs marked as stale label Oct 28, 2024
Copy link
Contributor

This PR was closed because there has been no follow up activity in the last 14 days. Thank you for your contributions.

@github-actions github-actions bot closed this Nov 11, 2024
@Mrtenz Mrtenz reopened this Jan 15, 2025
@Mrtenz Mrtenz removed the stale issues and PRs marked as stale label Jan 15, 2025
@Mrtenz Mrtenz force-pushed the mrtenz/snap-networks branch from 6453f80 to cf763b1 Compare January 17, 2025 12:42
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@Mrtenz Mrtenz changed the base branch from develop to main January 17, 2025 12:42
@FrederikBolding
Copy link
Member

@adonesky1 or @jiexi should review this PR too

@FrederikBolding FrederikBolding requested a review from jiexi January 17, 2025 13:32
@Mrtenz Mrtenz force-pushed the mrtenz/snap-networks branch from 0110271 to b74b5a8 Compare January 21, 2025 13:33
@metamaskbot
Copy link
Collaborator

Builds ready [b74b5a8]
Page Load Metrics (1927 ± 202 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint30630261663678326
domContentLoaded150529691899411197
load152230321927421202
domInteractive25188513617
backgroundConnect781272512
firstReactRender1575462311
getState55214147
initialActions01000
loadScripts107819871395291140
setupStore65114136
uiStartup169832082208492236
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 54 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@Mrtenz Mrtenz force-pushed the mrtenz/snap-networks branch from 5b07c03 to 49ac07d Compare January 22, 2025 11:29
@Mrtenz Mrtenz force-pushed the mrtenz/snap-networks branch from 49ac07d to 1bfbbc1 Compare February 12, 2025 10:10
@metamaskbot
Copy link
Collaborator

Builds ready [1bfbbc1]
Page Load Metrics (1686 ± 71 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint21319881557432207
domContentLoaded14391976166314369
load14481988168614771
domInteractive229437199
backgroundConnect96224189
firstReactRender1577342311
getState55817209
initialActions01000
loadScripts9861458119012460
setupStore55721209
uiStartup16462291194018187
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 4.14 KiB (0.07%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [889a8f5]
Page Load Metrics (1691 ± 76 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint40220141635322154
domContentLoaded14531949166714469
load14592013169115976
domInteractive21186413718
backgroundConnect1078282311
firstReactRender1773362411
getState45417178
initialActions00000
loadScripts10231451119612259
setupStore759212010
uiStartup17102247191517081
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 4.14 KiB (0.07%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@Mrtenz Mrtenz force-pushed the mrtenz/snap-networks branch from 00a2c0b to 50a0699 Compare February 17, 2025 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INVALID-PR-TEMPLATE PR's body doesn't match template team-snaps-platform Snaps Platform team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants