Skip to content

Commit 1f74bf6

Browse files
committed
WIP: staging to get help
1 parent 9f5289b commit 1f74bf6

File tree

7 files changed

+60
-68
lines changed

7 files changed

+60
-68
lines changed

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

Lines changed: 49 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,16 @@ import { CircleAlertIcon, ExternalLinkIcon, InfoIcon } from "lucide-react";
2626
import Link from "next/link";
2727
import { useCallback, useMemo } from "react";
2828
import { 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";
3530
import type { FetchDeployMetadataResult } from "thirdweb/contract";
3631
import {
3732
deployContractfromDeployMetadata,
3833
deployMarketplaceContract,
3934
getRequiredTransactions,
4035
} from "thirdweb/deploys";
41-
import { installPublishedModule } from "thirdweb/modules";
4236
import { useActiveAccount, useActiveWalletChain } from "thirdweb/react";
4337
import { 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";
5039
import { FormHelperText, FormLabel, Heading, Text } from "tw-components";
5140
import { useCustomFactoryAbi, useFunctionParamsFromABI } from "../hooks";
5241
import { 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

apps/dashboard/src/data/explore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ const CROSS_CHAIN = {
203203
[
204204
"deployer.thirdweb.eth/ERC20CoreInitializable", // TODO: replace this with the thirdweb published contract
205205
[
206-
"deployer.thirdweb.eth/ClaimableERC20",
207206
"0xf2d22310905EaD92C19c7ef0003C1AD38e129cb1/SuperChainInterop", // TODO: replace this with the OP published contract
207+
"deployer.thirdweb.eth/ClaimableERC20",
208208
],
209209
{
210210
title: "Modular Token Drop",

packages/thirdweb/src/contract/deployment/deploy-via-autofactory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { keccakId } from "src/exports/utils.js";
21
import { parseEventLogs } from "../../event/actions/parse-logs.js";
32
import { proxyDeployedEvent } from "../../extensions/thirdweb/__generated__/IContractFactory/events/ProxyDeployed.js";
43
import { deployProxyByImplementation } from "../../extensions/thirdweb/__generated__/IContractFactory/write/deployProxyByImplementation.js";
@@ -7,6 +6,7 @@ import { getRpcClient } from "../../rpc/rpc.js";
76
import { encode } from "../../transaction/actions/encode.js";
87
import { sendAndConfirmTransaction } from "../../transaction/actions/send-and-confirm-transaction.js";
98
import type { PreparedTransaction } from "../../transaction/prepare-transaction.js";
9+
import { keccakId } from "../../utils/any-evm/keccak-id.js";
1010
import { isZkSyncChain } from "../../utils/any-evm/zksync/isZkSyncChain.js";
1111
import { toHex } from "../../utils/encoding/hex.js";
1212
import { resolvePromisedValue } from "../../utils/promise/resolve-promised-value.js";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export async function deployContractfromDeployMetadata(
196196
chain,
197197
});
198198

199-
return deployViaAutoFactory({
199+
return await deployViaAutoFactory({
200200
client,
201201
chain,
202202
account,

packages/thirdweb/src/extensions/thirdweb/__generated__/IContractFactory/events/ProxyDeployed.ts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/thirdweb/src/transaction/actions/send-and-confirm-transaction.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,7 @@ export async function sendAndConfirmTransaction(
5353
options: SendTransactionOptions,
5454
): Promise<TransactionReceipt> {
5555
const submittedTx = await sendTransaction(options);
56-
return waitForReceipt(submittedTx);
56+
const receipt = await waitForReceipt(submittedTx);
57+
58+
return receipt;
5759
}

packages/thirdweb/src/utils/ens/namehash.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ export function namehash(name: string) {
2020
const hashed = hashFromEncodedLabel
2121
? toBytes(hashFromEncodedLabel)
2222
: keccak256(stringToBytes(item), "bytes");
23-
result = keccak256(concat([result, hashed]), "bytes");
23+
result = keccak256(
24+
concat([result, hashed]),
25+
"bytes",
26+
) as Uint8Array<ArrayBuffer>;
2427
}
2528

2629
return bytesToHex(result);

0 commit comments

Comments
 (0)