Files
js/pages/api/checkVerificationStatus.ts
T
Nacho Iacovino 9fe29f9d11 Batch upload for custom contracts (#277)
* Make two batch files into one

* Disable Delayed Reveal on Edition Drop

* Don't use full width drawer for airdrop/snapshot

* big wip

* Detect correct feature

* Make it work

* phrasing plz

* Fix lgtm

* Update SDK
2022-07-19 15:54:09 -07:00

30 lines
894 B
TypeScript

import { apiKeyMap, apiMap } from "./verify";
import { ChainId } from "@thirdweb-dev/sdk";
import { NextApiRequest, NextApiResponse } from "next";
export default async (req: NextApiRequest, res: NextApiResponse) => {
if (req.method !== "GET") {
return res.status(400).json({ error: "invalid method" });
}
const guid = req.query["guid"];
const chainId = Number(req.query["chainId"]) as ChainId;
const endpoint = `${apiMap[chainId]}?module=contract&action=checkverifystatus&guid=${guid}&apikey=${apiKeyMap[chainId]}"`;
try {
const result = await fetch(endpoint, {
method: "GET",
});
const data = await result.json();
if (data.status === "1") {
return res.status(200).json({ result: data.result });
} else {
return res.status(200).json({ result: data.result });
}
} catch (e) {
return res.status(400).json({ error: e });
}
};