@@ -56,6 +56,11 @@ import type {
56
56
UserOperationV06 ,
57
57
UserOperationV07 ,
58
58
} from "./types.js" ;
59
+ import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js" ;
60
+ import {
61
+ confirmContractDeployment ,
62
+ deploySmartAccount ,
63
+ } from "./lib/signing.js" ;
59
64
/**
60
65
* Checks if the provided wallet is a smart wallet.
61
66
*
@@ -214,16 +219,16 @@ async function createSmartAccount(
214
219
}
215
220
}
216
221
217
- const { accountContract } = options ;
222
+ let accountContract = options . accountContract ;
218
223
const account : Account = {
219
224
address : getAddress ( accountContract . address ) ,
220
225
async sendTransaction ( transaction : SendTransactionOption ) {
221
226
// if erc20 paymaster - check allowance and approve if needed
222
227
let paymasterOverride :
223
228
| undefined
224
229
| ( (
225
- userOp : UserOperationV06 | UserOperationV07 ,
226
- ) => Promise < PaymasterResult > ) = undefined ;
230
+ userOp : UserOperationV06 | UserOperationV07 ,
231
+ ) => Promise < PaymasterResult > ) = undefined ;
227
232
if ( erc20Paymaster ) {
228
233
await approveERC20 ( {
229
234
accountContract,
@@ -241,21 +246,17 @@ async function createSmartAccount(
241
246
paymasterOverride = options . overrides ?. paymaster ;
242
247
}
243
248
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
+ }
256
257
257
258
const executeTx = prepareExecute ( {
258
- accountContract : accountContractForTransaction ,
259
+ accountContract : accountContract ,
259
260
transaction,
260
261
executeOverride : options . overrides ?. execute ,
261
262
} ) ;
0 commit comments