Skip to content

Commit

Permalink
feat : added the Starbase project
Browse files Browse the repository at this point in the history
  • Loading branch information
zeke-Frontiers committed Jan 16, 2025
1 parent 0d377cd commit ab176d5
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
39 changes: 39 additions & 0 deletions aggregators/starbase/index.ts
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions helpers/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ab176d5

Please sign in to comment.