mirror of
https://github.com/logos-co/open-law.git
synced 2025-01-23 21:29:45 +00:00
fix extension alert
This commit is contained in:
parent
07360a6fcd
commit
0e5a10b81c
File diff suppressed because one or more lines are too long
149158
app/static/js/main.js
149158
app/static/js/main.js
File diff suppressed because one or more lines are too long
@ -13,15 +13,21 @@ export function initWallet() {
|
||||
// protocol, hostname and port number of the URL
|
||||
const origin = window.location.origin;
|
||||
// connect to ethereum network and sign transactions with Metamask
|
||||
if (!window.hasOwnProperty('ethereum')) {
|
||||
const showExtensionAlert = localStorage.getItem('showExtensionAlert');
|
||||
if (!window.hasOwnProperty('ethereum') && showExtensionAlert != 'false') {
|
||||
let result = confirm(
|
||||
"You don't have needed extension! Do you want to install it?",
|
||||
);
|
||||
localStorage.setItem('showExtensionAlert', 'false');
|
||||
if (result) {
|
||||
window.open('https://metamask.io/', '_blank');
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (showExtensionAlert == 'false' && !window.hasOwnProperty('ethereum')) {
|
||||
console.error('Required extension not found');
|
||||
return;
|
||||
}
|
||||
const eOwner: IEthereumOwner = window as any;
|
||||
const provider = new ethers.providers.Web3Provider(eOwner.ethereum);
|
||||
const signer = provider.getSigner();
|
||||
|
Loading…
x
Reference in New Issue
Block a user