createUnsignedUserOp

Creates an unsigned user operation from a prepared transaction.

Example

import { createUnsignedUserOp } from "thirdweb/wallets/smart";
const transaction = prepareContractCall(...);
const userOp = await createUnsignedUserOp({
transaction,
factoryContract,
accountContract,
adminAddress,
sponsorGas,
overrides,
});
function createUnsignedUserOp(args: {
accountContract: Readonly<ContractOptions<[]>>;
adminAddress: string;
factoryContract: Readonly<ContractOptions<[]>>;
overrides?: {
accountAddress?: string;
accountSalt?: string;
bundlerUrl?: string;
createAccount?: (
factoryContract: Readonly<ContractOptions<[]>>,
entrypointAddress?: string;
erc20Paymaster?: { address: string; token: string };
execute?: (
accountContract: Readonly<ContractOptions<[]>>,
transaction: SendTransactionOption,
executeBatch?: (
accountContract: Readonly<ContractOptions<[]>>,
transactions: Array<SendTransactionOption>,
getAccountNonce?: (
accountContract: Readonly<ContractOptions<[]>>,
) => Promise<bigint>;
paymaster?: (
userOp: UserOperationV06 | UserOperationV07,
) => Promise<PaymasterResult>;
predictAddress?: (
factoryContract: Readonly<ContractOptions<[]>>,
) => Promise<string>;
};
sponsorGas: boolean;
transaction: PreparedTransaction;
waitForDeployment?: boolean;
}): Promise<UserOperationV06 | UserOperationV07>;

Parameters

The prepared transaction and options

Type

let args: {
accountContract: Readonly<ContractOptions<[]>>;
adminAddress: string;
factoryContract: Readonly<ContractOptions<[]>>;
overrides?: {
accountAddress?: string;
accountSalt?: string;
bundlerUrl?: string;
createAccount?: (
factoryContract: Readonly<ContractOptions<[]>>,
entrypointAddress?: string;
erc20Paymaster?: { address: string; token: string };
execute?: (
accountContract: Readonly<ContractOptions<[]>>,
transaction: SendTransactionOption,
executeBatch?: (
accountContract: Readonly<ContractOptions<[]>>,
transactions: Array<SendTransactionOption>,
getAccountNonce?: (
accountContract: Readonly<ContractOptions<[]>>,
) => Promise<bigint>;
paymaster?: (
userOp: UserOperationV06 | UserOperationV07,
) => Promise<PaymasterResult>;
predictAddress?: (
factoryContract: Readonly<ContractOptions<[]>>,
) => Promise<string>;
};
sponsorGas: boolean;
transaction: PreparedTransaction;
waitForDeployment?: boolean;
};

Returns

let returnType: Promise<UserOperationV06 | UserOperationV07>;
  • The unsigned user operation