ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

Add Bug Title Here

Open napindc opened this issue 1 year ago • 0 comments

Ethers Version

6.13.2

Search Terms

No response

Describe the Problem

I'm using the wallet connection code (snippet below) and some users are having issues with Metamask (especially when they also have the Phantom wallet). Code snippet below

The user initially connected and got this error Screenshot 2024-09-11 at 9 57 39 AM

After restarting browser / resetting cache, they tried it and then the Phantom wallet (which has ETh wallet support) pops up saying this. They had to disable the phantom connection to finally get it to work Screenshot 2024-09-11 at 10 02 21 AM

Is there a way to more easily connect to the user's wallet? and also have it ignore these phantom issues

Code Snippet

const newProvider = new ethers.BrowserProvider(window.ethereum)
const newSigner = await newProvider.getSigner()

setProvider(newProvider)
setSigner(newSigner)

// Request a signature to verify the user
const message = `Please sign this message to verify your address. Timestamp: ${new Date().toISOString()}`
const signature = await newSigner.signMessage(message)
const signingAddress = newSigner.address

setAddress(signingAddress)

Contract ABI

No response

Errors

No response

Environment

No response

Environment (Other)

No response

napindc avatar Sep 11 '24 02:09 napindc