mirror of https://github.com/logos-co/open-law.git
issue Change pop up trigger to when the user clicks on `connect wallet` and they don't have the extension + change copy #155
This commit is contained in:
parent
f3988e2873
commit
7f7066e2ff
|
@ -13,8 +13,9 @@ export function initWallet() {
|
||||||
// protocol, hostname and port number of the URL
|
// protocol, hostname and port number of the URL
|
||||||
const origin = window.location.origin;
|
const origin = window.location.origin;
|
||||||
// connect to ethereum network and sign transactions with Metamask
|
// connect to ethereum network and sign transactions with Metamask
|
||||||
const showExtensionAlert = localStorage.getItem('showExtensionAlert');
|
|
||||||
if (!window.hasOwnProperty('ethereum') && showExtensionAlert != 'false') {
|
async function signInWithEthereum() {
|
||||||
|
if (!window.hasOwnProperty('ethereum')) {
|
||||||
let result = confirm(
|
let result = confirm(
|
||||||
"You don't have needed extension! Do you want to install it?",
|
"You don't have needed extension! Do you want to install it?",
|
||||||
);
|
);
|
||||||
|
@ -24,15 +25,13 @@ export function initWallet() {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (showExtensionAlert == 'false' && !window.hasOwnProperty('ethereum')) {
|
if (!window.hasOwnProperty('ethereum')) {
|
||||||
console.error('Required extension not found');
|
console.error('Required extension not found');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const eOwner: IEthereumOwner = window as any;
|
const eOwner: IEthereumOwner = window as any;
|
||||||
const provider = new ethers.providers.Web3Provider(eOwner.ethereum);
|
const provider = new ethers.providers.Web3Provider(eOwner.ethereum);
|
||||||
const signer = provider.getSigner();
|
const signer = provider.getSigner();
|
||||||
|
|
||||||
async function signInWithEthereum() {
|
|
||||||
// create siwe message and call backend to get a nonce
|
// create siwe message and call backend to get a nonce
|
||||||
const res1 = await fetch('/nonce', {
|
const res1 = await fetch('/nonce', {
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
|
|
Loading…
Reference in New Issue