Skip to content

Commit

Permalink
Merge pull request #2305 from anqa-ag/nhd98z/add-anqa-aggregator
Browse files Browse the repository at this point in the history
Add volume adapter for anqa aggregator
  • Loading branch information
dtmkeng authored Jan 13, 2025
2 parents 76a3465 + 0bd93b6 commit 293f927
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions aggregators/anqa/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {FetchResult,} from "../../adapters/types";
import {getUniqStartOfTodayTimestamp} from "../../helpers/getUniSubgraphVolume";
import {fetchURLWithRetry} from "../../helpers/duneRequest";

const fetch = async (_: number): Promise<FetchResult> => {
const unixTimestamp = getUniqStartOfTodayTimestamp();
const data = await fetchURLWithRetry(`https://api.dune.com/api/v1/query/3835933/results`)
const chainData = data.result.rows[0];
if (!chainData) throw new Error(`Dune query failed: ${JSON.stringify(data)}`)
return {
dailyVolume: chainData["Volume 24h"],
totalVolume: chainData["Total Volume"],
timestamp: unixTimestamp,
};
};

const adapter: any = {
timetravel: false,
adapter: {
"aptos": {
fetch: fetch,
runAtCurrTime: true,
start: '2023-06-16',
}
},
isExpensiveAdapter: true,
};

export default adapter;

0 comments on commit 293f927

Please sign in to comment.