feat: add MetaMask detection functionality#93
Conversation
8aa8b44 to
2c2c56d
Compare
| */ | ||
| export const isChromeRuntime = (): boolean => { | ||
| return typeof chrome !== 'undefined' && chrome.runtime && typeof chrome.runtime.connect === 'function'; | ||
| return typeof chrome !== 'undefined' && !!chrome.runtime && typeof chrome.runtime.connect === 'function'; |
There was a problem hiding this comment.
This was returning undefined instead of a boolean in case chrome.runtime was undefined
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning MetaMask internal reviewing guidelines:
Ignoring alerts on:
|
|
@SocketSecurity ignore npm/@metamask/auto-changelog@5.3.0 |
Add and exports the
isMetamaskInstalledfunction to check either if MetaMask extension is installed, or if we're in the in-app browser.This feature is required to correctly expose the
readyStateof TRON wallet adapterNote
Introduces a simple MetaMask presence check and wires it into the public API.
isMetamaskInstalled({ timeout })inhelpers/metamask.tsusing EIP-6963announceProvider/requestProviderisMetamaskInstalledfromsrc/index.tshelpers/metamask(frommetamaskExtensionId) inexternallyConnectableTransportand its testsisChromeRuntimecheck inhelpers/utils.tsWritten by Cursor Bugbot for commit a5ca5de. This will update automatically on new commits. Configure here.