Skip to content

sendTransaction

Sends a transaction using the provided client, arguments, optional overrides, and context. This sends a UO and then waits for it to be mined

Import

import { sendTransaction } from "@aa-sdk/core";

Usage

import { createSmartAccountClient } from "@aa-sdk/core";
 
// smart account client is already extended with sendTransaction
const client = createSmartAccountClient(...);
const result = await client.sendTransaction({
to: "0x...",
data: "0x...", // or "0x",
value: 0n, // optional
account, // only required if the client above is not connected to an account
});

Parameters

client

Client<Transport, TChain, TAccount> The client to send the transaction through

args

SendTransactionParameters<TChain, TAccount, TChainOverride> The parameters required to send the transaction

overrides

UserOperationOverrides<TEntryPointVersion> Optional overrides for the user operation

context

UserOperationContext Optional context for the user operation

Returns

Promise<Hex> A promise that resolves to a hex string representing the transaction hash