Gets the Wallet client exposed by the the AbstractWalletProvider context. Use this client to perform actions from the connected Abstract Global Wallet, for example deployContract, sendTransaction, writeContract, etc.

Import

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

Usage

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

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

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

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

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

Returns

Returns a UseQueryResult<AbstractClient, Error>.