@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
57 lines (53 loc) • 1.33 kB
JavaScript
'use strict';
var assertWindowEthereum = require('./assertWindowEthereum-1a9cc710.cjs.prod.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.assertWindowEthereum(globalThis.window)) {
if (globalThis.window.ethereum?.providers) {
return globalThis.window.ethereum.providers.find(getReady);
}
return getReady(globalThis.window.ethereum);
}
}
exports.getInjectedRainbowProvider = getInjectedRainbowProvider;