on master help sign in
metamask: fix getAuthToken logic
86fddd6Fang
src/store/network.js−1
@@ -28,7 +28,6 @@ function _useNetwork(initialNetworkType = null) {
28 (async () => {
28 (async () => {
29 if (window.ethereum) {
29 if (window.ethereum) {
30 try {
30 try {
31− await window.ethereum.enable();
32 setMetamask(true);
31 setMetamask(true);
33 setNetworkType(chainIdToNetworkType(window.ethereum.chainId));
32 setNetworkType(chainIdToNetworkType(window.ethereum.chainId));
34 } catch (e) {
33 } catch (e) {
src/views/Login/Metamask.js+3−3
@@ -25,11 +25,11 @@ export default function Metamask({ className, goHome }) {
25
25
26 const onSubmit = useCallback(async () => {
26 const onSubmit = useCallback(async () => {
27 try {
27 try {
28− const accounts = await window.ethereum.enable();
28+ const accounts = await window.ethereum.send('eth_requestAccounts');
29− const wallet = new MetamaskWallet(accounts[0]);
29+ const wallet = new MetamaskWallet(accounts.result[0]);
30
30
31 const authToken = await getAuthToken({
31 const authToken = await getAuthToken({
32− wallet,
32+ address: wallet.address,
33 walletType: WALLET_TYPES.METAMASK,
33 walletType: WALLET_TYPES.METAMASK,
34 web3: _web3,
34 web3: _web3,
35 });
35 });