Skip to content

Commit

Permalink
add pact fes
Browse files Browse the repository at this point in the history
  • Loading branch information
dtmkeng committed Sep 5, 2023
1 parent 2aef80f commit 2286765
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions fees/pact.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Adapter, FetchResultFees, SimpleAdapter } from "../adapters/types"
import { CHAIN } from "../helpers/chains"
import fetchURL from "../utils/fetchURL"

interface IAPIResponse {
fee_usd_24h: string
}
const url = 'https://api.pact.fi/api/internal/pools_details/all'
const fetchFees = async (timestamp: number): Promise<FetchResultFees> => {
const response = (await fetchURL(url)).data.map((e: any) => { return {fee_usd_24h: e.fee_usd_24h}}) as IAPIResponse[]
const dailyFees = response.reduce((a: number, b: IAPIResponse) => a + Number(b.fee_usd_24h), 0)
return {
dailyFees: `${dailyFees}`,
timestamp
}
}

const adapters: SimpleAdapter = {
adapter:{
[CHAIN.ALGORAND]: {
fetch: fetchFees,
start: async () => 1693699200,
runAtCurrTime: true
}
}
}

export default adapters

0 comments on commit 2286765

Please sign in to comment.