-1

I'm encountering a "Network Request Failed" error specifically when trying to interact with Seaport contracts using the WalletConnect connector from the Wagmi library.

I've set up a project where I'm utilizing the WalletConnect connector provided by Wagmi to establish a connection with a wallet. My goal is to interact with Seaport contracts for various tasks. However, whenever I attempt to interact with these contracts, I consistently receive a "Network Request Failed" error.

wagmi configuration

const { chains, publicClient, webSocketPublicClient } = configureChains(
  [mainnet, sepolia, goerli, polygon, optimism, arbitrum],
  [publicProvider()],
  {
    pollingInterval: 18000,
    targetQuorum: 3
  }
);

const chainConfig = createConfig({
  autoConnect: true,
  chains,
  connectors: [
    new InjectedConnector({
      options: {
        shimDisconnect: true,
        shimChainChangedDisconnect: true
      }
    }),
    new WalletConnectConnector({
      chains: [sepolia],
      options: {
        projectId : projectId
    })
  ],
  publicClient,
  webSocketPublicClient
});

this is ethers adapter that i'm using for signer

export function walletClientToSigner(walletClient) {
  const { account, chain, transport } = walletClient;
  const connectedNetwork = getNetwork()?.chain;
  const network = {
    chainId: chain?.id || connectedNetwork.id,
    name: chain?.name || connectedNetwork.name,
    ensAddress:
      chain?.contracts?.ensRegistry?.address ||
      connectedNetwork.contracts?.ensRegistry?.address
  };
  const web3Provider = new providers.Web3Provider(transport, network);
  const signer = web3Provider.getSigner(account.address);
  return signer;
}

export function useSigner(chainId) {
  const { data: walletClient } = useWalletClient({ chainId });
  return React.useMemo(
    () => (walletClient ? walletClientToSigner(walletClient) : undefined),
    [walletClient]
  );
}

the versions i'm using for config wagmi : 1.3.10 @wagmi/core: 1.3.9 ethers: 5.7.2

I tried everything from changing network configuration using different provider like alchemy and infura but i think nothing's work, I think problem with seaport that it doesn't allow public rpc so can any one give the solution to the problem or tell me how can i set the custom private Json-RPC to provider so that the interaction can be done by that RPC

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Aug 22 '23 at 13:36

0 Answers0