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: UserOperation) => Promise<PaymasterResult>;
predictAddress?: (
factoryContract: Readonly<ContractOptions<[]>>,
) => Promise<string>;
};
sponsorGas: boolean;
transaction: PreparedTransaction;
}): Promise<UserOperation>;

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: UserOperation) => Promise<PaymasterResult>;
predictAddress?: (
factoryContract: Readonly<ContractOptions<[]>>,
) => Promise<string>;
};
sponsorGas: boolean;
transaction: PreparedTransaction;
};

Returns

let returnType: {
callData: Hex | Uint8Array;
callGasLimit: bigint;
initCode: Hex | Uint8Array;
maxFeePerGas: bigint;
maxPriorityFeePerGas: bigint;
nonce: bigint;
paymasterAndData: Hex | Uint8Array;
preVerificationGas: bigint;
sender: Address;
signature: Hex | Uint8Array;
verificationGasLimit: bigint;
};
  • The unsigned user operation