Skip to content

Contracts version 3.11.1 #2459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 14, 2024
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
6 changes: 6 additions & 0 deletions .changeset/plenty-bulldogs-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@thirdweb-dev/contracts-js": patch
"@thirdweb-dev/sdk": patch
---

Contracts version 3.11.1
19 changes: 9 additions & 10 deletions packages/contracts-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
"./dist/abis/IClaimCondition_V1.json": "./dist/abis/IClaimCondition_V1.json",
"./dist/abis/IERC1155.json": "./dist/abis/IERC1155.json",
"./dist/abis/IStaking1155.json": "./dist/abis/IStaking1155.json",
"./dist/abis/Math.json": "./dist/abis/Math.json",
"./dist/abis/IRoyaltyEngineV1.json": "./dist/abis/IRoyaltyEngineV1.json",
"./dist/abis/DelayedRevealStorage.json": "./dist/abis/DelayedRevealStorage.json",
"./dist/abis/ISignatureMintERC1155.json": "./dist/abis/ISignatureMintERC1155.json",
Expand All @@ -106,7 +105,6 @@
"./dist/abis/IERC1155Receiver.json": "./dist/abis/IERC1155Receiver.json",
"./dist/abis/IERC4906.json": "./dist/abis/IERC4906.json",
"./dist/abis/ERC2771ContextLogic.json": "./dist/abis/ERC2771ContextLogic.json",
"./dist/abis/TWBitMaps.json": "./dist/abis/TWBitMaps.json",
"./dist/abis/IERC2981.json": "./dist/abis/IERC2981.json",
"./dist/abis/ILazyMintWithTier.json": "./dist/abis/ILazyMintWithTier.json",
"./dist/abis/ERC721SignatureMint.json": "./dist/abis/ERC721SignatureMint.json",
Expand All @@ -129,11 +127,9 @@
"./dist/abis/AirdropERC721.json": "./dist/abis/AirdropERC721.json",
"./dist/abis/IDropSinglePhase.json": "./dist/abis/IDropSinglePhase.json",
"./dist/abis/zora_IERC721Drop.json": "./dist/abis/zora_IERC721Drop.json",
"./dist/abis/TWStringSet.json": "./dist/abis/TWStringSet.json",
"./dist/abis/InitStorage.json": "./dist/abis/InitStorage.json",
"./dist/abis/IDropSinglePhase1155.json": "./dist/abis/IDropSinglePhase1155.json",
"./dist/abis/AccountCore.json": "./dist/abis/AccountCore.json",
"./dist/abis/TWStorageSlot.json": "./dist/abis/TWStorageSlot.json",
"./dist/abis/TWMinimalFactory.json": "./dist/abis/TWMinimalFactory.json",
"./dist/abis/TWRegistry.json": "./dist/abis/TWRegistry.json",
"./dist/abis/OpenEditionERC721.json": "./dist/abis/OpenEditionERC721.json",
Expand All @@ -155,8 +151,8 @@
"./dist/abis/Proxy.json": "./dist/abis/Proxy.json",
"./dist/abis/ERC1967Proxy.json": "./dist/abis/ERC1967Proxy.json",
"./dist/abis/IRoyaltyPayments.json": "./dist/abis/IRoyaltyPayments.json",
"./dist/abis/IERC721AQueryable.json": "./dist/abis/IERC721AQueryable.json",
"./dist/abis/BaseRouter.json": "./dist/abis/BaseRouter.json",
"./dist/abis/TWAddress.json": "./dist/abis/TWAddress.json",
"./dist/abis/EvolvingNFT.json": "./dist/abis/EvolvingNFT.json",
"./dist/abis/ContractMetadata.json": "./dist/abis/ContractMetadata.json",
"./dist/abis/IOffers.json": "./dist/abis/IOffers.json",
Expand Down Expand Up @@ -200,7 +196,6 @@
"./dist/abis/IEntryPoint.json": "./dist/abis/IEntryPoint.json",
"./dist/abis/EnglishAuctionsStorage.json": "./dist/abis/EnglishAuctionsStorage.json",
"./dist/abis/IDropERC721_V3.json": "./dist/abis/IDropERC721_V3.json",
"./dist/abis/EIP712.json": "./dist/abis/EIP712.json",
"./dist/abis/DelayedReveal.json": "./dist/abis/DelayedReveal.json",
"./dist/abis/IAccount.json": "./dist/abis/IAccount.json",
"./dist/abis/OffersStorage.json": "./dist/abis/OffersStorage.json",
Expand All @@ -218,6 +213,7 @@
"./dist/abis/DynamicAccount.json": "./dist/abis/DynamicAccount.json",
"./dist/abis/LoyaltyCard.json": "./dist/abis/LoyaltyCard.json",
"./dist/abis/IClaimCondition.json": "./dist/abis/IClaimCondition.json",
"./dist/abis/StorageSlot.json": "./dist/abis/StorageSlot.json",
"./dist/abis/IStaking721.json": "./dist/abis/IStaking721.json",
"./dist/abis/IEnglishAuctions.json": "./dist/abis/IEnglishAuctions.json",
"./dist/abis/TWMultichainRegistry.json": "./dist/abis/TWMultichainRegistry.json",
Expand All @@ -234,7 +230,6 @@
"./dist/abis/IAirdropERC1155.json": "./dist/abis/IAirdropERC1155.json",
"./dist/abis/OffersLogic.json": "./dist/abis/OffersLogic.json",
"./dist/abis/Marketplace.json": "./dist/abis/Marketplace.json",
"./dist/abis/TWStrings.json": "./dist/abis/TWStrings.json",
"./dist/abis/DirectListingsStorage.json": "./dist/abis/DirectListingsStorage.json",
"./dist/abis/TieredDrop.json": "./dist/abis/TieredDrop.json",
"./dist/abis/ERC1155Receiver.json": "./dist/abis/ERC1155Receiver.json",
Expand All @@ -245,6 +240,7 @@
"./dist/abis/PermissionsInit.json": "./dist/abis/PermissionsInit.json",
"./dist/abis/Account.json": "./dist/abis/Account.json",
"./dist/abis/ERC20Base.json": "./dist/abis/ERC20Base.json",
"./dist/abis/Address.json": "./dist/abis/Address.json",
"./dist/abis/INFTStake.json": "./dist/abis/INFTStake.json",
"./dist/abis/BytesLib.json": "./dist/abis/BytesLib.json",
"./dist/abis/LazyMintStorage.json": "./dist/abis/LazyMintStorage.json",
Expand Down Expand Up @@ -309,6 +305,7 @@
"./dist/abis/ERC6551BytecodeLib.json": "./dist/abis/ERC6551BytecodeLib.json",
"./dist/abis/TWMultichainRegistryStorage.json": "./dist/abis/TWMultichainRegistryStorage.json",
"./dist/abis/ForwarderEOAOnly.json": "./dist/abis/ForwarderEOAOnly.json",
"./dist/abis/Strings.json": "./dist/abis/Strings.json",
"./dist/abis/TokenStore.json": "./dist/abis/TokenStore.json",
"./dist/abis/TokenBundle.json": "./dist/abis/TokenBundle.json",
"./dist/abis/IPaymaster.json": "./dist/abis/IPaymaster.json",
Expand Down Expand Up @@ -336,8 +333,10 @@
"./dist/abis/IMultiwrap.json": "./dist/abis/IMultiwrap.json",
"./dist/abis/BurnToClaimDrop721Storage.json": "./dist/abis/BurnToClaimDrop721Storage.json",
"./dist/abis/IBurnableERC721.json": "./dist/abis/IBurnableERC721.json",
"./dist/abis/OpenEditionERC721FlatFee.json": "./dist/abis/OpenEditionERC721FlatFee.json",
"./dist/abis/AccountPermissionsStorage.json": "./dist/abis/AccountPermissionsStorage.json",
"./dist/abis/FeeType.json": "./dist/abis/FeeType.json",
"./dist/abis/ERC721AQueryable.json": "./dist/abis/ERC721AQueryable.json",
"./dist/abis/Split.json": "./dist/abis/Split.json",
"./dist/abis/IERC20Metadata.json": "./dist/abis/IERC20Metadata.json",
"./dist/abis/EditionStake.json": "./dist/abis/EditionStake.json",
Expand All @@ -354,12 +353,11 @@
"./dist/abis/IPlatformFee.json": "./dist/abis/IPlatformFee.json",
"./dist/abis/Base64.json": "./dist/abis/Base64.json",
"./dist/abis/ProxyForUpgradeable.json": "./dist/abis/ProxyForUpgradeable.json",
"./dist/abis/Helpers.json": "./dist/abis/Helpers.json",
"./dist/abis/StringSet.json": "./dist/abis/StringSet.json",
"./dist/abis/VRFV2WrapperConsumerBase.json": "./dist/abis/VRFV2WrapperConsumerBase.json",
"./dist/abis/ITokenERC1155.json": "./dist/abis/ITokenERC1155.json",
"./dist/abis/BatchMintMetadata.json": "./dist/abis/BatchMintMetadata.json",
"./dist/abis/NFTMetadata.json": "./dist/abis/NFTMetadata.json",
"./dist/abis/ERC20Permit.json": "./dist/abis/ERC20Permit.json",
"./dist/abis/IAppURI.json": "./dist/abis/IAppURI.json",
"./dist/abis/ERC1155DelayedReveal.json": "./dist/abis/ERC1155DelayedReveal.json",
"./dist/abis/BatchMintMetadata_V1.json": "./dist/abis/BatchMintMetadata_V1.json",
Expand All @@ -386,6 +384,7 @@
"./dist/abis/Ownable.json": "./dist/abis/Ownable.json",
"./dist/abis/ERC721Base.json": "./dist/abis/ERC721Base.json",
"./dist/abis/OperatorFilterToggleStorage.json": "./dist/abis/OperatorFilterToggleStorage.json",
"./dist/abis/BitMaps.json": "./dist/abis/BitMaps.json",
"./dist/abis/NFTStake.json": "./dist/abis/NFTStake.json",
"./dist/abis/ContractMetadataStorage.json": "./dist/abis/ContractMetadataStorage.json",
"./dist/abis/DropERC20_V2.json": "./dist/abis/DropERC20_V2.json",
Expand Down Expand Up @@ -423,7 +422,7 @@
"license": "Apache-2.0",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/contracts-js",
"dependencies": {
"@thirdweb-dev/contracts": "3.10.3"
"@thirdweb-dev/contracts": "3.11.2"
},
"devDependencies": {
"@babel/preset-env": "^7.23.8",
Expand Down
11 changes: 8 additions & 3 deletions packages/sdk/src/evm/core/classes/drop-claim-conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ export class DropClaimConditions<
} catch (err: any) {
if (
includesErrorMessage(err, "!CONDITION") ||
includesErrorMessage(err, "no active mint condition")
includesErrorMessage(err, "no active mint condition") ||
includesErrorMessage(err, "DropNoActiveCondition")
) {
reasons.push(ClaimEligibility.NoClaimConditionSet);
return reasons;
Expand Down Expand Up @@ -386,20 +387,24 @@ export class DropClaimConditions<
} catch (e: any) {
console.warn(
"Merkle proof verification failed:",
"reason" in e ? e.reason : e,
"reason" in e ? e.reason || e.errorName : e,
);
const reason = (e as any).reason;
const reason = (e as any).reason || (e as any).errorName;
switch (reason) {
case "!Qty":
case "DropClaimExceedLimit":
reasons.push(ClaimEligibility.OverMaxClaimablePerWallet);
break;
case "!PriceOrCurrency":
case "DropClaimInvalidTokenPrice":
reasons.push(ClaimEligibility.WrongPriceOrCurrency);
break;
case "!MaxSupply":
case "DropClaimExceedMaxSupply":
reasons.push(ClaimEligibility.NotEnoughSupply);
break;
case "cant claim yet":
case "DropClaimNotStarted":
reasons.push(ClaimEligibility.ClaimPhaseNotStarted);
break;
default: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ export class DropErc1155ClaimConditions<
} catch (err: any) {
if (
includesErrorMessage(err, "!CONDITION") ||
includesErrorMessage(err, "no active mint condition")
includesErrorMessage(err, "no active mint condition") ||
includesErrorMessage(err, "DropNoActiveCondition")
) {
reasons.push(ClaimEligibility.NoClaimConditionSet);
return reasons;
Expand Down Expand Up @@ -374,20 +375,24 @@ export class DropErc1155ClaimConditions<
} catch (e: any) {
console.warn(
"Merkle proof verification failed:",
"reason" in e ? e.reason : e,
"reason" in e ? e.reason || e.errorName : e,
);
const reason = (e as any).reason;
const reason = (e as any).reason || (e as any).errorName;
switch (reason) {
case "!Qty":
case "DropClaimExceedLimit":
reasons.push(ClaimEligibility.OverMaxClaimablePerWallet);
break;
case "!PriceOrCurrency":
case "DropClaimInvalidTokenPrice":
reasons.push(ClaimEligibility.WrongPriceOrCurrency);
break;
case "!MaxSupply":
case "DropClaimExceedMaxSupply":
reasons.push(ClaimEligibility.NotEnoughSupply);
break;
case "cant claim yet":
case "DropClaimNotStarted":
reasons.push(ClaimEligibility.ClaimPhaseNotStarted);
break;
default: {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/test/evm/account.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe("Accounts with account factory", function () {
AccountFactory__factory.abi,
AccountFactory__factory.bytecode,
adminWallet,
[entrypoint.address],
[adminWallet.address, entrypoint.address],
);
accountFactory = (await sdk.getContract(factoryAddress)).accountFactory;
});
Expand Down
3 changes: 1 addition & 2 deletions packages/sdk/test/evm/before-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export const mochaHooks = {
)
.connect(signer)
.deploy(
signer.address,
trustedForwarderAddress,
mockPublisher.address,
)) as ContractPublisher; // TODO needs MockPublisher here
Expand All @@ -219,13 +220,11 @@ export const mochaHooks = {
const addr = getNativeTokenByChainId(ChainId.Hardhat).wrapped.address;
return await deployContractAndUploadMetadata(abi, bytecode, signer, [
addr,
trustedForwarderAddress,
]);
default:
return await deployContractAndUploadMetadata(abi, bytecode, signer);
}
}

for (const contractType in CONTRACTS_MAP) {
if (contractType === "custom" || contractType === "marketplace-v3") {
continue;
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/test/evm/custom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ describe("Custom Contracts", async () => {
it("should not detect feature if missing from ABI", async () => {
const address = await sdk.deployer.deployVote({
name: "My Vote",
voting_token_address: adminWallet.address,
voting_token_address: tokenContractAddress,
});
const c = await sdk.getContractFromAbi(address, VoteERC20__factory.abi);
invariant(c, "Contract undefined");
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/test/evm/edition-drop-v4.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ describe("Edition Drop Contract (V4)", async () => {
await sdk.updateSignerOrProvider(w2);
await bdContract.claim(0, 2);
} catch (e) {
expectError(e, "!Qty");
expectError(e, "DropClaimExceedLimit");
}
});

Expand Down Expand Up @@ -695,7 +695,7 @@ describe("Edition Drop Contract (V4)", async () => {
try {
await bdContract.claim("1", 2);
} catch (e) {
expectError(e, "!MaxSupply");
expectError(e, "DropClaimExceedMaxSupply");
}
});

Expand Down
21 changes: 11 additions & 10 deletions packages/sdk/test/evm/nft-drop-v4.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe("NFT Drop Contract (v4)", async () => {
await dropContract.claim(2);
expect.fail("should not be able to claim 2 - maxSupply");
} catch (e) {
expectError(e, "!MaxSupply");
expectError(e, "DropClaimExceedMaxSupply");
}
await dropContract.claim(1);
// claiming with max per wallet
Expand All @@ -84,7 +84,7 @@ describe("NFT Drop Contract (v4)", async () => {
await dropContract.claim(2);
expect.fail("should not be able to claim 2 - maxClaimablePerWallet");
} catch (e) {
expectError(e, "!Qty");
expectError(e, "DropClaimExceedLimit");
}
await dropContract.claim(1);
expect((await dropContract.totalClaimedSupply()).toString()).eq("3");
Expand Down Expand Up @@ -127,7 +127,7 @@ describe("NFT Drop Contract (v4)", async () => {
await dropContract.claim(1);
expect.fail("should not be able to claim - not in allowlist");
} catch (e) {
expectError(e, "!Qty");
expectError(e, "DropClaimExceedLimit");
}
sdk.updateSignerOrProvider(adminWallet);
await dropContract.claim(1);
Expand All @@ -144,7 +144,7 @@ describe("NFT Drop Contract (v4)", async () => {
await dropContract.claim(2);
expect.fail("should not be able to claim - maxClaimableSupply");
} catch (e) {
expectError(e, "!MaxSupply");
expectError(e, "DropClaimExceedMaxSupply");
}
await dropContract.claim(1);
// claiming with max per wallet
Expand All @@ -161,7 +161,7 @@ describe("NFT Drop Contract (v4)", async () => {
await dropContract.claim(2);
expect.fail("should not be able to claim - maxClaimablePerWallet");
} catch (e) {
expectError(e, "!Qty");
expectError(e, "DropClaimExceedLimit");
}
await dropContract.claim(1);
// claiming with max per wallet in snapshot
Expand All @@ -178,14 +178,14 @@ describe("NFT Drop Contract (v4)", async () => {
await dropContract.claim(2);
expect.fail("should not be able to claim - proof maxClaimable");
} catch (e) {
expectError(e, "!Qty");
expectError(e, "DropClaimExceedLimit");
}
await dropContract.claim(1);
try {
await dropContract.claim(1);
expect.fail("should not be able to claim - proof used");
} catch (e) {
expectError(e, "!Qty");
expectError(e, "DropClaimExceedLimit");
}
});

Expand Down Expand Up @@ -235,7 +235,7 @@ describe("NFT Drop Contract (v4)", async () => {
await dropContract.claim(1);
assert.fail("Should have thrown");
} catch (e) {
expectError(e, "!Qty");
expectError(e, "DropClaimExceedLimit");
}
});

Expand Down Expand Up @@ -538,7 +538,7 @@ describe("NFT Drop Contract (v4)", async () => {
await dropContract.claim(1);
assert.fail("should have thrown");
} catch (err: any) {
expectError(err, "!Qty");
expectError(err, "DropClaimExceedLimit");
}
});

Expand Down Expand Up @@ -590,7 +590,7 @@ describe("NFT Drop Contract (v4)", async () => {
await sdk.updateSignerOrProvider(w2);
await dropContract.claim(2);
} catch (e) {
expectError(e, "!Qty");
expectError(e, "DropClaimExceedLimit");
}
});

Expand Down Expand Up @@ -758,6 +758,7 @@ describe("NFT Drop Contract (v4)", async () => {

expect(reasons).to.include(ClaimEligibility.NoClaimConditionSet);
assert.lengthOf(reasons, 1);
console.log(reasons);
const canClaim = await dropContract.claimConditions.canClaim(
1,
w1.address,
Expand Down
10 changes: 5 additions & 5 deletions packages/sdk/test/evm/signature-drop-v5.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,8 @@ describe("Signature drop tests (v5)", async () => {
i % 3 === 0
? w.address.toLowerCase()
: i % 3 === 1
? w.address.toUpperCase().replace("0X", "0x")
: w.address,
? w.address.toUpperCase().replace("0X", "0x")
: w.address,
)
.map((a) => ({
address: a,
Expand Down Expand Up @@ -597,7 +597,7 @@ describe("Signature drop tests (v5)", async () => {
await signatureDropContract.claim(1);
} catch (e) {
// expected
expectError(e, "!Qty");
expectError(e, "DropClaimExceedLimit");
}
});

Expand Down Expand Up @@ -693,7 +693,7 @@ describe("Signature drop tests (v5)", async () => {
try {
await signatureDropContract.claim(1);
} catch (err: any) {
expectError(err, "!Qty");
expectError(err, "DropClaimExceedLimit");
}
});

Expand Down Expand Up @@ -728,7 +728,7 @@ describe("Signature drop tests (v5)", async () => {
await sdk.updateSignerOrProvider(w2);
await signatureDropContract.claim(2);
} catch (e) {
expectError(e, "!Qty");
expectError(e, "DropClaimExceedLimit");
}
});

Expand Down
Loading