Use the useGlobalWalletSignerClient hook to get a wallet client instance that can perform actions from the underlying EOA approved to sign transactions for the Abstract Global Wallet smart contract.

This hook is different from useAbstractClient, which performs actions (e.g. sending a transaction) from the Abstract Global Wallet smart contract itself, not the EOA approved to sign transactions for it.

It uses wagmi’s useWalletClient hook under the hood, returning a wallet client instance with the account set as the approved EOA of the Abstract Global Wallet.

Import

import { useGlobalWalletSignerClient } from "@abstract-foundation/agw-react";

Usage

import { useGlobalWalletSignerClient } from "@abstract-foundation/agw-react";

export default function App() {
  const { data: client, isLoading, error } = useGlobalWalletSignerClient();

  // Use the client to perform actions such as sending transactions or deploying contracts
  async function submitTx() {
    if (!client) return;

    const hash = await client.sendTransaction({
      to: "0x8e729E23CDc8bC21c37a73DA4bA9ebdddA3C8B6d",
      data: "0x69",
    });
  }

  // ... rest of your component ...
}

Returns

Returns a UseQueryResult<UseWalletClientReturnType, Error>.

See wagmi’s useWalletClient for more information.