@@ -2,6 +2,7 @@ import { trackConnect } from "../../analytics/track/connect.js";
22import type { Chain } from "../../chains/types.js" ;
33import { getCachedChainIfExists } from "../../chains/utils.js" ;
44import { getContract } from "../../contract/contract.js" ;
5+ import { isZkSyncChain } from "../../utils/any-evm/zksync/isZkSyncChain.js" ;
56import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js" ;
67import type { Account , Wallet } from "../interfaces/wallet.js" ;
78import { createWalletEmitter } from "../wallet-emitter.js" ;
@@ -202,19 +203,24 @@ export function smartWallet(
202203 if ( ! lastConnectOptions ) {
203204 throw new Error ( "Cannot switch chain without a previous connection" ) ;
204205 }
205- // check if factory is deployed
206- const factory = getContract ( {
207- address :
208- createOptions . factoryAddress ||
209- getDefaultAccountFactory ( createOptions . overrides ?. entrypointAddress ) ,
210- chain : newChain ,
211- client : lastConnectOptions . client ,
212- } ) ;
213- const isDeployed = await isContractDeployed ( factory ) ;
214- if ( ! isDeployed ) {
215- throw new Error (
216- `Factory contract not deployed on chain: ${ newChain . id } ` ,
217- ) ;
206+ const isZksyncChain = await isZkSyncChain ( newChain ) ;
207+ if ( ! isZksyncChain ) {
208+ // check if factory is deployed
209+ const factory = getContract ( {
210+ address :
211+ createOptions . factoryAddress ||
212+ getDefaultAccountFactory (
213+ createOptions . overrides ?. entrypointAddress ,
214+ ) ,
215+ chain : newChain ,
216+ client : lastConnectOptions . client ,
217+ } ) ;
218+ const isDeployed = await isContractDeployed ( factory ) ;
219+ if ( ! isDeployed ) {
220+ throw new Error (
221+ `Factory contract not deployed on chain: ${ newChain . id } ` ,
222+ ) ;
223+ }
218224 }
219225 const { connectSmartWallet } = await import ( "./index.js" ) ;
220226 const [ connectedAccount , connectedChain ] = await connectSmartWallet (
0 commit comments