Skip to content

Commit 4dc97e5

Browse files
Copilot0xrinegade
andcommitted
Add REST API for dynamic IDL loading from GitHub and direct upload
Co-authored-by: 0xrinegade <[email protected]>
1 parent 42563df commit 4dc97e5

File tree

5 files changed

+1375
-1
lines changed

5 files changed

+1375
-1
lines changed

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,62 @@ npm run mcp:websocket
114114

115115
See [mcp-server/README.md](mcp-server/README.md) for complete documentation.
116116

117+
## 🔌 REST API
118+
119+
IDLHub provides a REST API for dynamically loading and uploading IDL files.
120+
121+
### Quick Start
122+
123+
```bash
124+
# Start the API server
125+
npm run api:start
126+
127+
# Server runs on http://localhost:3000
128+
```
129+
130+
### Key Endpoints
131+
132+
- **`POST /api/idl/load-from-github`** - Load IDL from GitHub repository
133+
- **`POST /api/idl/upload`** - Upload IDL directly
134+
- **`GET /api/programs`** - List all programs
135+
- **`GET /api/programs/:id/idl`** - Get specific program IDL
136+
- **`GET /api/search`** - Semantic search using Qdrant
137+
138+
### Load IDL from GitHub
139+
140+
```bash
141+
curl -X POST http://localhost:3000/api/idl/load-from-github \
142+
-H "Content-Type: application/json" \
143+
-d '{
144+
"owner": "coral-xyz",
145+
"repo": "anchor",
146+
"path": "tests/example.json",
147+
"branch": "master",
148+
"programId": "example",
149+
"name": "Example Program",
150+
"category": "defi"
151+
}'
152+
```
153+
154+
### Upload IDL Directly
155+
156+
```bash
157+
curl -X POST http://localhost:3000/api/idl/upload \
158+
-H "Content-Type: application/json" \
159+
-d '{
160+
"programId": "myprogram",
161+
"name": "My Program",
162+
"category": "defi",
163+
"idl": {
164+
"version": "0.1.0",
165+
"name": "my_program",
166+
"instructions": []
167+
}
168+
}'
169+
```
170+
171+
See [api/README.md](api/README.md) for complete API documentation.
172+
117173
## 🚀 Deployment
118174

119175
### Netlify (Recommended)

0 commit comments

Comments
 (0)