MetaMask / MetaMask/metamask-extension
[Bug]: Wallet is connected with the dapp and locked, No popup to sign the message
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
### Describe the bug
current issue -
user had conencted his wallet with the our dapp
after few minutes, the metamask extension app is locked
as user wallet is still connected, no need to make the new connection request
when user click on signTypedData, user did not get the popup to sign the message (due to the metamask extension is locked)
if users goes to metamask extension and unlock it and tried again to sign the message he has the popup
### Expected behavior
user should alway get the sign message popup if wallet is connected ( id does not matter metamask extension wallet is locked or not after connected) or if wallet is locked there should be some error message like wallet is locked.
### Screenshots/Recordings
_No response_
### Steps to reproduce
Go to beta.weje.com
connected your metamask wallet and signup
go to the link - /table-poker and click on Play button
(send me message so that I can add some WEJE funds for the testing)
it will show the popup to sing and confirm.
now lock the metamask extension wallet and try the same
there will be no sign/ confirm popup
I'm using the below code -
```import { ethers } from "ethers";
import { splitSignature } from "ethers/lib/utils";
import WejeTokenAbi from "../ABI/WejeTokenAbi.json";
const WEJE_TOKEN_ADDRESS = import.meta.env.VITE_WEJE_TOKEN_CONTRACT_ADDRESS;
export async function signPermit({
owner,
spender,
value,
deadline,
provider
}) {
const token = new ethers.Contract(WEJE_TOKEN_ADDRESS, WejeTokenAbi, provider);
const [nonce, name, version, chainId] = await Promise.all([
token.nonces(owner),
token.name(),
"1", // Often version is 1
provider.getNetwork().then((n) => n.chainId),
]);
const domain = {
name,
version,
chainId,
verifyingContract: WEJE_TOKEN_ADDRESS,
};
const types = {
Permit: [
{ name: "owner", type: "address" },
{ name: "spender", type: "address" },
{ name: "value", type: "uint256" },
{ name: "nonce", type: "uint256" },
{ name: "deadline", type: "uint256" },
],
};
const message = {
owner,
spender,
value,
nonce,
deadline,
};
console.log("messag", message.value.toString(), nonce)
const signer = provider.getSigner();
const signature = await signer._signTypedData(domain, types, message);
return splitSignature(signature);
}```
### Error messages or log output
```shell
there is no error message or log
```
### Detection stage
In production (default)
### Version
13.4.2
### Build type
None
### Browser
Chrome
### Operating system
MacOS
### Hardware wallet
_No response_
### Additional context
_No response_
### Severity
_No response_
Contributor guide
Research direction
Reproduce the locked-wallet flow at beta.weje.com using the supplied signPermit snippet and the signTypedData call. Trace how the connected wallet handles signing while MetaMask is locked, then verify that the flow either shows the signing popup or returns an explicit locked-wallet error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- blockchain, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100