kyscott18 / reverse-mirage

Application level TypeScript utilities for Ethereum
https://reversemirage.com
MIT License
49 stars 3 forks source link

How to correctly set the type of the client? #65

Open LXVC opened 8 months ago

LXVC commented 8 months ago
function usePublicClient() {
  const [client, setClient] = useState<Client | null>(null);
  const chain = useChain();

  useEffect(() => {
    setClient(
      createClient({
        chain: chain,
        transport: http(),
      }).extend(publicActionReverseMirage),
    );
  }, [chain]);
}

Code as shown above, How should I correctly set the type of useState to ensure that the returned client has all the methods from publicActionReverseMirage?

LXVC commented 8 months ago

@kyscott18