From 5e66d7aa92764507268bb1c60d5b4027cc560856 Mon Sep 17 00:00:00 2001 From: Joaquim Verges Date: Thu, 3 Oct 2024 13:50:21 +1300 Subject: [PATCH 1/2] feat: optimize zksync contract deployment and bytecode handling --- .../src/extensions/prebuilts/get-required-transactions.ts | 5 +++++ .../actions/zksync/send-eip712-transaction.test.ts | 2 +- packages/thirdweb/src/utils/any-evm/deploy-metadata.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/thirdweb/src/extensions/prebuilts/get-required-transactions.ts b/packages/thirdweb/src/extensions/prebuilts/get-required-transactions.ts index 241926c612d..0ae1c6be28e 100644 --- a/packages/thirdweb/src/extensions/prebuilts/get-required-transactions.ts +++ b/packages/thirdweb/src/extensions/prebuilts/get-required-transactions.ts @@ -210,6 +210,11 @@ export async function getAllDefaultConstructorParamsForImplementation(args: { client: ThirdwebClient; }) { const { chain, client } = args; + const isZkSync = await isZkSyncChain(chain); + if (isZkSync) { + // zksync contracts dont need these implementation constructor params + return {}; + } const [forwarder, weth] = await Promise.all([ computePublishedContractAddress({ chain, diff --git a/packages/thirdweb/src/transaction/actions/zksync/send-eip712-transaction.test.ts b/packages/thirdweb/src/transaction/actions/zksync/send-eip712-transaction.test.ts index 956d7307c73..b5d1e33bb40 100644 --- a/packages/thirdweb/src/transaction/actions/zksync/send-eip712-transaction.test.ts +++ b/packages/thirdweb/src/transaction/actions/zksync/send-eip712-transaction.test.ts @@ -30,7 +30,7 @@ describe("sendEip712Transaction", () => { expect(res.transactionHash.length).toBe(66); }); - it.skip("should deploy a published autofactory contract on zksync", async () => { + it("should deploy a published autofactory contract on zksync", async () => { const address = await deployPublishedContract({ client: TEST_CLIENT, chain: zkSyncSepolia, // TODO make zksync fork chain work diff --git a/packages/thirdweb/src/utils/any-evm/deploy-metadata.ts b/packages/thirdweb/src/utils/any-evm/deploy-metadata.ts index 7b832ba99e8..365d9b882e0 100644 --- a/packages/thirdweb/src/utils/any-evm/deploy-metadata.ts +++ b/packages/thirdweb/src/utils/any-evm/deploy-metadata.ts @@ -80,7 +80,7 @@ export async function fetchBytecodeFromCompilerMetadata(options: { async () => { const isZksolc = await isZkSyncChain(chain); const bytecodeUri = isZksolc - ? compilerMetadata.compilers?.zksolc[0]?.bytecodeUri + ? compilerMetadata.compilers?.zksolc?.[0]?.bytecodeUri : compilerMetadata.bytecodeUri; if (!bytecodeUri) { From 119ebf148e11653ba3a0bc60a29ec9c6a8cee655 Mon Sep 17 00:00:00 2001 From: Joaquim Verges Date: Thu, 3 Oct 2024 13:51:24 +1300 Subject: [PATCH 2/2] disable test for now --- .../transaction/actions/zksync/send-eip712-transaction.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/thirdweb/src/transaction/actions/zksync/send-eip712-transaction.test.ts b/packages/thirdweb/src/transaction/actions/zksync/send-eip712-transaction.test.ts index b5d1e33bb40..956d7307c73 100644 --- a/packages/thirdweb/src/transaction/actions/zksync/send-eip712-transaction.test.ts +++ b/packages/thirdweb/src/transaction/actions/zksync/send-eip712-transaction.test.ts @@ -30,7 +30,7 @@ describe("sendEip712Transaction", () => { expect(res.transactionHash.length).toBe(66); }); - it("should deploy a published autofactory contract on zksync", async () => { + it.skip("should deploy a published autofactory contract on zksync", async () => { const address = await deployPublishedContract({ client: TEST_CLIENT, chain: zkSyncSepolia, // TODO make zksync fork chain work