@@ -5,6 +5,7 @@ import type { ThirdwebClient } from "../../../client/client.js";
5
5
import { ZERO_ADDRESS } from "../../../constants/addresses.js" ;
6
6
import { getContract } from "../../../contract/contract.js" ;
7
7
import { CONTRACT_PUBLISHER_ADDRESS } from "../../../contract/deployment/publisher.js" ;
8
+ import { isGetAllExtensionsSupported } from "../../../extensions/dynamic-contracts/__generated__/IExtensionManager/read/getAllExtensions.js" ;
8
9
import { download } from "../../../storage/download.js" ;
9
10
import { upload } from "../../../storage/upload.js" ;
10
11
import type { BaseTransactionOptions } from "../../../transaction/types.js" ;
@@ -79,8 +80,14 @@ export function publishContract(
79
80
compositeAbi : options . metadata . compositeAbi ,
80
81
constructorParams : options . metadata . constructorParams ,
81
82
implConstructorParams : options . metadata . implConstructorParams ,
82
- defaultExtensions : options . metadata . defaultExtensions ,
83
- defaultModules : options . metadata . defaultModules ,
83
+ defaultExtensions :
84
+ routerType === "dynamic"
85
+ ? options . metadata . defaultExtensions
86
+ : undefined ,
87
+ defaultModules :
88
+ routerType === "modular"
89
+ ? options . metadata . defaultModules
90
+ : undefined ,
84
91
deployType : options . metadata . deployType ,
85
92
description : options . metadata . description ,
86
93
displayName : options . metadata . displayName ,
@@ -131,6 +138,7 @@ function getRouterType(abi: Abi) {
131
138
. filter ( ( f ) => f . type === "function" )
132
139
. map ( ( f ) => toFunctionSelector ( f ) ) ;
133
140
const isModule = isGetInstalledModulesSupported ( fnSelectors ) ;
134
- // TODO add dynamic detection
135
- return isModule ? "modular" : "none" ;
141
+ const isDynamic = isGetAllExtensionsSupported ( fnSelectors ) ;
142
+
143
+ return isModule ? "modular" : isDynamic ? "dynamic" : "none" ;
136
144
}
0 commit comments