thirdweb 5.93.14 → 5.93.15-nightly-386138e4f06b14aac2fea2ab4a7a0497932f74a7-20250406000354
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/erc1155.js +4 -2
- package/dist/cjs/exports/extensions/erc1155.js.map +1 -1
- package/dist/cjs/extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.js +31 -37
- package/dist/cjs/extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.js.map +1 -1
- package/dist/cjs/extensions/erc1155/drops/read/getActiveClaimCondition.js +30 -7
- package/dist/cjs/extensions/erc1155/drops/read/getActiveClaimCondition.js.map +1 -1
- package/dist/cjs/extensions/erc1155/drops/read/getClaimConditions.js +32 -14
- package/dist/cjs/extensions/erc1155/drops/read/getClaimConditions.js.map +1 -1
- package/dist/cjs/extensions/erc1155/drops/write/resetClaimEligibility.js +31 -2
- package/dist/cjs/extensions/erc1155/drops/write/resetClaimEligibility.js.map +1 -1
- package/dist/cjs/utils/extensions/drops/get-claim-params.js +0 -7
- package/dist/cjs/utils/extensions/drops/get-claim-params.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/exports/extensions/erc1155.js +1 -0
- package/dist/esm/exports/extensions/erc1155.js.map +1 -1
- package/dist/esm/extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.js +31 -37
- package/dist/esm/extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.js.map +1 -1
- package/dist/esm/extensions/erc1155/drops/read/getActiveClaimCondition.js +30 -7
- package/dist/esm/extensions/erc1155/drops/read/getActiveClaimCondition.js.map +1 -1
- package/dist/esm/extensions/erc1155/drops/read/getClaimConditions.js +32 -14
- package/dist/esm/extensions/erc1155/drops/read/getClaimConditions.js.map +1 -1
- package/dist/esm/extensions/erc1155/drops/write/resetClaimEligibility.js +33 -4
- package/dist/esm/extensions/erc1155/drops/write/resetClaimEligibility.js.map +1 -1
- package/dist/esm/utils/extensions/drops/get-claim-params.js +0 -7
- package/dist/esm/utils/extensions/drops/get-claim-params.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/exports/extensions/erc1155.d.ts +1 -0
- package/dist/types/exports/extensions/erc1155.d.ts.map +1 -1
- package/dist/types/extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.d.ts +2 -20
- package/dist/types/extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.d.ts.map +1 -1
- package/dist/types/extensions/erc1155/drops/read/getActiveClaimCondition.d.ts.map +1 -1
- package/dist/types/extensions/erc1155/drops/read/getClaimConditions.d.ts.map +1 -1
- package/dist/types/extensions/erc1155/drops/write/resetClaimEligibility.d.ts +3 -1
- package/dist/types/extensions/erc1155/drops/write/resetClaimEligibility.d.ts.map +1 -1
- package/dist/types/utils/extensions/drops/get-claim-params.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/erc1155.ts +1 -0
- package/src/extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.ts +31 -37
- package/src/extensions/erc1155/customDrop1155.test.ts +86 -0
- package/src/extensions/erc1155/drops/read/getActiveClaimCondition.ts +42 -6
- package/src/extensions/erc1155/drops/read/getClaimConditions.ts +49 -18
- package/src/extensions/erc1155/drops/write/resetClaimEligibility.ts +54 -5
- package/src/utils/extensions/drops/get-claim-params.ts +0 -9
- package/src/version.ts +1 -1
@@ -2,6 +2,7 @@ import type { BaseTransactionOptions } from "../../../../transaction/types.js";
|
|
2
2
|
import type { ClaimCondition } from "../../../../utils/extensions/drops/types.js";
|
3
3
|
import * as MultiPhase from "../../__generated__/IDrop1155/read/claimCondition.js";
|
4
4
|
import * as MultiById from "../../__generated__/IDrop1155/read/getClaimConditionById.js";
|
5
|
+
import * as SinglePhase from "../../__generated__/IDropSinglePhase1155/read/claimCondition.js";
|
5
6
|
|
6
7
|
export type GetClaimConditionsParams = {
|
7
8
|
tokenId: bigint;
|
@@ -21,24 +22,53 @@ export type GetClaimConditionsParams = {
|
|
21
22
|
export async function getClaimConditions(
|
22
23
|
options: BaseTransactionOptions<GetClaimConditionsParams>,
|
23
24
|
): Promise<ClaimCondition[]> {
|
24
|
-
|
25
|
-
|
25
|
+
const [multi, single] = await Promise.allSettled([
|
26
|
+
(async () => {
|
27
|
+
const [startId, count] = await MultiPhase.claimCondition(options);
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
29
|
+
const conditionPromises: Array<
|
30
|
+
ReturnType<typeof MultiById.getClaimConditionById>
|
31
|
+
> = [];
|
32
|
+
for (let i = startId; i < startId + count; i++) {
|
33
|
+
conditionPromises.push(
|
34
|
+
MultiById.getClaimConditionById({
|
35
|
+
...options,
|
36
|
+
conditionId: i,
|
37
|
+
}),
|
38
|
+
);
|
39
|
+
}
|
40
|
+
return Promise.all(conditionPromises);
|
41
|
+
})(),
|
42
|
+
SinglePhase.claimCondition(options).then(
|
43
|
+
([
|
44
|
+
startTimestamp,
|
45
|
+
maxClaimableSupply,
|
46
|
+
supplyClaimed,
|
47
|
+
quantityLimitPerWallet,
|
48
|
+
merkleRoot,
|
49
|
+
pricePerToken,
|
50
|
+
currency,
|
51
|
+
metadata,
|
52
|
+
]) => ({
|
53
|
+
startTimestamp,
|
54
|
+
maxClaimableSupply,
|
55
|
+
supplyClaimed,
|
56
|
+
quantityLimitPerWallet,
|
57
|
+
merkleRoot,
|
58
|
+
pricePerToken,
|
59
|
+
currency,
|
60
|
+
metadata,
|
61
|
+
}),
|
62
|
+
),
|
63
|
+
]);
|
64
|
+
if (multi.status === "fulfilled") {
|
65
|
+
return multi.value;
|
41
66
|
}
|
67
|
+
if (single.status === "fulfilled") {
|
68
|
+
return [single.value];
|
69
|
+
}
|
70
|
+
|
71
|
+
throw new Error("Claim condition not found");
|
42
72
|
}
|
43
73
|
|
44
74
|
/**
|
@@ -56,7 +86,8 @@ export async function getClaimConditions(
|
|
56
86
|
export function isGetClaimConditionsSupported(availableSelectors: string[]) {
|
57
87
|
// if multi phase is supported, return true
|
58
88
|
return (
|
59
|
-
MultiPhase.isClaimConditionSupported(availableSelectors) &&
|
60
|
-
|
89
|
+
(MultiPhase.isClaimConditionSupported(availableSelectors) &&
|
90
|
+
MultiById.isGetClaimConditionByIdSupported(availableSelectors)) ||
|
91
|
+
SinglePhase.isClaimConditionSupported(availableSelectors)
|
61
92
|
);
|
62
93
|
}
|
@@ -3,8 +3,16 @@ import type { BaseTransactionOptions } from "../../../../transaction/types.js";
|
|
3
3
|
import type { ClaimCondition } from "../../../../utils/extensions/drops/types.js";
|
4
4
|
import {
|
5
5
|
isSetClaimConditionsSupported,
|
6
|
-
setClaimConditions,
|
6
|
+
setClaimConditions as setClaimConditionsMultiPhase,
|
7
7
|
} from "../../__generated__/IDrop1155/write/setClaimConditions.js";
|
8
|
+
import {
|
9
|
+
claimCondition as claimConditionSinglePhase,
|
10
|
+
isClaimConditionSupported,
|
11
|
+
} from "../../__generated__/IDropSinglePhase1155/read/claimCondition.js";
|
12
|
+
import {
|
13
|
+
isSetClaimConditionsSupported as isSetClaimConditionsSupportedGeneratedSinglePhase,
|
14
|
+
setClaimConditions as setClaimConditionsSinglePhase,
|
15
|
+
} from "../../__generated__/IDropSinglePhase1155/write/setClaimConditions.js";
|
8
16
|
import {
|
9
17
|
type GetClaimConditionsParams,
|
10
18
|
getClaimConditions,
|
@@ -31,10 +39,49 @@ export type ResetClaimEligibilityParams = GetClaimConditionsParams;
|
|
31
39
|
* ```
|
32
40
|
*/
|
33
41
|
export function resetClaimEligibility(
|
34
|
-
options: BaseTransactionOptions<ResetClaimEligibilityParams
|
42
|
+
options: BaseTransactionOptions<ResetClaimEligibilityParams> & {
|
43
|
+
singlePhaseDrop?: boolean;
|
44
|
+
},
|
35
45
|
) {
|
46
|
+
if (options.singlePhaseDrop) {
|
47
|
+
return setClaimConditionsSinglePhase({
|
48
|
+
contract: options.contract,
|
49
|
+
asyncParams: async () => {
|
50
|
+
// get existing condition
|
51
|
+
const existingCondition = await claimConditionSinglePhase(options).then(
|
52
|
+
([
|
53
|
+
startTimestamp,
|
54
|
+
maxClaimableSupply,
|
55
|
+
supplyClaimed,
|
56
|
+
quantityLimitPerWallet,
|
57
|
+
merkleRoot,
|
58
|
+
pricePerToken,
|
59
|
+
currency,
|
60
|
+
metadata,
|
61
|
+
]) => ({
|
62
|
+
startTimestamp,
|
63
|
+
maxClaimableSupply,
|
64
|
+
supplyClaimed,
|
65
|
+
quantityLimitPerWallet,
|
66
|
+
merkleRoot,
|
67
|
+
pricePerToken,
|
68
|
+
currency,
|
69
|
+
metadata,
|
70
|
+
}),
|
71
|
+
);
|
72
|
+
|
73
|
+
// then simply return the exact same ones, but with the resetClaimEligibility flag set to true
|
74
|
+
return {
|
75
|
+
tokenId: options.tokenId,
|
76
|
+
// type is necessary because of viem hex shenanigans (strict vs non-strict `0x` prefix string)
|
77
|
+
phase: existingCondition,
|
78
|
+
resetClaimEligibility: true,
|
79
|
+
};
|
80
|
+
},
|
81
|
+
});
|
82
|
+
}
|
36
83
|
// download existing conditions
|
37
|
-
return
|
84
|
+
return setClaimConditionsMultiPhase({
|
38
85
|
contract: options.contract,
|
39
86
|
asyncParams: async () => {
|
40
87
|
// get existing conditions
|
@@ -70,7 +117,9 @@ export function resetClaimEligibility(
|
|
70
117
|
*/
|
71
118
|
export function isResetClaimEligibilitySupported(availableSelectors: string[]) {
|
72
119
|
return (
|
73
|
-
isGetClaimConditionsSupported(availableSelectors) &&
|
74
|
-
|
120
|
+
(isGetClaimConditionsSupported(availableSelectors) &&
|
121
|
+
isSetClaimConditionsSupported(availableSelectors)) ||
|
122
|
+
isClaimConditionSupported(availableSelectors) ||
|
123
|
+
isSetClaimConditionsSupportedGeneratedSinglePhase(availableSelectors)
|
75
124
|
);
|
76
125
|
}
|
@@ -50,15 +50,6 @@ export async function getClaimParams(options: GetClaimParamsOptions) {
|
|
50
50
|
const cc: ClaimCondition = await (async () => {
|
51
51
|
if (options.type === "erc1155") {
|
52
52
|
// lazy-load the getActiveClaimCondition function
|
53
|
-
if (options.singlePhaseDrop) {
|
54
|
-
const { claimCondition } = await import(
|
55
|
-
"../../../extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.js"
|
56
|
-
);
|
57
|
-
return await claimCondition({
|
58
|
-
contract: options.contract,
|
59
|
-
tokenId: options.tokenId,
|
60
|
-
});
|
61
|
-
}
|
62
53
|
const { getActiveClaimCondition } = await import(
|
63
54
|
"../../../extensions/erc1155/drops/read/getActiveClaimCondition.js"
|
64
55
|
);
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.93.
|
1
|
+
export const version = "5.93.15-nightly-386138e4f06b14aac2fea2ab4a7a0497932f74a7-20250406000354";
|