Wrap your application in the AbstractWalletProvider component to enable the use of the package’s hooks and components throughout your application. Learn more on the Native Integration guide.

import { AbstractWalletProvider } from "@abstract-foundation/agw-react";
import { abstractTestnet, abstract } from "viem/chains"; // Use abstract for mainnet

const App = () => {
  return (
    <AbstractWalletProvider
      chain={abstractTestnet} // Use abstract for mainnet
      // Optionally, provide your own RPC URL
      // transport={http("https://.../rpc")}
      // Optionally, provide your own QueryClient
      // queryClient={queryClient}
    >
      {/* Your application components */}
    </AbstractWalletProvider>
  );
};

Props

chain
Chain
required

The chain to connect to. Must be either abstractTestnet or abstract (for mainnet). The provider will throw an error if an unsupported chain is provided.

transport
Transport

Optional. A Viem Transport instance to use if you want to connect to a custom RPC URL.

If not provided, the default HTTP transport will be used.

queryClient
QueryClient

Optional. A @tanstack/react-query QueryClient instance to use for data fetching.

If not provided, a new QueryClient instance will be created with default settings.