Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback to personal_sign if eth_sign fails #7468

Merged
merged 1 commit into from
Sep 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion app/assets/v2/js/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,16 @@ Vue.component('grants-cart', {
const message = 'Access Gitcoin zkSync account.\n\nOnly sign this message for a trusted client!';

indicateMetamaskPopup();
const signature = await this.signer.signMessage(message); // web3 prompt to user is here
let signature;

signature = await this.signer.signMessage(message); // web3 prompt to user is here
if (!signature) {
// Fallback to personal_sign if eth_sign isn't supported (for Status and other wallets)
signature = await this.ethersProvider.send(
'personal_sign',
[ ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)), this.userAddress.toLowerCase() ]
);
}

indicateMetamaskPopup(true);
const privateKey = ethers.utils.sha256(signature);
Expand Down