From 60642797e1ba4ee685f8ac2175129cc8954dbabd Mon Sep 17 00:00:00 2001 From: omry rosenfeld Date: Thu, 2 May 2024 12:00:54 +0300 Subject: [PATCH] add myswapcl volume support --- dexs/myswap-cl/index.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 dexs/myswap-cl/index.ts diff --git a/dexs/myswap-cl/index.ts b/dexs/myswap-cl/index.ts new file mode 100644 index 0000000000..96a95e22d3 --- /dev/null +++ b/dexs/myswap-cl/index.ts @@ -0,0 +1,27 @@ +import { SimpleAdapter } from "../../adapters/types"; +import { CHAIN } from "../../helpers/chains"; +import fetchURL from "../../utils/fetchURL"; + +type VolumeResponse = { timestamp: number; volume: number }; +const fetch = async (timestamp: number) => { + const response = (await fetchURL( + "https://myswap-cl-charts.s3.amazonaws.com/data/total_volume.json" + )) as VolumeResponse[]; + return { + timestamp: timestamp, + dailyVolume: response[response.length - 1].volume, + }; +}; + +const adapter: SimpleAdapter = { + version: 2, + adapter: { + [CHAIN.STARKNET]: { + fetch: fetch, + runAtCurrTime: true, + start: 1695081600, + }, + }, +}; + +export default adapter;