MetaMask / MetaMask/metamask-mobile
After recent updates, endless timeout when making read calls
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 1.7k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 669
Description
### What is this about?
My application is using wallet connect and metamask for the purpose of Sign In With Ethereum. We also use it to verify the user holds a specific NFT.
Once a user has signed in with ethereum, I create a JWT that can be used for a week. However each time they return to the page still need to check they hold the NFT.
Using wagmi, I make a read call like this:
```js
const ckBalance: bigint = await readCkGenesis({
functionName: 'balanceOf',
args: [address],
});
```
(The address is pulled from the wagmi useAccount function.)
For 5 months or so this has worked without a hitch in production, on desktop extension and mobile.
However, since last week, I can no longer make this call if metamask has "gone idle." On the desktop extension this means that the user needs to re-enter their password. Once they enter their password into metamask it works fine.
On the mobile app though, there is no fix. This call doesn't trigger any sort of action, like signing, that "activates the wallet" so my app is now perpetually stuck and time out out on the read contract call. In the meantime, as a bandaid, I now have to force the user to sign in every time they access the page, which is not a good look. This adds a lot of friction to my app as well as detrimental to noble effort of onboarding people through SIWE.
I originally reached out to WalletConnect, here is a snippet of what they had to say
```
This is something hard to handle on the mobile side because we don't have a way to check if the wallet is locked or not, and also it's not protocolar, meaning not all wallets behave this way, I think MM should at least show some notification that there's an interaction being requested
on the extension side we're handling this on v3
```
So it looks like they have a fix they will implement for the browser extension, but we are still at a bit of a loss for the mobile version.
Is there anything you can suggest, or can we plan in a feature to handle cases like this?
Thank you.
### Scenario
_No response_
### Design
_No response_
### Technical Details
_No response_
### Threat Modeling Framework
_No response_
### Acceptance Criteria
_No response_
### Stakeholder review needed before the work gets merged
- [ ] Engineering (needed in most cases)
- [ ] Design
- [ ] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)
### References
_No response_
Contributor guide
Research direction
The report concerns a wagmi balanceOf read using an address from useAccount, with MetaMask Mobile and WalletConnect involved. Start by reproducing the timeout after MetaMask becomes idle on mobile; the issue names no repository files or tests. Done would require an agreed behavior for handling the locked-wallet case, including acceptance criteria and coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- authentication, mobile
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100