@abstract-foundation/agw-react
Version:
Abstract Global Wallet React Components
62 lines • 2.82 kB
TypeScript
import { type LoginMethodOrderOption, type PrivyProviderProps } from '@privy-io/react-auth';
import { QueryClient } from '@tanstack/react-query';
import React from 'react';
import { type Chain, type Transport } from 'viem';
export declare const agwAppLoginMethod: LoginMethodOrderOption;
/**
* Configuration options for the AbstractPrivyProvider.
* @interface AgwPrivyProviderProps
* @extends PrivyProviderProps
* @property {boolean} testnet - Whether to use abstract testnet, defaults to false.
* @property {Transport} transport - Optional transport to use, defaults to standard http.
* @property {QueryClient} queryClient - Optional query client to use, defaults to a standard query client.
*/
interface AgwPrivyProviderProps extends PrivyProviderProps {
chain: Chain;
transport?: Transport;
queryClient?: QueryClient;
}
/**
* Provider component that integrates Abstract Global Wallet with Privy authentication.
*
* This component wraps your application with the necessary providers to use Abstract Global Wallet
* with Privy authentication, including:
* - PrivyProvider: Handles user authentication and EOA creation
* - WagmiProvider: Provides web3 functionality
* - QueryClientProvider: Manages data fetching with TanStack Query
* - InjectWagmiConnector: Injects the Abstract wallet into Wagmi
*
* @param props - Props for the AbstractPrivyProvider component
* @param props.chain - The blockchain network to connect to (must be supported by Abstract)
* @param props.transport - Optional transport for network requests (defaults to http)
* @param props.queryClient - Optional TanStack Query client (defaults to a new QueryClient)
* @param props.appId - Your Privy app ID (required)
* @param props.config - Optional Privy configuration (defaults to using Abstract as primary login)
* @returns A provider component that wraps your application
*
* @example
* ```tsx
* import { AbstractPrivyProvider } from "@abstract-foundation/agw-react/privy";
* import { abstract } from "viem/chains";
*
* function App() {
* return (
* <AbstractPrivyProvider
* appId="your-privy-app-id"
* chain={abstract}
* >
* <YourApp />
* </AbstractPrivyProvider>
* );
* }
* ```
*
* Once your app is wrapped with this provider, you can use all the Abstract and Wagmi hooks
* throughout your application to interact with blockchain and manage user authentication.
*
* @see {@link useAbstractPrivyLogin} - Hook to login users with Abstract Global Wallet via Privy
* @see {@link useAbstractClient} - Hook to get an Abstract client for blockchain interactions
*/
export declare const AbstractPrivyProvider: ({ chain, transport, queryClient, ...props }: AgwPrivyProviderProps) => React.JSX.Element;
export {};
//# sourceMappingURL=abstractPrivyProvider.d.ts.map