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,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.tokensMintedWithSignatureEvent = exports.approvalForAllEvent = exports.approvalEvent = exports.tokensLazyMintedEvent = exports.transferEvent = exports.setSharedMetadata = exports.sharedMetadata = exports.generateMintSignature = exports.mintWithSignature = exports.isResetClaimEligibilitySupported = exports.resetClaimEligibility = exports.isSetClaimConditionsSupported = exports.setClaimConditions = exports.isLazyMintSupported = exports.lazyMint = exports.isClaimToSupported = exports.claimTo = exports.isGetActiveClaimConditionSupported = exports.getActiveClaimCondition = exports.isClaimConditionSupported = exports.claimCondition = exports.isGetClaimConditionsSupported = exports.getClaimConditions = exports.isGetActiveClaimConditionIdSupported = exports.getActiveClaimConditionId = exports.isGetClaimConditionByIdSupported = exports.getClaimConditionById = exports.setTokenURI = exports.approve = exports.setApprovalForAll = exports.burn = exports.transferFrom = exports.mintTo = exports.getOwnedNFTs = exports.getOwnedTokenIds = exports.getTotalClaimedSupply = exports.getTotalUnclaimedSupply = exports.isApprovedForAll = exports.getAllOwners = exports.tokensOfOwner = exports.tokenOfOwnerByIndex = exports.balanceOf = exports.totalSupply = exports.tokenURI = exports.startTokenId = exports.ownerOf = exports.nextTokenIdToMint = exports.getNFTs = exports.getNFT = exports.isERC721 = void 0;
|
4
|
+
exports.updateTokenURI = exports.updateMetadata = exports.getBatchesToReveal = exports.reveal = exports.createDelayedRevealBatch = exports.tokenURIRevealedEvent = exports.sharedMetadataUpdatedEvent = exports.tokensClaimedEvent = exports.claimConditionsUpdatedEvent = void 0;
|
4
5
|
/**
|
5
6
|
* READ extension for ERC721
|
6
7
|
*/
|
@@ -56,18 +57,41 @@ Object.defineProperty(exports, "setTokenURI", { enumerable: true, get: function
|
|
56
57
|
/**
|
57
58
|
* DROPS extension for ERC721
|
58
59
|
*/
|
60
|
+
// READ
|
61
|
+
// multi-phase --
|
59
62
|
var getClaimConditionById_js_1 = require("../../extensions/erc721/__generated__/IDrop/read/getClaimConditionById.js");
|
60
63
|
Object.defineProperty(exports, "getClaimConditionById", { enumerable: true, get: function () { return getClaimConditionById_js_1.getClaimConditionById; } });
|
64
|
+
Object.defineProperty(exports, "isGetClaimConditionByIdSupported", { enumerable: true, get: function () { return getClaimConditionById_js_1.isGetClaimConditionByIdSupported; } });
|
65
|
+
var getActiveClaimConditionId_js_1 = require("../../extensions/erc721/__generated__/IDrop/read/getActiveClaimConditionId.js");
|
66
|
+
Object.defineProperty(exports, "getActiveClaimConditionId", { enumerable: true, get: function () { return getActiveClaimConditionId_js_1.getActiveClaimConditionId; } });
|
67
|
+
Object.defineProperty(exports, "isGetActiveClaimConditionIdSupported", { enumerable: true, get: function () { return getActiveClaimConditionId_js_1.isGetActiveClaimConditionIdSupported; } });
|
68
|
+
var getClaimConditions_js_1 = require("../../extensions/erc721/drops/read/getClaimConditions.js");
|
69
|
+
Object.defineProperty(exports, "getClaimConditions", { enumerable: true, get: function () { return getClaimConditions_js_1.getClaimConditions; } });
|
70
|
+
Object.defineProperty(exports, "isGetClaimConditionsSupported", { enumerable: true, get: function () { return getClaimConditions_js_1.isGetClaimConditionsSupported; } });
|
71
|
+
// --
|
72
|
+
// single phase --
|
61
73
|
var claimCondition_js_1 = require("../../extensions/erc721/__generated__/DropSinglePhase/read/claimCondition.js");
|
62
74
|
Object.defineProperty(exports, "claimCondition", { enumerable: true, get: function () { return claimCondition_js_1.claimCondition; } });
|
75
|
+
Object.defineProperty(exports, "isClaimConditionSupported", { enumerable: true, get: function () { return claimCondition_js_1.isClaimConditionSupported; } });
|
76
|
+
// --
|
77
|
+
// multi and single phase --
|
63
78
|
var getActiveClaimCondition_js_1 = require("../../extensions/erc721/drops/read/getActiveClaimCondition.js");
|
64
79
|
Object.defineProperty(exports, "getActiveClaimCondition", { enumerable: true, get: function () { return getActiveClaimCondition_js_1.getActiveClaimCondition; } });
|
80
|
+
Object.defineProperty(exports, "isGetActiveClaimConditionSupported", { enumerable: true, get: function () { return getActiveClaimCondition_js_1.isGetActiveClaimConditionSupported; } });
|
81
|
+
// --
|
82
|
+
// WRITE
|
65
83
|
var claimTo_js_1 = require("../../extensions/erc721/drops/write/claimTo.js");
|
66
84
|
Object.defineProperty(exports, "claimTo", { enumerable: true, get: function () { return claimTo_js_1.claimTo; } });
|
85
|
+
Object.defineProperty(exports, "isClaimToSupported", { enumerable: true, get: function () { return claimTo_js_1.isClaimToSupported; } });
|
67
86
|
var lazyMint_js_1 = require("../../extensions/erc721/write/lazyMint.js");
|
68
87
|
Object.defineProperty(exports, "lazyMint", { enumerable: true, get: function () { return lazyMint_js_1.lazyMint; } });
|
88
|
+
Object.defineProperty(exports, "isLazyMintSupported", { enumerable: true, get: function () { return lazyMint_js_1.isLazyMintSupported; } });
|
69
89
|
var setClaimConditions_js_1 = require("../../extensions/erc721/drops/write/setClaimConditions.js");
|
70
90
|
Object.defineProperty(exports, "setClaimConditions", { enumerable: true, get: function () { return setClaimConditions_js_1.setClaimConditions; } });
|
91
|
+
Object.defineProperty(exports, "isSetClaimConditionsSupported", { enumerable: true, get: function () { return setClaimConditions_js_1.isSetClaimConditionsSupported; } });
|
92
|
+
var resetClaimEligibility_js_1 = require("../../extensions/erc721/drops/write/resetClaimEligibility.js");
|
93
|
+
Object.defineProperty(exports, "resetClaimEligibility", { enumerable: true, get: function () { return resetClaimEligibility_js_1.resetClaimEligibility; } });
|
94
|
+
Object.defineProperty(exports, "isResetClaimEligibilitySupported", { enumerable: true, get: function () { return resetClaimEligibility_js_1.isResetClaimEligibilitySupported; } });
|
71
95
|
/**
|
72
96
|
* SIGNATURE extension for ERC721
|
73
97
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"erc721.js","sourceRoot":"","sources":["../../../../src/exports/extensions/erc721.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"erc721.js","sourceRoot":"","sources":["../../../../src/exports/extensions/erc721.ts"],"names":[],"mappings":"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"}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.FN_SELECTOR = void 0;
|
4
|
+
exports.isClaimConditionSupported = isClaimConditionSupported;
|
5
|
+
exports.decodeClaimConditionResult = decodeClaimConditionResult;
|
6
|
+
exports.claimCondition = claimCondition;
|
7
|
+
const read_contract_js_1 = require("../../../../../transaction/read-contract.js");
|
8
|
+
const viem_1 = require("viem");
|
9
|
+
const detectExtension_js_1 = require("../../../../../utils/bytecode/detectExtension.js");
|
10
|
+
exports.FN_SELECTOR = "0xd637ed59";
|
11
|
+
const FN_INPUTS = [];
|
12
|
+
const FN_OUTPUTS = [
|
13
|
+
{
|
14
|
+
type: "uint256",
|
15
|
+
name: "currentStartId",
|
16
|
+
},
|
17
|
+
{
|
18
|
+
type: "uint256",
|
19
|
+
name: "count",
|
20
|
+
},
|
21
|
+
];
|
22
|
+
/**
|
23
|
+
* Checks if the `claimCondition` method is supported by the given contract.
|
24
|
+
* @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.
|
25
|
+
* @returns A boolean indicating if the `claimCondition` method is supported.
|
26
|
+
* @extension ERC721
|
27
|
+
* @example
|
28
|
+
* ```ts
|
29
|
+
* import { isClaimConditionSupported } from "thirdweb/extensions/erc721";
|
30
|
+
*
|
31
|
+
* const supported = isClaimConditionSupported(["0x..."]);
|
32
|
+
* ```
|
33
|
+
*/
|
34
|
+
function isClaimConditionSupported(availableSelectors) {
|
35
|
+
return (0, detectExtension_js_1.detectMethod)({
|
36
|
+
availableSelectors,
|
37
|
+
method: [exports.FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
38
|
+
});
|
39
|
+
}
|
40
|
+
/**
|
41
|
+
* Decodes the result of the claimCondition function call.
|
42
|
+
* @param result - The hexadecimal result to decode.
|
43
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
44
|
+
* @extension ERC721
|
45
|
+
* @example
|
46
|
+
* ```ts
|
47
|
+
* import { decodeClaimConditionResult } from "thirdweb/extensions/erc721";
|
48
|
+
* const result = decodeClaimConditionResult("...");
|
49
|
+
* ```
|
50
|
+
*/
|
51
|
+
function decodeClaimConditionResult(result) {
|
52
|
+
return (0, viem_1.decodeAbiParameters)(FN_OUTPUTS, result);
|
53
|
+
}
|
54
|
+
/**
|
55
|
+
* Calls the "claimCondition" function on the contract.
|
56
|
+
* @param options - The options for the claimCondition function.
|
57
|
+
* @returns The parsed result of the function call.
|
58
|
+
* @extension ERC721
|
59
|
+
* @example
|
60
|
+
* ```ts
|
61
|
+
* import { claimCondition } from "thirdweb/extensions/erc721";
|
62
|
+
*
|
63
|
+
* const result = await claimCondition({
|
64
|
+
* contract,
|
65
|
+
* });
|
66
|
+
*
|
67
|
+
* ```
|
68
|
+
*/
|
69
|
+
async function claimCondition(options) {
|
70
|
+
return (0, read_contract_js_1.readContract)({
|
71
|
+
contract: options.contract,
|
72
|
+
method: [exports.FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
73
|
+
params: [],
|
74
|
+
});
|
75
|
+
}
|
76
|
+
//# sourceMappingURL=claimCondition.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"claimCondition.js","sourceRoot":"","sources":["../../../../../../../src/extensions/erc721/__generated__/IDrop/read/claimCondition.ts"],"names":[],"mappings":";;;AAgCA,8DAKC;AAaD,gEAEC;AAiBD,wCAMC;AA3ED,kFAA2E;AAG3E,+BAA2C;AAE3C,yFAAgF;AAEnE,QAAA,WAAW,GAAG,YAAqB,CAAC;AACjD,MAAM,SAAS,GAAG,EAAW,CAAC;AAC9B,MAAM,UAAU,GAAG;IACjB;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,gBAAgB;KACvB;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,OAAO;KACd;CACO,CAAC;AAEX;;;;;;;;;;;GAWG;AACH,SAAgB,yBAAyB,CAAC,kBAA4B;IACpE,OAAO,IAAA,iCAAY,EAAC;QAClB,kBAAkB;QAClB,MAAM,EAAE,CAAC,mBAAW,EAAE,SAAS,EAAE,UAAU,CAAU;KACtD,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,0BAA0B,CAAC,MAAW;IACpD,OAAO,IAAA,0BAAmB,EAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,cAAc,CAAC,OAA+B;IAClE,OAAO,IAAA,+BAAY,EAAC;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,MAAM,EAAE,CAAC,mBAAW,EAAE,SAAS,EAAE,UAAU,CAAU;QACrD,MAAM,EAAE,EAAE;KACX,CAAC,CAAC;AACL,CAAC"}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getActiveClaimCondition = getActiveClaimCondition;
|
4
|
-
|
5
|
-
const
|
6
|
-
const
|
4
|
+
exports.isGetActiveClaimConditionSupported = isGetActiveClaimConditionSupported;
|
5
|
+
const SinglePhase = require("../../__generated__/DropSinglePhase/read/claimCondition.js");
|
6
|
+
const GetActiveId = require("../../__generated__/IDrop/read/getActiveClaimConditionId.js");
|
7
|
+
const ById = require("../../__generated__/IDrop/read/getClaimConditionById.js");
|
7
8
|
/**
|
8
9
|
* Retrieves the active claim condition.
|
9
10
|
* @param options - The transaction options.
|
@@ -18,11 +19,11 @@ const getClaimConditionById_js_1 = require("../../__generated__/IDrop/read/getCl
|
|
18
19
|
*/
|
19
20
|
async function getActiveClaimCondition(options) {
|
20
21
|
const getActiveClaimConditionMultiPhase = async () => {
|
21
|
-
const conditionId = await
|
22
|
-
return
|
22
|
+
const conditionId = await GetActiveId.getActiveClaimConditionId(options);
|
23
|
+
return ById.getClaimConditionById({ ...options, conditionId });
|
23
24
|
};
|
24
25
|
const getActiveClaimConditionSinglePhase = async () => {
|
25
|
-
const [startTimestamp, maxClaimableSupply, supplyClaimed, quantityLimitPerWallet, merkleRoot, pricePerToken, currency, metadata,] = await
|
26
|
+
const [startTimestamp, maxClaimableSupply, supplyClaimed, quantityLimitPerWallet, merkleRoot, pricePerToken, currency, metadata,] = await SinglePhase.claimCondition(options);
|
26
27
|
return {
|
27
28
|
startTimestamp,
|
28
29
|
maxClaimableSupply,
|
@@ -45,4 +46,25 @@ async function getActiveClaimCondition(options) {
|
|
45
46
|
}
|
46
47
|
throw new Error("Claim condition not found");
|
47
48
|
}
|
49
|
+
/**
|
50
|
+
* Checks if the `getActiveClaimCondition` method is supported by the given contract.
|
51
|
+
* @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.
|
52
|
+
* @returns A boolean indicating if the `getActiveClaimCondition` method is supported.
|
53
|
+
* @extension ERC721
|
54
|
+
* @example
|
55
|
+
* ```ts
|
56
|
+
* import { isGetActiveClaimConditionSupported } from "thirdweb/extensions/erc721";
|
57
|
+
*
|
58
|
+
* const supported = isGetActiveClaimConditionSupported(["0x..."]);
|
59
|
+
* ```
|
60
|
+
*/
|
61
|
+
function isGetActiveClaimConditionSupported(availableSelectors) {
|
62
|
+
// if single phase is supported, return true
|
63
|
+
if (SinglePhase.isClaimConditionSupported(availableSelectors)) {
|
64
|
+
return true;
|
65
|
+
}
|
66
|
+
// otherwise check that both multi phase functions are supported
|
67
|
+
return (GetActiveId.isGetActiveClaimConditionIdSupported(availableSelectors) &&
|
68
|
+
ById.isGetClaimConditionByIdSupported(availableSelectors));
|
69
|
+
}
|
48
70
|
//# sourceMappingURL=getActiveClaimCondition.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getActiveClaimCondition.js","sourceRoot":"","sources":["../../../../../../src/extensions/erc721/drops/read/getActiveClaimCondition.ts"],"names":[],"mappings":";;AAkBA,0DAyCC;
|
1
|
+
{"version":3,"file":"getActiveClaimCondition.js","sourceRoot":"","sources":["../../../../../../src/extensions/erc721/drops/read/getActiveClaimCondition.ts"],"names":[],"mappings":";;AAkBA,0DAyCC;AAcD,gFAYC;AAnFD,0FAA0F;AAC1F,2FAA2F;AAC3F,gFAAgF;AAEhF;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,uBAAuB,CAC3C,OAA+B;IAE/B,MAAM,iCAAiC,GAAG,KAAK,IAAI,EAAE;QACnD,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC,qBAAqB,CAAC,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;IACjE,CAAC,CAAC;IACF,MAAM,kCAAkC,GAAG,KAAK,IAAI,EAAE;QACpD,MAAM,CACJ,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,UAAU,EACV,aAAa,EACb,QAAQ,EACR,QAAQ,EACT,GAAG,MAAM,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC9C,OAAO;YACL,cAAc;YACd,kBAAkB;YAClB,aAAa;YACb,sBAAsB;YACtB,UAAU;YACV,aAAa;YACb,QAAQ;YACR,QAAQ;SACT,CAAC;IACJ,CAAC,CAAC;IAEF,oHAAoH;IACpH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC;QACvC,iCAAiC,EAAE;QACnC,kCAAkC,EAAE;KACrC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC;IAC1E,IAAI,SAAS,EAAE,MAAM,KAAK,WAAW,EAAE,CAAC;QACtC,OAAO,SAAS,CAAC,KAAK,CAAC;IACzB,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,kCAAkC,CAChD,kBAA4B;IAE5B,4CAA4C;IAC5C,IAAI,WAAW,CAAC,yBAAyB,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAC9D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,gEAAgE;IAChE,OAAO,CACL,WAAW,CAAC,oCAAoC,CAAC,kBAAkB,CAAC;QACpE,IAAI,CAAC,gCAAgC,CAAC,kBAAkB,CAAC,CAC1D,CAAC;AACJ,CAAC"}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getClaimConditions = getClaimConditions;
|
4
|
+
exports.isGetClaimConditionsSupported = isGetClaimConditionsSupported;
|
5
|
+
const SinglePhase = require("../../__generated__/DropSinglePhase/read/claimCondition.js");
|
6
|
+
const MultiPhase = require("../../__generated__/IDrop/read/claimCondition.js");
|
7
|
+
const ById = require("../../__generated__/IDrop/read/getClaimConditionById.js");
|
8
|
+
/**
|
9
|
+
* Retrieves all claim conditions.
|
10
|
+
* @param options - The transaction options.
|
11
|
+
* @returns A promise that resolves to all claim conditions.
|
12
|
+
* @throws An error if the claim conditions are unsupported by the contract.
|
13
|
+
* @extension ERC721
|
14
|
+
* @example
|
15
|
+
* ```ts
|
16
|
+
* import { getClaimConditions } from "thirdweb/extensions/erc721";
|
17
|
+
* const conditions = await getClaimConditions({ contract });
|
18
|
+
* ```
|
19
|
+
*/
|
20
|
+
async function getClaimConditions(options) {
|
21
|
+
const [multi, single] = await Promise.allSettled([
|
22
|
+
(async () => {
|
23
|
+
const [startId, count] = await MultiPhase.claimCondition(options);
|
24
|
+
const conditionPromises = [];
|
25
|
+
for (let i = startId; i < count; i++) {
|
26
|
+
conditionPromises.push(ById.getClaimConditionById({
|
27
|
+
...options,
|
28
|
+
conditionId: i,
|
29
|
+
}));
|
30
|
+
}
|
31
|
+
return Promise.all(conditionPromises);
|
32
|
+
})(),
|
33
|
+
SinglePhase.claimCondition(options).then(([startTimestamp, maxClaimableSupply, supplyClaimed, quantityLimitPerWallet, merkleRoot, pricePerToken, currency, metadata,]) => ({
|
34
|
+
startTimestamp,
|
35
|
+
maxClaimableSupply,
|
36
|
+
supplyClaimed,
|
37
|
+
quantityLimitPerWallet,
|
38
|
+
merkleRoot,
|
39
|
+
pricePerToken,
|
40
|
+
currency,
|
41
|
+
metadata,
|
42
|
+
})),
|
43
|
+
]);
|
44
|
+
if (multi.status === "fulfilled") {
|
45
|
+
return multi.value;
|
46
|
+
}
|
47
|
+
if (single.status === "fulfilled") {
|
48
|
+
return [single.value];
|
49
|
+
}
|
50
|
+
throw new Error("Claim condition not found");
|
51
|
+
}
|
52
|
+
/**
|
53
|
+
* Checks if the `getClaimConditions` method is supported by the given contract.
|
54
|
+
* @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.
|
55
|
+
* @returns A boolean indicating if the `getClaimConditions` method is supported.
|
56
|
+
* @extension ERC721
|
57
|
+
* @example
|
58
|
+
* ```ts
|
59
|
+
* import { isGetClaimConditionsSupported } from "thirdweb/extensions/erc721";
|
60
|
+
*
|
61
|
+
* const supported = isGetClaimConditionsSupported(["0x..."]);
|
62
|
+
* ```
|
63
|
+
*/
|
64
|
+
function isGetClaimConditionsSupported(availableSelectors) {
|
65
|
+
// if single phase is supported, return true
|
66
|
+
if (SinglePhase.isClaimConditionSupported(availableSelectors)) {
|
67
|
+
return true;
|
68
|
+
}
|
69
|
+
// if multi phase is supported, return true
|
70
|
+
return (MultiPhase.isClaimConditionSupported(availableSelectors) &&
|
71
|
+
ById.isGetClaimConditionByIdSupported(availableSelectors));
|
72
|
+
}
|
73
|
+
//# sourceMappingURL=getClaimConditions.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getClaimConditions.js","sourceRoot":"","sources":["../../../../../../src/extensions/erc721/drops/read/getClaimConditions.ts"],"names":[],"mappings":";;AAkBA,gDAkDC;AAcD,sEAUC;AA1FD,0FAA0F;AAC1F,+EAA+E;AAC/E,gFAAgF;AAEhF;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,kBAAkB,CACtC,OAA+B;IAE/B,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC;QAC/C,CAAC,KAAK,IAAI,EAAE;YACV,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,MAAM,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAElE,MAAM,iBAAiB,GAEnB,EAAE,CAAC;YACP,KAAK,IAAI,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;gBACrC,iBAAiB,CAAC,IAAI,CACpB,IAAI,CAAC,qBAAqB,CAAC;oBACzB,GAAG,OAAO;oBACV,WAAW,EAAE,CAAC;iBACf,CAAC,CACH,CAAC;YACJ,CAAC;YACD,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACxC,CAAC,CAAC,EAAE;QACJ,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,IAAI,CACtC,CAAC,CACC,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,UAAU,EACV,aAAa,EACb,QAAQ,EACR,QAAQ,EACT,EAAE,EAAE,CAAC,CAAC;YACL,cAAc;YACd,kBAAkB;YAClB,aAAa;YACb,sBAAsB;YACtB,UAAU;YACV,aAAa;YACb,QAAQ;YACR,QAAQ;SACT,CAAC,CACH;KACF,CAAC,CAAC;IACH,IAAI,KAAK,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,6BAA6B,CAAC,kBAA4B;IACxE,4CAA4C;IAC5C,IAAI,WAAW,CAAC,yBAAyB,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAC9D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,2CAA2C;IAC3C,OAAO,CACL,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;QACxD,IAAI,CAAC,gCAAgC,CAAC,kBAAkB,CAAC,CAC1D,CAAC;AACJ,CAAC"}
|
@@ -1,8 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.claimTo = claimTo;
|
4
|
+
exports.isClaimToSupported = isClaimToSupported;
|
4
5
|
const get_claim_params_js_1 = require("../../../../utils/extensions/drops/get-claim-params.js");
|
5
6
|
const claim_js_1 = require("../../__generated__/IDrop/write/claim.js");
|
7
|
+
const getActiveClaimCondition_js_1 = require("../read/getActiveClaimCondition.js");
|
6
8
|
/**
|
7
9
|
* Claim ERC721 NFTs to a specified address
|
8
10
|
* @param options - The options for the transaction
|
@@ -35,4 +37,21 @@ function claimTo(options) {
|
|
35
37
|
}),
|
36
38
|
});
|
37
39
|
}
|
40
|
+
/**
|
41
|
+
* Checks if the `claimTo` method is supported by the given contract.
|
42
|
+
* @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.
|
43
|
+
* @returns A boolean indicating if the `claimTo` method is supported.
|
44
|
+
* @extension ERC721
|
45
|
+
* @example
|
46
|
+
* ```ts
|
47
|
+
* import { isClaimToSupported } from "thirdweb/extensions/erc721";
|
48
|
+
*
|
49
|
+
* const supported = isClaimToSupported(["0x..."]);
|
50
|
+
* ```
|
51
|
+
*/
|
52
|
+
function isClaimToSupported(availableSelectors) {
|
53
|
+
return ((0, claim_js_1.isClaimSupported)(availableSelectors) &&
|
54
|
+
// required to check if the contract supports the getActiveClaimCondition method
|
55
|
+
(0, getActiveClaimCondition_js_1.isGetActiveClaimConditionSupported)(availableSelectors));
|
56
|
+
}
|
38
57
|
//# sourceMappingURL=claimTo.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"claimTo.js","sourceRoot":"","sources":["../../../../../../src/extensions/erc721/drops/write/claimTo.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"claimTo.js","sourceRoot":"","sources":["../../../../../../src/extensions/erc721/drops/write/claimTo.ts"],"names":[],"mappings":";;AAuCA,0BAYC;AAcD,gDAMC;AArED,gGAAwF;AACxF,uEAGkD;AAClD,mFAAwF;AAYxF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,OAAO,CAAC,OAA8C;IACpE,OAAO,IAAA,gBAAK,EAAC;QACX,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,WAAW,EAAE,GAAG,EAAE,CAChB,IAAA,oCAAc,EAAC;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB,CAAC;KACL,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,kBAAkB,CAAC,kBAA4B;IAC7D,OAAO,CACL,IAAA,2BAAgB,EAAC,kBAAkB,CAAC;QACpC,gFAAgF;QAChF,IAAA,+DAAkC,EAAC,kBAAkB,CAAC,CACvD,CAAC;AACJ,CAAC"}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.resetClaimEligibility = resetClaimEligibility;
|
4
|
+
exports.isResetClaimEligibilitySupported = isResetClaimEligibilitySupported;
|
5
|
+
const setClaimConditions_js_1 = require("../../__generated__/IDrop/write/setClaimConditions.js");
|
6
|
+
const getClaimConditions_js_1 = require("../read/getClaimConditions.js");
|
7
|
+
/**
|
8
|
+
* Reset the claim eligibility for all users.
|
9
|
+
* @param options
|
10
|
+
* @returns the prepared transaction
|
11
|
+
* @extension ERC721
|
12
|
+
* @example
|
13
|
+
* ```ts
|
14
|
+
* import { resetClaimEligibility } from "thirdweb/extensions/erc721";
|
15
|
+
* import { sendTransaction } from "thirdweb";
|
16
|
+
*
|
17
|
+
* const transaction = resetClaimEligibility({
|
18
|
+
* contract,
|
19
|
+
* });
|
20
|
+
*
|
21
|
+
* await sendTransaction({ transaction, account });
|
22
|
+
* ```
|
23
|
+
*/
|
24
|
+
function resetClaimEligibility(options) {
|
25
|
+
// download existing conditions
|
26
|
+
return (0, setClaimConditions_js_1.setClaimConditions)({
|
27
|
+
contract: options.contract,
|
28
|
+
asyncParams: async () => {
|
29
|
+
// get existing conditions
|
30
|
+
const existingConditions = await (0, getClaimConditions_js_1.getClaimConditions)(options);
|
31
|
+
// then simply return the exact same ones, but with the resetClaimEligibility flag set to true
|
32
|
+
return {
|
33
|
+
// type is necessary because of viem hex shenanigans (strict vs non-strict `0x` prefix string)
|
34
|
+
phases: existingConditions,
|
35
|
+
resetClaimEligibility: true,
|
36
|
+
};
|
37
|
+
},
|
38
|
+
});
|
39
|
+
}
|
40
|
+
/**
|
41
|
+
* Checks if the `resetClaimEligibility` method is supported by the given contract.
|
42
|
+
* @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.
|
43
|
+
* @returns A boolean indicating if the `resetClaimEligibility` method is supported.
|
44
|
+
* @extension ERC721
|
45
|
+
* @example
|
46
|
+
* ```ts
|
47
|
+
* import { isResetClaimEligibilitySupported } from "thirdweb/extensions/erc721";
|
48
|
+
*
|
49
|
+
* const supported = isResetClaimEligibilitySupported(["0x..."]);
|
50
|
+
* ```
|
51
|
+
*/
|
52
|
+
function isResetClaimEligibilitySupported(availableSelectors) {
|
53
|
+
return ((0, getClaimConditions_js_1.isGetClaimConditionsSupported)(availableSelectors) &&
|
54
|
+
(0, setClaimConditions_js_1.isSetClaimConditionsSupported)(availableSelectors));
|
55
|
+
}
|
56
|
+
//# sourceMappingURL=resetClaimEligibility.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"resetClaimEligibility.js","sourceRoot":"","sources":["../../../../../../src/extensions/erc721/drops/write/resetClaimEligibility.ts"],"names":[],"mappings":";;AA6BA,sDAqBC;AAcD,4EAKC;AAlED,iGAG+D;AAC/D,yEAGuC;AAEvC;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,qBAAqB,CAAC,OAA+B;IACnE,+BAA+B;IAC/B,OAAO,IAAA,0CAAkB,EAAC;QACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,WAAW,EAAE,KAAK,IAAI,EAAE;YACtB,0BAA0B;YAC1B,MAAM,kBAAkB,GAAG,MAAM,IAAA,0CAAkB,EAAC,OAAO,CAAC,CAAC;YAE7D,8FAA8F;YAC9F,OAAO;gBACL,8FAA8F;gBAC9F,MAAM,EAAE,kBAKP;gBACD,qBAAqB,EAAE,IAAI;aAC5B,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,gCAAgC,CAAC,kBAA4B;IAC3E,OAAO,CACL,IAAA,qDAA6B,EAAC,kBAAkB,CAAC;QACjD,IAAA,qDAA6B,EAAC,kBAAkB,CAAC,CAClD,CAAC;AACJ,CAAC"}
|
@@ -1,8 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.setClaimConditions = setClaimConditions;
|
4
|
+
exports.isSetClaimConditionsSupported = isSetClaimConditionsSupported;
|
4
5
|
const get_multicall_set_claim_claim_conditon_transactions_js_1 = require("../../../../utils/extensions/drops/get-multicall-set-claim-claim-conditon-transactions.js");
|
6
|
+
const setContractURI_js_1 = require("../../../common/__generated__/IContractMetadata/write/setContractURI.js");
|
5
7
|
const multicall_js_1 = require("../../../common/__generated__/IMulticall/write/multicall.js");
|
8
|
+
const getContractMetadata_js_1 = require("../../../common/read/getContractMetadata.js");
|
9
|
+
const setClaimConditions_js_1 = require("../../__generated__/IDrop/write/setClaimConditions.js");
|
6
10
|
/**
|
7
11
|
* Set the claim conditions for a ERC721 drop
|
8
12
|
* @param options
|
@@ -44,4 +48,24 @@ function setClaimConditions(options) {
|
|
44
48
|
},
|
45
49
|
});
|
46
50
|
}
|
51
|
+
/**
|
52
|
+
* Checks if the `setClaimConditions` method is supported by the given contract.
|
53
|
+
* @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.
|
54
|
+
* @returns A boolean indicating if the `setClaimConditions` method is supported.
|
55
|
+
* @extension ERC721
|
56
|
+
* @example
|
57
|
+
* ```ts
|
58
|
+
* import { isSetClaimConditionsSupported } from "thirdweb/extensions/erc721";
|
59
|
+
*
|
60
|
+
* const supported = isSetClaimConditionsSupported(["0x..."]);
|
61
|
+
* ```
|
62
|
+
*/
|
63
|
+
function isSetClaimConditionsSupported(availableSelectors) {
|
64
|
+
return ((0, multicall_js_1.isMulticallSupported)(availableSelectors) &&
|
65
|
+
// needed for setting contract metadata
|
66
|
+
(0, getContractMetadata_js_1.isGetContractMetadataSupported)(availableSelectors) &&
|
67
|
+
(0, setContractURI_js_1.isSetContractURISupported)(availableSelectors) &&
|
68
|
+
// needs to actually be able to set the claim Conditions
|
69
|
+
(0, setClaimConditions_js_1.isSetClaimConditionsSupported)(availableSelectors));
|
70
|
+
}
|
47
71
|
//# sourceMappingURL=setClaimConditions.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"setClaimConditions.js","sourceRoot":"","sources":["../../../../../../src/extensions/erc721/drops/write/setClaimConditions.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"setClaimConditions.js","sourceRoot":"","sources":["../../../../../../src/extensions/erc721/drops/write/setClaimConditions.ts"],"names":[],"mappings":";;AA6CA,gDAgBC;AAcD,sEASC;AAnFD,sKAAsJ;AAEtJ,+GAAoH;AACpH,8FAGqE;AACrE,wFAA6F;AAC7F,iGAAgJ;AAUhJ;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,kBAAkB,CAChC,OAAyD;IAEzD,OAAO,IAAA,wBAAS,EAAC;QACf,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,WAAW,EAAE,KAAK,IAAI,EAAE;YACtB,OAAO;gBACL,IAAI,EAAE,MAAM,IAAA,kGAAyC,EAAC;oBACpD,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;oBACpD,aAAa,EAAE,CAAC;iBACjB,CAAC;aACH,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,6BAA6B,CAAC,kBAA4B;IACxE,OAAO,CACL,IAAA,mCAAoB,EAAC,kBAAkB,CAAC;QACxC,uCAAuC;QACvC,IAAA,uDAA8B,EAAC,kBAAkB,CAAC;QAClD,IAAA,6CAAyB,EAAC,kBAAkB,CAAC;QAC7C,wDAAwD;QACxD,IAAA,qDAAsC,EAAC,kBAAkB,CAAC,CAC3D,CAAC;AACJ,CAAC"}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.lazyMint = lazyMint;
|
4
|
+
exports.isLazyMintSupported = isLazyMintSupported;
|
4
5
|
const ipfs_js_1 = require("../../../utils/ipfs.js");
|
5
6
|
const nextTokenIdToMint_js_1 = require("../__generated__/IERC721Enumerable/read/nextTokenIdToMint.js");
|
6
|
-
const
|
7
|
+
const LazyMint = require("../__generated__/ILazyMint/write/lazyMint.js");
|
7
8
|
/**
|
8
9
|
* Lazily mints ERC721 tokens.
|
9
10
|
* @param options - The options for the lazy minting process.
|
@@ -29,7 +30,7 @@ const lazyMint_js_1 = require("../__generated__/ILazyMint/write/lazyMint.js");
|
|
29
30
|
* ```
|
30
31
|
*/
|
31
32
|
function lazyMint(options) {
|
32
|
-
return
|
33
|
+
return LazyMint.lazyMint({
|
33
34
|
contract: options.contract,
|
34
35
|
asyncParams: async () => {
|
35
36
|
const startFileNumber = await (0, nextTokenIdToMint_js_1.nextTokenIdToMint)({
|
@@ -47,4 +48,21 @@ function lazyMint(options) {
|
|
47
48
|
},
|
48
49
|
});
|
49
50
|
}
|
51
|
+
/**
|
52
|
+
* Checks if the `lazyMint` method is supported by the given contract.
|
53
|
+
* @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.
|
54
|
+
* @returns A boolean indicating if the `lazyMint` method is supported.
|
55
|
+
* @extension ERC721
|
56
|
+
* @example
|
57
|
+
* ```ts
|
58
|
+
* import { isLazyMintSupported } from "thirdweb/extensions/erc721";
|
59
|
+
*
|
60
|
+
* const supported = isLazyMintSupported(["0x..."]);
|
61
|
+
* ```
|
62
|
+
*/
|
63
|
+
function isLazyMintSupported(availableSelectors) {
|
64
|
+
return (LazyMint.isLazyMintSupported(availableSelectors) &&
|
65
|
+
// required because we use it in the lazyMint function
|
66
|
+
(0, nextTokenIdToMint_js_1.isNextTokenIdToMintSupported)(availableSelectors));
|
67
|
+
}
|
50
68
|
//# sourceMappingURL=lazyMint.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"lazyMint.js","sourceRoot":"","sources":["../../../../../src/extensions/erc721/write/lazyMint.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"lazyMint.js","sourceRoot":"","sources":["../../../../../src/extensions/erc721/write/lazyMint.ts"],"names":[],"mappings":";;AA6DA,4BAwBC;AAcD,kDAMC;AAvGD,oDAGgC;AAEhC,uGAGsE;AACtE,yEAAyE;AA0BzE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,QAAQ,CAAC,OAA+C;IACtE,OAAO,QAAQ,CAAC,QAAQ,CAAC;QACvB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,WAAW,EAAE,KAAK,IAAI,EAAE;YACtB,MAAM,eAAe,GAAG,MAAM,IAAA,wCAAiB,EAAC;gBAC9C,QAAQ,EAAE,OAAO,CAAC,QAAQ;aAC3B,CAAC,CAAC;YAEH,MAAM,WAAW,GAAG,MAAM,IAAA,6BAAmB,EAC3C,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,QAAQ,CAAC,MAAM;YACvB,+IAA+I;YAC/I,MAAM,CAAC,eAAe,CAAC,CACxB,CAAC;YAEF,MAAM,OAAO,GAAG,IAAA,6BAAmB,EAAC,WAAW,CAAC,CAAC;YAEjD,OAAO;gBACL,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC;gBAClC,gBAAgB,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG;gBACjE,SAAS,EAAE,IAAI;aACP,CAAC;QACb,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,mBAAmB,CAAC,kBAA4B;IAC9D,OAAO,CACL,QAAQ,CAAC,mBAAmB,CAAC,kBAAkB,CAAC;QAChD,sDAAsD;QACtD,IAAA,mDAA4B,EAAC,kBAAkB,CAAC,CACjD,CAAC;AACJ,CAAC"}
|
@@ -52,7 +52,7 @@ async function getClaimParams(options) {
|
|
52
52
|
// early exit if no merkle root is set
|
53
53
|
if (!cc.merkleRoot || cc.merkleRoot === (0, viem_1.padHex)("0x", { size: 32 })) {
|
54
54
|
return {
|
55
|
-
currency: addresses_js_1.
|
55
|
+
currency: addresses_js_1.ZERO_ADDRESS,
|
56
56
|
proof: [],
|
57
57
|
quantityLimitPerWallet: 0n,
|
58
58
|
pricePerToken: viem_1.maxUint256,
|
@@ -69,7 +69,7 @@ async function getClaimParams(options) {
|
|
69
69
|
// if no proof is found, we'll try the empty proof
|
70
70
|
if (!allowListProof) {
|
71
71
|
return {
|
72
|
-
currency: addresses_js_1.
|
72
|
+
currency: addresses_js_1.ZERO_ADDRESS,
|
73
73
|
proof: [],
|
74
74
|
quantityLimitPerWallet: 0n,
|
75
75
|
pricePerToken: viem_1.maxUint256,
|
@@ -80,7 +80,7 @@ async function getClaimParams(options) {
|
|
80
80
|
})();
|
81
81
|
// currency and price need to match the allowlist proof if set
|
82
82
|
// if default values in the allowlist proof, fallback to the claim condition
|
83
|
-
const currency = allowlistProof.currency && allowlistProof.currency !== addresses_js_1.
|
83
|
+
const currency = allowlistProof.currency && allowlistProof.currency !== addresses_js_1.ZERO_ADDRESS
|
84
84
|
? allowlistProof.currency
|
85
85
|
: cc.currency;
|
86
86
|
const pricePerToken = allowlistProof.pricePerToken !== undefined &&
|
package/dist/cjs/version.js
CHANGED
package/dist/cjs/version.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,wEAAwE,CAAC"}
|
@@ -30,12 +30,23 @@ export { setTokenURI, } from "../../extensions/erc721/__generated__/INFTMetadata
|
|
30
30
|
/**
|
31
31
|
* DROPS extension for ERC721
|
32
32
|
*/
|
33
|
-
|
34
|
-
|
35
|
-
export {
|
36
|
-
export {
|
37
|
-
export {
|
38
|
-
|
33
|
+
// READ
|
34
|
+
// multi-phase --
|
35
|
+
export { getClaimConditionById, isGetClaimConditionByIdSupported, } from "../../extensions/erc721/__generated__/IDrop/read/getClaimConditionById.js";
|
36
|
+
export { getActiveClaimConditionId, isGetActiveClaimConditionIdSupported, } from "../../extensions/erc721/__generated__/IDrop/read/getActiveClaimConditionId.js";
|
37
|
+
export { getClaimConditions, isGetClaimConditionsSupported, } from "../../extensions/erc721/drops/read/getClaimConditions.js";
|
38
|
+
// --
|
39
|
+
// single phase --
|
40
|
+
export { claimCondition, isClaimConditionSupported, } from "../../extensions/erc721/__generated__/DropSinglePhase/read/claimCondition.js";
|
41
|
+
// --
|
42
|
+
// multi and single phase --
|
43
|
+
export { getActiveClaimCondition, isGetActiveClaimConditionSupported, } from "../../extensions/erc721/drops/read/getActiveClaimCondition.js";
|
44
|
+
// --
|
45
|
+
// WRITE
|
46
|
+
export { claimTo, isClaimToSupported, } from "../../extensions/erc721/drops/write/claimTo.js";
|
47
|
+
export { lazyMint, isLazyMintSupported, } from "../../extensions/erc721/write/lazyMint.js";
|
48
|
+
export { setClaimConditions, isSetClaimConditionsSupported, } from "../../extensions/erc721/drops/write/setClaimConditions.js";
|
49
|
+
export { resetClaimEligibility, isResetClaimEligibilitySupported, } from "../../extensions/erc721/drops/write/resetClaimEligibility.js";
|
39
50
|
/**
|
40
51
|
* SIGNATURE extension for ERC721
|
41
52
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"erc721.js","sourceRoot":"","sources":["../../../../src/exports/extensions/erc721.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,EACL,MAAM,GAEP,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,OAAO,GAER,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mFAAmF,CAAC;AACtH,OAAO,EACL,OAAO,GAER,MAAM,gEAAgE,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,qEAAqE,CAAC;AACnG,OAAO,EACL,QAAQ,GAET,MAAM,iEAAiE,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,oEAAoE,CAAC;AACjG,OAAO,EACL,SAAS,GAEV,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EACL,mBAAmB,GAEpB,MAAM,qFAAqF,CAAC;AAC7F,OAAO,EACL,aAAa,GAEd,MAAM,+EAA+E,CAAC;AACvF,OAAO,EACL,YAAY,GAEb,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,gBAAgB,GAEjB,MAAM,yEAAyE,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,EAAE,qBAAqB,EAAE,MAAM,uDAAuD,CAAC;AAC9F,OAAO,EACL,gBAAgB,GAEjB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACL,YAAY,GAEb,MAAM,8CAA8C,CAAC;AACtD;;GAEG;AACH,OAAO,EACL,MAAM,GAEP,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,YAAY,GAEb,MAAM,sEAAsE,CAAC;AAC9E,OAAO,EACL,IAAI,GAEL,MAAM,qEAAqE,CAAC;AAC7E,OAAO,EACL,iBAAiB,GAElB,MAAM,2EAA2E,CAAC;AACnF,OAAO,EACL,OAAO,GAER,MAAM,iEAAiE,CAAC;AACzE,OAAO,EACL,WAAW,GAEZ,MAAM,yEAAyE,CAAC;AAEjF;;GAEG;AACH,OAAO,
|
1
|
+
{"version":3,"file":"erc721.js","sourceRoot":"","sources":["../../../../src/exports/extensions/erc721.ts"],"names":[],"mappings":"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"}
|