MetaMask / MetaMask/detect-provider
MetaMask detect connection does not detect my mobile MetaMask App
- Dominant language
- JavaScript
- Stars
- 238
- Forks
- 63
- PR merge metrics
- No merged PRs in 30d
Description
```
const detectProv = async () => {
const provider = await detectEthereumProvider()
let web3 = new Web3(provider)
let chainID = await web3.eth.getChainId()
window.alert(chainID)
if (window.ethereum) {
handleEthereum();
} else {
window.addEventListener('ethereum#initialized', handleEthereum, {
once: true,
});
// If the event is not dispatched by the end of the timeout,
// the user probably doesn't have MetaMask installed.
setTimeout(handleEthereum, 3000); // 3 seconds
}
function handleEthereum() {
const { ethereum } = window;
if (ethereum && ethereum.isMetaMask) {
console.log('Ethereum successfully detected!');
window.alert("detected")
// Access the decentralized web!
} else {
console.log('Please install MetaMask!');
}
}
}
```
I try to detect my MetaMask application as the provider via a web-site using detect-provider library. In the desktop, it works fine but when I try to detect the provider using the same website and connect it to via my phone, it does not detect any provider. Where am I wrong?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the detectEthereumProvider entry point and reproduce the supplied JavaScript flow in desktop and mobile MetaMask, including window.ethereum and the ethereum#initialized event. Compare the provider returned on each platform and determine whether mobile detection is supported or requires a documented change; done means the behavior and next action are established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100