Skip to content

Commit 2d2bfc8

Browse files
committed
skip factory entrypoint lookup for ZKsync chains
1 parent 54c9333 commit 2d2bfc8

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

.changeset/early-adults-travel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Skip factory entrypoint lookup for ZKsync chains

packages/thirdweb/src/wallets/smart/index.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,14 @@ export async function connectSmartAccount(
9595

9696
const options = creationOptions;
9797
const chain = connectChain ?? options.chain;
98+
const isZksyncChain = await isZkSyncChain(chain);
9899

99100
// if factory is passed, but no entrypoint, try to resolve entrypoint from factory
100-
if (options.factoryAddress && !options.overrides?.entrypointAddress) {
101+
if (
102+
!isZksyncChain &&
103+
options.factoryAddress &&
104+
!options.overrides?.entrypointAddress
105+
) {
101106
const entrypointAddress = await getEntrypointFromFactory(
102107
options.factoryAddress,
103108
client,
@@ -122,13 +127,10 @@ export async function connectSmartAccount(
122127
};
123128
}
124129

125-
const factoryAddress =
126-
options.factoryAddress ??
127-
getDefaultAccountFactory(options.overrides?.entrypointAddress);
128130
const sponsorGas =
129131
"gasless" in options ? options.gasless : options.sponsorGas;
130132

131-
if (await isZkSyncChain(chain)) {
133+
if (isZksyncChain) {
132134
return [
133135
createZkSyncAccount({
134136
creationOptions,
@@ -140,6 +142,10 @@ export async function connectSmartAccount(
140142
];
141143
}
142144

145+
const factoryAddress =
146+
options.factoryAddress ??
147+
getDefaultAccountFactory(options.overrides?.entrypointAddress);
148+
143149
const factoryContract = getContract({
144150
client: client,
145151
address: factoryAddress,

0 commit comments

Comments
 (0)