2

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";

enter image description here

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);
burnsi
  • 6,194
  • 13
  • 17
  • 27
  • I ended up using wagmi + fetchSigner() then everything else directly on ethers. Still looking for an easier walletconnect 2.0 integration to ethers without wagmi. – Hashim Sayyid Jan 23 '23 at 01:31

1 Answers1

0

I found official example for WalletConnect v2 integration with Ethers.js

See https://github.com/WalletConnect/web-examples/blob/main/dapps/react-dapp-v2-with-ethers/src/contexts/ClientContext.tsx

Bad thing is that it's more complex than one with Wagmi. You have to connect lot of WalletConnect events to keep session info up to date, or to reset connection state.

Also official example (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).

But it is definitely useful example to make Ethers integration work.

Jurosh
  • 6,984
  • 7
  • 40
  • 51