Skip to content

Commit

Permalink
set response type
Browse files Browse the repository at this point in the history
  • Loading branch information
dtmkeng committed Aug 10, 2023
1 parent 2b98c19 commit d516dae
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions helpers/etherscanFees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Adapter, ProtocolType } from "../adapters/types";

export async function getEtherscanFees(timestamp: number, url:string, coin:string) {
const ts = getTimestampAtStartOfDayUTC(timestamp)
const dailyFees = await axios.get(url);
const dailyFees = await axios.get(url, { responseType: 'document'});
const feesToday = dailyFees.data?.split("\n").find((d: any) => d?.split(",")?.[1]?.slice(1, -1) == ts)
const pricesObj = await getPrices([coin], ts);
return Number(feesToday?.split(",")[2].slice(1, -2)) / 1e18 * pricesObj[coin].price
Expand All @@ -18,23 +18,23 @@ export function etherscanFeeAdapter(chain:string, url:string, coin:string){
[chain]: {
fetch: async (timestamp: number) => {
const usdFees = await getEtherscanFees(timestamp, url, coin)

return {
timestamp,
dailyFees: usdFees.toString(),
dailyFees: usdFees.toString(),
};
},
start: async () => 1575158400
},
},
protocolType: ProtocolType.CHAIN
}

return adapter
}

/*
Broken fees:
- Boba chart is empty
- Cronos has a weird drop + their current fees are way too long, seems wrong
*/
*/

0 comments on commit d516dae

Please sign in to comment.