forked from DefiLlama/dimension-adapters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkittypunch.ts
34 lines (26 loc) · 851 Bytes
/
kittypunch.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import request from "graphql-request";
import { SimpleAdapter } from "../adapters/types";
import { CHAIN } from "../helpers/chains";
import { getUniqStartOfTodayTimestamp } from "../helpers/getUniSubgraphVolume";
const historical = "https://api.goldsky.com/api/public/project_cm33d1338c1jc010e715n1z6n/subgraphs/punch-swap-core-subgraph-flow-mainnet/2.3.0/gn";
const fetch: any = async (timestamp: number) => {
const dayTimestamp = getUniqStartOfTodayTimestamp(new Date(timestamp * 1000))
const query = `{
uniswapDayDatas (where: { date: ${dayTimestamp}}){
date
dailyVolumeUSD
}
}`
const res = await request(historical, query);
return {
dailyVolume: res.uniswapDayDatas[0].dailyVolumeUSD,
}
};
const adapter: SimpleAdapter = {
adapter: {
[CHAIN.FLOW]: {
fetch,
},
},
};
export default adapter;