@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
56 lines (52 loc) • 1.25 kB
JavaScript
import { a as assertWindowEthereum } from './assertWindowEthereum-88295886.browser.esm.js';
/**
* @internal
*/
function getInjectedRainbowProvider() {
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 };