web3-react icon indicating copy to clipboard operation
web3-react copied to clipboard

RPC Error

Open afa7789 opened this issue 3 years ago • 1 comments

Not sure how to handle errors with the library itself.

<Button
            type="primary"
            disabled={connecting}
            onClick={() => {
              setConnecting(true);
              activate(injected, undefined, true).then(
                () => {
                  setConnecting(true)
                }
              ).catch((error) => {
                // ignore the error if it's a user rejected request
                if (error instanceof UserRejectedRequestError) {
                  setConnecting(false);
                } else if (error instanceof UnsupportedChainIdError) {
                  setConnecting(false);
                } else if (error instanceof RpcError) { // was trying to find if this error was typed already.
                  setConnecting(false);
                } else {
                  setError(error);
                }
              });
            }}
          >
            {isMetaMaskInstalled ? t('connect_metamask') : t('connect_wallet')}
          </Button>
inpage.js:1 MetaMask - RPC Error: Already processing eth_requestAccounts. Please wait. {code: -32002, message: 'Already processing eth_requestAccounts. Please wait.'}

afa7789 avatar May 06 '22 21:05 afa7789

this error usually appears when you connect to a wallet but user hasn't unlocked it yet. The easiest way is checking by error.code imo

v1rtl avatar Aug 18 '22 08:08 v1rtl