mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 16:53:02 +08:00
* Add .vscode folder to .gitignore * Add v0 test script * Fix types * Fix chain blocks type * Change dex volumes readme * Fix ts errors * Remove workbench.colorCustomizations * Finally fix ts errors * Chore test script * Revert "Remove workbench.colorCustomizations" This reverts commit 8e8721096f2d148495511442e6d822f30e576f42. * Revert back since it doesn't solve the issue * Upgrade trilom/file-changes-action from 1.2.3 -> 1.2.4
51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import { getChainVolume } from "../helper/getUniSubgraphVolume";
|
|
import { getStartTimestamp } from "../helper/getStartTimestamp";
|
|
import { FANTOM } from "../helper/chains";
|
|
import { DexVolumeAdapter } from "../dexVolume.type";
|
|
import { Chain } from "@defillama/sdk/build/general";
|
|
|
|
const endpoints = {
|
|
// [AVAX]: "https://api.thegraph.com/subgraphs/name/soulswapfinance/avalanche-exchange
|
|
[FANTOM]: "https://api.thegraph.com/subgraphs/name/soulswapfinance/fantom-exchange",
|
|
};
|
|
|
|
const VOLUME_FIELD = "volumeUSD";
|
|
|
|
const graphs = getChainVolume({
|
|
graphUrls: {
|
|
// [AVAX]: endpoints[AVAX],
|
|
[FANTOM]: endpoints[FANTOM]
|
|
},
|
|
totalVolume: {
|
|
factory: "factories",
|
|
field: VOLUME_FIELD,
|
|
},
|
|
dailyVolume: {
|
|
factory: "dayData",
|
|
field: VOLUME_FIELD,
|
|
},
|
|
});
|
|
|
|
const startTimeQuery = {
|
|
endpoints,
|
|
dailyDataField: "dayDatas",
|
|
volumeField: VOLUME_FIELD,
|
|
};
|
|
|
|
const volume = Object.keys(endpoints).reduce(
|
|
(acc, chain) => ({
|
|
...acc,
|
|
[chain]: {
|
|
fetch: graphs(chain as Chain),
|
|
start: getStartTimestamp({ ...startTimeQuery, chain }),
|
|
},
|
|
}),
|
|
{}
|
|
);
|
|
|
|
const adapter: DexVolumeAdapter = {
|
|
volume,
|
|
};
|
|
|
|
export default adapter;
|