The AbstractClient includes a sendTransaction method that can be used to sign and submit a transaction to the chain using the connected Abstract Global Wallet. Transactions are signed by the approved signer account (EOA) of the Abstract Global Wallet and sent from the AGW smart contract itself.

Usage

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

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

  async function sendTransaction() {
    if (!agwClient) return;
    
    const hash = await agwClient.sendTransaction({
      to: "0x273B3527BF5b607dE86F504fED49e1582dD2a1C6",
      data: "0x69",
    });
  }

}

Parameters

to
Address | null | undefined
The recipient address of the transaction.
from
Address
The sender address of the transaction.By default, this is set as the Abstract Global Wallet smart contract address.
data
Hex | undefined
Contract code or a hashed method call with encoded args.
gas
bigint | undefined
Gas provided for transaction execution.
nonce
number | undefined
Unique number identifying this transaction.Learn more in the handling nonces section.
value
bigint | undefined
Value in wei sent with this transaction.
maxFeePerGas
bigint
Total fee per gas in wei (gasPrice/baseFeePerGas + maxPriorityFeePerGas).
maxPriorityFeePerGas
bigint
Max priority fee per gas (in wei).
gasPerPubdata
bigint | undefined
The amount of gas to pay per byte of data on Ethereum.
factoryDeps
Hex[] | undefined
An array of bytecodes of contracts that are dependencies for the transaction.
paymaster
Account | Address
Address of the paymaster smart contract that will pay the gas fees of the transaction.Must also provide a paymasterInput field.
paymasterInput
Hex
Input data to the paymaster.Must also provide a paymaster field.
customSignature
Hex | undefined
Custom signature for the transaction.
type
'eip712' | undefined
Transaction type. For EIP-712 transactions, this should be eip712.

Returns

Returns a Promise<Hex> containing the transaction hash of the submitted transaction.