UNPKG

@thirdweb-dev/wallets

Version:

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

55 lines (52 loc) 1.28 kB
import { a as assertWindowEthereum } from './assertWindowEthereum-7e869013.esm.js'; function getInjectedRainbowProvider() { if (typeof window === "undefined") { return; } function getReady(ethereum) { const isRainbow = !!ethereum?.isRainbow; if (!isRainbow) { 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.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; } return ethereum; } if (assertWindowEthereum(globalThis.window)) { if (globalThis.window.ethereum?.providers) { return globalThis.window.ethereum.providers.find(getReady); } return getReady(globalThis.window.ethereum); } } export { getInjectedRainbowProvider as g };