Skip to content

Commit 42a313f

Browse files
committed
[SDK/Dashboard] Fix: Deploy specified version of published contracts (#5923)
TOOL-3013 TOOL-3014 ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on updating the deployment process for contracts in the `thirdweb` package, including changes to version handling and contract IDs. ### Detailed summary - Updated `version` handling in the `custom-contract.tsx` file. - Changed `contractId` from `"Forwarder"` to `"ForwarderEOAOnly"` in `deploy-pack.ts`. - Added `version` to the options in `deployMarketplaceContract`. - Modified `getAllDefaultConstructorParamsForImplementation` to use a dynamic `contractId`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 7fb5ce1 commit 42a313f

File tree

6 files changed

+19
-3
lines changed

6 files changed

+19
-3
lines changed

.changeset/breezy-items-relate.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Fix deploy version for published contracts

apps/dashboard/src/components/contract-components/contract-deploy-form/custom-contract.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
447447
? JSON.parse(params.deployParams._trustedForwarders as string)
448448
: undefined,
449449
},
450+
version: metadata.version,
450451
});
451452
}
452453

packages/thirdweb/src/extensions/prebuilts/deploy-marketplace.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export type MarketplaceContractParams = {
3636
export type DeployMarketplaceContractOptions = Prettify<
3737
ClientAndChainAndAccount & {
3838
params: MarketplaceContractParams;
39+
} & {
40+
version?: string;
3941
}
4042
>;
4143

@@ -46,7 +48,7 @@ export type DeployMarketplaceContractOptions = Prettify<
4648
export async function deployMarketplaceContract(
4749
options: DeployMarketplaceContractOptions,
4850
) {
49-
const { chain, client, account, params } = options;
51+
const { chain, client, account, params, version } = options;
5052
const WETH = await getOrDeployInfraContract({
5153
chain,
5254
client,
@@ -127,6 +129,7 @@ export async function deployMarketplaceContract(
127129
nativeTokenWrapper: WETH.address,
128130
} as MarketplaceConstructorParams[number],
129131
},
132+
version,
130133
});
131134

132135
const initializeTransaction = await getInitializeTransaction({

packages/thirdweb/src/extensions/prebuilts/deploy-pack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export async function deployPackContract(options: DeployPackContractOptions) {
8888
chain,
8989
client,
9090
account,
91-
contractId: "Forwarder",
91+
contractId: "ForwarderEOAOnly",
9292
}),
9393
]);
9494
const { cloneFactoryContract, implementationContract } =

packages/thirdweb/src/extensions/prebuilts/deploy-published.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,10 @@ export async function deployContractfromDeployMetadata(
211211
(await getAllDefaultConstructorParamsForImplementation({
212212
chain,
213213
client,
214+
contractId: deployMetadata.name,
214215
})),
215216
publisher: deployMetadata.publisher,
217+
version: deployMetadata.version,
216218
});
217219

218220
const initializeTransaction = await getInitializeTransaction({

packages/thirdweb/src/extensions/prebuilts/get-required-transactions.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ async function getTransactionsForImplementation(options: {
136136
(await getAllDefaultConstructorParamsForImplementation({
137137
chain,
138138
client,
139+
contractId: deployMetadata.name,
139140
}));
140141

141142
const result = await getDeployedInfraContract({
@@ -224,6 +225,7 @@ async function getTransactionsForMaketplaceV3(options: {
224225
export async function getAllDefaultConstructorParamsForImplementation(args: {
225226
chain: Chain;
226227
client: ThirdwebClient;
228+
contractId: string;
227229
}) {
228230
const { chain, client } = args;
229231
const isZkSync = await isZkSyncChain(chain);
@@ -234,11 +236,14 @@ export async function getAllDefaultConstructorParamsForImplementation(args: {
234236
nativeTokenWrapper: weth,
235237
};
236238
}
239+
240+
const forwarderContractId =
241+
args.contractId === "Pack" ? "ForwarderEOAOnly" : "Forwarder";
237242
const [forwarder, weth] = await Promise.all([
238243
computePublishedContractAddress({
239244
chain,
240245
client,
241-
contractId: "Forwarder",
246+
contractId: forwarderContractId,
242247
}),
243248
computePublishedContractAddress({
244249
chain,

0 commit comments

Comments
 (0)