Skip to content

Commit 2775e0a

Browse files
committed
resolve ens, sort contracts alphabetically
1 parent 85afb3c commit 2775e0a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

apps/dashboard/src/components/contract-components/fetchPublishedContracts.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { getThirdwebClient } from "@/constants/thirdweb.server";
2+
import { resolveEns } from "lib/ens";
23
import {
34
getAllPublishedContracts,
45
getContractPublisher,
@@ -8,12 +9,16 @@ import { fetchDeployMetadata } from "./fetchDeployMetadata";
89

910
export async function fetchPublishedContracts(address?: string | null) {
1011
invariant(address, "address is not defined");
12+
const resolvedAddress = (await resolveEns(address)).address;
13+
invariant(resolvedAddress, "invalid ENS");
1114
const tempResult = (
1215
(await getAllPublishedContracts({
1316
contract: getContractPublisher(getThirdwebClient()),
14-
publisher: address,
17+
publisher: resolvedAddress,
1518
})) || []
16-
).filter((c) => c.contractId);
19+
)
20+
.filter((c) => c.contractId)
21+
.sort((a, b) => a.contractId.localeCompare(b.contractId));
1722
return await Promise.all(
1823
tempResult.map(async (c) => ({
1924
...c,

0 commit comments

Comments
 (0)