From f7dbf4e6fb637a6929c5acfec593d628dd29fa51 Mon Sep 17 00:00:00 2001 From: Will Sewell Date: Wed, 25 Feb 2026 14:56:11 +0000 Subject: [PATCH 1/2] Remove unused useSonarEntity hook and action --- src/app/actions/sonar.ts | 23 --------------------- src/app/hooks/use-sonar-entity.ts | 33 ------------------------------- 2 files changed, 56 deletions(-) delete mode 100644 src/app/hooks/use-sonar-entity.ts diff --git a/src/app/actions/sonar.ts b/src/app/actions/sonar.ts index e0d7356..9b0bec3 100644 --- a/src/app/actions/sonar.ts +++ b/src/app/actions/sonar.ts @@ -23,29 +23,6 @@ export const getEntities = createSonarServerAction( - async (client, { saleUUID, walletAddress }) => { - if (!saleUUID || !walletAddress) { - throw new Error("Missing saleUUID or walletAddress"); - } - - try { - return await client.readEntity({ saleUUID, walletAddress }); - } catch (error) { - // Special handling: 404 returns null entity instead of error - if (error instanceof APIError && error.status === 404) { - return { Entity: null } as unknown as ReadEntityResponse; - } - throw error; - } - } -); - type PrePurchaseCheckInput = { saleUUID: string; entityID: string; walletAddress: string }; /** diff --git a/src/app/hooks/use-sonar-entity.ts b/src/app/hooks/use-sonar-entity.ts deleted file mode 100644 index 9265947..0000000 --- a/src/app/hooks/use-sonar-entity.ts +++ /dev/null @@ -1,33 +0,0 @@ -"use client"; - -import { ReadEntityResponse } from "@echoxyz/sonar-core"; -import { saleUUID } from "@/lib/config"; -import { useSonarQuery } from "./use-sonar-query"; -import { getEntity } from "@/app/actions/sonar"; - -/** - * Hook to fetch Sonar entity details for a specific wallet - */ -export function useSonarEntity(walletAddress?: string) { - const query = useSonarQuery< - { saleUUID: string; walletAddress: string }, - ReadEntityResponse - >(getEntity, { - saleUUID, - walletAddress: walletAddress ?? "", - }); - - // No wallet address - return idle state - if (!walletAddress) { - return { loading: false, entity: undefined, error: undefined }; - } - - // Treat 404 as "no entity" rather than an error - const is404 = query.error?.message.includes("404"); - - return { - loading: query.loading, - entity: query.data?.Entity, - error: is404 ? undefined : query.error, - }; -} From 3a9d34959ea7f3dbf70bf6580705c344a21af627 Mon Sep 17 00:00:00 2001 From: Will Sewell Date: Wed, 25 Feb 2026 15:14:42 +0000 Subject: [PATCH 2/2] Remove unused imports --- src/app/actions/sonar.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/app/actions/sonar.ts b/src/app/actions/sonar.ts index 9b0bec3..4e53b13 100644 --- a/src/app/actions/sonar.ts +++ b/src/app/actions/sonar.ts @@ -3,10 +3,8 @@ import { createSonarServerAction } from "@/lib/sonar"; import { ListAvailableEntitiesResponse, - ReadEntityResponse, PrePurchaseCheckResponse, GeneratePurchasePermitResponse, - APIError, } from "@echoxyz/sonar-core"; type ListAvailableEntitiesInput = { saleUUID: string };