Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

Commit 0f3b35d

Browse files
Fix: use new talentprotocol endpoint to fetch builder score (#2346)
* Update talentprotocol endpoint and builder score query * Rename fetch method to match new api
1 parent 2dfd4e0 commit 0f3b35d

File tree

2 files changed

+7
-7
lines changed
  • apps/web
    • app/(basenames)/api/basenames/talentprotocol/[address]
    • src/components/Basenames/UsernameProfileSectionBadges/hooks

2 files changed

+7
-7
lines changed

apps/web/app/(basenames)/api/basenames/talentprotocol/[address]/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function GET(
1313

1414
try {
1515
const response = await fetch(
16-
`https://api.talentprotocol.com/api/v2/passports/${encodeURIComponent(address)}`,
16+
`https://api.talentprotocol.com/score?id=${encodeURIComponent(address)}`,
1717
{
1818
method: 'GET',
1919
headers: {

apps/web/src/components/Basenames/UsernameProfileSectionBadges/hooks/useTalentProtocol.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
import { useQuery } from '@tanstack/react-query';
22

3-
async function fetchPassport(address: `0x${string}`): Promise<Data> {
3+
async function fetchScore(address: `0x${string}`): Promise<Data> {
44
const response = await fetch(`/api/basenames/talentprotocol/${address}`);
55
const data = (await response.json()) as Data;
66
return data;
77
}
88

99
type Data = {
10-
passport: {
11-
score: number;
10+
score: {
11+
points: number;
12+
v1_score: number;
1213
};
1314
error?: string;
1415
};
1516

1617
export function useTalentProtocol(address?: `0x${string}`) {
1718
const query = useQuery<Data>({
1819
queryKey: ['talent-protocol', address],
19-
queryFn: async ({ queryKey }) => fetchPassport(queryKey[1] as `0x${string}`),
20+
queryFn: async ({ queryKey }) => fetchScore(queryKey[1] as `0x${string}`),
2021
enabled: !!address,
2122
});
2223

2324
if (query.data) {
2425
if (query.data.error) {
2526
return undefined;
2627
}
27-
28-
return query.data.passport.score;
28+
return query.data.score.points;
2929
}
3030

3131
return undefined;

0 commit comments

Comments
 (0)