Comments (7)
Additionally, the EthereumProvider
type only contains a single field (isMetaMask
). It would be very useful to have full provider typing here!
from detect-provider.
+1
It would be better if it returned EthereumProvider | null
from detect-provider.
This is fixed in #41, but we have yet to release a new version.
from detect-provider.
+1
from detect-provider.
got dist/index.d.ts
with Promise<unknown>
interface EthereumProvider {
isMetaMask?: boolean;
}
declare global {
interface Window {
ethereum?: EthereumProvider;
}
}
export = detectEthereumProvider;
/**
* Returns a Promise that resolves to the value of window.ethereum if it is
* set within the given timeout, or null.
* The Promise will not reject, but an error will be thrown if invalid options
* are provided.
*
* @param options - Options bag.
* @param options.mustBeMetaMask - Whether to only look for MetaMask providers.
* Default: false
* @param options.silent - Whether to silence console errors. Does not affect
* thrown errors. Default: false
* @param options.timeout - Milliseconds to wait for 'ethereum#initialized' to
* be dispatched. Default: 3000
* @returns A Promise that resolves with the Provider if it is detected within
* given timeout, otherwise null.
*/
declare function detectEthereumProvider({ mustBeMetaMask, silent, timeout, }?: {
mustBeMetaMask?: boolean | undefined;
silent?: boolean | undefined;
timeout?: number | undefined;
}): Promise<unknown>;
from detect-provider.
Still no new version, it is a bit annoying to deal with these types myself
from detect-provider.
2.0.0 is released with proper types to remind you to handle null in your code. Please let us know if you're still having problems and we'll look into it further!
from detect-provider.
Related Issues (20)
- Metamusk point
- No provider selected for request eth_chainId when coinbase wallet extension is installed HOT 3
- @metamask/detect-provider: Unable to detect window.ethereum on Android browsers and Metamask app HOT 4
- @metamask/detect-provider: Unable to detect window.ethereum. HOT 7
- (WARNING) MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead. HOT 1
- Failed to parse source map - Error: ENOENT: no such file or directory HOT 26
- Can't detect provider on Android Metamask browser HOT 14
- $@
- npm package is not up to date HOT 1
- Its seems the files for latest version is missing HOT 2
- Unexpected behavior when there are multiple injected providers HOT 1
- MetaMask detect connection does not detect my mobile MetaMask App HOT 21
- Property 'request' does not exist on type 'MetaMaskEthereumProvider'.ts(2339) HOT 10
- USTc
- C++ HOT 1
- Readme's description of the behaviour of mobile apps. HOT 6
- Reject instead of resolve(null) when `mustBeMetamask` is true HOT 1
- Is there an API to open the MetaMask mobile app?
- Export MetaMaskEthereumProvider
- Make compatible with EIP-6963
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from detect-provider.