I'm calling window.ethereum
and there are all these functions but it's confusing what they accept and the types. My understanding is that MetaMask injects something into window.ethereum... so I assume all the methods are from MetaMask? If so, are all the methods different for Coinbase wallet then?
- Where are the docs for
window.ethereum
? - Are there any types associated with this?
My console when I console.log(window.ethereum);
coinbase - window.ethereum
w {_events: {…}, _eventsCount: 4, _maxListeners: undefined, _filterPolyfill: e.FilterPolyfill, _subscriptionManager: e.SubscriptionManager, …}
close: ƒ ()
enable: ƒ ()
genericRequest: ƒ ()
getChainId: ƒ ()
hasMadeFirstChainChangedEmission: false
isCoinbaseWallet: true
request: ƒ ()
scanQRCode: ƒ ()
send: ƒ ()
sendAsync: ƒ ()
setAppInfo: ƒ ()
setProviderInfo: ƒ ()
updateProviderInfo: ƒ ()
_addresses: ['0xmyAddress']
_eventListener: undefined
_events: {chainChanged: Array(2), accountsChanged: Array(2), connect: ƒ, message: ƒ}
_eventsCount: 4
_filterPolyfill: e.FilterPolyfill {logFilters: Map(0), blockFilters: Set(0), pendingTransactionFilters: Set(0), cursors: Map(0), timeouts: Map(0), …}
_jsonRpcUrlFromOpts: "https://mainnet-infura.wallet.coinbase.com"
_maxListeners: undefined
_overrideIsMetaMask: false
_relay: S {appName: 'localhost:3000', appLogoUrl: 'http://localhost:3000/favicon.ico', subscriptions: t, accountsCallback: ƒ, chainCallback: ƒ, …}
_relayEventManager: e.WalletSDKRelayEventManager {_nextRequestId: 0, callbacks: Map(0)}
_relayProvider: async ƒ I()
_send: ƒ ()
_sendAsync: ƒ ()
_setAddresses: ƒ ()
_storage: e.ScopedLocalStorage {scope: '-walletlink:https://www.walletlink.org'}
_subscriptionManager: e.SubscriptionManager {events: o, subscriptionMiddleware: ƒ}
chainId: (...)
connected: (...)
host: (...)
isChainOverridden: (...)
isMetaMask: (...)
isWalletLink: (...)
jsonRpcUrl: (...)
networkVersion: (...)
selectedAddress: (...)
[[Prototype]]: o
For example:
- I can't find
setProviderInfo
in the Ethereum docs - I can't find
setProviderInfo
in the Metamask docs either - Just to show I'm not lazy... Coinbase wallet docs are here
setProviderInfo
method. – Donelladonelle