Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ packages/*/typedoc/*
*storybook.log
storybook-static
.aider*

tsconfig.tsbuildinfo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getActiveAccountCookie, getJWTCookie } from "@/constants/cookie";
import { getThirdwebClient } from "@/constants/thirdweb.server";
import { ContractPublishForm } from "components/contract-components/contract-publish-form";
import { revalidatePath } from "next/cache";
import { redirect } from "next/navigation";
import { notFound, redirect } from "next/navigation";
import { fetchDeployMetadata } from "thirdweb/contract";
import { getPublishedContractsWithPublisherMapping } from "../../../published-contract/[publisher]/[contract_id]/utils/getPublishedContractsWithPublisherMapping";

Expand Down Expand Up @@ -47,6 +47,10 @@ export default async function PublishContractPage(
contract_id: publishMetadataFromUri.name,
});

if (!publishedContractVersions) {
notFound();
}

const publishedContract = publishedContractVersions[0];

if (publishedContract) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export default async function Image(props: {
fetchPublisherProfile(publisher),
]);

if (!publishedContracts) {
return null;
}

const publishedContract =
publishedContracts.find((p) => p.version === props.params.version) ||
publishedContracts[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,24 @@ export default async function PublishedContractPage(
props: PublishedContractDeployPageProps,
) {
// resolve ENS if required
const publisherAddress = isAddress(props.params.publisher)
? props.params.publisher
: await resolveAddress({
let publisherAddress: string | undefined = undefined;

if (isAddress(props.params.publisher)) {
publisherAddress = props.params.publisher;
} else {
try {
publisherAddress = await resolveAddress({
client: getThirdwebClient(),
name: mapThirdwebPublisher(props.params.publisher),
});
} catch {
// ignore
}
}

if (!publisherAddress) {
notFound();
}

// get all the published versions of the contract
const publishedContractVersions = await fetchPublishedContractVersions(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { notFound } from "next/navigation";
import { PublishedContractBreadcrumbs } from "./components/breadcrumbs.client";
import { getPublishedContractsWithPublisherMapping } from "./utils/getPublishedContractsWithPublisherMapping";

Expand All @@ -23,6 +24,10 @@ export async function generateMetadata({ params }: { params: Params }) {
contract_id: contract_id,
});

if (!publishedContracts) {
notFound();
}

const publishedContract = publishedContracts[0];

if (!publishedContract) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export default async function Image(props: {
fetchPublisherProfile(publisher),
]);

if (!publishedContracts) {
return null;
}

const publishedContract = publishedContracts[0];

if (!publishedContract) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export default async function PublishedContractPage(
contract_id: props.params.contract_id,
});

if (!publishedContractVersions) {
notFound();
}

const publishedContract = publishedContractVersions[0];

if (!publishedContract) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,23 @@ export async function getPublishedContractsWithPublisherMapping(options: {
}) {
const { publisher, contract_id } = options;

// resolve ENS
const publisherAddress = isAddress(publisher)
? publisher
: await resolveAddress({
client: getThirdwebClient(),
name: mapThirdwebPublisher(publisher),
});
try {
// resolve ENS
const publisherAddress = isAddress(publisher)
? publisher
: await resolveAddress({
client: getThirdwebClient(),
name: mapThirdwebPublisher(publisher),
});

// get all the published versions of the contract
const publishedContractVersions = await fetchPublishedContractVersions(
publisherAddress,
contract_id,
);
// get all the published versions of the contract
const publishedContractVersions = await fetchPublishedContractVersions(
publisherAddress,
contract_id,
);

return publishedContractVersions;
return publishedContractVersions;
} catch {
return undefined;
}
}
1 change: 0 additions & 1 deletion apps/dashboard/tsconfig.tsbuildinfo

This file was deleted.

Loading