Skip to content

Commit 2b8dedf

Browse files
committed
update swagger
1 parent b1ab906 commit 2b8dedf

File tree

1 file changed

+358
-20
lines changed

1 file changed

+358
-20
lines changed

swagger.yaml

Lines changed: 358 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
openapi: 3.0.0
22
info:
3-
title: API Docs
3+
title: NFT Trading API
4+
description: API documentation for NFT trading system
45
version: 1.0.0
56
servers:
7+
- url: https://nft-trading-prod.vercel.app/api
8+
description: Production server
69
- url: http://localhost:3000/api
10+
description: Local development server
711
paths:
812
/listings:
913
get:
@@ -54,29 +58,363 @@ paths:
5458
type: integer
5559
total:
5660
type: integer
61+
/markets:
62+
get:
63+
summary: Get market listings
64+
parameters:
65+
- in: query
66+
name: page
67+
schema: { type: integer, default: 1 }
68+
- in: query
69+
name: limit
70+
schema: { type: integer, default: 12 }
71+
- in: query
72+
name: vType
73+
schema: { type: string }
74+
- in: query
75+
name: sort
76+
schema: { type: string }
77+
- in: query
78+
name: minPrice
79+
schema: { type: number }
80+
- in: query
81+
name: maxPrice
82+
schema: { type: number }
83+
- in: query
84+
name: minHashrate
85+
schema: { type: number }
86+
- in: query
87+
name: maxHashrate
88+
schema: { type: number }
89+
- in: query
90+
name: search
91+
schema: { type: string }
92+
responses:
93+
"200":
94+
description: List of markets
95+
content:
96+
application/json:
97+
schema:
98+
type: object
99+
properties:
100+
list:
101+
type: array
102+
items:
103+
$ref: "#/components/schemas/AuctionDto"
104+
page:
105+
type: integer
106+
limit:
107+
type: integer
108+
total:
109+
type: integer
110+
/inventory:
111+
get:
112+
summary: Get all inventories
113+
responses:
114+
"200":
115+
description: List of inventories
116+
content:
117+
application/json:
118+
schema:
119+
type: array
120+
items:
121+
$ref: "#/components/schemas/InventoryDto"
122+
/activities:
123+
get:
124+
summary: Get recent activities
125+
responses:
126+
"200":
127+
description: List of recent sold activities
128+
content:
129+
application/json:
130+
schema:
131+
type: array
132+
items:
133+
$ref: "#/components/schemas/RecentSoldDto"
134+
/accounts:
135+
get:
136+
summary: Get accounts information
137+
responses:
138+
"200":
139+
description: List of accounts with their details
140+
content:
141+
application/json:
142+
schema:
143+
type: array
144+
items:
145+
$ref: "#/components/schemas/AccountConsoleDto"
146+
"500":
147+
description: Server error
148+
content:
149+
application/json:
150+
schema:
151+
type: object
152+
properties:
153+
error:
154+
type: string
155+
example: "Failed to fetch accounts"
156+
/gem/gemEquipment:
157+
get:
158+
summary: Get gem equipment information
159+
parameters:
160+
- in: query
161+
name: tokenId
162+
required: true
163+
schema:
164+
type: string
165+
description: The token ID of the equipment
166+
example: "16"
167+
responses:
168+
"200":
169+
description: Gem equipment details
170+
content:
171+
application/json:
172+
schema:
173+
type: array
174+
items:
175+
type: object
176+
properties:
177+
tokenId:
178+
type: string
179+
description: Token ID of the gem
180+
"500":
181+
description: Server error
182+
content:
183+
application/json:
184+
schema:
185+
type: object
186+
properties:
187+
error:
188+
type: string
189+
example: "Failed to fetch accounts"
190+
/predict721:
191+
post:
192+
summary: Predict NFT price for 721 tokens
193+
requestBody:
194+
required: true
195+
content:
196+
application/json:
197+
schema:
198+
type: object
199+
properties:
200+
hashrate: { type: number, example: 100 }
201+
lvHashrate: { type: number, example: 21000 }
202+
prototype: { type: number, example: 50001 }
203+
level: { type: number, example: 40 }
204+
tokenId: { type: number, example: 12345 }
205+
responses:
206+
"200":
207+
description: Price prediction
208+
content:
209+
application/json:
210+
schema:
211+
type: object
212+
properties:
213+
prediction: { type: number }
214+
/predict1155:
215+
post:
216+
summary: Predict NFT price for 1155 tokens
217+
requestBody:
218+
required: true
219+
content:
220+
application/json:
221+
schema:
222+
type: object
223+
properties:
224+
ids: { type: array, items: { type: string }, example: ["11011"] }
225+
amounts: { type: array, items: { type: string }, example: ["1"] }
226+
prototype: { type: string, example: "11011" }
227+
responses:
228+
"200":
229+
description: Price prediction
230+
content:
231+
application/json:
232+
schema:
233+
type: object
234+
properties:
235+
prediction: { type: number }
57236
components:
58237
schemas:
59238
AuctionDto:
60239
type: object
61240
properties:
62-
id: { type: string }
63-
chain: { type: string }
64-
auctor: { type: string }
65-
startPrice: { type: number }
66-
endPrice: { type: number }
67-
durationDays: { type: number }
68-
index: { type: number }
241+
id:
242+
type: string
243+
description: Unique identifier for the auction
244+
example: "0x123abc..."
245+
chain:
246+
type: string
247+
description: Blockchain network
248+
example: "BSC"
249+
auctor:
250+
type: string
251+
description: Seller's address
252+
example: "0xabc123..."
253+
startPrice:
254+
type: number
255+
description: Initial listing price
256+
example: 1000
257+
endPrice:
258+
type: number
259+
description: Final price
260+
example: 900
261+
durationDays:
262+
type: number
263+
description: Auction duration in days
264+
example: 7
265+
index:
266+
type: number
267+
description: Item index
268+
example: 1
269+
ids:
270+
type: array
271+
items: { type: string }
272+
description: Array of token IDs
273+
example: ["1", "2", "3"]
274+
amounts:
275+
type: array
276+
items: { type: string }
277+
description: Array of token amounts
278+
example: ["1", "1", "1"]
279+
tokenId:
280+
type: number
281+
description: NFT token ID
282+
example: 12345
283+
uptime:
284+
type: number
285+
description: Time since listing
286+
example: 86400
287+
prototype:
288+
type: number
289+
description: NFT prototype number
290+
example: 10001
291+
hashrate:
292+
type: number
293+
description: Base hashrate
294+
example: 100
295+
lvHashrate:
296+
type: number
297+
description: Level bonus hashrate
298+
example: 20
299+
level:
300+
type: number
301+
description: NFT level
302+
example: 5
303+
specialty:
304+
type: number
305+
description: Special attribute
306+
example: 1
307+
category:
308+
type: number
309+
description: NFT category
310+
example: 2
311+
quality:
312+
type: number
313+
description: NFT quality tier
314+
example: 3
315+
tx:
316+
type: string
317+
description: Transaction hash
318+
example: "0xtx123..."
319+
deleted:
320+
type: boolean
321+
description: Whether the listing is deleted
322+
example: false
323+
nowPrice:
324+
type: number
325+
description: Current price
326+
example: 950
327+
RecentSoldDto:
328+
type: object
329+
properties:
330+
type: { type: number }
331+
tokens:
332+
type: array
333+
items:
334+
type: object
335+
properties:
336+
tokenId: { type: number }
337+
prototype: { type: number }
338+
hashrate: { type: number }
339+
lvHashrate: { type: number }
340+
level: { type: number }
69341
ids: { type: array, items: { type: string } }
70342
amounts: { type: array, items: { type: string } }
71-
tokenId: { type: number }
72-
uptime: { type: number }
73-
prototype: { type: number }
74-
hashrate: { type: number }
75-
lvHashrate: { type: number }
76-
level: { type: number }
77-
specialty: { type: number }
78-
category: { type: number }
79-
quality: { type: number }
80-
tx: { type: string }
81-
deleted: { type: boolean }
82-
nowPrice: { type: number }
343+
InventoryDto:
344+
type: object
345+
properties:
346+
id:
347+
type: string
348+
description: Unique identifier for the inventory item
349+
example: "0xabc123..."
350+
prototype:
351+
type: number
352+
description: NFT prototype number
353+
example: 10001
354+
owner:
355+
type: string
356+
description: Owner's address
357+
example: "0xowner123..."
358+
type:
359+
type: string
360+
description: type
361+
example: "PRO"
362+
amount:
363+
type: number
364+
description: Amount of tokens
365+
example: 1
366+
tokenId:
367+
type: number
368+
description: NFT token ID
369+
example: 12345
370+
quality:
371+
type: number
372+
description: NFT quality tier
373+
example: 3
374+
category:
375+
type: number
376+
description: NFT category
377+
example: 2
378+
level:
379+
type: number
380+
description: NFT level
381+
example: 5
382+
specialty:
383+
type: number
384+
description: Special attribute
385+
example: 1
386+
hashrate:
387+
type: number
388+
description: Base hashrate
389+
example: 100
390+
lvHashrate:
391+
type: number
392+
description: Level bonus hashrate
393+
example: 200
394+
AccountConsoleDto:
395+
type: object
396+
properties:
397+
id:
398+
type: string
399+
description: Account identifier
400+
example: "0xabc123..."
401+
address:
402+
type: string
403+
description: Wallet address
404+
example: "0xabc123..."
405+
listingsCount:
406+
type: number
407+
description: Number of active listings
408+
example: 5
409+
balance:
410+
type: number
411+
description: Account balance
412+
example: 1000.50
413+
hash:
414+
type: number
415+
description: Account hashrate
416+
example: 5000
417+
totalPriceSell:
418+
type: number
419+
description: Total selling price after fees
420+
example: 2500.75

0 commit comments

Comments
 (0)