is anyway to use walletconnect with etherejs ?
the demos are nice but they are with wagmi
i cant port all project from etherjs to wagmi
i need this feature this button connect disconect and possibility to use only few networks/chainids
import { arbitrum, mainnet, polygon } from "wagmi/chains";
https://docs.walletconnect.com/2.0/web3modal/react/installation
i this this exactly but with ETHERSJS
const { provider } = configureChains(chains, [
walletConnectProvider({ projectId: "<YOUR_PROJECT_ID>" }),
]);
const wagmiClient = createClient({
autoConnect: true,
connectors: modalConnectors({ appName: "web3Modal", chains }),
provider,
});
// Web3Modal Ethereum Client
const ethereumClient = new EthereumClient(wagmiClient, chains);
I found official example for WalletConnect v2 integration with Ethers.js
New 2024 solution (**Does not seems to be reliable):
Official example https://github.com/WalletConnect/web-examples/blob/main/dapps/ethereum-provider/src/App.tsx#L25C49-L25C61
BrowserProvider
instead ofWeb3Provider
Older/Until 2024 solution:
Previous example was here but most likely above is more up to date: https://github.com/WalletConnect/web-examples/blob/2.7.8/dapps/react-dapp-v2-with-ethers/src/contexts/ClientContext.tsx
Wagmi
. You have to connect lot of WalletConnect events to keep session info up to date, or to reset connection state.ClientContext.tsx
) is IMO overusing React state which is not ideal. Would be nice to have official Ethers wrapper (not React, or other UI library dependent).