Skip to content

Commit 9dea0f5

Browse files
authored
Change API docs to use Redocly (#214)
1 parent 2261fc2 commit 9dea0f5

File tree

15 files changed

+1386
-574
lines changed

15 files changed

+1386
-574
lines changed

docs/.vitepress/config.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export default defineConfig({
134134
],
135135
resolve: {
136136
alias: []
137-
}
137+
},
138+
publicDir: 'public'
138139
}
139140
})

docs/.vitepress/theme/index.ts

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,8 @@ import { h } from 'vue'
33
import DefaultTheme from 'vitepress/theme'
44
import type { Theme } from 'vitepress'
55
import './style.css'
6-
import { theme, useOpenapi } from 'vitepress-openapi/client'
7-
import 'vitepress-openapi/dist/style.css'
86
import ActionHighlight from './components/ActionHighlight.vue'
97

10-
// Global server fetching utility
11-
export const fetchWaxEndpoints = async () => {
12-
// Check cache first
13-
const cacheKey = 'wax-endpoints-cache'
14-
const cacheExpiry = 1000 * 60 * 60 * 24 // 24 hours in milliseconds
15-
16-
try {
17-
const cached = localStorage.getItem(cacheKey)
18-
if (cached) {
19-
const { endpoints: cachedEndpoints, timestamp } = JSON.parse(cached)
20-
const now = Date.now()
21-
22-
// Use cached endpoints if they're still valid
23-
if (now - timestamp < cacheExpiry) {
24-
console.log('Using cached endpoint list')
25-
return cachedEndpoints
26-
}
27-
}
28-
29-
// Fetch fresh data if cache is expired or doesn't exist
30-
console.log('Fetching fresh endpoint list')
31-
const response = await fetch('https://validate.eosnation.io/wax/reports/endpoints.json')
32-
const data = await response.json()
33-
const endpoints = data.report
34-
35-
// Cache the new data
36-
const cacheData = {
37-
endpoints,
38-
timestamp: Date.now()
39-
}
40-
localStorage.setItem(cacheKey, JSON.stringify(cacheData))
41-
42-
return endpoints
43-
} catch (err) {
44-
console.error('Failed to fetch endpoints, using defaults:', err)
45-
return null
46-
}
47-
}
48-
498
/** @type {import('vitepress').Theme} */
509
export default {
5110
extends: DefaultTheme,
@@ -55,17 +14,6 @@ export default {
5514
})
5615
},
5716
async enhanceApp({ app, router, siteData }) {
58-
app.component('ActionHighlight', ActionHighlight),
59-
useOpenapi({
60-
config: {
61-
spec: {
62-
groupByTags: false,
63-
},
64-
server: {
65-
allowCustomServer: true,
66-
},
67-
},
68-
}),
69-
theme.enhanceApp({ app, router, siteData })
17+
app.component('ActionHighlight', ActionHighlight)
7018
}
7119
} satisfies Theme

docs/apis.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: WAX API Documentation
3+
description: Redirecting to API Reference
4+
---
5+
6+
<script setup>
7+
import { onMounted } from 'vue'
8+
9+
onMounted(() => {
10+
// Redirect to the main API reference page
11+
window.location.href = '/build/api-reference'
12+
})
13+
</script>
14+
15+
# Redirecting to API Reference...
16+
17+
If you're not redirected automatically, [click here](/build/api-reference) to view the WAX API documentation.

docs/apis/atomic-api.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: WAX Atomic Assets API
3+
description: WAX Blockchain Atomic Assets API Documentation
4+
---
5+
6+
<script setup>
7+
import { onMounted } from 'vue'
8+
9+
onMounted(() => {
10+
// Redirect to the static HTML file
11+
window.location.href = '/apis/atomic-api'
12+
})
13+
</script>
14+
15+
# Redirecting to Atomic Assets API...
16+
17+
If you're not redirected automatically, [click here](/apis/atomic-api) to view the WAX Atomic Assets API documentation.

docs/apis/chain-api.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: WAX Chain API
3+
description: WAX Blockchain Chain API Documentation
4+
---
5+
6+
<script setup>
7+
import { onMounted } from 'vue'
8+
9+
onMounted(() => {
10+
// Redirect to the static HTML file
11+
window.location.href = '/apis/chain-api'
12+
})
13+
</script>
14+
15+
# Redirecting to Chain API...
16+
17+
If you're not redirected automatically, [click here](/apis/chain-api) to view the WAX Chain API documentation.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: WAX Atomic Assets API
3+
description: Redirecting to Atomic Assets API
4+
---
5+
6+
<script setup>
7+
import { onMounted } from 'vue'
8+
9+
onMounted(() => {
10+
// Redirect to the Atomic Assets API page
11+
window.location.href = '/apis/atomic-api'
12+
})
13+
</script>
14+
15+
# Redirecting to Atomic Assets API...
16+
17+
If you're not redirected automatically, [click here](/apis/atomic-api) to view the WAX Atomic Assets API documentation.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: WAX RPC API
3+
description: Redirecting to Chain API
4+
---
5+
6+
<script setup>
7+
import { onMounted } from 'vue'
8+
9+
onMounted(() => {
10+
// Redirect to the Chain API page
11+
window.location.href = '/apis/chain-api'
12+
})
13+
</script>
14+
15+
# Redirecting to Chain API...
16+
17+
If you're not redirected automatically, [click here](/apis/chain-api) to view the WAX Chain API documentation.

docs/en/build/api-reference/atomic_api.md

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
---
22
title: WAX API Reference
3+
description: API documentation for WAX Blockchain
34
---
45

5-
# WAX API Reference
6+
# {{ $frontmatter.title }}
67

7-
Here you'll find detailed documentation, usage guides, and examples to help you understand and integrate WAX APIs into your applications efficiently.
8+
Here you'll find comprehensive documentation for WAX Blockchain APIs
89

910
## APIs
1011

11-
- [Chain API](/build/api-reference/rpc_api)
12-
- [AtomiAssets API](/build/api-reference/atomic_api)
13-
- [CDT](/build/api-reference/cdt_api)
12+
**[Chain API](/apis/chain-api)**
13+
The Chain API offers blockchain data access including account information, transaction details, and blockchain state.
14+
15+
**[Atomic Assets API](/apis/atomic-api)**
16+
The Atomic Assets API provides endpoints for managing and querying NFT assets on the WAX blockchain.
17+
18+
**[CDT](/build/api-reference/cdt_api)**
19+
Contract Development Toolkit for smart contract development.

docs/en/build/api-reference/rpc_api.md

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)