Add DISABLED_ADAPTER key + add v1 pancake

This commit is contained in:
0xtawa
2022-09-25 18:28:43 +02:00
parent 2698fe12d8
commit a8f59f6985
4 changed files with 24 additions and 12 deletions

View File

@@ -3,7 +3,6 @@
"version": "1.0.0",
"private": true,
"main": "index.js",
"pre-commit": "npm run check-types",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"weeklyChanges": "git pull && git diff $(git log -1 --before=@{7.days.ago} --format=%H) --stat | grep -E \"projects/\" | cut -d / -f 2 | cut -d \" \" -f 1 | uniq | wc -l",
@@ -11,7 +10,8 @@
"test-interactive": "node utils/testInteractive",
"test-dex": "ts-node volumes/cli/testAdapter.ts",
"postinstall": "echo 'run \"npm update @defillama/sdk\" if you want lastest sdk changes' ",
"get-not-exported-volumes": "ts-node volumes/cli/checkExported"
"get-not-exported-volumes": "ts-node volumes/cli/checkExported",
"check-types": "npx tsc volumes/**/*.ts --noEmit"
},
"author": "",
"license": "ISC",

View File

@@ -1,4 +1,5 @@
import { SimpleVolumeAdapter } from "../../dexVolume.type";
import { BreakdownVolumeAdapter, DISABLED_ADAPTER_KEY, SimpleVolumeAdapter } from "../../dexVolume.type";
import disabledAdapter from "../../helper/disabledAdapter";
const {
getChainVolume,
@@ -27,15 +28,20 @@ const graphs = getChainVolume({
},
});
const adapter: SimpleVolumeAdapter = {
volume: {
[BSC]: {
fetch: graphs(BSC),
start: getStartTimestamp({
endpoints,
chain: BSC,
dailyDataField: `${DAILY_VOLUME_FACTORY}s`,
}),
const adapter: BreakdownVolumeAdapter = {
breakdown: {
v1: {
[DISABLED_ADAPTER_KEY]: disabledAdapter
},
v2: {
[BSC]: {
fetch: graphs(BSC),
start: getStartTimestamp({
endpoints,
chain: BSC,
dailyDataField: `${DAILY_VOLUME_FACTORY}s`,
}),
}
},
},
};

View File

@@ -31,6 +31,8 @@ export type Adapter = {
}
};
export const DISABLED_ADAPTER_KEY = 'DISABLED_ADAPTER'
export type SimpleVolumeAdapter = {
volume: Adapter
};

View File

@@ -0,0 +1,4 @@
export default {
start: async () => 0,
fetch: async () => ({ timestamp: 0 })
}