Merge pull request #59 from blinklabs-io/feat/disable-openapi
feat: disable openapi
feat: disable openapi
import { logError } from "./utils/error";
require("dotenv").config();
const openapi = require("@wesleytodd/openapi");
const fs = require("fs");
const CARDANO_NETWORK = process.env.CARDANO_NETWORK || CardanoNetwork.preview;
const CLOUDFLARE_PSK = process.env.CLOUDFLARE_PSK;
const CLAIM_ENABLED = process.env.CLAIM_ENABLED === "true";
const ERGO_ENABLED = process.env.ERGO_ENABLED === "true";
const oapi = openapi({
openapi: "3.0.0",
info: {
title: "CloudStruct",
description: "Generated API docs for CloudStruct",
version: "1",
},
});
const app = express();
app.use(express.json());
app.use(require("morgan")(LOG_TYPE));
app.use(oapi);
// Disabled swagger generation
// app.use("/swaggerui", oapi.swaggerui);
/**
* Serve static files for our React app
});
});
const resp200Ok = {
responses: {
200: {
description: "Success",
content: {
"application/json": {
schema: {
type: "object",
},
},
},
},
},
};
const resp200Ok500Bad = {
responses: {
200: {
description: "Success",
content: {
"application/json": {
schema: {
type: "object",
},
},
},
},
500: {
content: {
"application/json": {
schema: {
type: "object",
properties: {
error: { type: "string" },
},
},
},
},
},
},
};
app.get("/api/getprices", oapi.path(resp200Ok), async (req, res) => {
app.get("/api/getprices", async (req, res) => {
const prices = await getPrices();
return res.status(200).send(prices);
});
app.get(
"/api/getpools",
oapi.path(resp200Ok),
async (req, res: Response<GetPoolsDto>) => {
const pools = await getPools();
}
);
app.get("/api/gettokens", oapi.path(resp200Ok), async (req, res) => {
app.get("/api/gettokens", async (req, res) => {
const tokens = await getTokens();
return res.status(200).send(tokens);
});
app.get("/api/getsettings", oapi.path(resp200Ok), async (req, res) => {
app.get("/api/getsettings", async (req, res) => {
const settings: IVMSettings = await getFromVM("get_settings");
return res.status(200).send(settings);
});
app.get("/api/systeminfo", oapi.path(resp200Ok), async (req, res) => {
app.get("/api/systeminfo", async (req, res) => {
const systeminfo = await getFromVM("system_info");
return res.status(200).send(systeminfo);
});
app.get(
"/api/getstakekey",
oapi.path({
description:
"Return a stake address from a given address string. Resolves adahandles.",
parameters: [
{
name: "address",
in: "query",
required: true,
},
],
responses: {
200: {
content: {
"application/json": {
schema: {
type: "object",
properties: {
staking_address: { type: "string" },
},
},
},
},
},
400: {
content: {
"application/json": {
schema: {
type: "object",
properties: {
error: { type: "string" },
},
},
},
},
},
500: {
content: {
"application/json": {
schema: {
type: "object",
properties: {
error: { type: "string" },
},
},
},
},
},
},
}),
async (req: any, res: any) => {
try {
const queryObject = url.parse(req.url, true).query;
*/
app.get(
"/api/getrewards",
oapi.path({
description: "Return available rewards from a given stake address.",
parameters: [
{
name: "address",
in: "query",
required: true,
},
],
responses: {
200: {
content: {
"application/json": {
schema: {
type: "object",
properties: {
pool_info: { type: "object" },
claimable_tokens: { type: "object" },
is_whitelisted: { type: "boolean" },
},
},
},
},
},
400: {
content: {
"application/json": {
schema: {
type: "object",
properties: {
error: { type: "string" },
"keywords": [],
"dependencies": {
"@emurgo/cardano-serialization-lib-nodejs": "^11.1.0",
"@wesleytodd/openapi": "^0.1.0",
"axios": "^0.26.0",
"cors": "^2.8.5",
"dotenv": "^16.0.0",
Added ToExpr instances Moved ImpTest to cardano-ledger-conway:testlib Moved ConwayEpochs to cardano-ledger-conway:test
Maybe not needed anymore, but this honors the comment just above in project.nix which was put in place to fix static muslc builds.
plutus: 1.7 -> 1.9 Drop BundledProtocolParameters and ProtocolParameters in favour of PParams LedgerEra
Implement `tcTranslationContextL` for Shelley