Skip to content

Commit 7b09d75

Browse files
committed
Deploy and install stylus modules
1 parent 282edf7 commit 7b09d75

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

packages/thirdweb/src/extensions/modules/common/installPublishedModule.ts

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { ThirdwebContract } from "../../../contract/contract.js";
22
import { getOrDeployInfraForPublishedContract } from "../../../contract/deployment/utils/bootstrap.js";
33
import type { Account } from "../../../wallets/interfaces/wallet.js";
4+
import { deployPublishedContract } from "../../prebuilts/deploy-published.js";
45
import { installModule } from "../__generated__/IModularCore/write/installModule.js";
56

67
/**
@@ -49,17 +50,35 @@ export function installPublishedModule(options: InstallPublishedModuleOptions) {
4950

5051
return installModule({
5152
asyncParams: async () => {
52-
const deployedModule = await getOrDeployInfraForPublishedContract({
53-
account,
54-
chain: contract.chain,
55-
client: contract.client,
56-
constructorParams,
57-
contractId: moduleName,
58-
publisher,
59-
});
53+
let implementationAddress: string;
54+
55+
if (moduleName.toLowerCase().includes("stylus")) {
56+
// TODO: switch to deterministic / create2 when available
57+
58+
implementationAddress = await deployPublishedContract({
59+
account,
60+
chain: contract.chain,
61+
client: contract.client,
62+
contractParams: constructorParams,
63+
contractId: moduleName,
64+
publisher,
65+
});
66+
} else {
67+
const deployedModule = await getOrDeployInfraForPublishedContract({
68+
account,
69+
chain: contract.chain,
70+
client: contract.client,
71+
constructorParams,
72+
contractId: moduleName,
73+
publisher,
74+
});
75+
76+
implementationAddress = deployedModule.implementationContract
77+
.address as string;
78+
}
6079
return {
6180
data: moduleData || "0x",
62-
moduleContract: deployedModule.implementationContract.address as string,
81+
moduleContract: implementationAddress,
6382
};
6483
},
6584
contract,

0 commit comments

Comments
 (0)