thirdweb 5.50.1 → 5.51.0-nightly-f9c351c22d9c869770dad13332f9c23d8cb84ed7-20240905000555
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/exports/extensions/erc721.js +25 -1
- package/dist/cjs/exports/extensions/erc721.js.map +1 -1
- package/dist/cjs/extensions/erc721/__generated__/IDrop/read/claimCondition.js +76 -0
- package/dist/cjs/extensions/erc721/__generated__/IDrop/read/claimCondition.js.map +1 -0
- package/dist/cjs/extensions/erc721/drops/read/getActiveClaimCondition.js +28 -6
- package/dist/cjs/extensions/erc721/drops/read/getActiveClaimCondition.js.map +1 -1
- package/dist/cjs/extensions/erc721/drops/read/getClaimConditions.js +73 -0
- package/dist/cjs/extensions/erc721/drops/read/getClaimConditions.js.map +1 -0
- package/dist/cjs/extensions/erc721/drops/write/claimTo.js +19 -0
- package/dist/cjs/extensions/erc721/drops/write/claimTo.js.map +1 -1
- package/dist/cjs/extensions/erc721/drops/write/resetClaimEligibility.js +56 -0
- package/dist/cjs/extensions/erc721/drops/write/resetClaimEligibility.js.map +1 -0
- package/dist/cjs/extensions/erc721/drops/write/setClaimConditions.js +24 -0
- package/dist/cjs/extensions/erc721/drops/write/setClaimConditions.js.map +1 -1
- package/dist/cjs/extensions/erc721/write/lazyMint.js +20 -2
- package/dist/cjs/extensions/erc721/write/lazyMint.js.map +1 -1
- package/dist/cjs/utils/extensions/drops/get-claim-params.js +3 -3
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/exports/extensions/erc721.js +17 -6
- package/dist/esm/exports/extensions/erc721.js.map +1 -1
- package/dist/esm/extensions/erc721/__generated__/IDrop/read/claimCondition.js +70 -0
- package/dist/esm/extensions/erc721/__generated__/IDrop/read/claimCondition.js.map +1 -0
- package/dist/esm/extensions/erc721/drops/read/getActiveClaimCondition.js +27 -6
- package/dist/esm/extensions/erc721/drops/read/getActiveClaimCondition.js.map +1 -1
- package/dist/esm/extensions/erc721/drops/read/getClaimConditions.js +69 -0
- package/dist/esm/extensions/erc721/drops/read/getClaimConditions.js.map +1 -0
- package/dist/esm/extensions/erc721/drops/write/claimTo.js +19 -1
- package/dist/esm/extensions/erc721/drops/write/claimTo.js.map +1 -1
- package/dist/esm/extensions/erc721/drops/write/resetClaimEligibility.js +52 -0
- package/dist/esm/extensions/erc721/drops/write/resetClaimEligibility.js.map +1 -0
- package/dist/esm/extensions/erc721/drops/write/setClaimConditions.js +24 -1
- package/dist/esm/extensions/erc721/drops/write/setClaimConditions.js.map +1 -1
- package/dist/esm/extensions/erc721/write/lazyMint.js +20 -3
- package/dist/esm/extensions/erc721/write/lazyMint.js.map +1 -1
- package/dist/esm/utils/extensions/drops/get-claim-params.js +4 -4
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/exports/extensions/erc721.d.ts +9 -6
- package/dist/types/exports/extensions/erc721.d.ts.map +1 -1
- package/dist/types/extensions/erc721/__generated__/IDrop/read/claimCondition.d.ts +45 -0
- package/dist/types/extensions/erc721/__generated__/IDrop/read/claimCondition.d.ts.map +1 -0
- package/dist/types/extensions/erc721/drops/read/getActiveClaimCondition.d.ts +13 -0
- package/dist/types/extensions/erc721/drops/read/getActiveClaimCondition.d.ts.map +1 -1
- package/dist/types/extensions/erc721/drops/read/getClaimConditions.d.ts +29 -0
- package/dist/types/extensions/erc721/drops/read/getClaimConditions.d.ts.map +1 -0
- package/dist/types/extensions/erc721/drops/write/claimTo.d.ts +13 -0
- package/dist/types/extensions/erc721/drops/write/claimTo.d.ts.map +1 -1
- package/dist/types/extensions/erc721/drops/write/resetClaimEligibility.d.ts +33 -0
- package/dist/types/extensions/erc721/drops/write/resetClaimEligibility.d.ts.map +1 -0
- package/dist/types/extensions/erc721/drops/write/setClaimConditions.d.ts +13 -0
- package/dist/types/extensions/erc721/drops/write/setClaimConditions.d.ts.map +1 -1
- package/dist/types/extensions/erc721/write/lazyMint.d.ts +13 -0
- package/dist/types/extensions/erc721/write/lazyMint.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/exports/extensions/erc721.ts +36 -3
- package/src/extensions/erc721/__generated__/IDrop/read/claimCondition.ts +76 -0
- package/src/extensions/erc721/drop721.test.ts +102 -2
- package/src/extensions/erc721/drops/read/getActiveClaimCondition.ts +32 -6
- package/src/extensions/erc721/drops/read/getClaimConditions.ts +93 -0
- package/src/extensions/erc721/drops/write/claimTo.ts +25 -1
- package/src/extensions/erc721/drops/write/resetClaimEligibility.ts +70 -0
- package/src/extensions/erc721/drops/write/setClaimConditions.ts +30 -1
- package/src/extensions/erc721/write/lazyMint.ts +26 -3
- package/src/utils/extensions/drops/get-claim-params.ts +4 -4
- package/src/version.ts +1 -1
@@ -1,7 +1,13 @@
|
|
1
1
|
import type { BaseTransactionOptions } from "../../../../transaction/types.js";
|
2
2
|
import { getMulticallSetClaimConditionTransactions } from "../../../../utils/extensions/drops/get-multicall-set-claim-claim-conditon-transactions.js";
|
3
3
|
import type { ClaimConditionsInput } from "../../../../utils/extensions/drops/types.js";
|
4
|
-
import {
|
4
|
+
import { isSetContractURISupported } from "../../../common/__generated__/IContractMetadata/write/setContractURI.js";
|
5
|
+
import {
|
6
|
+
isMulticallSupported,
|
7
|
+
multicall,
|
8
|
+
} from "../../../common/__generated__/IMulticall/write/multicall.js";
|
9
|
+
import { isGetContractMetadataSupported } from "../../../common/read/getContractMetadata.js";
|
10
|
+
import { isSetClaimConditionsSupported as isSetClaimConditionsSupportedGenerated } from "../../__generated__/IDrop/write/setClaimConditions.js";
|
5
11
|
|
6
12
|
/**
|
7
13
|
* @extension ERC721
|
@@ -54,3 +60,26 @@ export function setClaimConditions(
|
|
54
60
|
},
|
55
61
|
});
|
56
62
|
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Checks if the `setClaimConditions` method is supported by the given contract.
|
66
|
+
* @param availableSelectors An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors.
|
67
|
+
* @returns A boolean indicating if the `setClaimConditions` method is supported.
|
68
|
+
* @extension ERC721
|
69
|
+
* @example
|
70
|
+
* ```ts
|
71
|
+
* import { isSetClaimConditionsSupported } from "thirdweb/extensions/erc721";
|
72
|
+
*
|
73
|
+
* const supported = isSetClaimConditionsSupported(["0x..."]);
|
74
|
+
* ```
|
75
|
+
*/
|
76
|
+
export function isSetClaimConditionsSupported(availableSelectors: string[]) {
|
77
|
+
return (
|
78
|
+
isMulticallSupported(availableSelectors) &&
|
79
|
+
// needed for setting contract metadata
|
80
|
+
isGetContractMetadataSupported(availableSelectors) &&
|
81
|
+
isSetContractURISupported(availableSelectors) &&
|
82
|
+
// needs to actually be able to set the claim Conditions
|
83
|
+
isSetClaimConditionsSupportedGenerated(availableSelectors)
|
84
|
+
);
|
85
|
+
}
|
@@ -5,8 +5,11 @@ import {
|
|
5
5
|
uploadOrExtractURIs,
|
6
6
|
} from "../../../utils/ipfs.js";
|
7
7
|
import type { Prettify } from "../../../utils/type-utils.js";
|
8
|
-
import {
|
9
|
-
|
8
|
+
import {
|
9
|
+
isNextTokenIdToMintSupported,
|
10
|
+
nextTokenIdToMint,
|
11
|
+
} from "../__generated__/IERC721Enumerable/read/nextTokenIdToMint.js";
|
12
|
+
import * as LazyMint from "../__generated__/ILazyMint/write/lazyMint.js";
|
10
13
|
|
11
14
|
/**
|
12
15
|
* Represents the input data for creating an NFT (Non-Fungible Token).
|
@@ -57,7 +60,7 @@ export type LazyMintParams = {
|
|
57
60
|
* ```
|
58
61
|
*/
|
59
62
|
export function lazyMint(options: BaseTransactionOptions<LazyMintParams>) {
|
60
|
-
return
|
63
|
+
return LazyMint.lazyMint({
|
61
64
|
contract: options.contract,
|
62
65
|
asyncParams: async () => {
|
63
66
|
const startFileNumber = await nextTokenIdToMint({
|
@@ -81,3 +84,23 @@ export function lazyMint(options: BaseTransactionOptions<LazyMintParams>) {
|
|
81
84
|
},
|
82
85
|
});
|
83
86
|
}
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Checks if the `lazyMint` method is supported by the given contract.
|
90
|
+
* @param availableSelectors An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors.
|
91
|
+
* @returns A boolean indicating if the `lazyMint` method is supported.
|
92
|
+
* @extension ERC721
|
93
|
+
* @example
|
94
|
+
* ```ts
|
95
|
+
* import { isLazyMintSupported } from "thirdweb/extensions/erc721";
|
96
|
+
*
|
97
|
+
* const supported = isLazyMintSupported(["0x..."]);
|
98
|
+
* ```
|
99
|
+
*/
|
100
|
+
export function isLazyMintSupported(availableSelectors: string[]) {
|
101
|
+
return (
|
102
|
+
LazyMint.isLazyMintSupported(availableSelectors) &&
|
103
|
+
// required because we use it in the lazyMint function
|
104
|
+
isNextTokenIdToMintSupported(availableSelectors)
|
105
|
+
);
|
106
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { maxUint256, padHex } from "viem";
|
2
2
|
import {
|
3
|
-
|
3
|
+
ZERO_ADDRESS,
|
4
4
|
isNativeTokenAddress,
|
5
5
|
} from "../../../constants/addresses.js";
|
6
6
|
import type { ThirdwebContract } from "../../../contract/contract.js";
|
@@ -85,7 +85,7 @@ export async function getClaimParams(options: GetClaimParamsOptions) {
|
|
85
85
|
// early exit if no merkle root is set
|
86
86
|
if (!cc.merkleRoot || cc.merkleRoot === padHex("0x", { size: 32 })) {
|
87
87
|
return {
|
88
|
-
currency:
|
88
|
+
currency: ZERO_ADDRESS,
|
89
89
|
proof: [],
|
90
90
|
quantityLimitPerWallet: 0n,
|
91
91
|
pricePerToken: maxUint256,
|
@@ -105,7 +105,7 @@ export async function getClaimParams(options: GetClaimParamsOptions) {
|
|
105
105
|
// if no proof is found, we'll try the empty proof
|
106
106
|
if (!allowListProof) {
|
107
107
|
return {
|
108
|
-
currency:
|
108
|
+
currency: ZERO_ADDRESS,
|
109
109
|
proof: [],
|
110
110
|
quantityLimitPerWallet: 0n,
|
111
111
|
pricePerToken: maxUint256,
|
@@ -118,7 +118,7 @@ export async function getClaimParams(options: GetClaimParamsOptions) {
|
|
118
118
|
// currency and price need to match the allowlist proof if set
|
119
119
|
// if default values in the allowlist proof, fallback to the claim condition
|
120
120
|
const currency =
|
121
|
-
allowlistProof.currency && allowlistProof.currency !==
|
121
|
+
allowlistProof.currency && allowlistProof.currency !== ZERO_ADDRESS
|
122
122
|
? allowlistProof.currency
|
123
123
|
: cc.currency;
|
124
124
|
const pricePerToken =
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.
|
1
|
+
export const version = "5.51.0-nightly-f9c351c22d9c869770dad13332f9c23d8cb84ed7-20240905000555";
|