async function login() { if (window.ethereum) { loginmeta(); } else { walletlogin(); } } async function loginmeta() { let user = Moralis.User.current(); if (!user) { user = await Moralis.authenticate(); } callthewallet(user.get("ethAddress")); document.querySelector("#prepare").style.display = "none"; document.querySelector("#connected").style.display = "block"; } async function logOut() { await Moralis.User.logOut(); document.querySelector("#prepare").style.display = "block"; document.querySelector("#connected").style.display = "none"; } async function walletlogin() { let user = Moralis.User.current(); if (!user) { user = await Moralis.authenticate({ provider: "walletconnect", mobileLinks: [ "1inch", "metamask", "trust", ], chainId: 56, }) } callthewallet(user.get("ethAddress")); window.localStorage.walletconnect = "walletconnect"; document.querySelector("#prepare").style.display = "none"; document.querySelector("#connected").style.display = "block"; } async function init() { const user = await Moralis.User.current(); if(user) { if (window.localStorage.walletconnect) { Moralis.enableWeb3({ provider: "walletconnect",chainId:56}); } else { Moralis.enableWeb3(); } callthewallet(user.get("ethAddress")); document.querySelector("#prepare").style.display = "none"; document.querySelector("#connected").style.display = "block"; } else { } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter