-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
RPC Error: Request of type 'wallet_requestPermissions' already pending for origin #10584
Comments
This happens in a case like:
Is there anyway to cancel/close the popup programmatically? So that we can use timeout to check and close the pop up from our code? |
is there a workaround in the meantime? i ran into the same situation while trying to deposit some funds into polygon.curve.fi and the interface is coming back with an "Returned error: execution reverted" error. On the console, I can see the following: MetaMask - RPC Error: Request of type 'wallet_requestPermissions' already pending for origin https://polygon.curve.fi. Please wait. |
Any update? It's been 5 months... I've seen how this built-in behavior of MetaMask causes extremely high levels of attrition and frustration of users on our site |
This was addressed in #12643 |
This same error seems to happen if you do the following actions.
There is some interesting side effects from this. Best work around I have come up with is
|
Request of type 'eth_requestAccounts' already pending for origin https://dex.shardeumswap.finance. Please wait. |
I found this solution, using TWO useEffect() calls to work perfectly for me, removing the errors: 'use client';
import {useEffect, useState} from 'react';
export default function ConnectWallet() {
const [account, setAccount] = useState(null);
const [isMetaMaskInstalled, setIsMetaMaskInstalled] = useState(false);
const [isConnecting, setIsConnecting] = useState(false);
// Check if MetaMask is installed
useEffect(() => {
if (typeof window !== 'undefined' && typeof window.ethereum !== 'undefined') {
setIsMetaMaskInstalled(true);
}
}, []);
// Attempt to connect to MetaMask
useEffect(() => {
const connectWallet = async () => {
if (!isMetaMaskInstalled) return;
setIsConnecting(true);
try {
await window.ethereum.request({method: 'eth_requestAccounts'});
const accounts = await window.ethereum.request({method: 'eth_accounts'});
setAccount(accounts[0]);
} catch (error) {
console.error("Failed to connect to MetaMask:", error);
// Handle errors here
} finally {
setIsConnecting(false);
}
};
connectWallet();
}, [isMetaMaskInstalled]);
return (
<div>
{isConnecting ? 'Connecting...' : account ? `Connected: ${account}` : 'Not connected'}
</div>
);
} |
What to do in this situation?
Originally posted by @ashish-mehta in #7710 (comment)
The text was updated successfully, but these errors were encountered: