@@ -26,27 +26,16 @@ import { CircleAlertIcon, ExternalLinkIcon, InfoIcon } from "lucide-react";
2626import Link from "next/link" ;
2727import { useCallback , useMemo } from "react" ;
2828import { FormProvider , type UseFormReturn , useForm } from "react-hook-form" ;
29- import {
30- ZERO_ADDRESS ,
31- getContract ,
32- sendTransaction ,
33- waitForReceipt ,
34- } from "thirdweb" ;
29+ import { ZERO_ADDRESS , getContract } from "thirdweb" ;
3530import type { FetchDeployMetadataResult } from "thirdweb/contract" ;
3631import {
3732 deployContractfromDeployMetadata ,
3833 deployMarketplaceContract ,
3934 getRequiredTransactions ,
4035} from "thirdweb/deploys" ;
41- import { installPublishedModule } from "thirdweb/modules" ;
4236import { useActiveAccount , useActiveWalletChain } from "thirdweb/react" ;
4337import { upload } from "thirdweb/storage" ;
44- import {
45- type AbiFunction ,
46- concatHex ,
47- encodeAbiParameters ,
48- padHex ,
49- } from "thirdweb/utils" ;
38+ import { concatHex , padHex } from "thirdweb/utils" ;
5039import { FormHelperText , FormLabel , Heading , Text } from "tw-components" ;
5140import { useCustomFactoryAbi , useFunctionParamsFromABI } from "../hooks" ;
5241import { addContractToMultiChainRegistry } from "../utils" ;
@@ -461,7 +450,7 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
461450 } ) ) ;
462451 console . log ( "module deploy data" , moduleDeployData ) ;
463452
464- const deployData = {
453+ const coreContractAddress = await deployContractfromDeployMetadata ( {
465454 account : activeAccount ,
466455 chain : walletChain ,
467456 client : thirdwebClient ,
@@ -472,61 +461,59 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
472461 ? // remove modules for superchain interop in order to deploy deterministically deploy just the core contract
473462 [ ]
474463 : moduleDeployData ,
475- } ;
476-
477- console . log ( "deploy data" , deployData ) ;
478- const coreContractAddress =
479- await deployContractfromDeployMetadata ( deployData ) ;
464+ } ) ;
480465 const coreContract = getContract ( {
481466 client : thirdwebClient ,
482467 address : coreContractAddress ,
483468 chain : walletChain ,
484469 } ) ;
485470 console . log ( "core contract" , coreContract ) ;
486471
487- if ( isSuperchainInterop && moduleDeployData ) {
488- await Promise . all (
489- moduleDeployData . map ( async ( m ) => {
490- let moduleData : `0x${string } ` | undefined ;
491-
492- const moduleInstallParams = m . deployMetadata . abi . find (
493- ( abiType ) =>
494- ( abiType as AbiFunction ) . name === "encodeBytesOnInstall" ,
495- ) as AbiFunction | undefined ;
496-
497- if ( m . initializeParams && moduleInstallParams ) {
498- moduleData = encodeAbiParameters (
499- (
500- moduleInstallParams . inputs as { name : string ; type : string } [ ]
501- ) . map ( ( p ) => ( {
502- name : p . name ,
503- type : p . type ,
504- } ) ) ,
505- Object . values ( m . initializeParams ) ,
506- ) ;
507- }
508- console . log ( "module install params" , moduleInstallParams ) ;
509-
510- const installTransaction = installPublishedModule ( {
511- contract : coreContract ,
512- account : activeAccount ,
513- moduleName : m . deployMetadata . name ,
514- publisher : m . deployMetadata . publisher ,
515- version : m . deployMetadata . version ,
516- moduleData,
517- } ) ;
518- console . log ( "install transaction" , installTransaction ) ;
519-
520- const txResult = await sendTransaction ( {
521- transaction : installTransaction ,
522- account : activeAccount ,
523- } ) ;
524- console . log ( "tx result" , txResult ) ;
525-
526- return await waitForReceipt ( txResult ) ;
527- } ) ,
528- ) ;
529- }
472+ //if (isSuperchainInterop && moduleDeployData) {
473+ // await Promise.all(
474+ // moduleDeployData.map(async (m) => {
475+ // let moduleData: `0x${string}` | undefined;
476+ //
477+ // const moduleInstallParams = m.deployMetadata.abi.find(
478+ // (abiType) =>
479+ // (abiType as AbiFunction).name === "encodeBytesOnInstall",
480+ // ) as AbiFunction | undefined;
481+ //
482+ // if (m.initializeParams && moduleInstallParams) {
483+ // moduleData = encodeAbiParameters(
484+ // (
485+ // moduleInstallParams.inputs as { name: string; type: string }[]
486+ // ).map((p) => ({
487+ // name: p.name,
488+ // type: p.type,
489+ // })),
490+ // Object.values(m.initializeParams),
491+ // );
492+ // }
493+ // console.log("module install params", moduleInstallParams);
494+ //
495+ // const installTransaction = installPublishedModule({
496+ // contract: coreContract,
497+ // account: activeAccount,
498+ // moduleName: m.deployMetadata.name,
499+ // publisher: m.deployMetadata.publisher,
500+ // version: m.deployMetadata.version,
501+ // moduleData,
502+ // });
503+ // console.log("install transaction", installTransaction);
504+ //
505+ // const txResult = await sendTransaction({
506+ // transaction: installTransaction,
507+ // account: activeAccount,
508+ // });
509+ // console.log("tx result", txResult);
510+ //
511+ // return await waitForReceipt(txResult);
512+ // }),
513+ // );
514+ //}
515+
516+ return coreContractAddress ;
530517 } ,
531518 } ) ;
532519
0 commit comments