UNPKG

@thirdweb-dev/wallets

Version:

<p align="center"> <br /> <a href="https://thirdweb.com"><img src="https://github.com/thirdweb-dev/js/blob/main/legacy_packages/sdk/logo.svg?raw=true" width="200" alt=""/></a> <br /> </p> <h1 align="center">thirdweb Wallet SDK</h1> <p align="center"> <a h

67 lines (64 loc) 1.46 kB
import { a as assertWindowEthereum } from './assertWindowEthereum-2bcf9787.esm.js'; /** * @internal */ function getInjectedMetamaskProvider() { if (typeof window === "undefined") { return; } function getReady(ethereum) { const isMetaMask = !!ethereum?.isMetaMask; if (!isMetaMask) { return; } // Brave tries to make itself look like MetaMask // Could also try RPC `web3_clientVersion` if following is unreliable if (ethereum.isBraveWallet && !ethereum._events && !ethereum._state) { return; } if (ethereum.isRainbow) { return; } if (ethereum.isPhantom) { return; } if (ethereum.isAvalanche) { return; } if (ethereum.isBitKeep) { return; } if (ethereum.isMathWallet) { return; } if (ethereum.isZerion) { return; } if (ethereum.isKuCoinWallet) { return; } if (ethereum.isPortal) { return; } if (ethereum.isTokenPocket) { return; } if (ethereum.isTokenary) { return; } if (ethereum.isRabbyWallet) { return; } if (ethereum.isImToken) { return; } return ethereum; } if (assertWindowEthereum(globalThis.window)) { if (globalThis.window.ethereum?.providers) { return globalThis.window.ethereum.providers.find(getReady); } return getReady(globalThis.window.ethereum); } } export { getInjectedMetamaskProvider as g };