Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rich-steaks-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Handle zk sync direct deploys in `deployContract`
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[
"function encodeBytesOnInstall() pure returns (bytes)",
"function getAllMetadataBatches() view returns ((uint256 startTokenIdInclusive, uint256 endTokenIdInclusive, string baseURI)[])",
"function getBatchIndex(uint256 _tokenId) view returns (uint256)",
"function getMetadataBatch(uint256 _batchIndex) view returns ((uint256 startTokenIdInclusive, uint256 endTokenIdInclusive, string baseURI))",
"function getModuleConfig() pure returns ((bool registerInstallationCallback, bytes4[] requiredInterfaces, bytes4[] supportedInterfaces, (bytes4 selector)[] callbackFunctions, (bytes4 selector, uint256 permissionBits)[] fallbackFunctions) config)",
"function setBaseURI(uint256 _batchIndex, string _baseURI)",
"function uploadMetadata(uint256 _amount, string _baseURI)",
"event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId)"
"event BatchMetadataUpdate(uint256 startTokenIdIncluside, uint256 endTokenIdInclusive, string baseURI)"
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[
"function encodeBytesOnInstall() pure returns (bytes)",
"function getAllMetadataBatches() view returns ((uint256 startTokenIdInclusive, uint256 endTokenIdInclusive, string baseURI)[])",
"function getBatchIndex(uint256 _tokenId) view returns (uint256)",
"function getMetadataBatch(uint256 _batchIndex) view returns ((uint256 startTokenIdInclusive, uint256 endTokenIdInclusive, string baseURI))",
"function getModuleConfig() pure returns ((bool registerInstallationCallback, bytes4[] requiredInterfaces, bytes4[] supportedInterfaces, (bytes4 selector)[] callbackFunctions, (bytes4 selector, uint256 permissionBits)[] fallbackFunctions) config)",
"function setBaseURI(uint256 _batchIndex, string _baseURI)",
"function uploadMetadata(uint256 _amount, string _baseURI)",
"event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId)"
"event BatchMetadataUpdate(uint256 startTokenIdIncluside, uint256 endTokenIdInclusive, string baseURI)"
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
"function encodeBytesOnInstall() pure returns (bytes)",
"function encodeBytesOnInstall(uint256 startTokenId) pure returns (bytes)",
"function getModuleConfig() pure returns ((bool registerInstallationCallback, bytes4[] requiredInterfaces, bytes4[] supportedInterfaces, (bytes4 selector)[] callbackFunctions, (bytes4 selector, uint256 permissionBits)[] fallbackFunctions) config)",
"function getNextTokenId() view returns (uint256)",
"error SequentialTokenIdInvalidTokenId()",
"error UpdateTokenIdCallbackERC1155NotImplemented()"
"function updateTokenIdERC1155(uint256 _tokenId) payable returns (uint256)"
]
14 changes: 14 additions & 0 deletions packages/thirdweb/src/contract/deployment/deploy-with-abi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import { normalizeFunctionParams } from "../../utils/abi/normalizeFunctionParams.js";
import { computeDeploymentAddress } from "../../utils/any-evm/compute-deployment-address.js";
import { computeDeploymentInfoFromBytecode } from "../../utils/any-evm/compute-published-contract-deploy-info.js";
import { isZkSyncChain } from "../../utils/any-evm/zksync/isZkSyncChain.js";
import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js";
import { ensureBytecodePrefix } from "../../utils/bytecode/prefix.js";
import { concatHex } from "../../utils/encoding/helpers/concat-hex.js";
Expand All @@ -13,6 +14,7 @@
import type { ClientAndChain } from "../../utils/types.js";
import type { Account } from "../../wallets/interfaces/wallet.js";
import { getContract } from "../contract.js";
import { zkDeployContract } from "./zksync/zkDeployContract.js";

/**
* @extension DEPLOY
Expand Down Expand Up @@ -121,6 +123,18 @@
salt?: string;
},
) {
if (await isZkSyncChain(options.chain)) {
return zkDeployContract({
account: options.account,
client: options.client,
chain: options.chain,
bytecode: options.bytecode,
abi: options.abi,
params: options.constructorParams,
salt: options.salt,
});
}

Check warning on line 136 in packages/thirdweb/src/contract/deployment/deploy-with-abi.ts

View check run for this annotation

Codecov / codecov/patch

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

Added lines #L127 - L136 were not covered by tests

if (options.salt !== undefined) {
// Deploy with CREATE2 if salt is provided
const info = await computeDeploymentInfoFromBytecode(options);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { describe, expect, it } from "vitest";

import { TEST_CLIENT } from "../../../test/src/test-clients.js";
import { resolveAvatar } from "./resolve-avatar.js";

Expand All @@ -22,9 +21,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("ENS:resolve-avatar", () => {
client: TEST_CLIENT,
name: "vitalik.eth",
});
expect(avatarUri?.split("/ipfs/")[1]).toMatchInlineSnapshot(
`"QmSP4nq9fnN9dAiCj42ug9Wa79rqmQerZXZch82VqpiH7U/image.gif"`,
);
expect(avatarUri).toMatchInlineSnapshot(`"https://euc.li/vitalik.eth"`);
});

it("resolves name without avatar record to null", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ describe.runIf(process.env.TW_SECRET_KEY)("ModularTokenERC1155", () => {
primarySaleRecipient: TEST_ACCOUNT_A.address,
}),
BatchMetadataERC1155.module(),
SequentialTokenIdERC1155.module(),
SequentialTokenIdERC1155.module({
startTokenId: 0n,
}),
],
});
contract = getContract({
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading