on master help sign in
roller: use same solution for personal signing as getMetamaskAuthToken
commitf941cfaf072272ede68e347bf8d634a802e25c75 authorHunter Miller <hunter@thisdot.co> dateFri 11 Feb 2022, 15:25 (5 years ago) parent8ad8a74
1 file changed+13−1
src/lib/utils/roller.ts+13−1
src/lib/utils/roller.ts+13−1
@@ -66,7 +66,19 @@ export const generateHashAndSign = async (
6666) => {
6767 if (walletType === WALLET_TYPES.METAMASK) {
6868 const hash = await api.prepareForSigning(nonce, from, type, data);
69− const sig = await web3.eth.personal.sign(hash, wallet.address, '');
69+ let sig;
70+
71+ // same issue as seen in getMetamaskAuthToken
72+ if (window.ethereum) {
73+ sig = window.ethereum.request({
74+ method: 'personal_sign',
75+ params: [hash, wallet.address],
76+ from: wallet.address,
77+ });
78+ } else {
79+ sig = await web3.eth.personal.sign(hash, wallet.address, '');
80+ }
81+
7082 return sig;
7183 } else if (walletType === WALLET_TYPES.WALLET_CONNECT) {
7284 if (!connector || !connector.connected) {