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(sdk): upgrade @metamask/providers to ^18.3.1 #1199

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

abretonc7s
Copy link
Collaborator

Description

This PR updates the @metamask/providers package to version 18.3.1 and externalizes it as a dependency. This change brings important updates to the MetaMask provider handling but requires attention from dApp developers due to potential breaking changes in build configurations.

Key Changes

  • Upgraded @metamask/providers from 16.1.0 to ^18.3.1
  • Modified rollup.config.js to externalize @metamask/providers
  • Added support for turborepo to improve development workflow
  • Created Next.js playground for testing provider integration

Breaking Changes

This update may require dApp developers to update their build configurations, particularly for Vite-based applications. The following changes might be necessary:

For Vite Applications

Add the following configurations to vite.config.js:

{
  resolve: {
    alias: {
      stream: 'stream-browserify',
      buffer: 'buffer'
    }
  },
  optimizeDeps: {
    include: ['buffer', 'stream-browserify']
  }
}

Additional Dependencies

Some applications may need to install these dependencies:

{
  "dependencies": {
    "buffer": "^6.0.3",
    "stream-browserify": "^3.0.0"
  }
}

Migration Guide

  1. Update to the latest SDK version
  2. Check your build configuration for compatibility
  3. Add required polyfills and dependencies if using Vite
  4. Test MetaMask connection thoroughly in your application

Testing Instructions

  1. Build and run the new Next.js playground
  2. Test MetaMask connection and basic operations
  3. Verify provider functions work as expected
  4. Test in both development and production builds

Review Checklist

  • Test provider upgrade in Next.js playground
  • Verify build process in different environments (Next.js, Vite, CRA)
  • Check for any runtime errors related to streams or buffers
  • Update documentation to reflect new provider version
  • Add migration guide to documentation
  • Test MetaMask connection in various scenarios

Copy link

socket-security bot commented Jan 15, 2025

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

Package New capabilities Transitives Size Publisher
npm/@metamask/[email protected] None +5 1.62 MB metamaskbot

View full report↗︎

Copy link

socket-security bot commented Jan 15, 2025

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

@abretonc7s abretonc7s changed the base branch from main to newnext January 15, 2025 03:41
@abretonc7s
Copy link
Collaborator Author

@SocketSecurity ignore npm/[email protected]
@SocketSecurity ignore npm/[email protected]

Copy link

codecov bot commented Jan 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.06%. Comparing base (a24e803) to head (bb20d00).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1199   +/-   ##
=======================================
  Coverage   74.06%   74.06%           
=======================================
  Files         182      182           
  Lines        4350     4350           
  Branches     1066     1066           
=======================================
  Hits         3222     3222           
  Misses       1128     1128           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Base automatically changed from newnext to main January 15, 2025 12:13
@abretonc7s abretonc7s marked this pull request as ready for review January 15, 2025 12:13
@abretonc7s abretonc7s requested a review from a team as a code owner January 15, 2025 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants