diff --git a/dexs/catton/index.ts b/dexs/catton/index.ts new file mode 100644 index 0000000000..28b84d5b37 --- /dev/null +++ b/dexs/catton/index.ts @@ -0,0 +1,28 @@ +import fetchURL from "../../utils/fetchURL" +import { CHAIN } from "../../helpers/chains"; +import { FetchOptions } from "../../adapters/types"; + +const endpoint = "https://datagrab.catton.tech/getVolumeData?" + +const fetch = async (options: FetchOptions) => { + const startTime = new Date(options.startTimestamp * 1000).toISOString().split("T")[0] + const endTime = new Date(options.endTimestamp * 1000).toISOString().split("T")[0] + const res = await fetchURL(`${endpoint}startTime=${startTime}&endTime=${endTime}`) + return { + dailyVolume: parseInt(res['dailyVolume']), + totalVolume: parseInt(res['totalVolume']), + }; +}; + + +const adapter: any = { + version: 2, + adapter: { + [CHAIN.TON]: { + fetch, + start: '2024-11-21', + }, + }, +}; + +export default adapter;