@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
31 lines (28 loc) • 875 B
JavaScript
import { a as assertWindowEthereum } from './assertWindowEthereum-7e869013.esm.js';
function getInjectedCoinbaseProvider() {
if (typeof window === "undefined") {
return;
}
function getReady(ethereum) {
const isCoinbaseWallet = !!ethereum?.isCoinbaseWallet;
if (isCoinbaseWallet) {
return ethereum;
}
if (ethereum && "overrideIsMetaMask" in ethereum) {
if ("providerMap" in ethereum) {
if (ethereum.providerMap instanceof Map) {
if (ethereum.providerMap.has("CoinbaseWallet")) {
return ethereum;
}
}
}
}
}
if (assertWindowEthereum(globalThis.window)) {
if (globalThis.window.ethereum?.providers) {
return globalThis.window.ethereum.providers.find(getReady);
}
return getReady(globalThis.window.ethereum);
}
}
export { getInjectedCoinbaseProvider as g };