sendTransaction
This takes an ethereum transaction and converts it into a UserOperation
(UO), sends the UO, and waits on the receipt of that UO (i.e. has it been mined).
If you don't want to wait for the UO to mine, it is recommended to use sendUserOperation instead.
Note that to
, data
, value
, maxFeePerGas
, maxPriorityFeePerGas
fields of the transaction request type are considered and used to build the user operation from the transaction, while other fields are not used.
Usage
import { smartAccountClient } from "./smartAccountClient";
const tx: RpcTransactionRequest = {
from, // ignored
to,
data: encodeFunctionData({
abi: ContractABI.abi,
functionName: "func",
args: [arg1, arg2, ...],
}),
};
const txHash = await smartAccountClient.sendTransaction(tx);
Returns
Promise<Hash | null>
A Promise
containing the transaction hash
Parameters
SendTransactionParameters
Same as viem
TransactionRequest
, but with the from
field excluded
export type SendTransactionParameters<
TChain extends Chain | undefined = Chain | undefined,
TAccount extends Account | undefined = Account | undefined,
TChainOverride extends Chain | undefined = Chain | undefined,
///
derivedChain extends Chain | undefined = DeriveChain<TChain, TChainOverride>
> = UnionOmit<FormattedTransactionRequest<derivedChain>, "from"> &
GetAccountParameter<TAccount> &
GetChainParameter<TChain, TChainOverride>;
overrides?:
UserOperationOverrides
Optional parameter where you can specify override values for maxFeePerGas
, maxPriorityFeePerGas
, callGasLimit
, preVerificationGas
, verificationGasLimit
, paymasterAndData
, or nonceKey
for the user operation request. You can also specify a stateOverride
to be passed into eth_estimateUserOperationGas
during gas estimation.
account?: TAccount extends SmartContractAccount | undefined
When using this action, if the SmartContractAccount
has not been connected to the SmartAccountClient
(e.g. SmartAccountClient
not instantiated with your SmartContractAccount
during createSmartAccountClient
). If the account is not connected, you can specify the SmartContractAccount
instance to use for the function call.