import { Compute } from '@wagmi/core/internal'; import { providers } from 'ethers'; import { Address, Chain } from 'viem'; import { Config, Connector, ResolvedRegister, UseAccountReturnType, UseConnectorClientReturnType, UseWalletClientReturnType, UseWriteContractParameters, UseWriteContractReturnType } from 'wagmi'; import { MultisigSchema } from './inner/GraphAuthKitInner.context'; import { SafeEthersSigner } from './safe/SafeEthersSigner'; import { GraphAuthKitConnector } from './types'; /** * Hook to to convert a Viem Client to an ethers.js Signer: * - if a multisig wallet is connected return an instance of SafeEthersSigner * - if an EoA wallet is connected return the Signer from `clientToProvider` */ export declare function useClientToEthersSigner(): Omit & { signer: providers.JsonRpcSigner | SafeEthersSigner | undefined | null; }; export declare function useGraphAuthKitConnector(): GraphAuthKitConnector | null; export type UseGraphAuthKitAccountReturnType = UseAccountReturnType & Readonly<{ /** If the user is connected to a multisig, this is the EoA signer address the user is connected with */ eoa?: Address | null; /** Flag on if the user is connected via a multisig */ connectedWithMultisig: boolean; }>; /** * Override hook of wagmi `useAccount`. * The GraphAuthKit lets users connect to a Safe by entering the Safe information in, * and then connecting their EoA account through the other EoA wallet options. * * However, in this use-case, the connected account according to wagmi is still the EoA. * This hook checks the inner context and if the user is connected via a multisig, * returns the multisig address as the `address` return from the hook. * * Otherwise, returns the connected wallet state. * * @see https://wagmi.sh/react/api/hooks/useAccount */ export declare function useGraphAuthKitAccount(): UseGraphAuthKitAccountReturnType; export type UseAuthAccountReturnType = { address: Address; addresses: readonly [Address, ...Address[]]; chain: chain | undefined; chainId: number; connector: Connector; } & Readonly<{ /** If the user is connected to a multisig, this is the EoA signer address the user is connected with */ eoa?: Address | null; /** Flag on if the user is connected via a multisig */ connectedWithMultisig: boolean; }>; /** * Hook that returns the authenticated account information. * If the wallet is not connected, an error is thrown. * This hooks is useful to render where you _know_ the wallet is connected, * preventing checks if the `address` is null further down the tree. */ export declare function useAuthAccount(): UseAuthAccountReturnType; /** * Retrieve the entered multisig info from: * - the innter context object * - if not in the inner context, check if found in storage */ export declare function useMultisigInfo({ config, }?: Readonly<{ config?: config; }>): MultisigSchema | null; export type UseGraphAuthKitAccountEffectArgs = Compute<{ config?: config | undefined; onConnect?(data: Compute, { status: 'connected'; }>, 'address' | 'addresses' | 'chain' | 'chainId' | 'connector' | 'eoa' | 'connectedWithMultisig'> & { isReconnected: boolean; }>): void; onDisconnect?(): void; }>; /** * Override hook of the wagmi `useAccountEffect` that listens to changes derived from the `useGraphAuthKitAccount` hook. * Listening to the `useAccountEffect` hook does not work when the user connects via a multisig in the graph-auth-kit * as the connected account is the EoA and not the Safe address. * This hooks listens on account changes, but checks if the user has connected through a multisig. * * @see https://wagmi.sh/react/api/hooks/useAccountEffect */ export declare function useGraphAuthKitAccountEffect(args?: UseGraphAuthKitAccountEffectArgs): void; /** * Override hook of wagmi `useWalletClient`. * The GraphAuthKit lets users connect to a Safe by entering the Safe information in, * and then connecting their EoA account through the other EoA wallet options. * * However, in this use-case, the connected account according to wagmi is still the EoA. * This hook checks the inner context and if the user is connected via a multisig, * it returns the an extended version of the walletClient overriding the `writeContract` method. * * Otherwise, it returns the walletClient as is. * * @see https://wagmi.sh/react/api/hooks/useWalletClient */ export declare function useGraphAuthKitWalletClient(): UseWalletClientReturnType; /** * Override hook of wagmi `useWriteContract`. * The GraphAuthKit lets users connect to a Safe by entering the Safe information in, * and then connecting their EoA account through the other EoA wallet options. * * However, in this use-case, the connected account according to wagmi is still the EoA. * This hook gets the WalletClient that could be the original EOA or the Safe's WalletClient, * and then it calls the `writeContract` method on the client itself with the passed arguments. * The returned values are the results of `useMutation` hook just like in wagmi's `useWriteContract`. * * @example * * function ComponentWithContractCall() { * const { data: walletClient } = useGraphAuthKitWalletClient() * const { writeContractAsync } = useGraphAuthKitWriteContract(); * * return ( * * ) * } * * @see https://wagmi.sh/react/api/hooks/useWriteContract */ export declare function useGraphAuthKitWriteContract(parameters?: UseWriteContractParameters): UseWriteContractReturnType; //# sourceMappingURL=hooks.d.ts.map