Better login

This commit is contained in:
Balazs Toldi 2022-06-01 12:20:30 +02:00
parent decf98e1b7
commit 80af9c120e
Signed by: Bazsalanszky
GPG key ID: 6C7D440036F99D58

View file

@ -150,7 +150,7 @@
let priceDivider = await contract.methods.getPriceDivider().call();
accounts = await ethereum.request({ method: 'eth_requestAccounts' });
document.getElementById("address").value = accounts[0];
let allowed = new web3.utils.BN(await tokenContract.methods.allowance(accounts[0], ContractAddress).call());
let sellWei = new web3.utils.BN(await web3.utils.toWei(sellAmount, 'ether'));
if (allowed.gte(sellWei)) {
@ -181,7 +181,7 @@
document.getElementById("address").value = accounts[0];
hideLogin();
showSwap();
if(contract == undefined){
if (contract == undefined) {
initContracts();
}
}
@ -243,9 +243,11 @@
initContracts();
web3.eth.getAccounts().then(account => {
console.log(account);
document.getElementById("address").value = account[0];
hideLogin();
showSwap();
if (account.length > 0) {
document.getElementById("address").value = account[0];
hideLogin();
showSwap();
}
});
} else {