-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2089 from stabbleorg/master
Add fees for stabble.org
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { CHAIN } from "../../helpers/chains"; | ||
import { Adapter, FetchOptions, FetchV2 } from "../../adapters/types"; | ||
import fetchURL from "../../utils/fetchURL"; | ||
|
||
const feesURL = "https://api.stabble.org/stats/fees"; | ||
|
||
interface DailyStats { | ||
revenue: number; | ||
fees: number; | ||
} | ||
|
||
const fetch: FetchV2 = async (options: FetchOptions) => { | ||
const url = `${feesURL}?startTimestamp=${options.startTimestamp}&endTimestamp=${options.endTimestamp}`; | ||
const stats: DailyStats = await fetchURL(url); | ||
|
||
return { | ||
dailyFees: stats.fees, | ||
dailyRevenue: stats.revenue, | ||
}; | ||
}; | ||
|
||
const adapter: Adapter = { | ||
version: 2, | ||
adapter: { | ||
[CHAIN.SOLANA]: { | ||
fetch: fetch, | ||
runAtCurrTime: true, | ||
start: 1717563162, | ||
}, | ||
}, | ||
}; | ||
|
||
export default adapter; |