Skip to content

Instantly share code, notes, and snippets.

@duartefdias
Last active May 28, 2022 05:22
Show Gist options
  • Save duartefdias/a02f5461e17d51d0c1dbcb9690961a91 to your computer and use it in GitHub Desktop.
Save duartefdias/a02f5461e17d51d0c1dbcb9690961a91 to your computer and use it in GitHub Desktop.
function checkIfWalletConnected() {
if (window.ethereum.request({ method: 'eth_accounts' }).then(function (accounts) {
if (accounts.length > 0) {
connected = true;
buyerAddress = accounts[0];
} else {
connected = false;
}
})
) {
connected = true;
} else {
connected = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment