forked from LaconicNetwork/icns-frontend
Add allowlist api for external usage
This commit is contained in:
parent
59d14ea1ec
commit
860a35c4de
34
.pnp.cjs
generated
34
.pnp.cjs
generated
@ -36,6 +36,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@next/eslint-plugin-next", "npm:13.0.5"],\
|
||||
["@sentry/nextjs", "virtual:4b77e00d446246df1ed27001550885fbf1b51be18c660c1b5c357d3d763078ecef2a676194291a120f149b87573081e5af0621dc83cf1f83383639f39ac133c7#npm:7.27.0"],\
|
||||
["@svgr/webpack", "npm:6.5.1"],\
|
||||
["@types/cors", "npm:2.8.13"],\
|
||||
["@types/eslint", "npm:8.4.10"],\
|
||||
["@types/node", "npm:18.11.9"],\
|
||||
["@types/react", "npm:18.0.25"],\
|
||||
@ -47,6 +48,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@typescript-eslint/parser", "virtual:4b77e00d446246df1ed27001550885fbf1b51be18c660c1b5c357d3d763078ecef2a676194291a120f149b87573081e5af0621dc83cf1f83383639f39ac133c7#npm:5.45.0"],\
|
||||
["axios", "npm:0.27.2"],\
|
||||
["buffer", "npm:6.0.3"],\
|
||||
["cors", "npm:2.8.5"],\
|
||||
["crypto", "npm:1.0.1"],\
|
||||
["eslint", "npm:8.28.0"],\
|
||||
["eslint-config-next", "virtual:4b77e00d446246df1ed27001550885fbf1b51be18c660c1b5c357d3d763078ecef2a676194291a120f149b87573081e5af0621dc83cf1f83383639f39ac133c7#npm:13.0.5"],\
|
||||
@ -3957,6 +3959,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["@types/cors", [\
|
||||
["npm:2.8.13", {\
|
||||
"packageLocation": "./.yarn/cache/@types-cors-npm-2.8.13-4b8ac1068f-7ef197ea19.zip/node_modules/@types/cors/",\
|
||||
"packageDependencies": [\
|
||||
["@types/cors", "npm:2.8.13"],\
|
||||
["@types/node", "npm:18.11.9"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["@types/eslint", [\
|
||||
["npm:8.4.10", {\
|
||||
"packageLocation": "./.yarn/cache/@types-eslint-npm-8.4.10-9df5f4bc78-21e009ed9e.zip/node_modules/@types/eslint/",\
|
||||
@ -5466,6 +5478,17 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["cors", [\
|
||||
["npm:2.8.5", {\
|
||||
"packageLocation": "./.yarn/cache/cors-npm-2.8.5-c9935a2d12-ced838404c.zip/node_modules/cors/",\
|
||||
"packageDependencies": [\
|
||||
["cors", "npm:2.8.5"],\
|
||||
["object-assign", "npm:4.1.1"],\
|
||||
["vary", "npm:1.1.2"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["cosmiconfig", [\
|
||||
["npm:7.1.0", {\
|
||||
"packageLocation": "./.yarn/cache/cosmiconfig-npm-7.1.0-13a5090bcd-c53bf7befc.zip/node_modules/cosmiconfig/",\
|
||||
@ -7291,6 +7314,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@next/eslint-plugin-next", "npm:13.0.5"],\
|
||||
["@sentry/nextjs", "virtual:4b77e00d446246df1ed27001550885fbf1b51be18c660c1b5c357d3d763078ecef2a676194291a120f149b87573081e5af0621dc83cf1f83383639f39ac133c7#npm:7.27.0"],\
|
||||
["@svgr/webpack", "npm:6.5.1"],\
|
||||
["@types/cors", "npm:2.8.13"],\
|
||||
["@types/eslint", "npm:8.4.10"],\
|
||||
["@types/node", "npm:18.11.9"],\
|
||||
["@types/react", "npm:18.0.25"],\
|
||||
@ -7302,6 +7326,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@typescript-eslint/parser", "virtual:4b77e00d446246df1ed27001550885fbf1b51be18c660c1b5c357d3d763078ecef2a676194291a120f149b87573081e5af0621dc83cf1f83383639f39ac133c7#npm:5.45.0"],\
|
||||
["axios", "npm:0.27.2"],\
|
||||
["buffer", "npm:6.0.3"],\
|
||||
["cors", "npm:2.8.5"],\
|
||||
["crypto", "npm:1.0.1"],\
|
||||
["eslint", "npm:8.28.0"],\
|
||||
["eslint-config-next", "virtual:4b77e00d446246df1ed27001550885fbf1b51be18c660c1b5c357d3d763078ecef2a676194291a120f149b87573081e5af0621dc83cf1f83383639f39ac133c7#npm:13.0.5"],\
|
||||
@ -10550,6 +10575,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["vary", [\
|
||||
["npm:1.1.2", {\
|
||||
"packageLocation": "./.yarn/cache/vary-npm-1.1.2-b49f70ae63-ae0123222c.zip/node_modules/vary/",\
|
||||
"packageDependencies": [\
|
||||
["vary", "npm:1.1.2"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["warning", [\
|
||||
["npm:4.0.3", {\
|
||||
"packageLocation": "./.yarn/cache/warning-npm-4.0.3-291e921d6d-4f2cb6a957.zip/node_modules/warning/",\
|
||||
|
BIN
.yarn/cache/@types-cors-npm-2.8.13-4b8ac1068f-7ef197ea19.zip
vendored
Normal file
BIN
.yarn/cache/@types-cors-npm-2.8.13-4b8ac1068f-7ef197ea19.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/cors-npm-2.8.5-c9935a2d12-ced838404c.zip
vendored
Normal file
BIN
.yarn/cache/cors-npm-2.8.5-c9935a2d12-ced838404c.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/vary-npm-1.1.2-b49f70ae63-ae0123222c.zip
vendored
Normal file
BIN
.yarn/cache/vary-npm-1.1.2-b49f70ae63-ae0123222c.zip
vendored
Normal file
Binary file not shown.
@ -18,6 +18,7 @@
|
||||
"@sentry/nextjs": "^7.27.0",
|
||||
"axios": "^0.27.2",
|
||||
"buffer": "^6.0.3",
|
||||
"cors": "^2.8.5",
|
||||
"crypto": "^1.0.1",
|
||||
"iron-session": "^6.3.1",
|
||||
"next": "13.0.5",
|
||||
@ -33,6 +34,7 @@
|
||||
"devDependencies": {
|
||||
"@next/eslint-plugin-next": "^13.0.5",
|
||||
"@svgr/webpack": "^6.5.1",
|
||||
"@types/cors": "^2",
|
||||
"@types/eslint": "^8.4.10",
|
||||
"@types/node": "18.11.9",
|
||||
"@types/react": "18.0.25",
|
||||
|
23
pages/api/allowlist.ts
Normal file
23
pages/api/allowlist.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { CHAIN_ALLOWLIST } from "../../constants/icns";
|
||||
import Cors from "cors";
|
||||
|
||||
const cors = Cors({
|
||||
methods: ["GET"],
|
||||
});
|
||||
|
||||
export default async function (req: NextApiRequest, res: NextApiResponse) {
|
||||
await new Promise((resolve, reject) => {
|
||||
cors(req, res, (result: any) => {
|
||||
if (result instanceof Error) {
|
||||
return reject(result);
|
||||
}
|
||||
|
||||
return resolve(result);
|
||||
});
|
||||
});
|
||||
|
||||
res.status(200).json({
|
||||
chains: CHAIN_ALLOWLIST,
|
||||
});
|
||||
}
|
30
yarn.lock
30
yarn.lock
@ -2527,6 +2527,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/cors@npm:^2":
|
||||
version: 2.8.13
|
||||
resolution: "@types/cors@npm:2.8.13"
|
||||
dependencies:
|
||||
"@types/node": "*"
|
||||
checksum: 7ef197ea19d2e5bf1313b8416baa6f3fd6dd887fd70191da1f804f557395357dafd8bc8bed0ac60686923406489262a7c8a525b55748f7b2b8afa686700de907
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/eslint@npm:^8.4.10":
|
||||
version: 8.4.10
|
||||
resolution: "@types/eslint@npm:8.4.10"
|
||||
@ -3741,6 +3750,16 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"cors@npm:^2.8.5":
|
||||
version: 2.8.5
|
||||
resolution: "cors@npm:2.8.5"
|
||||
dependencies:
|
||||
object-assign: ^4
|
||||
vary: ^1
|
||||
checksum: ced838404ccd184f61ab4fdc5847035b681c90db7ac17e428f3d81d69e2989d2b680cc254da0e2554f5ed4f8a341820a1ce3d1c16b499f6e2f47a1b9b07b5006
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"cosmiconfig@npm:^7.0.1":
|
||||
version: 7.1.0
|
||||
resolution: "cosmiconfig@npm:7.1.0"
|
||||
@ -5196,6 +5215,7 @@ __metadata:
|
||||
"@next/eslint-plugin-next": ^13.0.5
|
||||
"@sentry/nextjs": ^7.27.0
|
||||
"@svgr/webpack": ^6.5.1
|
||||
"@types/cors": ^2
|
||||
"@types/eslint": ^8.4.10
|
||||
"@types/node": 18.11.9
|
||||
"@types/react": 18.0.25
|
||||
@ -5207,6 +5227,7 @@ __metadata:
|
||||
"@typescript-eslint/parser": ^5.45.0
|
||||
axios: ^0.27.2
|
||||
buffer: ^6.0.3
|
||||
cors: ^2.8.5
|
||||
crypto: ^1.0.1
|
||||
eslint: 8.28.0
|
||||
eslint-config-next: 13.0.5
|
||||
@ -6411,7 +6432,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"object-assign@npm:^4.0.1, object-assign@npm:^4.1.0, object-assign@npm:^4.1.1":
|
||||
"object-assign@npm:^4, object-assign@npm:^4.0.1, object-assign@npm:^4.1.0, object-assign@npm:^4.1.1":
|
||||
version: 4.1.1
|
||||
resolution: "object-assign@npm:4.1.1"
|
||||
checksum: fcc6e4ea8c7fe48abfbb552578b1c53e0d194086e2e6bbbf59e0a536381a292f39943c6e9628af05b5528aa5e3318bb30d6b2e53cadaf5b8fe9e12c4b69af23f
|
||||
@ -8047,6 +8068,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"vary@npm:^1":
|
||||
version: 1.1.2
|
||||
resolution: "vary@npm:1.1.2"
|
||||
checksum: ae0123222c6df65b437669d63dfa8c36cee20a504101b2fcd97b8bf76f91259c17f9f2b4d70a1e3c6bbcee7f51b28392833adb6b2770b23b01abec84e369660b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"warning@npm:^4.0.3":
|
||||
version: 4.0.3
|
||||
resolution: "warning@npm:4.0.3"
|
||||
|
Loading…
Reference in New Issue
Block a user