Skip to content

Commit 91e50c8

Browse files
ocandocrypto-uniswapAngela Ocando
andauthored
fix(docs): Docs Interim Updates (#1118)
Co-authored-by: Angela Ocando <[email protected]> Co-authored-by: Angela O <[email protected]>
1 parent 9241112 commit 91e50c8

File tree

15 files changed

+602
-1053
lines changed

15 files changed

+602
-1053
lines changed

api/feedback.ts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
const HUBSPOT_PORTAL_ID = '47435488'
2+
const HUBSPOT_FORM_ID = '80c7a6ab-9b96-412f-9469-aa2bc14faa18'
3+
const HUBSPOT_SUBMIT_URL = `https://api.hsforms.com/submissions/v3/integration/submit/${HUBSPOT_PORTAL_ID}/${HUBSPOT_FORM_ID}`
4+
5+
function isValidEmail(value: string): boolean {
6+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)
7+
}
8+
9+
export default async function handler(req: any, res: any) {
10+
if (req.method !== 'POST') {
11+
return res.status(405).json({ success: false, error: 'Method not allowed' })
12+
}
13+
14+
try {
15+
const body = typeof req.body === 'string' ? JSON.parse(req.body) : req.body || {}
16+
const { email, feedbackType, issue, followUp, challenges, docsUsefulness, pageUrl, website } = body
17+
18+
if (website) return res.status(200).json({ success: true }) // honeypot
19+
if (!email || !isValidEmail(email)) return res.status(400).json({ success: false, error: 'Invalid email' })
20+
if (!feedbackType || !issue) return res.status(400).json({ success: false, error: 'Missing required fields' })
21+
22+
const fields = [
23+
{ name: 'email', value: String(email) },
24+
{ name: 'type_of_feedback', value: String(feedbackType) },
25+
{ name: 'whats_the_issue_idea_or_question', value: String(issue) },
26+
{ name: 'can_we_follow_up_with_you_about_your_feedback', value: followUp ? 'Yes' : 'No' },
27+
...(challenges?.trim()
28+
? [{ name: 'what_has_been_the_most_challenging_part_of_building_on_or_integrating_with_uniswap', value: challenges.trim() }]
29+
: []),
30+
...(docsUsefulness?.trim()
31+
? [{ name: 'have_you_found_uniswap_docs_to_be_useful', value: docsUsefulness.trim() }]
32+
: []),
33+
]
34+
35+
const payload = {
36+
fields,
37+
legalConsentOptions: {
38+
consent: {
39+
consentToProcess: true,
40+
text: 'By submitting, I agree to Uniswap Labs Terms of Service and Privacy Policy.',
41+
},
42+
},
43+
context: {
44+
pageUri: pageUrl || '',
45+
pageName: 'Feedback | Uniswap Docs',
46+
},
47+
}
48+
49+
const hsRes = await fetch(HUBSPOT_SUBMIT_URL, {
50+
method: 'POST',
51+
headers: { 'Content-Type': 'application/json' },
52+
body: JSON.stringify(payload),
53+
})
54+
55+
if (!hsRes.ok) {
56+
const hsText = await hsRes.text()
57+
return res.status(502).json({ success: false, error: 'HubSpot submission failed', details: hsText })
58+
}
59+
60+
return res.status(200).json({ success: true })
61+
} catch {
62+
return res.status(500).json({ success: false, error: 'Internal server error' })
63+
}
64+
}

docs/api/overview.md

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@ id: overview
33
sidebar_position: 1
44
title: Overview
55
---
6-
76
## Uniswap APIs
87

9-
Welcome to the Uniswap API documentation. Uniswap provides several APIs and data sources to help developers integrate with and build on top of the Uniswap protocol.
8+
Uniswap provides several APIs and data sources to help developers integrate with and build on top of the Uniswap protocol.
109

1110
## Available APIs
1211

1312
### Trading API
1413
The Uniswap Trading API provides quote generation and transaction building for token swaps across 25+ chains.
1514

1615
- **[Trading API Overview](./trading/overview)** - Get started with the Trading API
17-
- **[Integration Guide](./trading/integration-guide)** - Complete implementation guide with schemas and best practices
16+
- **[Integration Guide](https://api-docs.uniswap.org/guides/integration_guide)** - Complete implementation guide with schemas and best practices
1817
- **Quote & Swap Endpoints** - Generate quotes and build unsigned transactions
1918
- **Permit2 Support** - Gasless approvals via EIP-712 signatures
2019
- **Cross-Chain Swaps** - Multi-step cross-chain swap support
@@ -44,10 +43,10 @@ Get real-time and historical price data for tokens on Uniswap.
4443

4544
### For Developers
4645
If you're building applications that need to:
47-
- Execute token swaps Use the **[Trading API](./trading/overview)**
48-
- Query historical trading data Use the **Subgraph API**
49-
- Get optimal swap routes Use the **Routing API**
50-
- Display token prices Use the **Price APIs**
46+
- Execute token swaps - Use the **[Trading API](https://developers.uniswap.org/dashboard/)**
47+
- Query historical trading data - Use the **Subgraph API**
48+
- Get optimal swap routes - Use the **Routing API**
49+
- Display token prices - Use the **Price APIs**
5150

5251
### For Data Analysis
5352
The Subgraph API is perfect for:
@@ -60,12 +59,4 @@ The Subgraph API is perfect for:
6059

6160
- **Subgraph API**: Generous rate limits via The Graph
6261
- **Routing API**: Production-ready with caching
63-
- **Price APIs**: Real-time updates with historical data
64-
65-
## Support and Resources
66-
67-
- **Discord**: Join the Uniswap developer community
68-
- **GitHub**: Explore code examples and integrations
69-
- **Documentation**: Comprehensive guides and references
70-
71-
Ready to start building? Choose the API that fits your needs from the navigation menu.
62+
- **Price APIs**: Real-time updates with historical data

0 commit comments

Comments
 (0)