Skip to content

Commit

Permalink
integrate AKKA in aggregators
Browse files Browse the repository at this point in the history
  • Loading branch information
chef-plankton committed Jul 19, 2024
1 parent b462f2d commit 48d4b21
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions aggregators/akka/index.ts
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;

0 comments on commit 48d4b21

Please sign in to comment.