> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abs.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# writeContract

> Function to call functions on a smart contract using the connected Abstract Global Wallet.

The [AbstractClient](/abstract-global-wallet/agw-client/createAbstractClient)
includes a `writeContract` method that can be used to call functions on a smart contract using the connected Abstract Global Wallet.

## Usage

```tsx theme={null}
import { useAbstractClient } from "@abstract-foundation/agw-react";
import { parseAbi } from "viem";

export default function WriteContract() {
  const { data: agwClient } = useAbstractClient();

  async function writeContract() {
    if (!agwClient) return;

    const transactionHash = await agwClient.writeContract({
      abi: parseAbi(["function mint(address,uint256) external"]), // Your contract ABI
      address: "0xC4822AbB9F05646A9Ce44EFa6dDcda0Bf45595AA",
      functionName: "mint",
      args: ["0x273B3527BF5b607dE86F504fED49e1582dD2a1C6", BigInt(1)],
    });
  }
}
```

## Parameters

<ResponseField name="address" type="Address" required>
  The address of the contract to write to.
</ResponseField>

<ResponseField name="abi" type="Abi" required>
  The ABI of the contract to write to.
</ResponseField>

<ResponseField name="functionName" type="string" required>
  The name of the function to call on the contract.
</ResponseField>

<ResponseField name="args" type="unknown[]">
  The arguments to pass to the function.
</ResponseField>

<ResponseField name="account" type="Account">
  The account to use for the transaction. By default, this is set to the
  Abstract Global Wallet's account.
</ResponseField>

<ResponseField name="chain" type="Chain">
  The chain to use for the transaction. By default, this is set to the chain
  specified in the AbstractClient.
</ResponseField>

<ResponseField name="value" type="bigint">
  The amount of native token to send with the transaction (in wei).
</ResponseField>

<ResponseField name="dataSuffix" type="Hex">
  Data to append to the end of the calldata. Useful for adding a ["domain"
  tag](https://opensea.notion.site/opensea/Seaport-Order-Attributions-ec2d69bf455041a5baa490941aad307f).
</ResponseField>

<ResponseField name="gasPerPubdata" type="bigint">
  The amount of gas to pay per byte of data on Ethereum.
</ResponseField>

<ResponseField name="paymaster" type="Account | Address">
  Address of the
  [paymaster](/how-abstract-works/native-account-abstraction/paymasters) smart
  contract that will pay the gas fees of the transaction.
</ResponseField>

<ResponseField name="paymasterInput" type="Hex">
  Input data to the paymaster. Required if `paymaster` is provided.

  <Expandable title="Example with Paymaster">
    ```tsx theme={null}
    import { agwClient } from "./config";
    import { parseAbi } from "viem";

    const transactionHash = await agwClient.writeContract({
      abi: parseAbi(["function mint(address,uint256) external"]),
      address: "0xC4822AbB9F05646A9Ce44EFa6dDcda0Bf45595AA",
      functionName: "mint",
      args: ["0x273B3527BF5b607dE86F504fED49e1582dD2a1C6", BigInt(1)],
    });
    ```
  </Expandable>
</ResponseField>

## Returns

Returns a `Promise<Hex>` containing the transaction hash of the contract write operation.
