-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b462f2d
commit 48d4b21
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import fetchURL from "../../utils/fetchURL" | ||
import { FetchResult, SimpleAdapter } from "../../adapters/types"; | ||
import { CHAIN } from "../../helpers/chains"; | ||
import { getUniqStartOfTodayTimestamp } from "../../helpers/getUniSubgraphVolume"; | ||
|
||
const URL = 'https://routerv2.akka.finance'; | ||
const endpoint = '/v2/1116/statistics/dappradar'; | ||
const startTimestamp = 1717200000;// 6/1/2024 | ||
|
||
interface IAPIResponse { | ||
dailyVolume: string; | ||
totalVolume: string; | ||
} | ||
|
||
const fetch = async (timestamp: number): Promise<FetchResult> => { | ||
const dayTimestamp = getUniqStartOfTodayTimestamp(new Date(timestamp * 1000)); | ||
const { dailyVolume, totalVolume }: IAPIResponse = (await fetchURL(`${URL}${endpoint}`)); | ||
return { | ||
dailyVolume, | ||
totalVolume, | ||
timestamp: dayTimestamp, | ||
}; | ||
} | ||
|
||
const adapter: SimpleAdapter = { | ||
version: 2, | ||
adapter: { | ||
[CHAIN.CORE]: { | ||
fetch, | ||
start: startTimestamp, | ||
}, | ||
}, | ||
}; | ||
|
||
export default adapter; |