thirdweb 5.93.5-nightly-b51157c0ff17e9535029fc8790cfa8538d1c995f-20250326000337 → 5.93.5-nightly-cff2481c06e2cdafec85da9d82df81641878957f-20250326041520

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 (45) hide show
  1. package/dist/cjs/exports/extensions/dynamic-contracts.js +11 -0
  2. package/dist/cjs/exports/extensions/dynamic-contracts.js.map +1 -0
  3. package/dist/cjs/extensions/dynamic-contracts/__generated__/IExtensionManager/write/addExtension.js +151 -0
  4. package/dist/cjs/extensions/dynamic-contracts/__generated__/IExtensionManager/write/addExtension.js.map +1 -0
  5. package/dist/cjs/extensions/dynamic-contracts/__generated__/IExtensionManager/write/removeExtension.js +117 -0
  6. package/dist/cjs/extensions/dynamic-contracts/__generated__/IExtensionManager/write/removeExtension.js.map +1 -0
  7. package/dist/cjs/extensions/dynamic-contracts/write/installPublishedExtension.js +60 -0
  8. package/dist/cjs/extensions/dynamic-contracts/write/installPublishedExtension.js.map +1 -0
  9. package/dist/cjs/extensions/dynamic-contracts/write/uninstallExtension.js +29 -0
  10. package/dist/cjs/extensions/dynamic-contracts/write/uninstallExtension.js.map +1 -0
  11. package/dist/cjs/version.js +1 -1
  12. package/dist/esm/exports/extensions/dynamic-contracts.js +6 -0
  13. package/dist/esm/exports/extensions/dynamic-contracts.js.map +1 -0
  14. package/dist/esm/extensions/dynamic-contracts/__generated__/IExtensionManager/write/addExtension.js +144 -0
  15. package/dist/esm/extensions/dynamic-contracts/__generated__/IExtensionManager/write/addExtension.js.map +1 -0
  16. package/dist/esm/extensions/dynamic-contracts/__generated__/IExtensionManager/write/removeExtension.js +110 -0
  17. package/dist/esm/extensions/dynamic-contracts/__generated__/IExtensionManager/write/removeExtension.js.map +1 -0
  18. package/dist/esm/extensions/dynamic-contracts/write/installPublishedExtension.js +57 -0
  19. package/dist/esm/extensions/dynamic-contracts/write/installPublishedExtension.js.map +1 -0
  20. package/dist/esm/extensions/dynamic-contracts/write/uninstallExtension.js +26 -0
  21. package/dist/esm/extensions/dynamic-contracts/write/uninstallExtension.js.map +1 -0
  22. package/dist/esm/version.js +1 -1
  23. package/dist/types/exports/extensions/dynamic-contracts.d.ts +6 -0
  24. package/dist/types/exports/extensions/dynamic-contracts.d.ts.map +1 -0
  25. package/dist/types/extensions/dynamic-contracts/__generated__/IExtensionManager/write/addExtension.d.ts +113 -0
  26. package/dist/types/extensions/dynamic-contracts/__generated__/IExtensionManager/write/addExtension.d.ts.map +1 -0
  27. package/dist/types/extensions/dynamic-contracts/__generated__/IExtensionManager/write/removeExtension.d.ts +79 -0
  28. package/dist/types/extensions/dynamic-contracts/__generated__/IExtensionManager/write/removeExtension.d.ts.map +1 -0
  29. package/dist/types/extensions/dynamic-contracts/write/installPublishedExtension.d.ts +30 -0
  30. package/dist/types/extensions/dynamic-contracts/write/installPublishedExtension.d.ts.map +1 -0
  31. package/dist/types/extensions/dynamic-contracts/write/uninstallExtension.d.ts +26 -0
  32. package/dist/types/extensions/dynamic-contracts/write/uninstallExtension.d.ts.map +1 -0
  33. package/dist/types/extensions/prebuilts/get-required-transactions.d.ts +2 -2
  34. package/dist/types/extensions/prebuilts/get-required-transactions.d.ts.map +1 -1
  35. package/dist/types/version.d.ts +1 -1
  36. package/package.json +1 -1
  37. package/src/exports/extensions/dynamic-contracts.ts +11 -0
  38. package/src/extensions/dynamic-contracts/__generated__/IExtensionManager/write/addExtension.ts +193 -0
  39. package/src/extensions/dynamic-contracts/__generated__/IExtensionManager/write/removeExtension.ts +140 -0
  40. package/src/extensions/dynamic-contracts/write/installPublishedExtension.test.ts +61 -0
  41. package/src/extensions/dynamic-contracts/write/installPublishedExtension.ts +85 -0
  42. package/src/extensions/dynamic-contracts/write/uninstallExtension.test.ts +64 -0
  43. package/src/extensions/dynamic-contracts/write/uninstallExtension.ts +35 -0
  44. package/src/extensions/prebuilts/get-required-transactions.ts +1 -1
  45. package/src/version.ts +1 -1
@@ -0,0 +1,193 @@
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 { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
10
+
11
+ /**
12
+ * Represents the parameters for the "addExtension" function.
13
+ */
14
+ export type AddExtensionParams = WithOverrides<{
15
+ extension: AbiParameterToPrimitiveType<{
16
+ type: "tuple";
17
+ name: "extension";
18
+ components: [
19
+ {
20
+ type: "tuple";
21
+ name: "metadata";
22
+ components: [
23
+ { type: "string"; name: "name" },
24
+ { type: "string"; name: "metadataURI" },
25
+ { type: "address"; name: "implementation" },
26
+ ];
27
+ },
28
+ {
29
+ type: "tuple[]";
30
+ name: "functions";
31
+ components: [
32
+ { type: "bytes4"; name: "functionSelector" },
33
+ { type: "string"; name: "functionSignature" },
34
+ ];
35
+ },
36
+ ];
37
+ }>;
38
+ }>;
39
+
40
+ export const FN_SELECTOR = "0xe05688fe" as const;
41
+ const FN_INPUTS = [
42
+ {
43
+ type: "tuple",
44
+ name: "extension",
45
+ components: [
46
+ {
47
+ type: "tuple",
48
+ name: "metadata",
49
+ components: [
50
+ {
51
+ type: "string",
52
+ name: "name",
53
+ },
54
+ {
55
+ type: "string",
56
+ name: "metadataURI",
57
+ },
58
+ {
59
+ type: "address",
60
+ name: "implementation",
61
+ },
62
+ ],
63
+ },
64
+ {
65
+ type: "tuple[]",
66
+ name: "functions",
67
+ components: [
68
+ {
69
+ type: "bytes4",
70
+ name: "functionSelector",
71
+ },
72
+ {
73
+ type: "string",
74
+ name: "functionSignature",
75
+ },
76
+ ],
77
+ },
78
+ ],
79
+ },
80
+ ] as const;
81
+ const FN_OUTPUTS = [] as const;
82
+
83
+ /**
84
+ * Checks if the `addExtension` method is supported by the given contract.
85
+ * @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.
86
+ * @returns A boolean indicating if the `addExtension` method is supported.
87
+ * @extension DYNAMIC-CONTRACTS
88
+ * @example
89
+ * ```ts
90
+ * import { isAddExtensionSupported } from "thirdweb/extensions/dynamic-contracts";
91
+ *
92
+ * const supported = isAddExtensionSupported(["0x..."]);
93
+ * ```
94
+ */
95
+ export function isAddExtensionSupported(availableSelectors: string[]) {
96
+ return detectMethod({
97
+ availableSelectors,
98
+ method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
99
+ });
100
+ }
101
+
102
+ /**
103
+ * Encodes the parameters for the "addExtension" function.
104
+ * @param options - The options for the addExtension function.
105
+ * @returns The encoded ABI parameters.
106
+ * @extension DYNAMIC-CONTRACTS
107
+ * @example
108
+ * ```ts
109
+ * import { encodeAddExtensionParams } from "thirdweb/extensions/dynamic-contracts";
110
+ * const result = encodeAddExtensionParams({
111
+ * extension: ...,
112
+ * });
113
+ * ```
114
+ */
115
+ export function encodeAddExtensionParams(options: AddExtensionParams) {
116
+ return encodeAbiParameters(FN_INPUTS, [options.extension]);
117
+ }
118
+
119
+ /**
120
+ * Encodes the "addExtension" function into a Hex string with its parameters.
121
+ * @param options - The options for the addExtension function.
122
+ * @returns The encoded hexadecimal string.
123
+ * @extension DYNAMIC-CONTRACTS
124
+ * @example
125
+ * ```ts
126
+ * import { encodeAddExtension } from "thirdweb/extensions/dynamic-contracts";
127
+ * const result = encodeAddExtension({
128
+ * extension: ...,
129
+ * });
130
+ * ```
131
+ */
132
+ export function encodeAddExtension(options: AddExtensionParams) {
133
+ // we do a "manual" concat here to avoid the overhead of the "concatHex" function
134
+ // we can do this because we know the specific formats of the values
135
+ return (FN_SELECTOR +
136
+ encodeAddExtensionParams(options).slice(
137
+ 2,
138
+ )) as `${typeof FN_SELECTOR}${string}`;
139
+ }
140
+
141
+ /**
142
+ * Prepares a transaction to call the "addExtension" function on the contract.
143
+ * @param options - The options for the "addExtension" function.
144
+ * @returns A prepared transaction object.
145
+ * @extension DYNAMIC-CONTRACTS
146
+ * @example
147
+ * ```ts
148
+ * import { sendTransaction } from "thirdweb";
149
+ * import { addExtension } from "thirdweb/extensions/dynamic-contracts";
150
+ *
151
+ * const transaction = addExtension({
152
+ * contract,
153
+ * extension: ...,
154
+ * overrides: {
155
+ * ...
156
+ * }
157
+ * });
158
+ *
159
+ * // Send the transaction
160
+ * await sendTransaction({ transaction, account });
161
+ * ```
162
+ */
163
+ export function addExtension(
164
+ options: BaseTransactionOptions<
165
+ | AddExtensionParams
166
+ | {
167
+ asyncParams: () => Promise<AddExtensionParams>;
168
+ }
169
+ >,
170
+ ) {
171
+ const asyncOptions = once(async () => {
172
+ return "asyncParams" in options ? await options.asyncParams() : options;
173
+ });
174
+
175
+ return prepareContractCall({
176
+ contract: options.contract,
177
+ method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
178
+ params: async () => {
179
+ const resolvedOptions = await asyncOptions();
180
+ return [resolvedOptions.extension] as const;
181
+ },
182
+ value: async () => (await asyncOptions()).overrides?.value,
183
+ accessList: async () => (await asyncOptions()).overrides?.accessList,
184
+ gas: async () => (await asyncOptions()).overrides?.gas,
185
+ gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
186
+ maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
187
+ maxPriorityFeePerGas: async () =>
188
+ (await asyncOptions()).overrides?.maxPriorityFeePerGas,
189
+ nonce: async () => (await asyncOptions()).overrides?.nonce,
190
+ extraGas: async () => (await asyncOptions()).overrides?.extraGas,
191
+ erc20Value: async () => (await asyncOptions()).overrides?.erc20Value,
192
+ });
193
+ }
@@ -0,0 +1,140 @@
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 { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
10
+
11
+ /**
12
+ * Represents the parameters for the "removeExtension" function.
13
+ */
14
+ export type RemoveExtensionParams = WithOverrides<{
15
+ extensionName: AbiParameterToPrimitiveType<{
16
+ type: "string";
17
+ name: "extensionName";
18
+ }>;
19
+ }>;
20
+
21
+ export const FN_SELECTOR = "0xee7d2adf" as const;
22
+ const FN_INPUTS = [
23
+ {
24
+ type: "string",
25
+ name: "extensionName",
26
+ },
27
+ ] as const;
28
+ const FN_OUTPUTS = [] as const;
29
+
30
+ /**
31
+ * Checks if the `removeExtension` method is supported by the given contract.
32
+ * @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.
33
+ * @returns A boolean indicating if the `removeExtension` method is supported.
34
+ * @extension DYNAMIC-CONTRACTS
35
+ * @example
36
+ * ```ts
37
+ * import { isRemoveExtensionSupported } from "thirdweb/extensions/dynamic-contracts";
38
+ *
39
+ * const supported = isRemoveExtensionSupported(["0x..."]);
40
+ * ```
41
+ */
42
+ export function isRemoveExtensionSupported(availableSelectors: string[]) {
43
+ return detectMethod({
44
+ availableSelectors,
45
+ method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
46
+ });
47
+ }
48
+
49
+ /**
50
+ * Encodes the parameters for the "removeExtension" function.
51
+ * @param options - The options for the removeExtension function.
52
+ * @returns The encoded ABI parameters.
53
+ * @extension DYNAMIC-CONTRACTS
54
+ * @example
55
+ * ```ts
56
+ * import { encodeRemoveExtensionParams } from "thirdweb/extensions/dynamic-contracts";
57
+ * const result = encodeRemoveExtensionParams({
58
+ * extensionName: ...,
59
+ * });
60
+ * ```
61
+ */
62
+ export function encodeRemoveExtensionParams(options: RemoveExtensionParams) {
63
+ return encodeAbiParameters(FN_INPUTS, [options.extensionName]);
64
+ }
65
+
66
+ /**
67
+ * Encodes the "removeExtension" function into a Hex string with its parameters.
68
+ * @param options - The options for the removeExtension function.
69
+ * @returns The encoded hexadecimal string.
70
+ * @extension DYNAMIC-CONTRACTS
71
+ * @example
72
+ * ```ts
73
+ * import { encodeRemoveExtension } from "thirdweb/extensions/dynamic-contracts";
74
+ * const result = encodeRemoveExtension({
75
+ * extensionName: ...,
76
+ * });
77
+ * ```
78
+ */
79
+ export function encodeRemoveExtension(options: RemoveExtensionParams) {
80
+ // we do a "manual" concat here to avoid the overhead of the "concatHex" function
81
+ // we can do this because we know the specific formats of the values
82
+ return (FN_SELECTOR +
83
+ encodeRemoveExtensionParams(options).slice(
84
+ 2,
85
+ )) as `${typeof FN_SELECTOR}${string}`;
86
+ }
87
+
88
+ /**
89
+ * Prepares a transaction to call the "removeExtension" function on the contract.
90
+ * @param options - The options for the "removeExtension" function.
91
+ * @returns A prepared transaction object.
92
+ * @extension DYNAMIC-CONTRACTS
93
+ * @example
94
+ * ```ts
95
+ * import { sendTransaction } from "thirdweb";
96
+ * import { removeExtension } from "thirdweb/extensions/dynamic-contracts";
97
+ *
98
+ * const transaction = removeExtension({
99
+ * contract,
100
+ * extensionName: ...,
101
+ * overrides: {
102
+ * ...
103
+ * }
104
+ * });
105
+ *
106
+ * // Send the transaction
107
+ * await sendTransaction({ transaction, account });
108
+ * ```
109
+ */
110
+ export function removeExtension(
111
+ options: BaseTransactionOptions<
112
+ | RemoveExtensionParams
113
+ | {
114
+ asyncParams: () => Promise<RemoveExtensionParams>;
115
+ }
116
+ >,
117
+ ) {
118
+ const asyncOptions = once(async () => {
119
+ return "asyncParams" in options ? await options.asyncParams() : options;
120
+ });
121
+
122
+ return prepareContractCall({
123
+ contract: options.contract,
124
+ method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
125
+ params: async () => {
126
+ const resolvedOptions = await asyncOptions();
127
+ return [resolvedOptions.extensionName] as const;
128
+ },
129
+ value: async () => (await asyncOptions()).overrides?.value,
130
+ accessList: async () => (await asyncOptions()).overrides?.accessList,
131
+ gas: async () => (await asyncOptions()).overrides?.gas,
132
+ gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
133
+ maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
134
+ maxPriorityFeePerGas: async () =>
135
+ (await asyncOptions()).overrides?.maxPriorityFeePerGas,
136
+ nonce: async () => (await asyncOptions()).overrides?.nonce,
137
+ extraGas: async () => (await asyncOptions()).overrides?.extraGas,
138
+ erc20Value: async () => (await asyncOptions()).overrides?.erc20Value,
139
+ });
140
+ }
@@ -0,0 +1,61 @@
1
+ import { describe, expect, it } from "vitest";
2
+
3
+ import { readContract } from "src/transaction/read-contract.js";
4
+ import { resolveMethod } from "src/transaction/resolve-method.js";
5
+ import { ANVIL_CHAIN } from "../../../../test/src/chains.js";
6
+ import { TEST_CLIENT } from "../../../../test/src/test-clients.js";
7
+ import { TEST_ACCOUNT_A } from "../../../../test/src/test-wallets.js";
8
+ import { getContract } from "../../../contract/contract.js";
9
+ import { deployCloneFactory } from "../../../contract/deployment/utils/bootstrap.js";
10
+ import { deployPublishedContract } from "../../../extensions/prebuilts/deploy-published.js";
11
+ import { sendTransaction } from "../../../transaction/actions/send-transaction.js";
12
+ import { installPublishedExtension } from "./installPublishedExtension.js";
13
+
14
+ describe.runIf(process.env.TW_SECRET_KEY)("install extension", () => {
15
+ it.sequential("should install extension to a dynamic contract", async () => {
16
+ await deployCloneFactory({
17
+ chain: ANVIL_CHAIN,
18
+ client: TEST_CLIENT,
19
+ account: TEST_ACCOUNT_A,
20
+ });
21
+
22
+ const deployed = await deployPublishedContract({
23
+ chain: ANVIL_CHAIN,
24
+ client: TEST_CLIENT,
25
+ account: TEST_ACCOUNT_A,
26
+ contractId: "EvolvingNFT",
27
+ contractParams: {
28
+ name: "Evolving nft",
29
+ symbol: "ENFT",
30
+ defaultAdmin: TEST_ACCOUNT_A.address,
31
+ royaltyBps: 0n,
32
+ royaltyRecipient: TEST_ACCOUNT_A.address,
33
+ saleRecipient: TEST_ACCOUNT_A.address,
34
+ trustedForwarders: [],
35
+ contractURI: "",
36
+ },
37
+ });
38
+
39
+ const contract = getContract({
40
+ chain: ANVIL_CHAIN,
41
+ client: TEST_CLIENT,
42
+ address: deployed,
43
+ });
44
+
45
+ const transaction = installPublishedExtension({
46
+ account: TEST_ACCOUNT_A,
47
+ contract,
48
+ extensionName: "DirectListingsLogic",
49
+ });
50
+
51
+ await sendTransaction({ transaction, account: TEST_ACCOUNT_A });
52
+
53
+ const extensions = await readContract({
54
+ contract,
55
+ method: resolveMethod("getAllExtensions"),
56
+ params: [],
57
+ });
58
+
59
+ expect(extensions.length).toEqual(4);
60
+ });
61
+ });
@@ -0,0 +1,85 @@
1
+ import { resolveContractAbi } from "../../../contract/actions/resolve-abi.js";
2
+ import type { ThirdwebContract } from "../../../contract/contract.js";
3
+ import { getOrDeployInfraForPublishedContract } from "../../../contract/deployment/utils/bootstrap.js";
4
+ import {
5
+ generateExtensionFunctionsFromAbi,
6
+ getAllDefaultConstructorParamsForImplementation,
7
+ } from "../../../extensions/prebuilts/get-required-transactions.js";
8
+ import type { Account } from "../../../wallets/interfaces/wallet.js";
9
+ import { addExtension } from "../__generated__/IExtensionManager/write/addExtension.js";
10
+
11
+ export type InstallPublishedExtensionOptions = {
12
+ account: Account;
13
+ contract: ThirdwebContract;
14
+ extensionName: string;
15
+ publisher?: string;
16
+ version?: string;
17
+ constructorParams?: Record<string, unknown>;
18
+ };
19
+
20
+ /**
21
+ * Install a published extension on a dynamic contract
22
+ * @param options - The options for installing a published extension
23
+ * @returns A prepared transaction to send
24
+ * @example
25
+ * ```ts
26
+ * import { installPublishedExtension } from "thirdweb/dynamic-contracts";
27
+ * const transaction = installPublishedExtension({
28
+ * client,
29
+ * chain,
30
+ * account,
31
+ * contract,
32
+ * extensionName: "MyExtension",
33
+ * publisherAddress: "0x...",
34
+ * });
35
+ * await sendTransaction({ transaction, account });
36
+ * ```
37
+ */
38
+ export function installPublishedExtension(
39
+ options: InstallPublishedExtensionOptions,
40
+ ) {
41
+ const {
42
+ account,
43
+ contract,
44
+ extensionName,
45
+ constructorParams,
46
+ publisher,
47
+ version,
48
+ } = options;
49
+
50
+ return addExtension({
51
+ contract,
52
+ asyncParams: async () => {
53
+ const deployedExtension = await getOrDeployInfraForPublishedContract({
54
+ chain: contract.chain,
55
+ client: contract.client,
56
+ account,
57
+ contractId: extensionName,
58
+ constructorParams:
59
+ constructorParams ||
60
+ (await getAllDefaultConstructorParamsForImplementation({
61
+ chain: contract.chain,
62
+ client: contract.client,
63
+ contractId: extensionName,
64
+ })),
65
+ publisher,
66
+ version,
67
+ });
68
+
69
+ const abi = await resolveContractAbi(
70
+ deployedExtension.implementationContract,
71
+ );
72
+ const functions = generateExtensionFunctionsFromAbi(abi);
73
+ return {
74
+ extension: {
75
+ metadata: {
76
+ name: extensionName,
77
+ metadataURI: "",
78
+ implementation: deployedExtension.implementationContract.address,
79
+ },
80
+ functions,
81
+ },
82
+ };
83
+ },
84
+ });
85
+ }
@@ -0,0 +1,64 @@
1
+ import { describe, expect, it } from "vitest";
2
+
3
+ import { readContract } from "src/transaction/read-contract.js";
4
+ import { resolveMethod } from "src/transaction/resolve-method.js";
5
+ import { ANVIL_CHAIN } from "../../../../test/src/chains.js";
6
+ import { TEST_CLIENT } from "../../../../test/src/test-clients.js";
7
+ import { TEST_ACCOUNT_A } from "../../../../test/src/test-wallets.js";
8
+ import { getContract } from "../../../contract/contract.js";
9
+ import { deployCloneFactory } from "../../../contract/deployment/utils/bootstrap.js";
10
+ import { sendTransaction } from "../../../transaction/actions/send-transaction.js";
11
+ import { deployPublishedContract } from "../../prebuilts/deploy-published.js";
12
+ import { uninstallExtension } from "./uninstallExtension.js";
13
+
14
+ describe.runIf(process.env.TW_SECRET_KEY)("uninstall extension", () => {
15
+ it.sequential(
16
+ "should uninstall extension from a dynamic contract",
17
+ async () => {
18
+ await deployCloneFactory({
19
+ chain: ANVIL_CHAIN,
20
+ client: TEST_CLIENT,
21
+ account: TEST_ACCOUNT_A,
22
+ });
23
+
24
+ const deployed = await deployPublishedContract({
25
+ chain: ANVIL_CHAIN,
26
+ client: TEST_CLIENT,
27
+ account: TEST_ACCOUNT_A,
28
+ contractId: "EvolvingNFT",
29
+ contractParams: {
30
+ name: "Evolving nft",
31
+ symbol: "ENFT",
32
+ defaultAdmin: TEST_ACCOUNT_A.address,
33
+ royaltyBps: 0n,
34
+ royaltyRecipient: TEST_ACCOUNT_A.address,
35
+ saleRecipient: TEST_ACCOUNT_A.address,
36
+ trustedForwarders: [],
37
+ contractURI: "",
38
+ },
39
+ });
40
+
41
+ const contract = getContract({
42
+ chain: ANVIL_CHAIN,
43
+ client: TEST_CLIENT,
44
+ address: deployed,
45
+ });
46
+
47
+ const transaction = uninstallExtension({
48
+ account: TEST_ACCOUNT_A,
49
+ contract,
50
+ extensionName: "EvolvingNFTLogic",
51
+ });
52
+
53
+ await sendTransaction({ transaction, account: TEST_ACCOUNT_A });
54
+
55
+ const extensions = await readContract({
56
+ contract,
57
+ method: resolveMethod("getAllExtensions"),
58
+ params: [],
59
+ });
60
+
61
+ expect(extensions.length).toEqual(2);
62
+ },
63
+ );
64
+ });
@@ -0,0 +1,35 @@
1
+ import type { ThirdwebContract } from "../../../contract/contract.js";
2
+ import type { Account } from "../../../wallets/interfaces/wallet.js";
3
+ import { removeExtension } from "../__generated__/IExtensionManager/write/removeExtension.js";
4
+
5
+ export type UninstallExtensionOptions = {
6
+ account: Account;
7
+ contract: ThirdwebContract;
8
+ extensionName: string;
9
+ };
10
+
11
+ /**
12
+ * Uninstall an extension on a dynamic contract
13
+ * @param options - The options for uninstalling an extension
14
+ * @returns A prepared transaction to send
15
+ * @example
16
+ * ```ts
17
+ * import { uninstallExtension } from "thirdweb/dynamic-contracts";
18
+ * const transaction = uninstallExtension({
19
+ * client,
20
+ * chain,
21
+ * account,
22
+ * contract,
23
+ * extensionName: "MyExtension",
24
+ * });
25
+ * await sendTransaction({ transaction, account });
26
+ * ```
27
+ */
28
+ export function uninstallExtension(options: UninstallExtensionOptions) {
29
+ const { contract, extensionName } = options;
30
+
31
+ return removeExtension({
32
+ contract,
33
+ extensionName,
34
+ });
35
+ }
@@ -382,7 +382,7 @@ async function generateExtensionInput(args: {
382
382
  }
383
383
 
384
384
  export function generateExtensionFunctionsFromAbi(abi: Abi): Array<{
385
- functionSelector: string;
385
+ functionSelector: `0x${string}`;
386
386
  functionSignature: string;
387
387
  }> {
388
388
  const functions = abi.filter(
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.93.5-nightly-b51157c0ff17e9535029fc8790cfa8538d1c995f-20250326000337";
1
+ export const version = "5.93.5-nightly-cff2481c06e2cdafec85da9d82df81641878957f-20250326041520";