diff --git a/aggregators/starbase/index.ts b/aggregators/starbase/index.ts new file mode 100644 index 0000000000..8d815d8550 --- /dev/null +++ b/aggregators/starbase/index.ts @@ -0,0 +1,39 @@ +import { getEnv } from "../../helpers/env"; +import axios from "axios"; +import { CHAIN } from "../../helpers/chains"; +import { FetchOptions } from "../../adapters/types"; + +type TChain = { + [key: string]: number; +}; +const CHAINS: TChain = { + [CHAIN.BASE]: 8453, +}; + +const fetch = async (_a, _b, options: FetchOptions) => { + const response = await axios.get(`https://api-analysis-dev.starbase.ag/api/combine/defillama/volume`, { + headers: { + "X-BYPASS-KEY": getEnv("STARBASE_API_KEY"), + } + }) + const data = response.data; + const negativeVolume = data.volume24h? - data.volume24h : undefined; + return { + dailyVolume: negativeVolume, + }; +}; + +const adapter: any = { + version: 1, + adapter: Object.keys(CHAINS).reduce((acc, chain) => { + return { + ...acc, + [chain]: { + fetch: fetch, + start: '2025-01-10', + }, + }; + }, {}), +}; + +export default adapter; \ No newline at end of file diff --git a/helpers/env.ts b/helpers/env.ts index 696683b8cd..98c3f9f36d 100644 --- a/helpers/env.ts +++ b/helpers/env.ts @@ -33,6 +33,7 @@ export const ENV_KEYS = new Set([ 'ALCHEMIX_KEY', 'ALCHEMIX_SECRET', 'FLIPSIDE_RESTRICTED_MODE', + 'STARBASE_API_KEY', ]) // This is done to support both ZEROx_API_KEY and ZEROX_API_KEY