@@ -56,6 +56,11 @@ import type {
5656 UserOperationV06 ,
5757 UserOperationV07 ,
5858} from "./types.js" ;
59+ import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js" ;
60+ import {
61+ confirmContractDeployment ,
62+ deploySmartAccount ,
63+ } from "./lib/signing.js" ;
5964/**
6065 * Checks if the provided wallet is a smart wallet.
6166 *
@@ -214,16 +219,16 @@ async function createSmartAccount(
214219 }
215220 }
216221
217- const { accountContract } = options ;
222+ let accountContract = options . accountContract ;
218223 const account : Account = {
219224 address : getAddress ( accountContract . address ) ,
220225 async sendTransaction ( transaction : SendTransactionOption ) {
221226 // if erc20 paymaster - check allowance and approve if needed
222227 let paymasterOverride :
223228 | undefined
224229 | ( (
225- userOp : UserOperationV06 | UserOperationV07 ,
226- ) => Promise < PaymasterResult > ) = undefined ;
230+ userOp : UserOperationV06 | UserOperationV07 ,
231+ ) => Promise < PaymasterResult > ) = undefined ;
227232 if ( erc20Paymaster ) {
228233 await approveERC20 ( {
229234 accountContract,
@@ -241,21 +246,17 @@ async function createSmartAccount(
241246 paymasterOverride = options . overrides ?. paymaster ;
242247 }
243248
244- const accountContractForTransaction = ( ( ) => {
245- // If this transaction is for a different chain than the initial one, get the account contract for that chain
246- if ( transaction . chainId !== accountContract . chain . id ) {
247- return getContract ( {
248- address : account . address ,
249- chain : getCachedChain ( transaction . chainId ) ,
250- client : options . client ,
251- } ) ;
252- }
253- // Default to the existing account contract
254- return accountContract ;
255- } ) ( ) ;
249+ // If this transaction is for a different chain than the initial one, get the account contract for that chain
250+ if ( transaction . chainId !== accountContract . chain . id ) {
251+ accountContract = getContract ( {
252+ address : account . address ,
253+ chain : getCachedChain ( transaction . chainId ) ,
254+ client : options . client ,
255+ } ) ;
256+ }
256257
257258 const executeTx = prepareExecute ( {
258- accountContract : accountContractForTransaction ,
259+ accountContract : accountContract ,
259260 transaction,
260261 executeOverride : options . overrides ?. execute ,
261262 } ) ;
0 commit comments