Skip to content

Commit 23a0f36

Browse files
authored
Update Token API to v1 (#1027)
* Update dependencies * Update Token API JSON from staging + implement new URL structure * Prettier * Lint * Add `endpoint-pricing` and `upgrade-to-v1` pages * Address Matthew’s and BK’s feedback * Prettier * Update to production URL * Last tweaks
1 parent 350fe3b commit 23a0f36

File tree

1,462 files changed

+19140
-10308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,462 files changed

+19140
-10308
lines changed

nginx.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ http {
166166
rewrite ^/docs/([a-zA-Z][a-zA-Z])/tap/$ $scheme://$http_host/docs/$1/indexing/tap/ permanent;
167167
rewrite ^/docs/([a-zA-Z][a-zA-Z])/tokenomics/$ $scheme://$http_host/docs/$1/resources/tokenomics/ permanent;
168168
rewrite ^/docs/([a-zA-Z][a-zA-Z])/token-api/$ $scheme://$http_host/docs/$1/token-api/quick-start/ permanent;
169-
rewrite ^/docs/([a-zA-Z][a-zA-Z])/token-api/evm/get-transfers-evm-by-address/$ $scheme://$http_host/docs/$1/token-api/evm/get-transfers-evm/ permanent;
170169
rewrite ^/docs/([a-zA-Z][a-zA-Z])/token-api/mcp/cline/$ $scheme://$http_host/docs/$1/ai-suite/token-api-mcp/ permanent;
171170
rewrite ^/docs/([a-zA-Z][a-zA-Z])/token-api/mcp/cline/$ $scheme://$http_host/docs/$1/ai-suite/token-api-mcp/ permanent;
172171
rewrite ^/docs/([a-zA-Z][a-zA-Z])/token-api/mcp/cline/$ $scheme://$http_host/docs/$1/ai-suite/token-api-mcp/ permanent;

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "graph-docs",
33
"private": true,
44
"version": "1.0.0",
5-
"packageManager": "[email protected].0",
5+
"packageManager": "[email protected].3",
66
"scripts": {
77
"dev": "turbo run dev",
88
"build": "NODE_OPTIONS='--max-old-space-size=8192' turbo run build",
@@ -21,11 +21,11 @@
2121
},
2222
"devDependencies": {
2323
"@edgeandnode/eslint-config": "^2.0.3",
24-
"@types/node": "^22.18.8",
24+
"@types/node": "^22.18.10",
2525
"eslint": "^8.57.1",
2626
"eslint-plugin-mdx": "^3.6.2",
2727
"prettier": "^3.6.2",
28-
"prettier-plugin-tailwindcss": "^0.6.14",
28+
"prettier-plugin-tailwindcss": "^0.7.0",
2929
"remark-frontmatter": "^5.0.0",
3030
"remark-lint-first-heading-level": "^4.0.1",
3131
"remark-lint-heading-increment": "^4.0.1",

packages/og-image/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
"yoga-wasm-web": "^0.3.3"
1717
},
1818
"devDependencies": {
19-
"@cloudflare/workers-types": "^4.20251001.0",
20-
"@types/react": "^18.3.25",
19+
"@cloudflare/workers-types": "^4.20251011.0",
20+
"@types/react": "^18.3.26",
2121
"jest-image-snapshot": "^6.5.1",
2222
"tsx": "4.20.4",
2323
"typescript": "^5.9.3",
2424
"vitest": "^2.1.9",
25-
"wrangler": "^3.114.14"
25+
"wrangler": "^3.114.15"
2626
},
2727
"sideEffects": false
2828
}

pnpm-lock.yaml

Lines changed: 1678 additions & 1684 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

website/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"dependencies": {
2020
"@docsearch/react": "^3.9.0",
2121
"@edgeandnode/common": "^7.0.4",
22-
"@edgeandnode/gds": "^6.7.4",
23-
"@edgeandnode/go": "^10.3.8",
22+
"@edgeandnode/gds": "^6.7.6",
23+
"@edgeandnode/go": "^10.3.10",
2424
"@emotion/react": "^11.14.0",
2525
"@graphprotocol/contracts": "^7.3.0",
2626
"@pinax/graph-networks-registry": "^0.7.1",
@@ -33,8 +33,8 @@
3333
"lodash": "^4.17.21",
3434
"mdast-util-mdx-jsx": "^3.2.0",
3535
"mdast-util-to-hast": "^13.2.0",
36-
"mixpanel-browser": "^2.70.0",
37-
"motion": "^12.23.22",
36+
"mixpanel-browser": "^2.71.0",
37+
"motion": "^12.23.24",
3838
"next": "^14.2.33",
3939
"next-seo": "^6.8.0",
4040
"next-sitemap": "^4.2.3",
@@ -55,12 +55,12 @@
5555
"@types/lodash": "^4.17.20",
5656
"@types/mdast": "^4.0.4",
5757
"@types/mixpanel-browser": "^2.66.0",
58-
"@types/node": "^22.18.8",
59-
"@types/react": "^18.3.25",
58+
"@types/node": "^22.18.10",
59+
"@types/react": "^18.3.26",
6060
"@types/react-dom": "^18.3.7",
6161
"@types/vfile": "^4.0.0",
6262
"autoprefixer": "^10.4.21",
63-
"fast-xml-parser": "^5.2.5",
63+
"fast-xml-parser": "^5.3.0",
6464
"postcss": "^8.5.6",
6565
"tailwindcss": "^3.4.18",
6666
"tsup": "^8.5.0",

website/src/openApi/index.ts

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,53 @@ import tokenApi from './tokenApi.json'
66

77
export const API_IDS = ['tokenApi'] as const
88

9-
export const APIS = {
9+
export const APIS: Record<ApiId, ApiConfig> = {
1010
tokenApi: {
1111
name: 'Token API',
1212
url: 'https://token-api.thegraph.com/openapi', // production
1313
// url: 'https://token-api.service.stage.pinax.network/openapi', // staging
1414
document: tokenApi as OpenAPIV3_1.Document,
1515
sections: {
16-
EVM: '/token-api/evm',
17-
SVM: '/token-api/svm',
18-
Monitoring: '/token-api/monitoring',
16+
'EVM Tokens': {
17+
path: '/token-api/evm-tokens',
18+
operationIdPrefixes: ['getV1Evm'],
19+
},
20+
'EVM DEXs': {
21+
path: '/token-api/evm-dexs',
22+
operationIdPrefixes: ['getV1Evm'],
23+
},
24+
'EVM NFTs': {
25+
path: '/token-api/evm-nfts',
26+
operationIdPrefixes: ['getV1EvmNft'],
27+
},
28+
'SVM Tokens': {
29+
path: '/token-api/svm-tokens',
30+
operationIdPrefixes: ['getV1Svm'],
31+
},
32+
'SVM DEXs': {
33+
path: '/token-api/svm-dexs',
34+
operationIdPrefixes: ['getV1Svm'],
35+
},
36+
Monitoring: {
37+
path: '/token-api/monitoring',
38+
operationIdPrefixes: ['getV1'],
39+
},
1940
},
2041
},
21-
} satisfies Record<ApiId, ApiConfig>
42+
}
2243

2344
export type ApiId = (typeof API_IDS)[number]
2445

2546
export type ApiConfig = {
2647
name: string
2748
url: string
2849
document: OpenAPIV3_1.Document
29-
sections: Record<string, string>
50+
sections: Record<string, ApiSectionConfig>
51+
}
52+
53+
export type ApiSectionConfig = {
54+
path: string
55+
operationIdPrefixes?: string[]
3056
}
3157

3258
export type ApiSection = {
@@ -116,17 +142,16 @@ export function getApi(apiId: ApiId, passedDocument?: OpenAPIV3_1.Document): Api
116142
if (typeof documentOperation !== 'object' || !('tags' in documentOperation) || !documentOperation.tags) continue
117143

118144
// Get the section name and path from the tags
119-
const sectionName = documentOperation.tags.find((tag) => tag in config.sections) as
120-
| keyof typeof config.sections
121-
| undefined
122-
const sectionPath = sectionName ? config.sections[sectionName] : undefined
123-
if (!sectionName || !sectionPath || !('operationId' in documentOperation) || !documentOperation.operationId) {
145+
const sectionName = documentOperation.tags.find((tag) => tag in config.sections)
146+
const section = sectionName ? config.sections[sectionName] : undefined
147+
if (!sectionName || !section || !('operationId' in documentOperation) || !documentOperation.operationId) {
124148
continue
125149
}
150+
const operationId = documentOperation.operationId
126151
if (!sections[sectionName]) {
127152
sections[sectionName] = {
128153
name: sectionName,
129-
path: sectionPath,
154+
path: section.path,
130155
operations: [],
131156
}
132157
}
@@ -174,10 +199,19 @@ export function getApi(apiId: ApiId, passedDocument?: OpenAPIV3_1.Document): Api
174199
})
175200
}
176201

202+
const longestOperationIdPrefixThatMatches = (section.operationIdPrefixes ?? [])
203+
.filter((prefix) => operationId.startsWith(prefix))
204+
.sort((a, b) => b.length - a.length)[0]
205+
const slug = camelToKebab(
206+
longestOperationIdPrefixThatMatches
207+
? operationId.slice(longestOperationIdPrefixThatMatches.length)
208+
: operationId,
209+
)
210+
177211
const operation: ApiOperation = {
178212
...documentOperation,
179-
operationId: documentOperation.operationId,
180-
slug: camelToKebab(documentOperation.operationId),
213+
operationId,
214+
slug,
181215
method: method.toUpperCase(),
182216
baseUrl,
183217
path,

0 commit comments

Comments
 (0)