on master help sign in
metamask: fix getAuthToken logic

Call with an address instead of a full wallet. Additionally patches the Metamask logic more broadly to heed some of the deprecation warnings it's been giving.

commit86fddd690804da23c2b4f43cd3b41c72c6d3f222 authorFang <git@fang.io> dateTue 17 Aug 2021, 17:31 (5 years ago) parent7a09d40
2 files changed+3−4
src/store/network.js−1 src/views/Login/Metamask.js+3−3
src/store/network.js−1
@@ -28,7 +28,6 @@ function _useNetwork(initialNetworkType = null) {
2828 (async () => {
2929 if (window.ethereum) {
3030 try {
31− await window.ethereum.enable();
3231 setMetamask(true);
3332 setNetworkType(chainIdToNetworkType(window.ethereum.chainId));
3433 } catch (e) {
src/views/Login/Metamask.js+3−3
@@ -25,11 +25,11 @@ export default function Metamask({ className, goHome }) {
2525
2626 const onSubmit = useCallback(async () => {
2727 try {
28− const accounts = await window.ethereum.enable();
29− const wallet = new MetamaskWallet(accounts[0]);
28+ const accounts = await window.ethereum.send('eth_requestAccounts');
29+ const wallet = new MetamaskWallet(accounts.result[0]);
3030
3131 const authToken = await getAuthToken({
32− wallet,
32+ address: wallet.address,
3333 walletType: WALLET_TYPES.METAMASK,
3434 web3: _web3,
3535 });