mirshko / next-web3-boilerplate

Slightly opinionated Next.js Web3 boilerplate built on ethers, web3-react, Typechain, and SWR.
609 stars 147 forks source link

useEagerConnect does not work on SSR #17

Open fsouzadi1995 opened 2 years ago

fsouzadi1995 commented 2 years ago

Hi!

I'm not sure if I'm completely missing the point here, but it seems that useEagerConnect() does not currently work on Next.js or any prerendered site since the window.ethereumproperty cannot be accessed server-side.

I've tried both creating my own project from scratch and also cloned this one to confirm it.

I'm also getting the following console output:

MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead.
For more information, see: https://eips.ethereum.org/EIPS/eip-1193

I'm quite new to SSR so I might be doing some stuff the wrong way.

mirshko commented 2 years ago

Hey there!

So the console warning you're seeing is from the upstream library web3-react, this will be fixed in the newest version of web3-react which is currently under development.

Regarding useEagerConnect, you're correct this won't connect to your wallet while loading but should after the fact, are you seeing an error when using this? Or is it not working at all.