Skip to content

Commit 9531aa2

Browse files
feat: handle zksync direct deploys in deployContract
1 parent 4f346e6 commit 9531aa2

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

.changeset/rich-steaks-guess.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+
Handle zk sync direct deploys in `deployContract`

packages/thirdweb/src/contract/deployment/deploy-with-abi.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { encodeAbiParameters } from "../../utils/abi/encodeAbiParameters.js";
55
import { normalizeFunctionParams } from "../../utils/abi/normalizeFunctionParams.js";
66
import { computeDeploymentAddress } from "../../utils/any-evm/compute-deployment-address.js";
77
import { computeDeploymentInfoFromBytecode } from "../../utils/any-evm/compute-published-contract-deploy-info.js";
8+
import { isZkSyncChain } from "../../utils/any-evm/zksync/isZkSyncChain.js";
89
import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js";
910
import { ensureBytecodePrefix } from "../../utils/bytecode/prefix.js";
1011
import { concatHex } from "../../utils/encoding/helpers/concat-hex.js";
@@ -13,6 +14,7 @@ import type { Prettify } from "../../utils/type-utils.js";
1314
import type { ClientAndChain } from "../../utils/types.js";
1415
import type { Account } from "../../wallets/interfaces/wallet.js";
1516
import { getContract } from "../contract.js";
17+
import { zkDeployContract } from "./zksync/zkDeployContract.js";
1618

1719
/**
1820
* @extension DEPLOY
@@ -121,6 +123,18 @@ export async function deployContract(
121123
salt?: string;
122124
},
123125
) {
126+
if (await isZkSyncChain(options.chain)) {
127+
return zkDeployContract({
128+
account: options.account,
129+
client: options.client,
130+
chain: options.chain,
131+
bytecode: options.bytecode,
132+
abi: options.abi,
133+
params: options.constructorParams,
134+
salt: options.salt,
135+
});
136+
}
137+
124138
if (options.salt !== undefined) {
125139
// Deploy with CREATE2 if salt is provided
126140
const info = await computeDeploymentInfoFromBytecode(options);

packages/thirdweb/src/extensions/prebuilts/deploy-published.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -263,22 +263,6 @@ async function directDeploy(options: {
263263
const { account, client, chain, compilerMetadata, contractParams, salt } =
264264
options;
265265

266-
if (await isZkSyncChain(chain)) {
267-
return zkDeployContract({
268-
account,
269-
client,
270-
chain,
271-
bytecode: await fetchBytecodeFromCompilerMetadata({
272-
compilerMetadata,
273-
client,
274-
chain,
275-
}),
276-
abi: compilerMetadata.abi,
277-
params: contractParams,
278-
salt,
279-
});
280-
}
281-
282266
const { deployContract } = await import(
283267
"../../contract/deployment/deploy-with-abi.js"
284268
);

0 commit comments

Comments
 (0)