Skip to content

Commit

Permalink
Add catton volume adapter (#2119)
Browse files Browse the repository at this point in the history
* Create catton adapter

* fix bug

* Update index.ts

---------

Co-authored-by: g1nt0ki <[email protected]>
  • Loading branch information
Cattontech and g1nt0ki authored Nov 24, 2024
1 parent 5b96824 commit 40a3c8d
Showing 1 changed file with 28 additions and 0 deletions.
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;

0 comments on commit 40a3c8d

Please sign in to comment.