Skip to content

Commit 9858781

Browse files
committed
cleaup + change interface
1 parent 6b523c0 commit 9858781

File tree

1 file changed

+8
-14
lines changed
  • packages/thirdweb/src/wallets/smart/lib

1 file changed

+8
-14
lines changed

packages/thirdweb/src/wallets/smart/lib/userop.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export async function createUnsignedUserOp(args: {
136136
adminAddress: string;
137137
sponsorGas: boolean;
138138
waitForDeployment?: boolean;
139-
forceDeployment?: "force_deploy" | "force_skip_deploy";
139+
isDeployedOverride?: boolean;
140140
overrides?: SmartWalletOptions["overrides"];
141141
}): Promise<UserOperationV06 | UserOperationV07> {
142142
const {
@@ -147,7 +147,7 @@ export async function createUnsignedUserOp(args: {
147147
overrides,
148148
sponsorGas,
149149
waitForDeployment = true,
150-
forceDeployment,
150+
isDeployedOverride,
151151
} = args;
152152
const chain = executeTx.chain;
153153
const client = executeTx.client;
@@ -163,18 +163,12 @@ export async function createUnsignedUserOp(args: {
163163
args.overrides?.entrypointAddress || ENTRYPOINT_ADDRESS_v0_6,
164164
);
165165

166-
const isDeployedOverride = forceDeployment
167-
? {
168-
force_deploy: true,
169-
force_skip_deploy: false,
170-
}[forceDeployment]
171-
: undefined;
172-
173166
const [isDeployed, callData, callGasLimit, gasFees, nonce] =
174167
await Promise.all([
175168
typeof isDeployedOverride === "boolean"
176169
? isDeployedOverride
177-
: isContractDeployed(accountContract),
170+
: isContractDeployed(accountContract) ||
171+
isAccountDeploying(accountContract),
178172
encode(executeTx),
179173
resolvePromisedValue(executeTx.gas),
180174
getGasFees({
@@ -310,7 +304,7 @@ async function populateUserOp_v0_7(args: {
310304

311305
let factory: string | undefined;
312306
let factoryData: Hex;
313-
if (isDeployed || isAccountDeploying(accountContract)) {
307+
if (isDeployed) {
314308
factoryData = "0x";
315309
if (waitForDeployment) {
316310
// lock until account is deployed if needed to avoid 'sender already created' errors when sending multiple transactions in parallel
@@ -473,7 +467,7 @@ async function populateUserOp_v0_6(args: {
473467
const { chain, client } = bundlerOptions;
474468
let initCode: Hex;
475469

476-
if (isDeployed || isAccountDeploying(accountContract)) {
470+
if (isDeployed) {
477471
initCode = "0x";
478472
if (waitForDeployment) {
479473
// lock until account is deployed if needed to avoid 'sender already created' errors when sending multiple transactions in parallel
@@ -710,7 +704,7 @@ export async function createAndSignUserOp(options: {
710704
client: ThirdwebClient;
711705
smartWalletOptions: SmartWalletOptions;
712706
waitForDeployment?: boolean;
713-
forceDeployment?: "force_deploy" | "force_skip_deploy";
707+
isDeployedOverride?: boolean;
714708
}) {
715709
const config = options.smartWalletOptions;
716710
const factoryContract = getContract({
@@ -769,7 +763,7 @@ export async function createAndSignUserOp(options: {
769763
sponsorGas: "sponsorGas" in config ? config.sponsorGas : config.gasless,
770764
overrides: config.overrides,
771765
waitForDeployment: options.waitForDeployment,
772-
forceDeployment: options.forceDeployment,
766+
isDeployedOverride: options.isDeployedOverride,
773767
});
774768
const signedUserOp = await signUserOp({
775769
client: options.client,

0 commit comments

Comments
 (0)