forked from BoltzExchange/boltz-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswagger.js
More file actions
49 lines (45 loc) · 1.5 KB
/
Copy pathswagger.js
File metadata and controls
49 lines (45 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* eslint-disable @typescript-eslint/no-require-imports */
const fs = require('fs');
const packageJson = require('./package.json');
const swaggerJsdoc = require('swagger-jsdoc');
const options = {
definition: {
openapi: '3.0.0',
info: {
title: 'Boltz API',
version: packageJson.version,
description:
'## ⚠️ DO NOT INTEGRATE THIS API DIRECTLY ⚠️\n\n' +
'All Boltz integrations must use an official SDK or client library. ' +
'They handle the cryptography, the swap state machine, and the ' +
'fund-recovery edge cases for you. Integrating the API directly ' +
'is error-prone and will lead to **loss of funds**.\n\n' +
'Official SDK list available ' +
'[here](https://api.docs.boltz.exchange/libraries.html)!',
},
},
apis: [
'./lib/api/v2/routers/InfoRouter.ts',
'./lib/api/v2/routers/SwapRouter.ts',
'./lib/api/v2/routers/LightningRouter.ts',
'./lib/api/v2/routers/ChainRouter.ts',
'./lib/api/v2/routers/QuoteRouter.ts',
'./lib/api/v2/routers/NodesRouter.ts',
'./lib/api/v2/routers/CommitmentRouter.ts',
'./lib/api/v2/routers/ReferralRouter.ts',
'./lib/api/v2/routers/RouterBase.ts',
],
failOnErrors: true,
};
const specs = swaggerJsdoc(options);
specs.servers = [
{
url: 'https://api.boltz.exchange/v2',
description: 'Mainnet',
},
{
url: 'http://localhost:9006/v2',
description: 'Regtest',
},
];
fs.writeFileSync('swagger-spec.json', JSON.stringify(specs, undefined, 2));