-
Builder Detail Page (
app/builders/[slug]/page.tsx)- Uses:
useBuilders()hook from context - Gets:
builderobject withtotalStaked,totalClaimed,stakingCount
- Uses:
-
Builders Context (
context/builders-context.tsx)- Uses:
useAllBuildersQuery()hook - Returns: Array of
Builderobjects
- Uses:
-
All Builders Query (
app/hooks/useAllBuildersQuery.ts)- Calls:
fetchBuildersAPI()fromapp/services/buildersService.ts
- Calls:
-
Builders Service (
app/services/buildersService.ts)- Checks:
USE_GOLDSKY_V1_DATAflag (currentlytrue) - If
true: Calls API routes - If
false: Uses direct GraphQL queries
- Checks:
Feature Flag: USE_GOLDSKY_V1_DATA = true (in app/config/subgraph-endpoints.ts)
This means the code uses API routes instead of direct GraphQL queries.
- Internal API Route:
/api/builders/goldsky/base - File:
app/api/builders/goldsky/base/route.ts - Method: GET
- Calls External URL:
https://api.goldsky.com/api/public/project_cmgzm6igw009l5np264iw7obk/subgraphs/morpheus-mainnet-base-compatible/v0.0.1/gn
- Internal API Route:
/api/builders/goldsky/arbitrum - File:
app/api/builders/goldsky/arbitrum/route.ts - Method: GET
- Calls External URL:
https://api.goldsky.com/api/public/project_cmgzm6igw009l5np264iw7obk/subgraphs/morpheus-mainnet-arbitrum-compatible/v0.0.1/gn
Both API routes use the same query structure:
query combinedBuildersProjectsBaseMainnet {
buildersProjects(
first: 1000
orderBy: totalStaked
orderDirection: desc
) {
id
name
admin
totalStaked
totalClaimed
totalUsers
minimalDeposit
withdrawLockPeriodAfterDeposit
startsAt
claimLockEnd
__typename
}
}Note: For Arbitrum, the query name is combinedBuildersProjectsArbitrumMainnet but the structure is identical.
You can test the Goldsky endpoint directly using curl:
# Base Network
curl -X POST \
https://api.goldsky.com/api/public/project_cmgzm6igw009l5np264iw7obk/subgraphs/morpheus-mainnet-base-compatible/v0.0.1/gn \
-H "Content-Type: application/json" \
-d '{
"query": "query { buildersProjects(first: 1000, orderBy: totalStaked, orderDirection: desc) { id name admin totalStaked totalClaimed totalUsers minimalDeposit withdrawLockPeriodAfterDeposit startsAt claimLockEnd __typename } }"
}'
# Arbitrum Network
curl -X POST \
https://api.goldsky.com/api/public/project_cmgzm6igw009l5np264iw7obk/subgraphs/morpheus-mainnet-arbitrum-compatible/v0.0.1/gn \
-H "Content-Type: application/json" \
-d '{
"query": "query { buildersProjects(first: 1000, orderBy: totalStaked, orderDirection: desc) { id name admin totalStaked totalClaimed totalUsers minimalDeposit withdrawLockPeriodAfterDeposit startsAt claimLockEnd __typename } }"
}'The API routes return:
{
"buildersProjects": [
{
"id": "...",
"name": "...",
"totalStaked": "1000000000000000000", // in wei (18 decimals)
"totalClaimed": "500000000000000000", // in wei (18 decimals)
"totalUsers": "5", // string number
...
}
]
}This gets transformed in buildersService.ts:
totalStaked(wei) →totalStaked(MOR) =Number(totalStaked) / 1e18totalClaimed(wei) →totalClaimed(MOR) =Number(totalClaimed) / 1e18totalUsers(string) →stakingCount(number) =parseInt(totalUsers, 10)
In app/builders/[slug]/page.tsx:
- Total Staked:
builder.totalStaked(line 1058) - Total Claimed:
builder.totalClaimed(line 1066) - Cumulative stakers:
builder.stakingCount(line 1074) - Lock Period:
builder.lockPeriod(line 1082)
- Check browser Network tab for calls to
/api/builders/goldsky/baseand/api/builders/goldsky/arbitrum - Check server logs for
[Goldsky V4 API Base]and[Goldsky V4 API Arbitrum]messages - Check browser console for
[API]messages showing fetched project counts - Check if
builderobject has the expected properties when found
- Goldsky endpoint might be down or returning errors
- Query might be failing silently (check for GraphQL errors in response)
- Builder might not be found in the fetched projects list (name mismatch)
- Data transformation might be failing (check if totalStaked/totalClaimed are strings vs numbers)