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<[]>>,
admin: string,
entrypointAddress?: 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<[]>>,
admin: string,
) => Promise<string>;
signMessage?: (options: {
accountContract: Readonly<ContractOptions<[]>>;
adminAccount: Account;
factoryContract: Readonly<ContractOptions<[]>>;
message: SignableMessage;
}) => Promise<`0x${string}`>;
signTypedData?: (options: {
accountContract: Readonly<ContractOptions<[]>>;
adminAccount: Account;
factoryContract: Readonly<ContractOptions<[]>>;
typedData: Definition<
typedData,
primaryType,
typedData extends {
address?: undefined;
bool?: undefined;
bytes?: undefined;
bytes1?: undefined;
bytes10?: undefined;
bytes11?: undefined;
bytes12?: undefined;
bytes13?: undefined;
bytes14?: undefined;
bytes15?: undefined;
bytes16?: undefined;
bytes17?: undefined;
bytes18?: undefined;
bytes19?: undefined;
bytes2?: undefined;
bytes20?: undefined;
bytes21?: undefined;
bytes22?: undefined;
bytes23?: undefined;
bytes24?: undefined;
bytes25?: undefined;
bytes26?: undefined;
bytes27?: undefined;
bytes28?: undefined;
bytes29?: undefined;
bytes3?: undefined;
bytes30?: undefined;
bytes31?: undefined;
bytes32?: undefined;
bytes4?: undefined;
bytes5?: undefined;
bytes6?: undefined;
bytes7?: undefined;
bytes8?: undefined;
bytes9?: undefined;
int104?: undefined;
int112?: undefined;
int120?: undefined;
int128?: undefined;
int136?: undefined;
int144?: undefined;
int152?: undefined;
int16?: undefined;
int160?: undefined;
int168?: undefined;
int176?: undefined;
int184?: undefined;
int192?: undefined;
int200?: undefined;
int208?: undefined;
int216?: undefined;
int224?: undefined;
int232?: undefined;
int24?: undefined;
int240?: undefined;
int248?: undefined;
int256?: undefined;
int32?: undefined;
int40?: undefined;
int48?: undefined;
int56?: undefined;
int64?: undefined;
int72?: undefined;
int8?: undefined;
int80?: undefined;
int88?: undefined;
int96?: undefined;
string?: undefined;
uint104?: undefined;
uint112?: undefined;
uint120?: undefined;
uint128?: undefined;
uint136?: undefined;
uint144?: undefined;
uint152?: undefined;
uint16?: undefined;
uint160?: undefined;
uint168?: undefined;
uint176?: undefined;
uint184?: undefined;
uint192?: undefined;
uint200?: undefined;
uint208?: undefined;
uint216?: undefined;
uint224?: undefined;
uint232?: undefined;
uint24?: undefined;
uint240?: undefined;
uint248?: undefined;
uint256?: undefined;
uint32?: undefined;
uint40?: undefined;
uint48?: undefined;
uint56?: undefined;
uint64?: undefined;
uint72?: undefined;
uint8?: undefined;
uint80?: undefined;
uint88?: undefined;
uint96?: undefined;
}
? keyof typedData<typedData>
: string
>;
}) => Promise<`0x${string}`>;
tokenPaymaster?: TokenPaymasterConfig;
};
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<[]>>,
admin: string,
entrypointAddress?: 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<[]>>,
admin: string,
) => Promise<string>;
signMessage?: (options: {
accountContract: Readonly<ContractOptions<[]>>;
adminAccount: Account;
factoryContract: Readonly<ContractOptions<[]>>;
message: SignableMessage;
}) => Promise<`0x${string}`>;
signTypedData?: (options: {
accountContract: Readonly<ContractOptions<[]>>;
adminAccount: Account;
factoryContract: Readonly<ContractOptions<[]>>;
typedData: Definition<
typedData,
primaryType,
typedData extends {
address?: undefined;
bool?: undefined;
bytes?: undefined;
bytes1?: undefined;
bytes10?: undefined;
bytes11?: undefined;
bytes12?: undefined;
bytes13?: undefined;
bytes14?: undefined;
bytes15?: undefined;
bytes16?: undefined;
bytes17?: undefined;
bytes18?: undefined;
bytes19?: undefined;
bytes2?: undefined;
bytes20?: undefined;
bytes21?: undefined;
bytes22?: undefined;
bytes23?: undefined;
bytes24?: undefined;
bytes25?: undefined;
bytes26?: undefined;
bytes27?: undefined;
bytes28?: undefined;
bytes29?: undefined;
bytes3?: undefined;
bytes30?: undefined;
bytes31?: undefined;
bytes32?: undefined;
bytes4?: undefined;
bytes5?: undefined;
bytes6?: undefined;
bytes7?: undefined;
bytes8?: undefined;
bytes9?: undefined;
int104?: undefined;
int112?: undefined;
int120?: undefined;
int128?: undefined;
int136?: undefined;
int144?: undefined;
int152?: undefined;
int16?: undefined;
int160?: undefined;
int168?: undefined;
int176?: undefined;
int184?: undefined;
int192?: undefined;
int200?: undefined;
int208?: undefined;
int216?: undefined;
int224?: undefined;
int232?: undefined;
int24?: undefined;
int240?: undefined;
int248?: undefined;
int256?: undefined;
int32?: undefined;
int40?: undefined;
int48?: undefined;
int56?: undefined;
int64?: undefined;
int72?: undefined;
int8?: undefined;
int80?: undefined;
int88?: undefined;
int96?: undefined;
string?: undefined;
uint104?: undefined;
uint112?: undefined;
uint120?: undefined;
uint128?: undefined;
uint136?: undefined;
uint144?: undefined;
uint152?: undefined;
uint16?: undefined;
uint160?: undefined;
uint168?: undefined;
uint176?: undefined;
uint184?: undefined;
uint192?: undefined;
uint200?: undefined;
uint208?: undefined;
uint216?: undefined;
uint224?: undefined;
uint232?: undefined;
uint24?: undefined;
uint240?: undefined;
uint248?: undefined;
uint256?: undefined;
uint32?: undefined;
uint40?: undefined;
uint48?: undefined;
uint56?: undefined;
uint64?: undefined;
uint72?: undefined;
uint8?: undefined;
uint80?: undefined;
uint88?: undefined;
uint96?: undefined;
}
? keyof typedData<typedData>
: string
>;
}) => Promise<`0x${string}`>;
tokenPaymaster?: TokenPaymasterConfig;
};
sponsorGas: boolean;
transaction: PreparedTransaction;
waitForDeployment?: boolean;
};

Returns

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