Skip to content

Commit df338f5

Browse files
authored
feat(extensions/erc20): add claimTo and claim condition extensions (#2771)
1 parent ea0dedc commit df338f5

File tree

337 files changed

+1088
-337
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

337 files changed

+1088
-337
lines changed

.changeset/smooth-points-scream.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"thirdweb": minor
3+
---
4+
5+
Added ERC20 extensions:
6+
7+
- claimTo with allowlist support
8+
- setClaimConditions
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[
2-
"event ClaimConditionsUpdated((uint256 startTimestamp, uint256 maxClaimableSupply, uint256 supplyClaimed, uint256 quantityLimitPerWallet, uint256 waitTimeInSecondsBetweenClaims, bytes32 merkleRoot, uint256 pricePerToken, address currency)[] claimConditions)",
2+
"event ClaimConditionsUpdated((uint256 startTimestamp, uint256 maxClaimableSupply, uint256 supplyClaimed, uint256 quantityLimitPerWallet, bytes32 merkleRoot, uint256 pricePerToken, address currency, string metadata)[] claimConditions, bool resetEligibility)",
33
"event TokensClaimed(uint256 indexed claimConditionIndex, address indexed claimer, address indexed receiver, uint256 quantityClaimed)",
4-
"function claim(address receiver, uint256 quantity, address currency, uint256 pricePerToken, (bytes32[] proof, uint256 maxQuantityInAllowlist) allowlistProof, bytes data) payable",
5-
"function setClaimConditions((uint256 startTimestamp, uint256 maxClaimableSupply, uint256 supplyClaimed, uint256 quantityLimitPerWallet, uint256 waitTimeInSecondsBetweenClaims, bytes32 merkleRoot, uint256 pricePerToken, address currency)[] phases, bool resetClaimEligibility)"
4+
"function claim(address receiver, uint256 quantity, address currency, uint256 pricePerToken, (bytes32[] proof, uint256 quantityLimitPerWallet, uint256 pricePerToken, address currency) allowlistProof, bytes data) payable",
5+
"function setClaimConditions((uint256 startTimestamp, uint256 maxClaimableSupply, uint256 supplyClaimed, uint256 quantityLimitPerWallet, uint256 waitTimeInSecondsBetweenClaims, bytes32 merkleRoot, uint256 pricePerToken, address currency)[] phases, bool resetClaimEligibility)",
6+
"function getClaimConditionById(uint256 _conditionId) view returns ((uint256 startTimestamp, uint256 maxClaimableSupply, uint256 supplyClaimed, uint256 quantityLimitPerWallet, bytes32 merkleRoot, uint256 pricePerToken, address currency, string metadata) condition)",
7+
"function getActiveClaimConditionId() view returns (uint256)"
68
]

packages/thirdweb/scripts/generate/generate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ const FN_OUTPUTS = ${JSON.stringify(preparedMethod[2], null, 2)} as const;
151151
* Checks if the \`${f.name}\` method is supported by the given contract.
152152
* @param contract The ThirdwebContract.
153153
* @returns A promise that resolves to a boolean indicating if the \`${f.name}\` method is supported.
154-
* @extension ERC721
154+
* @extension ${extensionName.toUpperCase()}
155155
* @example
156156
* \`\`\`ts
157157
* import { is${uppercaseFirstLetter(
@@ -326,7 +326,7 @@ const FN_OUTPUTS = ${JSON.stringify(preparedMethod[2], null, 2)} as const;
326326
* Checks if the \`${f.name}\` method is supported by the given contract.
327327
* @param contract The ThirdwebContract.
328328
* @returns A promise that resolves to a boolean indicating if the \`${f.name}\` method is supported.
329-
* @extension ERC721
329+
* @extension ${extensionName.toUpperCase()}
330330
* @example
331331
* \`\`\`ts
332332
* import { is${uppercaseFirstLetter(

packages/thirdweb/src/exports/extensions/erc20.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,36 @@ export {
4444
burnFrom,
4545
type BurnFromParams,
4646
} from "../../extensions/erc20/__generated__/IBurnableERC20/write/burnFrom.js";
47+
48+
// EVENTS
49+
export {
50+
transferEvent,
51+
type TransferEventFilters,
52+
} from "../../extensions/erc20/__generated__/IERC20/events/Transfer.js";
53+
export {
54+
approvalEvent,
55+
type ApprovalEventFilters,
56+
} from "../../extensions/erc20/__generated__/IERC20/events/Approval.js";
57+
export {
58+
tokensMintedEvent,
59+
type TokensMintedEventFilters,
60+
} from "../../extensions/erc20/__generated__/IMintableERC20/events/TokensMinted.js";
61+
export {
62+
tokensClaimedEvent,
63+
type TokensClaimedEventFilters,
64+
} from "../../extensions/erc20/__generated__/IDropERC20/events/TokensClaimed.js";
65+
export { claimConditionsUpdatedEvent } from "../../extensions/erc20/__generated__/IDropERC20/events/ClaimConditionsUpdated.js";
66+
67+
/**
68+
* DROPS extension for ERC20
69+
*/
70+
export { getClaimConditionById } from "../../extensions/erc20/__generated__/IDropERC20/read/getClaimConditionById.js";
71+
export { getActiveClaimCondition } from "../../extensions/erc20/drops/read/getActiveClaimCondition.js";
72+
export {
73+
claimTo,
74+
type ClaimToParams,
75+
} from "../../extensions/erc20/drops/write/claimTo.js";
76+
export {
77+
setClaimConditions,
78+
type SetClaimConditionsParams,
79+
} from "../../extensions/erc20/drops/write/setClaimConditions.js";

packages/thirdweb/src/extensions/common/__generated__/IClaimConditionsSinglePhase/write/setClaimConditions.ts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/thirdweb/src/extensions/common/__generated__/IContractMetadata/read/contractURI.ts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/thirdweb/src/extensions/common/__generated__/IContractMetadata/read/name.ts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/thirdweb/src/extensions/common/__generated__/IContractMetadata/read/symbol.ts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/thirdweb/src/extensions/common/__generated__/IContractMetadata/write/setContractURI.ts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/thirdweb/src/extensions/common/__generated__/IMulticall/write/multicall.ts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)