Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add catton volume adapter #2119

Merged
merged 3 commits into from
Nov 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions dexs/catton/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import fetchURL from "../../utils/fetchURL"
import { CHAIN } from "../../helpers/chains";
import { FetchOptions } from "../../adapters/types";

const endpoint = "https://datagrab.catton.tech/getVolumeData?"

const fetch = async (options: FetchOptions) => {
const startTime = new Date(options.startTimestamp * 1000).toISOString().split("T")[0]
const endTime = new Date(options.endTimestamp * 1000).toISOString().split("T")[0]
const res = await fetchURL(`${endpoint}startTime=${startTime}&endTime=${endTime}`)
return {
dailyVolume: parseInt(res['dailyVolume']),
totalVolume: parseInt(res['totalVolume']),
};
};


const adapter: any = {
version: 2,
adapter: {
[CHAIN.TON]: {
fetch,
start: '2024-11-21',
},
},
};

export default adapter;
Loading