MetaMask / extension-provider

A module for allowing a WebExtension to access the web3 provider from an installed MetaMask instance
MIT License
68 stars 28 forks source link

Extension closing #26

Open EmanuelCampos opened 2 years ago

EmanuelCampos commented 2 years ago

Hey guys,

Are you having an issue when you connect your wallet or sign metamask extension in another extension both extensions close, have a workaround/way for solve it?

danfinlay commented 2 years ago

I don't think extensions have much or any control over whether their action views are open.

sunxivincent commented 2 years ago

@EmanuelCampos did you end up solving this issue? I am building up a chrome extension using react. I am doing below code in a button click event handler and expect after signing, it can go back to my popup's main page, however the Metamask closed both itself and my chrome extension popup. But when I put some breakpoint in the code, the behavior is expected. Sample code is as below shown.

const onClick = async() => {
  setLoading(true);
  const web3 = new Web3(provider); 
  const accounts = await web3.eth.requestAccounts();
  const account = accounts[0];
  await web3.eth.personal.sign(XXX, account.toLowerCase(), "");
  setLoading(false);
};
  return <LoginWall onClick={onClick}></LoginWall>