Skip to content

Commit e7bbc32

Browse files
committed
Fix auto verification of contracts (#5099)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR introduces the export of the `verifyContract` function from `ContractSourcesPage.tsx` and integrates it into the `CustomContractForm` component to send a verification request after deploying a contract. ### Detailed summary - Changed `verifyContract` from a local function to an exported function in `ContractSourcesPage.tsx`. - Imported `verifyContract` into `custom-contract.tsx`. - Added a call to `verifyContract` in the `CustomContractForm` after contract deployment. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 8f157aa commit e7bbc32

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/sources/ContractSourcesPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ interface VerificationResult {
3434
error?: string;
3535
}
3636

37-
async function verifyContract(contract: ThirdwebContract) {
37+
export async function verifyContract(contract: ThirdwebContract) {
3838
try {
3939
const response = await fetch(
4040
"https://contract.thirdweb.com/verify/contract",

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
FormControl,
1919
} from "@chakra-ui/react";
2020
import { useMutation, useQuery } from "@tanstack/react-query";
21+
import { verifyContract } from "app/(dashboard)/(chain)/[chain_id]/[contractAddress]/sources/ContractSourcesPage";
2122
import { NetworkSelectorButton } from "components/selects/NetworkSelectorButton";
2223
import { SolidityInput } from "contract-ui/components/solidity-inputs";
2324
import { useTrack } from "hooks/analytics/useTrack";
@@ -537,6 +538,13 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
537538
// do the actual deployment
538539
const contractAddr = await deployMutation.mutateAsync(formData);
539540

541+
// send verification request - no need to await
542+
verifyContract({
543+
address: contractAddr,
544+
chain: walletChain,
545+
client: thirdwebClient,
546+
});
547+
540548
trackEvent({
541549
category: "custom-contract",
542550
action: "deploy",

0 commit comments

Comments
 (0)