Describe the bug
When MetaMask disconnects a session using NodeJS, the SDK tries to show an alert which doesn't exist in NodeJS specifically, a proper exception should be thrown in order to be caught
We recently decided to have a new distribution strategy for MM SDK, which is to update the MM connectors on different web3 libraries with MM SDK. This way we can have SDK adoption without causing dapps that are using these libraries extra work to change their set up just for MM.
The current MetaMask integration can be found here within their injected wallets module
As you can see they don’t currently have to patch any MM operations so integration of the SDK should be fairly straight forward.
For integrating the MM SDK the workflow would be something like:
Create a new folder/module within the packages/ directory (you can checkout the Coinbase module for an idea on the module and connector structure).
Add the specific deps and the preferred MM icon.
Structure our connector with the typed properties we would like to extend to devs.
Patch any wallet ops needed (although since it looks like we are following 1193 standards this may not be needed depending on how the SDK handles those).
Return the provider (and SDK instance if applicable). To test the module
Add the new MetaMask module to the internal testing demo within the w3o repo at packages/demo (this can be committed).
From the top level of the web3-onboard project run yarn && yarn dev
This will spin up a testing interface available at localhost:8080 to testing connect, sign, send, switch chains, disconnect
A note here, as they support MM through the injected-wallets module, be sure to add the new MM module at the top of the wallets array (or comment out the injected module) within the web3-onboard init in the demo This will avoid any false positives/negatives while testing the module.
If you can grant blocknative team ([email protected] - Adam Carpenter) write access to the web3-onboard fork when we are all set for a PR he can setup the build/publish flow for the package.
Acceptance criteria
Users who are connecting their MM wallet to a dapp that uses blocknative's web3 onboarding should be able to connect via MM SDK when they don't have any extension installed.
We track a limited number of events and data from dApps/users who connect through the SDK. To better comprehend the value that the SDK connection brings to MetaMask, we aim to enhance our event tracking capabilities across all platform SDKs. This expansion will cover additional events that provide deeper insights into users connecting to MetaMask via the SDK.
User insights
Currently we have two event properties about the SDK.
request_source
request_platform
Request_source should show where the dapp connection is from, so it should be in-app browser, WalletConnect, or MetaMask SDK.
Request_platform should show the platform of the connection, should be iOS, Android, Unity, NodeJS, Electron, Web-Mobile, Web-Desktop, and React Native.
Task/Expected Behavior
Fix "request_source" event property to accurately track
In-app browser
WalletConnect
MetaMask SDK
Add "request_source" event property into the following events:
Dapp Transaction Started
Dapp interactions
Dapp Transaction Completed
Changed Dapp Permission (for future)
Viewed Dapp Permissions
Dapp Transaction Cancelled
Send Transaction Completed
Send Transaction Started
App Session
Transactions
Onboarding
Swap Completed
On-ramp Cancelled
On-ramp Purchase Completed
On-ramp Opened
Fix "request_platform" event property to report
iOS
Android
Unity
NodeJS
Electron
Web-Mobile
Web-Desktop
React Native
Add "request_platform" event property to every event where "request_source" event property is present.
Resources
Currently request_source event property is present in following events.
Currently request_platform event property is present in following events.
Acceptance criteria
Event tracking is successfully implemented in all 4 SDKs. (JS, iOS, Android, Unity)
Event properties "request_source" and "request_platform" are accurately captured.
Product success criteria
The outcome and impact expected from this work include better understanding of user interactions, facilitating data-driven decisions, and enhancing the overall user experience.
Install the Segment snippet on your website
Copy the Segment snippet and paste it high in the of your website. Learn more about setting up Segment in the Analytics.js guide.
Currently when user connects to one or multiple dapps using MetaMask sdk, there is only one way to clear all MetaMask connections at once via SDK. User should be able to select each connection and be able to disconnect one by one instead of all at once.
Steps to reproduce
Connect to a dapp via MetaMask SDK.
On MetaMask wallet app click on to the menu bar on top left corner.
Click on “Settings” from the menu.
Click on “Experimental”
You can see “MetaMask SDK Connections” & “Clear all MetaMask SDK Connections” button.
When user clicks on this button, MetaMask wallet clears all existing connections through MetaMask SDK.
Screenshots
Task/Expected Behavior
Connect to a dapp via MetaMask SDK.
On MetaMask wallet app click on to the menu bar on top left corner.
Click on “Settings” from the menu.
Click on “Experimental”
You can see “MetaMask SDK Connections”.
We should display each connection separately as a list with button options to disconnect. (Design can be different according to Yanrong’s decision.
User to chose a connection and just disconnects that connection while the others stay connected.
Information cannot be retrieved normally when the readonly api of the contract is executed.
ex) basic api - contract.name(), contract.symbol(), contract.decimals(),,,
The test source is basically a function that reads the contract information, and the web app and mobile app were compared and tested with the same code.
base source of web app: /examples/create-react-app
base source of mobile app: examples/reactNativeDemo
The modified source to test the contract function is as follows.
As a user, I want to be able to connect to a desktop dapp using my mobile wallet app.
When developers test to connect to MetaMask mobile app from their desktop dapp they see delays on connection. On Android connection takes even longer than iOS.
User insights
This has been reported by dapps testing the JS SDK. The behaviour happens both on iOS and Android. After user clicks on "connect" button on the dapp and is being redirected to the MetaMask app, the connect button on the MM app doesn't appear for a long time. There is a very visible delay, which we should work on resolving as soon as possible. Fandom (tiktok NFT marketplace) removed our SDK and reverted back to WalletConnect until we resolve this issue.
Steps to reproduce
Click on “Connect” on your desktop dapp.
Scan the QR code via your mobile app.
Wait for connection modal to be displayed on mobile app.
It takes long time on both iOS and Android to display connect modal on MM mobile app.
Samsung is launching their mobile internet browser and it's extensions to their users.
They want to make wallet connection easier for their users. Our solution is to create an extension for JS SDK that automatically injects JS SDK into mobile web dapps.
Task/Expected Behavior
I think we already have an extension for Chrome that we prototyped for the JS SDK. (Andre would know about it)
Check if this extension can be modified according to Samsung Internet Browser requirements.
It should automatically inject JS SDK into mobile web dapps that have connect library.
Extension should work on Samsung Internet Browser on Mobile Devices.
Extension should automatically fetch the latest version of the SDK.
Extension should detect the connect library on the dapp.
Extension should inject JS SDK into the dapps automatically.
Extension should add "Connect" button on the mobie dapp's connect UI
User should be able to click on "connect" button for MetaMask after adding SDK extension into their Samsung Internet Browser and connect to MetaMask wallet app via deeplinks.
If user doesn't have MetaMask wallet installed after clicking on "connect" button on the dapp user should be redirected to the google play store metamask mobile app page.
No problem connecting web app(examples/create-react-app) and chrome extension metamask(v10.29.0)
When using metamask-sdk(v0.2.3) and metamask-mobile(v6.3.0(1095)), there is no session information in wellectConnect sessions even if the connection is successful
In case of connection problem, if you close metamask-mobile and try to connect, it connects normally, i.e. the first one always succeeds
Describe the bug
After upgrading sdk from 0.1.0 some functionality stopped working, especially one that interacts with a contracts which worked prior with sdk 0.1.0 and metamask-mobile 6.2.0. SDK v0.1.0 stoped work with versions higher than metamask-mobile 6.2.0.
Interaction with contracts was ok and worked as expected, however after upgrading in't no longer working. In addition there are
Currently we establish a connection between a dapp and wallet via our communication layer. For each connection we create a uniqe id that is mapped to user's public key. When user kills the app, refreshes the page, even navigates through website in some cases, connection is lost. Session persistence should allow us to expand the usage of this unique id of the each connection.
Option 1
We can store the unique id that is created after every connection in our servers and call from the sdk via an api call. This way we can map user with each connection id when it's needed without needing to reconnect everytime. This unique id we create for each connection is already a nonce and Metamask mobile app stores this id. But the SDK doesn't.
Additional requirements
add an expiration time
allow the user to disconnect from a single one
Option 2
In the app we “store” ids of the connection channels so that the app when restarts/resumes tries to reconnect to them.
We can do the same on the dapp side by using asyncstorage that is browser session persistent so the only information that is kept is the channel id, which should be secure enough. We should re-do a key exchange every time a session is resumed. So that we don’t need to store any key pair information. This keeps the same security as the initial connection but without asking the user to re-scan the QRCode, approve connection etc.
Additional requirements
add an expiration time
allow the user to disconnect from a single one
Whichever option we chose we should make sure that we can use this for web3 auth and token gating in the future.
Areas to Investigate
Possibility of a malicious” dapp having access to the browser asyncstorage and trying to connect to the channel as if it was the original one.
Can storing ids on the dapp and app side be useful for token gating & web3 auth?
Can this solution work for mobile app, mobile web and desktop apps?
How should be the connection id - dapp - device - MM account mapping happen?
User to connect multiple daps through the same MM account.
User to connect multiple dapps through different MM accounts.
The ideal expiration time.
WalletConnect has two expiration times for connection. One for user transacting after connecting, the other one is for user connecting and not doing any transactions after the connection.
How to measure expiration time for multiple dapp connections on the same wallet app?
Identify user actions that requires a re-connection.
Killing and reopening the app
Refreshing the dapp
Navigating inside the dapp
Backgrounding the dapp on all platforms
Connection loss/Service loss
Steps to reproduce
User connects to MM mobile app using a dapp with SDK integration
User kills the dapp on mobile.
User reopens the app
Connection is established automatically without following the same user flow.
Task/Expected Behavior
User should be able to connect the same dapp without clicking on the “connect” modal or scanning any QR code after connecting once and killing the app.
User should have an expiration time for an established connection.
MM Mobile app and dapps to store connection id, expiration, MM account being mapped to each connection correctly.
Connection should be re-established after every user action that is identified as killing the connection.
Describe the bug
I just came across MetaMask SDK and then tried to install and use it in my React DApp, but after the initialization of MetaMask SDK (in a separate React hook), it gives me this error! I even defined process in .env file and did other stuff and solutions but it didn't solve the problem,
I don't know what's wrong with it.
To Reproduce
Steps to reproduce the behaviour:
If it's necessary, Go to my DApp repository which is available on GitHub profile.
then, Check out the src/hooks/useMetaMask.tsx
You can see if there is any mistake I've made or it perhaps is an issue!
Expected behaviour
It must not throw this kind of error!
Hi! I'm having a problem while connecting my RN dapp to metamask-mobile stoped working with sdk 0.1.0 after client has automatically updated to 6.3.0 from store and I believe upgrade sdk to 0.2.0 can help me in this situation. However, upgrading sdk version from 0.1.0 to 0.2.0 react native crashes with message: ReferenceError: Property 'MessageEvent' doesn't exist, js engine: hermes
To Reproduce
Steps to reproduce the behaviour:
Upgrade @metamask/sdk from 0.1.0 to 0.2.0
See error
Expected behaviour
Works without problems
Screenshots
** Provide environment information**
Platform (Eg. Web / React-Native / Node.js / Unity): React-Native
As a user I want to be able to access MetaMask SDK docs through the main MetaMask website https://docs.metamask.io/. Currently SDK docs are at a separate location and their URL looks like it’s a fake/spam url. This has a negative user experience on users/developers.
We will migrate to V2 using the light version of the WC V2 - https://github.com/WalletConnect/se-sdk
This also contain their Auth SDK which enables signing with ethereum. However, we won' be supporting this. So if this cannot be disabled we need to ask a new version of the light SDK from WC team.
Issue 2: Android Only
Noticed that on Rainbow, Trust, and Metamask - wallets are not setting the redirect field. This should be set to a URI that can be used for deep-linking directly to your wallet (ex: metamask:// or rainbow://).
Otherwise, when sending the user to the wallet for an action, the best we can do is show the system app chooser - this is extremely poor UX because the user could accidentally select the wrong wallet (ex: they connected Metamask, but chose to launch Rainbow by accident.)
Issue 3:
Opensea: Sending eth_sendTransaction requests to MM Android from a Kotlin Dapp does not seem to be working
getting java.lang.Throwable: JsonRpcInteractor: Received unknown object type
Native Kotlin test app for WCv2: https://appdistribution.firebase.dev/i/2b254c3073d2e514
MM is sending back:
{"id":1684337712156700,"jsonrpc":"2.0","error":{"line":3691,"column":1786,"sourceURL":"index.android.bundle"}}
which is not valid JsonRpc format
Hey MetaMask team, we have evaluated that although universal links provided a superior UX when it worked they were blocking users completely when it didn’t work
So with the new Web3Modal v2.3.0 we are moving away to prioritize deep links over universal links instead
We created this new UI which handles the pending state for deep links plus provide fallback buttons… one button for retrial and one button for the previous Universal Link which was preferred before
However we noticed that while MetaMask handles WC links through universal linking… it does NOT handle WC links through deep linking
This means that users in v2.3.0 will be getting stalled through the default pattern and would need to retry the connection with Universal Link instead
Task
Update the deeplinkmanager in the MetaMask Wallet app accordingly.
Describe the bug
WebGL build is on ios, deeplink does not work properly.
IOS Chrome -- I can navigate through the popup, but it only takes me to the app store, even when Metamask is already installed.
IOS Safari -- No response.
Android Chrome -- Works well
Expected behaviour
If MetaMask is not installed, it should point to the app store and if it is already installed, it should be ConnectWallet.
After successfully linking to metamask and establishing a connection MetaMask: Connected to chain with ID "0x1". I am no longer redirected back to my app
To Reproduce
Steps to reproduce the behaviour:
Create instance of MetaMaskSDK, getProvider, and request accounts
Metamask deeplink prompted on request account -> click connect
Successfully connected account but are not redirected back to app
Expected behaviour
Redirected back to app after successful connection
When user is redirected to the MM app from dapp using SDK our app shows a warning message which affects the user experience. We need to add an exception for SDK links in the next version of MM app.
User insights
Developer feedback: It could be cool to avoid this kind of message for our end-users.
Steps to reproduce
User clicks on a desktop dapp to connect.
QR code is displayed and user scans the QR code with MM mobile app.
MM Mobile app shows a warning message before redirecting the user to the connect modal.
Screenshots
Task/Expected Behavior
MM Mobile app to add an exception for SDK links and not show this warning message for desktop dapps using MM SDK to connect to MM mobile app.
Acceptance criteria
Warning message should not be shown for desktop dapps connecting to MM Mobile via MM SDK for both MM iOS and Android apps.
When user clicks on “connect” button on a mobile dapp and is redirected to the MetaMask wallet to establish the connection, sometimes connection is killed when dapp is backgrounded. To prevent this and to improve user experience, we want to show an animation that says “Connecting to MetaMask”
on dapp
on MetaMask app. This will prevent dapp connection to be killed when app is backgrounded but also creates a better user experience for the end user when user is redirected to the MetaMask app and experiences a connection delay.
Task/Expected Behavior
Add dapp animation into the JS SDK.
It should be displayed when user clicks on “connect” on the dapp.
It should continue to play when app is backgrounded until connection is established.
It should stop playing when connection is established.
Add app animation into the mobile app.
It should be displayed before connect modal is displayed.
Connect modal should be displayed after the loading animation.