Skip to content

useBundlerClient

The useBundlerClient hook returns the underlying Bundler RPC client instance.

Import

ts
import { useBundlerClient } from "@alchemy/aa-alchemy/react";

Usage

tsx
import { useBundlerClient } from "@alchemy/aa-alchemy/react";
import { useQuery } from "@tanstack/react-query";

export function ComponentWithBundlerClient() {
  const client = useBundlerClient();

  const { data, isLoading } = useQuery({
    queryKey: ["supportedEntryPoints"],
    queryFn: () => client.getSupportedEntryPoints(),
  });

  if (isLoading) {
    return <div>Loading...</div>;
  }

  return (
    <div>
      <h1>{JSON.stringify(data)}</h1>
    </div>
  );
}

Return Type

ts
import { type UseBundlerClientResult } from "@alchemy/aa-alchemy/react";

Returns an instance of ClientWithAlchemyMethods which is the JSON RPC client connected to Alchemy services.