thirdweb 5.29.4 → 5.29.5-nightly-2d7ebe2111d24448dd85ace25fc9fdbef987a57d-20240617204223

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.
Files changed (50) hide show
  1. package/dist/cjs/exports/extensions/erc721.js +3 -1
  2. package/dist/cjs/exports/extensions/erc721.js.map +1 -1
  3. package/dist/cjs/extensions/erc721/__generated__/DropERC721/write/freezeBatchBaseURI.js +116 -0
  4. package/dist/cjs/extensions/erc721/__generated__/DropERC721/write/freezeBatchBaseURI.js.map +1 -0
  5. package/dist/cjs/extensions/erc721/__generated__/DropERC721/write/setMaxTotalSupply.js +116 -0
  6. package/dist/cjs/extensions/erc721/__generated__/DropERC721/write/setMaxTotalSupply.js.map +1 -0
  7. package/dist/cjs/extensions/erc721/__generated__/DropERC721/write/updateBatchBaseURI.js +123 -0
  8. package/dist/cjs/extensions/erc721/__generated__/DropERC721/write/updateBatchBaseURI.js.map +1 -0
  9. package/dist/cjs/extensions/erc721/drops/write/updateMetadata.js +89 -0
  10. package/dist/cjs/extensions/erc721/drops/write/updateMetadata.js.map +1 -0
  11. package/dist/cjs/react/core/design-system/CustomThemeProvider.js +1 -6
  12. package/dist/cjs/react/core/design-system/CustomThemeProvider.js.map +1 -1
  13. package/dist/cjs/version.js +1 -1
  14. package/dist/cjs/version.js.map +1 -1
  15. package/dist/esm/exports/extensions/erc721.js +1 -0
  16. package/dist/esm/exports/extensions/erc721.js.map +1 -1
  17. package/dist/esm/extensions/erc721/__generated__/DropERC721/write/freezeBatchBaseURI.js +109 -0
  18. package/dist/esm/extensions/erc721/__generated__/DropERC721/write/freezeBatchBaseURI.js.map +1 -0
  19. package/dist/esm/extensions/erc721/__generated__/DropERC721/write/setMaxTotalSupply.js +109 -0
  20. package/dist/esm/extensions/erc721/__generated__/DropERC721/write/setMaxTotalSupply.js.map +1 -0
  21. package/dist/esm/extensions/erc721/__generated__/DropERC721/write/updateBatchBaseURI.js +116 -0
  22. package/dist/esm/extensions/erc721/__generated__/DropERC721/write/updateBatchBaseURI.js.map +1 -0
  23. package/dist/esm/extensions/erc721/drops/write/updateMetadata.js +84 -0
  24. package/dist/esm/extensions/erc721/drops/write/updateMetadata.js.map +1 -0
  25. package/dist/esm/react/core/design-system/CustomThemeProvider.js +1 -6
  26. package/dist/esm/react/core/design-system/CustomThemeProvider.js.map +1 -1
  27. package/dist/esm/version.js +1 -1
  28. package/dist/esm/version.js.map +1 -1
  29. package/dist/types/exports/extensions/erc721.d.ts +1 -0
  30. package/dist/types/exports/extensions/erc721.d.ts.map +1 -1
  31. package/dist/types/extensions/erc721/__generated__/DropERC721/write/freezeBatchBaseURI.d.ts +80 -0
  32. package/dist/types/extensions/erc721/__generated__/DropERC721/write/freezeBatchBaseURI.d.ts.map +1 -0
  33. package/dist/types/extensions/erc721/__generated__/DropERC721/write/setMaxTotalSupply.d.ts +80 -0
  34. package/dist/types/extensions/erc721/__generated__/DropERC721/write/setMaxTotalSupply.d.ts.map +1 -0
  35. package/dist/types/extensions/erc721/__generated__/DropERC721/write/updateBatchBaseURI.d.ts +87 -0
  36. package/dist/types/extensions/erc721/__generated__/DropERC721/write/updateBatchBaseURI.d.ts.map +1 -0
  37. package/dist/types/extensions/erc721/drops/write/updateMetadata.d.ts +37 -0
  38. package/dist/types/extensions/erc721/drops/write/updateMetadata.d.ts.map +1 -0
  39. package/dist/types/react/core/design-system/CustomThemeProvider.d.ts.map +1 -1
  40. package/dist/types/version.d.ts +1 -1
  41. package/dist/types/version.d.ts.map +1 -1
  42. package/package.json +1 -1
  43. package/src/exports/extensions/erc721.ts +4 -0
  44. package/src/extensions/erc721/__generated__/DropERC721/write/freezeBatchBaseURI.ts +141 -0
  45. package/src/extensions/erc721/__generated__/DropERC721/write/setMaxTotalSupply.ts +144 -0
  46. package/src/extensions/erc721/__generated__/DropERC721/write/updateBatchBaseURI.ts +149 -0
  47. package/src/extensions/erc721/drops/write/updateMetadata.test.ts +127 -0
  48. package/src/extensions/erc721/drops/write/updateMetadata.ts +123 -0
  49. package/src/react/core/design-system/CustomThemeProvider.tsx +1 -6
  50. package/src/version.ts +1 -1
@@ -0,0 +1,80 @@
1
+ import type { AbiParameterToPrimitiveType } from "abitype";
2
+ import type { BaseTransactionOptions, WithOverrides } from "../../../../../transaction/types.js";
3
+ import type { ThirdwebContract } from "../../../../../contract/contract.js";
4
+ /**
5
+ * Represents the parameters for the "setMaxTotalSupply" function.
6
+ */
7
+ export type SetMaxTotalSupplyParams = WithOverrides<{
8
+ maxTotalSupply: AbiParameterToPrimitiveType<{
9
+ type: "uint256";
10
+ name: "_maxTotalSupply";
11
+ }>;
12
+ }>;
13
+ export declare const FN_SELECTOR: "0x3f3e4c11";
14
+ /**
15
+ * Checks if the `setMaxTotalSupply` method is supported by the given contract.
16
+ * @param contract The ThirdwebContract.
17
+ * @returns A promise that resolves to a boolean indicating if the `setMaxTotalSupply` method is supported.
18
+ * @extension ERC721
19
+ * @example
20
+ * ```ts
21
+ * import { isSetMaxTotalSupplySupported } from "thirdweb/extensions/erc721";
22
+ *
23
+ * const supported = await isSetMaxTotalSupplySupported(contract);
24
+ * ```
25
+ */
26
+ export declare function isSetMaxTotalSupplySupported(contract: ThirdwebContract<any>): Promise<boolean>;
27
+ /**
28
+ * Encodes the parameters for the "setMaxTotalSupply" function.
29
+ * @param options - The options for the setMaxTotalSupply function.
30
+ * @returns The encoded ABI parameters.
31
+ * @extension ERC721
32
+ * @example
33
+ * ```ts
34
+ * import { encodeSetMaxTotalSupplyParams } "thirdweb/extensions/erc721";
35
+ * const result = encodeSetMaxTotalSupplyParams({
36
+ * maxTotalSupply: ...,
37
+ * });
38
+ * ```
39
+ */
40
+ export declare function encodeSetMaxTotalSupplyParams(options: SetMaxTotalSupplyParams): `0x${string}`;
41
+ /**
42
+ * Encodes the "setMaxTotalSupply" function into a Hex string with its parameters.
43
+ * @param options - The options for the setMaxTotalSupply function.
44
+ * @returns The encoded hexadecimal string.
45
+ * @extension ERC721
46
+ * @example
47
+ * ```ts
48
+ * import { encodeSetMaxTotalSupply } "thirdweb/extensions/erc721";
49
+ * const result = encodeSetMaxTotalSupply({
50
+ * maxTotalSupply: ...,
51
+ * });
52
+ * ```
53
+ */
54
+ export declare function encodeSetMaxTotalSupply(options: SetMaxTotalSupplyParams): `0x3f3e4c11${string}`;
55
+ /**
56
+ * Prepares a transaction to call the "setMaxTotalSupply" function on the contract.
57
+ * @param options - The options for the "setMaxTotalSupply" function.
58
+ * @returns A prepared transaction object.
59
+ * @extension ERC721
60
+ * @example
61
+ * ```ts
62
+ * import { setMaxTotalSupply } from "thirdweb/extensions/erc721";
63
+ *
64
+ * const transaction = setMaxTotalSupply({
65
+ * contract,
66
+ * maxTotalSupply: ...,
67
+ * overrides: {
68
+ * ...
69
+ * }
70
+ * });
71
+ *
72
+ * // Send the transaction
73
+ * ...
74
+ *
75
+ * ```
76
+ */
77
+ export declare function setMaxTotalSupply(options: BaseTransactionOptions<SetMaxTotalSupplyParams | {
78
+ asyncParams: () => Promise<SetMaxTotalSupplyParams>;
79
+ }>): import("../../../../../transaction/prepare-transaction.js").PreparedTransaction<any, import("abitype").AbiFunction, import("../../../../../transaction/prepare-transaction.js").PrepareTransactionOptions>;
80
+ //# sourceMappingURL=setMaxTotalSupply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setMaxTotalSupply.d.ts","sourceRoot":"","sources":["../../../../../../../src/extensions/erc721/__generated__/DropERC721/write/setMaxTotalSupply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,KAAK,EACV,sBAAsB,EACtB,aAAa,EACd,MAAM,qCAAqC,CAAC;AAI7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAG5E;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,aAAa,CAAC;IAClD,cAAc,EAAE,2BAA2B,CAAC;QAC1C,IAAI,EAAE,SAAS,CAAC;QAChB,IAAI,EAAE,iBAAiB,CAAC;KACzB,CAAC,CAAC;CACJ,CAAC,CAAC;AAEH,eAAO,MAAM,WAAW,cAAwB,CAAC;AASjD;;;;;;;;;;;GAWG;AACH,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,gBAAgB,CAAC,GAAG,CAAC,oBAMhC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,uBAAuB,iBAGjC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,uBAAuB,yBAOvE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,sBAAsB,CAC3B,uBAAuB,GACvB;IACE,WAAW,EAAE,MAAM,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACrD,CACJ,8MAuBF"}
@@ -0,0 +1,87 @@
1
+ import type { AbiParameterToPrimitiveType } from "abitype";
2
+ import type { BaseTransactionOptions, WithOverrides } from "../../../../../transaction/types.js";
3
+ import type { ThirdwebContract } from "../../../../../contract/contract.js";
4
+ /**
5
+ * Represents the parameters for the "updateBatchBaseURI" function.
6
+ */
7
+ export type UpdateBatchBaseURIParams = WithOverrides<{
8
+ index: AbiParameterToPrimitiveType<{
9
+ type: "uint256";
10
+ name: "_index";
11
+ }>;
12
+ uri: AbiParameterToPrimitiveType<{
13
+ type: "string";
14
+ name: "_uri";
15
+ }>;
16
+ }>;
17
+ export declare const FN_SELECTOR: "0xde903ddd";
18
+ /**
19
+ * Checks if the `updateBatchBaseURI` method is supported by the given contract.
20
+ * @param contract The ThirdwebContract.
21
+ * @returns A promise that resolves to a boolean indicating if the `updateBatchBaseURI` method is supported.
22
+ * @extension ERC721
23
+ * @example
24
+ * ```ts
25
+ * import { isUpdateBatchBaseURISupported } from "thirdweb/extensions/erc721";
26
+ *
27
+ * const supported = await isUpdateBatchBaseURISupported(contract);
28
+ * ```
29
+ */
30
+ export declare function isUpdateBatchBaseURISupported(contract: ThirdwebContract<any>): Promise<boolean>;
31
+ /**
32
+ * Encodes the parameters for the "updateBatchBaseURI" function.
33
+ * @param options - The options for the updateBatchBaseURI function.
34
+ * @returns The encoded ABI parameters.
35
+ * @extension ERC721
36
+ * @example
37
+ * ```ts
38
+ * import { encodeUpdateBatchBaseURIParams } "thirdweb/extensions/erc721";
39
+ * const result = encodeUpdateBatchBaseURIParams({
40
+ * index: ...,
41
+ * uri: ...,
42
+ * });
43
+ * ```
44
+ */
45
+ export declare function encodeUpdateBatchBaseURIParams(options: UpdateBatchBaseURIParams): `0x${string}`;
46
+ /**
47
+ * Encodes the "updateBatchBaseURI" function into a Hex string with its parameters.
48
+ * @param options - The options for the updateBatchBaseURI function.
49
+ * @returns The encoded hexadecimal string.
50
+ * @extension ERC721
51
+ * @example
52
+ * ```ts
53
+ * import { encodeUpdateBatchBaseURI } "thirdweb/extensions/erc721";
54
+ * const result = encodeUpdateBatchBaseURI({
55
+ * index: ...,
56
+ * uri: ...,
57
+ * });
58
+ * ```
59
+ */
60
+ export declare function encodeUpdateBatchBaseURI(options: UpdateBatchBaseURIParams): `0xde903ddd${string}`;
61
+ /**
62
+ * Prepares a transaction to call the "updateBatchBaseURI" function on the contract.
63
+ * @param options - The options for the "updateBatchBaseURI" function.
64
+ * @returns A prepared transaction object.
65
+ * @extension ERC721
66
+ * @example
67
+ * ```ts
68
+ * import { updateBatchBaseURI } from "thirdweb/extensions/erc721";
69
+ *
70
+ * const transaction = updateBatchBaseURI({
71
+ * contract,
72
+ * index: ...,
73
+ * uri: ...,
74
+ * overrides: {
75
+ * ...
76
+ * }
77
+ * });
78
+ *
79
+ * // Send the transaction
80
+ * ...
81
+ *
82
+ * ```
83
+ */
84
+ export declare function updateBatchBaseURI(options: BaseTransactionOptions<UpdateBatchBaseURIParams | {
85
+ asyncParams: () => Promise<UpdateBatchBaseURIParams>;
86
+ }>): import("../../../../../transaction/prepare-transaction.js").PreparedTransaction<any, import("abitype").AbiFunction, import("../../../../../transaction/prepare-transaction.js").PrepareTransactionOptions>;
87
+ //# sourceMappingURL=updateBatchBaseURI.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateBatchBaseURI.d.ts","sourceRoot":"","sources":["../../../../../../../src/extensions/erc721/__generated__/DropERC721/write/updateBatchBaseURI.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,KAAK,EACV,sBAAsB,EACtB,aAAa,EACd,MAAM,qCAAqC,CAAC;AAI7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAG5E;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,aAAa,CAAC;IACnD,KAAK,EAAE,2BAA2B,CAAC;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC,CAAC;IACxE,GAAG,EAAE,2BAA2B,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpE,CAAC,CAAC;AAEH,eAAO,MAAM,WAAW,cAAwB,CAAC;AAajD;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CACjD,QAAQ,EAAE,gBAAgB,CAAC,GAAG,CAAC,oBAMhC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,wBAAwB,iBAGlC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,wBAAwB,yBAOzE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,sBAAsB,CAC3B,wBAAwB,GACxB;IACE,WAAW,EAAE,MAAM,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACtD,CACJ,8MAuBF"}
@@ -0,0 +1,37 @@
1
+ import type { ThirdwebClient } from "../../../../client/client.js";
2
+ import type { BaseTransactionOptions } from "../../../../transaction/types.js";
3
+ import type { NFTInput } from "../../../../utils/nft/parseNft.js";
4
+ import { type UpdateBatchBaseURIParams } from "../../__generated__/DropERC721/write/updateBatchBaseURI.js";
5
+ export type UpdateMetadataParams = {
6
+ targetTokenId: bigint;
7
+ newMetadata: NFTInput;
8
+ client: ThirdwebClient;
9
+ };
10
+ /**
11
+ * @internal
12
+ */
13
+ export declare function getUpdateMetadataParams(options: BaseTransactionOptions<UpdateMetadataParams>): Promise<UpdateBatchBaseURIParams>;
14
+ /**
15
+ * Update the metadata of the single token in an NFT Drop (DropERC721) collection
16
+ * For NFT Collection, please use `setTokenURI`
17
+ * @param options
18
+ * @returns the prepared transaction
19
+ * @extension ERC721
20
+ * @example
21
+ * ```ts
22
+ * import { updateMetadata } from "thirdweb/extensions/erc721";
23
+ *
24
+ * const transaction = updateMetadata({
25
+ * contract,
26
+ * targetTokenId: 0n,
27
+ * newMetadata: {
28
+ * name: "this is the new nft name",
29
+ * description: "...",
30
+ * image: "new image uri"
31
+ * // ...
32
+ * }
33
+ * });
34
+ * ```
35
+ */
36
+ export declare function updateMetadata(options: BaseTransactionOptions<UpdateMetadataParams>): import("../../../../transaction/prepare-transaction.js").PreparedTransaction<any, import("abitype").AbiFunction, import("../../../../transaction/prepare-transaction.js").PrepareTransactionOptions>;
37
+ //# sourceMappingURL=updateMetadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateMetadata.d.ts","sourceRoot":"","sources":["../../../../../../src/extensions/erc721/drops/write/updateMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,KAAK,EAAO,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EACL,KAAK,wBAAwB,EAE9B,MAAM,4DAA4D,CAAC;AAGpE,MAAM,MAAM,oBAAoB,GAAG;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,QAAQ,CAAC;IACtB,MAAM,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,GACpD,OAAO,CAAC,wBAAwB,CAAC,CAsEnC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,wMAOtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"CustomThemeProvider.d.ts","sourceRoot":"","sources":["../../../../../src/react/core/design-system/CustomThemeProvider.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,KAAK,EAA+B,MAAM,YAAY,CAAC;AAIrE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;CACjC,8CASA;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,CAc7E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAW3D;AAED;;;GAGG;AACH,wBAAgB,cAAc,UAE7B"}
1
+ {"version":3,"file":"CustomThemeProvider.d.ts","sourceRoot":"","sources":["../../../../../src/react/core/design-system/CustomThemeProvider.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,KAAK,EAA+B,MAAM,YAAY,CAAC;AAIrE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;CACjC,8CASA;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,CAc7E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAM3D;AAED;;;GAGG;AACH,wBAAgB,cAAc,UAE7B"}
@@ -1,2 +1,2 @@
1
- export declare const version = "5.29.4";
1
+ export declare const version = "5.29.5-nightly-2d7ebe2111d24448dd85ace25fc9fdbef987a57d-20240617204223";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,2EAA2E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thirdweb",
3
- "version": "5.29.4",
3
+ "version": "5.29.5-nightly-2d7ebe2111d24448dd85ace25fc9fdbef987a57d-20240617204223",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/thirdweb-dev/js.git#main"
@@ -163,3 +163,7 @@ export {
163
163
  type BatchToReveal,
164
164
  getBatchesToReveal,
165
165
  } from "../../extensions/erc721/lazyMinting/read/getBatchesToReveal.js";
166
+ export {
167
+ updateMetadata,
168
+ type UpdateMetadataParams,
169
+ } from "../../extensions/erc721/drops/write/updateMetadata.js";
@@ -0,0 +1,141 @@
1
+ import type { AbiParameterToPrimitiveType } from "abitype";
2
+ import type {
3
+ BaseTransactionOptions,
4
+ WithOverrides,
5
+ } from "../../../../../transaction/types.js";
6
+ import { prepareContractCall } from "../../../../../transaction/prepare-contract-call.js";
7
+ import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
8
+ import { once } from "../../../../../utils/promise/once.js";
9
+ import type { ThirdwebContract } from "../../../../../contract/contract.js";
10
+ import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
11
+
12
+ /**
13
+ * Represents the parameters for the "freezeBatchBaseURI" function.
14
+ */
15
+ export type FreezeBatchBaseURIParams = WithOverrides<{
16
+ index: AbiParameterToPrimitiveType<{ type: "uint256"; name: "_index" }>;
17
+ }>;
18
+
19
+ export const FN_SELECTOR = "0xa07ced9e" as const;
20
+ const FN_INPUTS = [
21
+ {
22
+ type: "uint256",
23
+ name: "_index",
24
+ },
25
+ ] as const;
26
+ const FN_OUTPUTS = [] as const;
27
+
28
+ /**
29
+ * Checks if the `freezeBatchBaseURI` method is supported by the given contract.
30
+ * @param contract The ThirdwebContract.
31
+ * @returns A promise that resolves to a boolean indicating if the `freezeBatchBaseURI` method is supported.
32
+ * @extension ERC721
33
+ * @example
34
+ * ```ts
35
+ * import { isFreezeBatchBaseURISupported } from "thirdweb/extensions/erc721";
36
+ *
37
+ * const supported = await isFreezeBatchBaseURISupported(contract);
38
+ * ```
39
+ */
40
+ export async function isFreezeBatchBaseURISupported(
41
+ contract: ThirdwebContract<any>,
42
+ ) {
43
+ return detectMethod({
44
+ contract,
45
+ method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
46
+ });
47
+ }
48
+
49
+ /**
50
+ * Encodes the parameters for the "freezeBatchBaseURI" function.
51
+ * @param options - The options for the freezeBatchBaseURI function.
52
+ * @returns The encoded ABI parameters.
53
+ * @extension ERC721
54
+ * @example
55
+ * ```ts
56
+ * import { encodeFreezeBatchBaseURIParams } "thirdweb/extensions/erc721";
57
+ * const result = encodeFreezeBatchBaseURIParams({
58
+ * index: ...,
59
+ * });
60
+ * ```
61
+ */
62
+ export function encodeFreezeBatchBaseURIParams(
63
+ options: FreezeBatchBaseURIParams,
64
+ ) {
65
+ return encodeAbiParameters(FN_INPUTS, [options.index]);
66
+ }
67
+
68
+ /**
69
+ * Encodes the "freezeBatchBaseURI" function into a Hex string with its parameters.
70
+ * @param options - The options for the freezeBatchBaseURI function.
71
+ * @returns The encoded hexadecimal string.
72
+ * @extension ERC721
73
+ * @example
74
+ * ```ts
75
+ * import { encodeFreezeBatchBaseURI } "thirdweb/extensions/erc721";
76
+ * const result = encodeFreezeBatchBaseURI({
77
+ * index: ...,
78
+ * });
79
+ * ```
80
+ */
81
+ export function encodeFreezeBatchBaseURI(options: FreezeBatchBaseURIParams) {
82
+ // we do a "manual" concat here to avoid the overhead of the "concatHex" function
83
+ // we can do this because we know the specific formats of the values
84
+ return (FN_SELECTOR +
85
+ encodeFreezeBatchBaseURIParams(options).slice(
86
+ 2,
87
+ )) as `${typeof FN_SELECTOR}${string}`;
88
+ }
89
+
90
+ /**
91
+ * Prepares a transaction to call the "freezeBatchBaseURI" function on the contract.
92
+ * @param options - The options for the "freezeBatchBaseURI" function.
93
+ * @returns A prepared transaction object.
94
+ * @extension ERC721
95
+ * @example
96
+ * ```ts
97
+ * import { freezeBatchBaseURI } from "thirdweb/extensions/erc721";
98
+ *
99
+ * const transaction = freezeBatchBaseURI({
100
+ * contract,
101
+ * index: ...,
102
+ * overrides: {
103
+ * ...
104
+ * }
105
+ * });
106
+ *
107
+ * // Send the transaction
108
+ * ...
109
+ *
110
+ * ```
111
+ */
112
+ export function freezeBatchBaseURI(
113
+ options: BaseTransactionOptions<
114
+ | FreezeBatchBaseURIParams
115
+ | {
116
+ asyncParams: () => Promise<FreezeBatchBaseURIParams>;
117
+ }
118
+ >,
119
+ ) {
120
+ const asyncOptions = once(async () => {
121
+ return "asyncParams" in options ? await options.asyncParams() : options;
122
+ });
123
+
124
+ return prepareContractCall({
125
+ contract: options.contract,
126
+ method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
127
+ params: async () => {
128
+ const resolvedOptions = await asyncOptions();
129
+ return [resolvedOptions.index] as const;
130
+ },
131
+ value: async () => (await asyncOptions()).overrides?.value,
132
+ accessList: async () => (await asyncOptions()).overrides?.accessList,
133
+ gas: async () => (await asyncOptions()).overrides?.gas,
134
+ gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
135
+ maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
136
+ maxPriorityFeePerGas: async () =>
137
+ (await asyncOptions()).overrides?.maxPriorityFeePerGas,
138
+ nonce: async () => (await asyncOptions()).overrides?.nonce,
139
+ extraGas: async () => (await asyncOptions()).overrides?.extraGas,
140
+ });
141
+ }
@@ -0,0 +1,144 @@
1
+ import type { AbiParameterToPrimitiveType } from "abitype";
2
+ import type {
3
+ BaseTransactionOptions,
4
+ WithOverrides,
5
+ } from "../../../../../transaction/types.js";
6
+ import { prepareContractCall } from "../../../../../transaction/prepare-contract-call.js";
7
+ import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
8
+ import { once } from "../../../../../utils/promise/once.js";
9
+ import type { ThirdwebContract } from "../../../../../contract/contract.js";
10
+ import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
11
+
12
+ /**
13
+ * Represents the parameters for the "setMaxTotalSupply" function.
14
+ */
15
+ export type SetMaxTotalSupplyParams = WithOverrides<{
16
+ maxTotalSupply: AbiParameterToPrimitiveType<{
17
+ type: "uint256";
18
+ name: "_maxTotalSupply";
19
+ }>;
20
+ }>;
21
+
22
+ export const FN_SELECTOR = "0x3f3e4c11" as const;
23
+ const FN_INPUTS = [
24
+ {
25
+ type: "uint256",
26
+ name: "_maxTotalSupply",
27
+ },
28
+ ] as const;
29
+ const FN_OUTPUTS = [] as const;
30
+
31
+ /**
32
+ * Checks if the `setMaxTotalSupply` method is supported by the given contract.
33
+ * @param contract The ThirdwebContract.
34
+ * @returns A promise that resolves to a boolean indicating if the `setMaxTotalSupply` method is supported.
35
+ * @extension ERC721
36
+ * @example
37
+ * ```ts
38
+ * import { isSetMaxTotalSupplySupported } from "thirdweb/extensions/erc721";
39
+ *
40
+ * const supported = await isSetMaxTotalSupplySupported(contract);
41
+ * ```
42
+ */
43
+ export async function isSetMaxTotalSupplySupported(
44
+ contract: ThirdwebContract<any>,
45
+ ) {
46
+ return detectMethod({
47
+ contract,
48
+ method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
49
+ });
50
+ }
51
+
52
+ /**
53
+ * Encodes the parameters for the "setMaxTotalSupply" function.
54
+ * @param options - The options for the setMaxTotalSupply function.
55
+ * @returns The encoded ABI parameters.
56
+ * @extension ERC721
57
+ * @example
58
+ * ```ts
59
+ * import { encodeSetMaxTotalSupplyParams } "thirdweb/extensions/erc721";
60
+ * const result = encodeSetMaxTotalSupplyParams({
61
+ * maxTotalSupply: ...,
62
+ * });
63
+ * ```
64
+ */
65
+ export function encodeSetMaxTotalSupplyParams(
66
+ options: SetMaxTotalSupplyParams,
67
+ ) {
68
+ return encodeAbiParameters(FN_INPUTS, [options.maxTotalSupply]);
69
+ }
70
+
71
+ /**
72
+ * Encodes the "setMaxTotalSupply" function into a Hex string with its parameters.
73
+ * @param options - The options for the setMaxTotalSupply function.
74
+ * @returns The encoded hexadecimal string.
75
+ * @extension ERC721
76
+ * @example
77
+ * ```ts
78
+ * import { encodeSetMaxTotalSupply } "thirdweb/extensions/erc721";
79
+ * const result = encodeSetMaxTotalSupply({
80
+ * maxTotalSupply: ...,
81
+ * });
82
+ * ```
83
+ */
84
+ export function encodeSetMaxTotalSupply(options: SetMaxTotalSupplyParams) {
85
+ // we do a "manual" concat here to avoid the overhead of the "concatHex" function
86
+ // we can do this because we know the specific formats of the values
87
+ return (FN_SELECTOR +
88
+ encodeSetMaxTotalSupplyParams(options).slice(
89
+ 2,
90
+ )) as `${typeof FN_SELECTOR}${string}`;
91
+ }
92
+
93
+ /**
94
+ * Prepares a transaction to call the "setMaxTotalSupply" function on the contract.
95
+ * @param options - The options for the "setMaxTotalSupply" function.
96
+ * @returns A prepared transaction object.
97
+ * @extension ERC721
98
+ * @example
99
+ * ```ts
100
+ * import { setMaxTotalSupply } from "thirdweb/extensions/erc721";
101
+ *
102
+ * const transaction = setMaxTotalSupply({
103
+ * contract,
104
+ * maxTotalSupply: ...,
105
+ * overrides: {
106
+ * ...
107
+ * }
108
+ * });
109
+ *
110
+ * // Send the transaction
111
+ * ...
112
+ *
113
+ * ```
114
+ */
115
+ export function setMaxTotalSupply(
116
+ options: BaseTransactionOptions<
117
+ | SetMaxTotalSupplyParams
118
+ | {
119
+ asyncParams: () => Promise<SetMaxTotalSupplyParams>;
120
+ }
121
+ >,
122
+ ) {
123
+ const asyncOptions = once(async () => {
124
+ return "asyncParams" in options ? await options.asyncParams() : options;
125
+ });
126
+
127
+ return prepareContractCall({
128
+ contract: options.contract,
129
+ method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
130
+ params: async () => {
131
+ const resolvedOptions = await asyncOptions();
132
+ return [resolvedOptions.maxTotalSupply] as const;
133
+ },
134
+ value: async () => (await asyncOptions()).overrides?.value,
135
+ accessList: async () => (await asyncOptions()).overrides?.accessList,
136
+ gas: async () => (await asyncOptions()).overrides?.gas,
137
+ gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
138
+ maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
139
+ maxPriorityFeePerGas: async () =>
140
+ (await asyncOptions()).overrides?.maxPriorityFeePerGas,
141
+ nonce: async () => (await asyncOptions()).overrides?.nonce,
142
+ extraGas: async () => (await asyncOptions()).overrides?.extraGas,
143
+ });
144
+ }