diff --git a/env.sample b/env.sample index 641cddf4..37db2273 100644 --- a/env.sample +++ b/env.sample @@ -21,4 +21,6 @@ AKAVE_API_KEY= LIGHTHOUSE_API_KEY= STORACHA_KEY= -STORACHA_PROOF= \ No newline at end of file +STORACHA_PROOF= + +PASSPORT_API_KEY= \ No newline at end of file diff --git a/packages/domain/src/config.ts b/packages/domain/src/config.ts index 51eecd7b..3756dc5b 100644 --- a/packages/domain/src/config.ts +++ b/packages/domain/src/config.ts @@ -19,6 +19,11 @@ export default { key: process.env.STORACHA_KEY, proof: process.env.STORACHA_PROOF, }, + passport: { + endpointUrl: + process.env.PASSPORT_API_ENDPOINT_URL || "https://api.passport.xyz", + apiKey: process.env.PASSPORT_API_KEY, + }, alchemy: { apiKey: process.env.ALCHEMY_API_KEY, }, diff --git a/packages/ui-react/src/components/passport/score-card.tsx b/packages/ui-react/src/components/passport/score-card.tsx index a7c95007..05b1fd77 100644 --- a/packages/ui-react/src/components/passport/score-card.tsx +++ b/packages/ui-react/src/components/passport/score-card.tsx @@ -63,7 +63,7 @@ export const PassportScoreCard = ({ passportParams, className, }: PassportScoreCardProps) => { - const { data, isPending, error } = useQuery({ + const { data, isSuccess, error } = useQuery({ queryKey: ["passport-score", address, passportParams], queryFn: async () => { if ("model" in passportParams) { @@ -124,7 +124,7 @@ export const PassportScoreCard = ({
- {isPending ? ( + {!isSuccess ? ( <> diff --git a/packages/ui-react/src/lib/passport/api.ts b/packages/ui-react/src/lib/passport/api.ts index 6e47f4f6..6a6872af 100644 --- a/packages/ui-react/src/lib/passport/api.ts +++ b/packages/ui-react/src/lib/passport/api.ts @@ -1,10 +1,7 @@ +import config from "@geist/domain/config"; import ky from "ky"; import type { Address } from "viem"; -const PASSPORT_API_ENDPOINT = "https://api.passport.xyz"; - -const PASSPORT_API_KEY = process.env.PASSPORT_API_KEY || ""; - /** * Creates a URL for the Passport API endpoint */ @@ -12,7 +9,7 @@ export const createEndpointUrl = ( path: string, queryParams?: Record, ) => { - const url = `${PASSPORT_API_ENDPOINT}${path}`; + const url = `${config.passport.endpointUrl}${path}`; if (!queryParams) return url; const params = new URLSearchParams(); @@ -33,7 +30,7 @@ export const createFetchOptions = ( options: { headers: { accept: "application/json", - "X-API-Key": PASSPORT_API_KEY, + "X-API-Key": config.passport.apiKey, }, }, };